コード例 #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);
    }
  }
コード例 #2
0
 /**
  * Set the content id, delegates to control attachment.
  *
  * @param contentId the contentId to set
  */
 public void setContentId(String contentId) {
   controlAttachment.setContentId(contentId);
 }
コード例 #3
0
 /**
  * Set the charset name, delegates to control attachment.
  *
  * @param charsetName the charsetName to set
  */
 public void setCharsetName(String charsetName) {
   controlAttachment.setCharsetName(charsetName);
 }
コード例 #4
0
 /**
  * Set the content type, delegates to control attachment.
  *
  * @param contentType the contentType to set
  */
 public void setContentType(String contentType) {
   controlAttachment.setContentType(contentType);
 }