net.javacrumbs.smock.common.server
Class AbstractCommonWebServiceServerTest

java.lang.Object
  extended by net.javacrumbs.smock.common.server.AbstractCommonWebServiceServerTest
Direct Known Subclasses:
AbstractCommonSmockServerTest

public abstract class AbstractCommonWebServiceServerTest
extends Object

Simplifies usage of Spring WS testing framework. Wraps static methods of RequestCreators, ResponseMatchers and MockWebServiceClient. It also automatically creates MockWebServiceClient instance.

Author:
Lukas Krecan

Constructor Summary
AbstractCommonWebServiceServerTest()
           
 
Method Summary
 org.springframework.ws.test.server.ResponseMatcher clientOrSenderFault()
          Expects a Client (SOAP 1.1) or Sender (SOAP 1.2) fault.
 org.springframework.ws.test.server.ResponseMatcher clientOrSenderFault(String faultStringOrReason)
          Expects a Client (SOAP 1.1) or Sender (SOAP 1.2) fault with a particular fault string or reason.
 org.springframework.ws.test.server.ResponseMatcher mustUnderstandFault()
          Expects a MustUnderstand fault.
 org.springframework.ws.test.server.ResponseMatcher mustUnderstandFault(String faultStringOrReason)
          Expects a MustUnderstand fault with a particular fault string or reason.
 org.springframework.ws.test.server.ResponseMatcher noFault()
          Expects the response not to contain a SOAP fault.
 org.springframework.ws.test.server.ResponseMatcher payload(org.springframework.core.io.Resource payload)
          Expects the given Resource XML payload.
 org.springframework.ws.test.server.ResponseMatcher payload(Source payload)
          Expects the given Source XML payload.
 org.springframework.ws.test.server.ResponseMatcher serverOrReceiverFault()
          Expects a Server (SOAP 1.1) or Receiver (SOAP 1.2) fault.
 org.springframework.ws.test.server.ResponseMatcher serverOrReceiverFault(String faultStringOrReason)
          Expects a Server (SOAP 1.1) or Receiver (SOAP 1.2) fault with a particular fault string or reason.
 org.springframework.ws.test.server.ResponseMatcher soapHeader(QName soapHeaderName)
          Expects the given SOAP header in the outgoing message.
 org.springframework.ws.test.server.ResponseMatcher validPayload(org.springframework.core.io.Resource schema, org.springframework.core.io.Resource... furtherSchemas)
          Expects the payload to validate against the given XSD schema(s).
 org.springframework.ws.test.server.ResponseMatcher versionMismatchFault()
          Expects a VersionMismatch fault.
 org.springframework.ws.test.server.ResponseMatcher versionMismatchFault(String faultStringOrReason)
          Expects a VersionMismatch fault with a particular fault string or reason.
 org.springframework.ws.test.server.RequestCreator withPayload(org.springframework.core.io.Resource payload)
          Create a request with the given Resource XML as payload.
 org.springframework.ws.test.server.RequestCreator withPayload(Source payload)
          Create a request with the given Source XML as payload.
 org.springframework.ws.test.server.ResponseXPathExpectations xpath(String xpathExpression)
          Expects the given XPath expression to (not) exist or be evaluated to a value.
 org.springframework.ws.test.server.ResponseXPathExpectations xpath(String xpathExpression, Map<String,String> namespaceMapping)
          Expects the given XPath expression to (not) exist or be evaluated to a value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCommonWebServiceServerTest

public AbstractCommonWebServiceServerTest()
Method Detail

withPayload

public org.springframework.ws.test.server.RequestCreator withPayload(Source payload)
Create a request with the given Source XML as payload.

Parameters:
payload - the request payload
Returns:
the request creator

withPayload

public org.springframework.ws.test.server.RequestCreator withPayload(org.springframework.core.io.Resource payload)
                                                              throws IOException
Create a request with the given Resource XML as payload.

Parameters:
payload - the request payload
Returns:
the request creator
Throws:
IOException

payload

public org.springframework.ws.test.server.ResponseMatcher payload(Source payload)
Expects the given Source XML payload.

Parameters:
payload - the XML payload
Returns:
the response matcher

payload

public org.springframework.ws.test.server.ResponseMatcher payload(org.springframework.core.io.Resource payload)
                                                           throws IOException
Expects the given Resource XML payload.

