org.springframework.integration.test.support
Class AbstractResponseValidator

java.lang.Object
  extended by org.springframework.integration.test.support.AbstractResponseValidator
All Implemented Interfaces:
MessageHandler
Direct Known Subclasses:
MessageValidator, PayloadValidator

public abstract class AbstractResponseValidator
extends java.lang.Object
implements MessageHandler

The base class for response validators used for RequestResponseScenarios


Constructor Summary
AbstractResponseValidator()
           
 
Method Summary
protected abstract  boolean extractPayload()
          If true will extract the payload as the parameter for validateResponse()
 void handleMessage(Message<?> message)
          Handles the message if possible.
protected abstract  void validateResponse(java.lang.Object response)
          Implement this method to validate the response (Message or Payload)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractResponseValidator

public AbstractResponseValidator()
Method Detail

handleMessage

public void handleMessage(Message<?> message)
                   throws MessagingException
Description copied from interface: MessageHandler
Handles the message if possible. If the handler cannot deal with the message this will result in a MessageRejectedException e.g. in case of a Selective Consumer. When a consumer tries to handle a message, but fails to do so, a MessageHandlingException is thrown. In the last case it is recommended to treat the message as tainted and go into an error scenario.

When the handling results in a failure of another message being sent (e.g. a "reply" message), that failure will trigger a MessageDeliveryException.

Specified by:
handleMessage in interface MessageHandler
Parameters:
message - the message to be handled
Throws:
MessageRejectedException - if the handler doesn't accept the message
MessageHandlingException - when something fails during the handling
MessageDeliveryException - when this handler failed to deliver the reply related to the handling of the message
MessagingException

validateResponse

protected abstract void validateResponse(java.lang.Object response)
Implement this method to validate the response (Message or Payload)

Parameters:
response -

extractPayload

protected abstract boolean extractPayload()
If true will extract the payload as the parameter for validateResponse()

Returns:
true to extract the payload; false to process the message.