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 java.lang.String RESPONSE
           
 
Constructor Summary
AbstractXFireTest()
           
 
Method Summary
 void addNamespace(java.lang.String ns, java.lang.String uri)
          Add a namespace that will be used for XPath expressions.
 java.util.List assertInvalid(java.lang.String xpath, java.lang.Object node)
          Assert that the following XPath query selects no nodes.
 void assertNoFault(org.jdom.Document node)
           
 java.util.List assertValid(java.lang.String xpath, java.lang.Object node)
          Assert that the following XPath query selects one or more nodes.
 void assertXPathEquals(java.lang.String xpath, java.lang.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 java.lang.String getBasedir()
           
protected  java.io.Reader getResourceAsReader(java.lang.String resource)
           
protected  java.io.InputStream getResourceAsStream(java.lang.String resource)
           
 ServiceFactory getServiceFactory()
           
protected  ServiceRegistry getServiceRegistry()
           
protected  Session getSession()
           
 java.io.File getTestFile(java.lang.String relativePath)
           
protected  TransportManager getTransportManager()
           
protected  WSDLWriter getWSDL(java.lang.String service)
          Get the WSDL for a service.
protected  org.jdom.Document getWSDLDocument(java.lang.String service)
           
protected  XFire getXFire()
           
protected  XFireProxyFactory getXFireProxyFactory()
           
protected  InMessage invokeService(OutMessage msg, java.lang.String transportID)
           
protected  org.jdom.Document invokeService(java.lang.String service, java.lang.String document)
          Invoke a service with the specified document.
protected  org.jdom.Document invokeService(java.lang.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(java.lang.String text)
           
protected  org.jdom.Document readDocument(java.lang.String text, javax.xml.stream.XMLInputFactory ifactory)
           
 void setServiceFactory(ServiceFactory factory)
           
protected  void setUp()
           
protected  java.lang.String stringNode(org.jdom.Document node)
           
protected  java.lang.String stringNode(org.jdom.Element node)
           
protected  void tearDown()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
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, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESPONSE

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

AbstractXFireTest

public AbstractXFireTest()
Method Detail

printNode

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

printNode

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

stringNode

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

stringNode

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

invokeService

protected org.jdom.Document invokeService(java.lang.String service,
                                          java.lang.String document)
                                   throws java.lang.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:
java.lang.Exception

invokeService

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

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

invokeService

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

readDocument

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

readDocument

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

getWSDLDocument

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

setUp

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

tearDown

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

createSession

protected void createSession()

assertValid

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

Parameters:
xpath -
Throws:
java.lang.Exception

assertInvalid

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

Parameters:
xpath -
Throws:
java.lang.Exception

assertXPathEquals

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

Parameters:
xpath -
value -
node -
Throws:
java.lang.Exception

assertNoFault

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

addNamespace

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

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

getWSDL

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

Parameters:
service - The name of the service.
Throws:
java.lang.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 java.io.InputStream getResourceAsStream(java.lang.String resource)

getResourceAsReader

protected java.io.Reader getResourceAsReader(java.lang.String resource)

getTestFile

public java.io.File getTestFile(java.lang.String relativePath)

getBasedir

public static java.lang.String getBasedir()


Copyright © 2004-2010. All Rights Reserved.