Package org.apache.cxf.test
Class TestUtilities
java.lang.Object
org.apache.cxf.test.TestUtilities
This class provides unit test support for tests that look at generated WSDL
contents, as well as some test methods for invoking services.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTestUtilities(Class<?> classpathReference) This class provides utilities to several conflicting inheritance stacks of test support. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddNamespace(String ns, String uri) Add a namespace that will be used for XPath expressions.assertInvalid(String xpath, Node node) Assert that the following XPath query selects no nodes.voidassertNoFault(Node node) Assert that this node is not a Soap fault body.assertValid(String xpath, Node node) Assert that the following XPath query selects one or more nodes.voidassertValidBoolean(String xpath, Node node) Assert that the following XPath query selects a boolean value.voidassertXPathEquals(String xpath, String value, Node node) Assert that the text of the xpath node retrieved is equal to the value specified.voidassertXPathEquals(String xpath, QName value, Node node) Assert that the text of the xpath node retrieved is equal to the value specified.static booleanstatic Stringorg.apache.cxf.BusgetBus()Return the CXF bus used.retrieve the entire namespace map.getResourceAsReader(String resource) getResourceAsStream(String resource) org.apache.cxf.endpoint.ServergetServerForAddress(String address) org.apache.cxf.endpoint.ServergetServerForService(QName serviceName) getTestFile(String relativePath) javax.wsdl.DefinitiongetWSDLDefinition(org.apache.cxf.endpoint.Server server) Return a WSDL definition model for a server.getWSDLDocument(org.apache.cxf.endpoint.Server server) Return a DOM tree for the WSDL for a server.byte[]invokeBytes(String address, String transport, String message) static voidresolveNamespacePrefix(String prefix, Node node) Handy function for checking correctness of qualifies names in schema attribute values.voidsetBus(org.apache.cxf.Bus bus) Set the CXF bus.static voidsetKeepAliveSystemProperty(boolean setAlive)
-
Field Details
-
bus
protected org.apache.cxf.Bus bus -
classpathAnchor
-
-
Constructor Details
-
TestUtilities
This class provides utilities to several conflicting inheritance stacks of test support. Thus, it can't be a base class, and so can't use getClass() to find resources. Users should pass getClass() to this constructor instead.- Parameters:
classpathReference-
-
-
Method Details
-
setKeepAliveSystemProperty
public static void setKeepAliveSystemProperty(boolean setAlive) -
recoverKeepAliveSystemProperty
public static void recoverKeepAliveSystemProperty() -
addDefaultNamespaces
public void addDefaultNamespaces() -
resolveNamespacePrefix
Handy function for checking correctness of qualifies names in schema attribute values.- Parameters:
prefix-node-- Returns:
- Throws:
Exception
-
assertValid
Assert that the following XPath query selects one or more nodes.- Parameters:
xpath-- Throws:
Exception
-
assertValidBoolean
Assert that the following XPath query selects a boolean value.- Parameters:
xpath-- Throws:
Exception
-
assertInvalid
Assert that the following XPath query selects no nodes.- Parameters:
xpath-- Throws:
Exception
-
assertXPathEquals
Assert that the text of the xpath node retrieved is equal to the value specified.- Parameters:
xpath-value-node-- Throws:
Exception
-
assertXPathEquals
Assert that the text of the xpath node retrieved is equal to the value specified.- Parameters:
xpath-value-node-- Throws:
Exception
-
assertNoFault
Assert that this node is not a Soap fault body.- Parameters:
node-- Throws:
Exception
-
invokeBytes
- Throws:
Exception
-
invoke
- Throws:
Exception
-
getResourceAsStream
-
getResourceAsReader
-
getTestFile
-
getBasedir
-
getWSDLDocument
public Document getWSDLDocument(org.apache.cxf.endpoint.Server server) throws javax.wsdl.WSDLException Return a DOM tree for the WSDL for a server.- Parameters:
server- the server.- Returns:
- the DOM tree.
- Throws:
javax.wsdl.WSDLException
-
getWSDLDefinition
public javax.wsdl.Definition getWSDLDefinition(org.apache.cxf.endpoint.Server server) throws javax.wsdl.WSDLException Return a WSDL definition model for a server.- Parameters:
server- the server.- Returns:
- the definition.
- Throws:
javax.wsdl.WSDLException
-
getServerForService
public org.apache.cxf.endpoint.Server getServerForService(QName serviceName) throws javax.wsdl.WSDLException - Throws:
javax.wsdl.WSDLException
-
getServerForAddress
public org.apache.cxf.endpoint.Server getServerForAddress(String address) throws javax.wsdl.WSDLException - Throws:
javax.wsdl.WSDLException
-
addNamespace
Add a namespace that will be used for XPath expressions.- Parameters:
ns- Namespace name.uri- The namespace uri.
-
getNamespaces
retrieve the entire namespace map.- Returns:
-
getBus
public org.apache.cxf.Bus getBus()Return the CXF bus used.- Returns:
-
setBus
public void setBus(org.apache.cxf.Bus bus) Set the CXF bus.- Parameters:
bus-
-
checkUnrestrictedPoliciesInstalled
public static boolean checkUnrestrictedPoliciesInstalled()
-