Parameters:
payload - the XML payload
Returns:
the response matcher
Throws:
IOException

validPayload

public org.springframework.ws.test.server.ResponseMatcher validPayload(org.springframework.core.io.Resource schema,
                                                                       org.springframework.core.io.Resource... furtherSchemas)
                                                                throws IOException
Expects the payload to validate against the given XSD schema(s).

Parameters:
schema - the schema
furtherSchemas - further schemas, if necessary
Returns:
the response matcher
Throws:
IOException

xpath

public org.springframework.ws.test.server.ResponseXPathExpectations xpath(String xpathExpression)
Expects the given XPath expression to (not) exist or be evaluated to a value.

Parameters:
xpathExpression - the XPath expression
Returns:
the XPath expectations, to be further configured

xpath

public org.springframework.ws.test.server.ResponseXPathExpectations xpath(String xpathExpression,
                                                                          Map<String,String> namespaceMapping)
Expects the given XPath expression to (not) exist or be evaluated to a value.

Parameters:
xpathExpression - the XPath expression
namespaceMapping - the namespaces
Returns:
the XPath expectations, to be further configured

soapHeader

public org.springframework.ws.test.server.ResponseMatcher soapHeader(QName soapHeaderName)
Expects the given SOAP header in the outgoing message.

Parameters:
soapHeaderName - the qualified name of the SOAP header to expect
Returns:
the request matcher

noFault

public org.springframework.ws.test.server.ResponseMatcher noFault()
Expects the response not to contain a SOAP fault.

Returns:
the response matcher

mustUnderstandFault

public org.springframework.ws.test.server.ResponseMatcher mustUnderstandFault()
Expects a MustUnderstand fault.

See Also:
SoapBody.addMustUnderstandFault(String, Locale)

mustUnderstandFault

public org.springframework.ws.test.server.ResponseMatcher mustUnderstandFault(String faultStringOrReason)
Expects a MustUnderstand fault with a particular fault string or reason.

Parameters:
faultStringOrReason - the SOAP 1.1 fault string or SOAP 1.2 reason text. If null the fault string or reason text will not be verified
See Also:
SoapBody.addMustUnderstandFault(String, Locale)

clientOrSenderFault

public org.springframework.ws.test.server.ResponseMatcher clientOrSenderFault()
Expects a Client (SOAP 1.1) or Sender (SOAP 1.2) fault.

See Also:
SoapBody.addClientOrSenderFault(String, Locale)

clientOrSenderFault

public org.springframework.ws.test.server.ResponseMatcher clientOrSenderFault(String faultStringOrReason)
Expects a Client (SOAP 1.1) or Sender (SOAP 1.2) fault with a particular fault string or reason.

Parameters:
faultStringOrReason - the SOAP 1.1 fault string or SOAP 1.2 reason text. If null the fault string or reason text will not be verified
See Also:
SoapBody.addClientOrSenderFault(String, Locale)

serverOrReceiverFault

public org.springframework.ws.test.server.ResponseMatcher serverOrReceiverFault()
Expects a Server (SOAP 1.1) or Receiver (SOAP 1.2) fault.

See Also:
SoapBody.addServerOrReceiverFault(String, java.util.Locale)

serverOrReceiverFault

public org.springframework.ws.test.server.ResponseMatcher serverOrReceiverFault(String faultStringOrReason)
Expects a Server (SOAP 1.1) or Receiver (SOAP 1.2) fault with a particular fault string or reason.

Parameters:
faultStringOrReason - the SOAP 1.1 fault string or SOAP 1.2 reason text. If null the fault string or reason text will not be verified
See Also:
SoapBody.addClientOrSenderFault(String, Locale)

versionMismatchFault

public org.springframework.ws.test.server.ResponseMatcher versionMismatchFault()
Expects a VersionMismatch fault.

See Also:
SoapBody.addVersionMismatchFault(String, java.util.Locale)

versionMismatchFault

public org.springframework.ws.test.server.ResponseMatcher versionMismatchFault(String faultStringOrReason)
Expects a VersionMismatch fault with a particular fault string or reason.

Parameters:
faultStringOrReason - the SOAP 1.1 fault string or SOAP 1.2 reason text. If null the fault string or reason text will not be verified
See Also:
SoapBody.addClientOrSenderFault(String, Locale)


Copyright © 2011. All Rights Reserved.