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

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.
 void assertInvalid(java.lang.String xpath, org.dom4j.Node node)
          Assert that the following XPath query selects no nodes.
 void assertNoFault(org.dom4j.Node node)
           
 void assertValid(java.lang.String xpath, org.dom4j.Node node)
          Assert that the following XPath query selects one or more nodes.
 void assertXPathEquals(java.lang.String xpath, java.lang.String value, org.dom4j.Node node)
          Asser that the text of the xpath node retrieved is equal to the value specified.
protected  org.dom4j.XPath createXPath(java.lang.String xpathString)
          Create the specified XPath expression with the namespaces added via addNamespace().
protected  java.io.Reader getResourceAsReader(java.lang.String resource)
           
protected  java.io.InputStream getResourceAsStream(java.lang.String resource)
           
protected  ServiceRegistry getServiceRegistry()
           
 java.io.File getTestFile(java.lang.String relativePath)
           
protected  WSDLWriter getWSDL(java.lang.String service)
          Get the WSDL for a service.
protected  org.dom4j.Document getWSDLDocument(java.lang.String service)
           
protected  XFire getXFire()
           
protected  org.dom4j.Document invokeService(java.lang.String service, java.lang.String document)
          Invoke a service with the specified document.
protected  void printNode(org.dom4j.Node node)
           
protected  org.dom4j.Document readDocument(java.lang.String text)
           
protected  void setUp()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractXFireTest

public AbstractXFireTest()
Method Detail

printNode

protected void printNode(org.dom4j.Node node)
                  throws java.lang.Exception
Throws:
java.lang.Exception

invokeService

protected org.dom4j.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

readDocument

protected org.dom4j.Document readDocument(java.lang.String text)
                                   throws org.dom4j.DocumentException
Throws:
org.dom4j.DocumentException

getWSDLDocument

protected org.dom4j.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()

assertValid

public void assertValid(java.lang.String xpath,
                        org.dom4j.Node node)
                 throws java.lang.Exception
Assert that the following XPath query selects one or more nodes.

Parameters:
xpath -
Throws:
java.lang.Exception

assertInvalid

public void assertInvalid(java.lang.String xpath,
                          org.dom4j.Node 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.dom4j.Node 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.dom4j.Node node)
                   throws java.lang.Exception
Throws:
java.lang.Exception

createXPath

protected org.dom4j.XPath createXPath(java.lang.String xpathString)
Create the specified XPath expression with the namespaces added via addNamespace().


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

getXFire

protected XFire getXFire()

getServiceRegistry

protected ServiceRegistry getServiceRegistry()

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)


Copyright © 2004-2005 Codehaus. All Rights Reserved.