com.consol.citrus.validation
Class ControlMessageValidator

java.lang.Object
  extended by com.consol.citrus.validation.AbstractMessageValidator<ControlMessageValidationContext>
      extended by com.consol.citrus.validation.ControlMessageValidator
All Implemented Interfaces:
MessageValidator<ControlMessageValidationContext>
Direct Known Subclasses:
JsonTextMessageValidator, PlainTextMessageValidator

public class ControlMessageValidator
extends AbstractMessageValidator<ControlMessageValidationContext>

Basic control message validator provides message header validation. Subclasses only have to add specific logic for message payload validation. This validator is based on a control message.

Author:
Christoph Deppisch

Field Summary
protected  org.slf4j.Logger log
          Logger
 
Constructor Summary
ControlMessageValidator()
           
 
Method Summary
 ControlMessageValidationContext findValidationContext(List<ValidationContext> validationContexts)
          Construct a proper validation context for this validator.
 boolean supportsMessageType(String messageType)
          Checks if the message type is supported.
 void validateMessage(org.springframework.integration.Message<?> receivedMessage, TestContext context, ControlMessageValidationContext validationContext)
          Implementation performs message header validation as well as message payload validation.
 void validateMessageHeader(org.springframework.integration.MessageHeaders controlHeaders, org.springframework.integration.MessageHeaders receivedHeaders, TestContext context)
          Validates the message header comparing its values to a control header set.
 void validateMessagePayload(org.springframework.integration.Message<?> receivedMessage, org.springframework.integration.Message<?> controlMessage, TestContext context)
          Validates the message payload with comparison to the control message payload located in validation context.
 
Methods inherited from class com.consol.citrus.validation.AbstractMessageValidator
validateMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.slf4j.Logger log
Logger

Constructor Detail

ControlMessageValidator

public ControlMessageValidator()
Method Detail

validateMessage

public void validateMessage(org.springframework.integration.Message<?> receivedMessage,
                            TestContext context,
                            ControlMessageValidationContext validationContext)
Implementation performs message header validation as well as message payload validation.

Parameters:
receivedMessage - the message to validate.
context - the current test context
validationContext - the proper validation context.

validateMessagePayload

public void validateMessagePayload(org.springframework.integration.Message<?> receivedMessage,
                                   org.springframework.integration.Message<?> controlMessage,
                                   TestContext context)
                            throws ValidationException
Validates the message payload with comparison to the control message payload located in validation context.

Parameters:
receivedMessage - the received message to check.
validationContext - the current validation context holding the expected control message.
context - the current test context with all variables.
Throws:
ValidationException

validateMessageHeader

public void validateMessageHeader(org.springframework.integration.MessageHeaders controlHeaders,
                                  org.springframework.integration.MessageHeaders receivedHeaders,
                                  TestContext context)
Validates the message header comparing its values to a control header set.

Parameters:
controlHeaders - the expected control headers.
receivedHeaders - the actual headers from message received.
context - the current test context.

findValidationContext

public ControlMessageValidationContext findValidationContext(List<ValidationContext> validationContexts)
Construct a proper validation context for this validator. Method uses the available context builder implementations searching for an accountable builder supporting ControlMessageValidationContext.

Returns:
the validation context.

supportsMessageType

public boolean supportsMessageType(String messageType)
Checks if the message type is supported.

Parameters:
messageType - the message type representation as String (e.g. xml, json, csv, plaintext).
Returns:
true if this message validator is capable of validating the message type.


Copyright © 2008-2013 ConSol* Consulting&Solutions GmbH. All Rights Reserved.