org.codehaus.xfire.test
Class AbstractXFireTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.codehaus.xfire.test.AbstractXFireTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractServletTest

public abstract class AbstractXFireTest
extends junit.framework.TestCase

Contains helpful methods to test SOAP services.

Author:
Dan Diephouse

Nested Class Summary
protected static class AbstractXFireTest.CopySerializer
           
 
Field Summary
static String RESPONSE
           
 
Constructor Summary
AbstractXFireTest()
           
 
Method Summary
 void addNamespace(String ns, String uri)
          Add a namespace that will be used for XPath expressions.
 List assertInvalid(String xpath, Object node)
          Assert that the following XPath query selects no nodes.
 void assertNoFault(org.jdom.Document node)
           
 List assertValid(String xpath, Object node)
          Assert that the following XPath query selects one or more nodes.
 void assertXPathEquals(String xpath, String value, org.jdom.Document node)
          Asser that the text of the xpath node retrieved is equal to the value specified.
protected  void createSession()
           
static String getBasedir()
           
protected  Reader getResourceAsReader(String resource)
           
protected  InputStream getResourceAsStream(String resource)
           
 ServiceFactory getServiceFactory()
           
protected  ServiceRegistry getServiceRegistry()
           
protected  Session getSession()
           
 File getTestFile(String relativePath)
           
protected  TransportManager getTransportManager()
           
protected  WSDLWriter getWSDL(String service)
          Get the WSDL for a service.
protected  org.jdom.Document getWSDLDocument(String service)
           
protected  XFire getXFire()
           
protected  XFireProxyFactory getXFireProxyFactory()
           
protected  InMessage invokeService(OutMessage msg, String transportID)
           
protected  org.jdom.Document invokeService(String service, String document)
          Invoke a service with the specified document.
protected  org.jdom.Document invokeService(String service, javax.xml.stream.XMLStreamReader streamReader)
          Invoke a service with the specified document.
protected  void printNode(org.jdom.Document node)
           
protected  void printNode(org.jdom.Element node)
           
protected  org.jdom.Document readDocument(String text)
           
protected  org.jdom.Document readDocument(String text, javax.xml.stream.XMLInputFactory ifactory)
           
 void setServiceFactory(ServiceFactory factory)
           
protected  void setUp()
           
protected  String stringNode(org.jdom.Document node)
           
protected  String stringNode(org.jdom.Element node)
           
protected  void tearDown()
           
 
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESPONSE

public static final String RESPONSE
See Also:
Constant Field Values
Constructor Detail

AbstractXFireTest

public AbstractXFireTest()
Method Detail

printNode

protected void printNode(org.jdom.Document node)
                  throws Exception
Throws:
Exception

printNode

protected void printNode(org.jdom.Element node)
                  throws Exception
Throws:
Exception

stringNode

protected String stringNode(org.jdom.Document node)
                     throws Exception
Throws:
Exception

stringNode

protected String stringNode(org.jdom.Element node)
                     throws Exception
Throws:
Exception

invokeService

protected org.jdom.Document invokeService(String service,
                                          String document)
                                   throws Exception
Invoke a service with the specified document.

Parameters:
service - The name of the service.
document - The request as an xml document in the classpath.
Throws:
Exception

invokeService

protected org.jdom.Document invokeService(String service,
                                          javax.xml.stream.XMLStreamReader streamReader)
                                   throws Exception
Invoke a service with the specified document.

Parameters:
service - The name of the service.
streamReader - Stream representing incoming message
Throws:
Exception

invokeService

protected InMessage invokeService(OutMessage msg,
                                  String transportID)
                           throws Exception
Throws:
Exception

readDocument

protected org.jdom.Document readDocument(String text)
                                  throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

readDocument

protected org.jdom.Document readDocument(String text,
                                         javax.xml.stream.XMLInputFactory ifactory)
                                  throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

getWSDLDocument

protected org.jdom.Document getWSDLDocument(String service)
                                     throws Exception
Throws:
Exception

setUp

protected void setUp()
              throws Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception
See Also:
TestCase.setUp()

tearDown

protected void tearDown()
                 throws Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
Exception

createSession

protected void createSession()

assertValid

public List assertValid(String xpath,
                        Object node)
                 throws Exception
Assert that the following XPath query selects one or more nodes.

Parameters:
xpath -
Throws:
Exception

assertInvalid

public List assertInvalid(String xpath,
                          Object node)
                   throws Exception
Assert that the following XPath query selects no nodes.

Parameters:
xpath -
Throws:
Exception

assertXPathEquals

public void assertXPathEquals(String xpath,
                              String value,
                              org.jdom.Document node)
                       throws Exception
Asser that the text of the xpath node retrieved is equal to the value specified.

Parameters:
xpath -
value -
node -
Throws:
Exception

assertNoFault

public void assertNoFault(org.jdom.Document node)
                   throws Exception
Throws:
Exception

addNamespace

public void addNamespace(String ns,
                         String uri)
Add a namespace that will be used for XPath expressions.

Parameters:
ns - Namespace name.
uri - The namespace uri.

getWSDL

protected WSDLWriter getWSDL(String service)
                      throws Exception
Get the WSDL for a service.

Parameters:
service - The name of the service.
Throws:
Exception

getSession

protected Session getSession()

getXFire

protected XFire getXFire()

getTransportManager

protected TransportManager getTransportManager()

getServiceRegistry

protected ServiceRegistry getServiceRegistry()

getServiceFactory

public ServiceFactory getServiceFactory()

setServiceFactory

public void setServiceFactory(ServiceFactory factory)

getXFireProxyFactory

protected XFireProxyFactory getXFireProxyFactory()

getResourceAsStream

protected InputStream getResourceAsStream(String resource)

getResourceAsReader

protected Reader getResourceAsReader(String resource)

getTestFile

public File getTestFile(String relativePath)

getBasedir

public static String getBasedir()


Copyright © 2004-2013. All Rights Reserved.