Ejemplo n.º 1
0
  /**
   * @see
   *     com.consol.citrus.actions.ReceiveMessageAction#validateMessage(org.springframework.integration.Message,
   *     com.consol.citrus.context.TestContext)
   */
  @Override
  protected void validateMessage(Message<?> receivedMessage, TestContext context) {
    try {
      super.validateMessage(receivedMessage, context);

      if (attachmentData != null) {
        controlAttachment.setContent(context.replaceDynamicContentInString(attachmentData));
      } else if (attachmentResourcePath != null) {
        controlAttachment.setContent(
            context.replaceDynamicContentInString(
                FileUtils.readToString(
                    FileUtils.getFileResource(attachmentResourcePath, context))));
      } else {
        return; // no attachment expected, no validation
      }

      // handle variables in content id
      if (controlAttachment.getContentId() != null) {
        controlAttachment.setContentId(
            context.replaceDynamicContentInString(controlAttachment.getContentId()));
      }

      // handle variables in content type
      if (controlAttachment.getContentType() != null) {
        controlAttachment.setContentType(
            context.replaceDynamicContentInString(controlAttachment.getContentType()));
      }

      attachmentValidator.validateAttachment(receivedMessage, controlAttachment);
    } catch (IOException e) {
      throw new CitrusRuntimeException(e);
    }
  }
Ejemplo n.º 2
0
 /**
  * Set the content id, delegates to control attachment.
  *
  * @param contentId the contentId to set
  */
 public void setContentId(String contentId) {
   controlAttachment.setContentId(contentId);
 }
Ejemplo n.º 3
0
 /**
  * Set the charset name, delegates to control attachment.
  *
  * @param charsetName the charsetName to set
  */
 public void setCharsetName(String charsetName) {
   controlAttachment.setCharsetName(charsetName);
 }
Ejemplo n.º 4
0
 /**
  * Set the content type, delegates to control attachment.
  *
  * @param contentType the contentType to set
  */
 public void setContentType(String contentType) {
   controlAttachment.setContentType(contentType);
 }