Package com.consol.citrus.message

Examples of com.consol.citrus.message.Message


    @Autowired(required = false)
    private List<MessageConstructionInterceptor> messageConstructionInterceptors = new ArrayList<MessageConstructionInterceptor>();

    @Override
    public Message interceptMessageConstruction(Message message, String messageType, TestContext context) {
        Message interceptedMessage = message;

        for (MessageConstructionInterceptor interceptor : messageConstructionInterceptors) {
            if (interceptor instanceof DataDictionary &&
                    !((DataDictionary) interceptor).isGlobalScope()) {
                // skip explicit data dictionary to avoid duplicate dictionary usage.
View Full Code Here


        messageBuilder.setPayloadData("TestMessagePayload");
    }
   
    @Test
    public void testMessageBuilder() {
        Message resultingMessage = messageBuilder.buildMessageContent(context, CitrusConstants.DEFAULT_MESSAGE_TYPE);
       
        Assert.assertEquals(resultingMessage.getPayload(), "TestMessagePayload");
    }
View Full Code Here

    @Test
    public void testMessageBuilderVariableSupport() {
        messageBuilder.setPayloadData("This ${placeholder} contains variables!");
        context.setVariable("placeholder", "payload data");
       
        Message resultingMessage = messageBuilder.buildMessageContent(context, CitrusConstants.DEFAULT_MESSAGE_TYPE);
       
        Assert.assertEquals(resultingMessage.getPayload(), "This payload data contains variables!");
    }
View Full Code Here

    public void testMessageBuilderWithPayloadResource() {
        messageBuilder = new PayloadTemplateMessageBuilder();
       
        messageBuilder.setPayloadResourcePath("classpath:com/consol/citrus/validation/builder/payload-data-resource.txt");
       
        Message resultingMessage = messageBuilder.buildMessageContent(context, CitrusConstants.DEFAULT_MESSAGE_TYPE);
       
        Assert.assertEquals(resultingMessage.getPayload(), "TestMessageData");
    }
View Full Code Here

        messageBuilder = new PayloadTemplateMessageBuilder();
       
        messageBuilder.setPayloadResourcePath("classpath:com/consol/citrus/validation/builder/variable-data-resource.txt");
        context.setVariable("placeholder", "payload data");
       
        Message resultingMessage = messageBuilder.buildMessageContent(context, CitrusConstants.DEFAULT_MESSAGE_TYPE);
       
        Assert.assertEquals(resultingMessage.getPayload(), "This payload data contains variables!");
    }
View Full Code Here

    public void testMessageBuilderWithHeaders() {
        Map<String, Object> headers = new HashMap<String, Object>();
        headers.put("operation", "unitTesting");
        messageBuilder.setMessageHeaders(headers);
       
        Message resultingMessage = messageBuilder.buildMessageContent(context, CitrusConstants.DEFAULT_MESSAGE_TYPE);
       
        Assert.assertEquals(resultingMessage.getPayload(), "TestMessagePayload");
        Assert.assertNotNull(resultingMessage.getHeader("operation"));
        Assert.assertEquals(resultingMessage.getHeader("operation"), "unitTesting");
    }
View Full Code Here

        headers.put("shortValue", "{short}:5");
        headers.put("byteValue", "{byte}:1");
        headers.put("stringValue", "{string}:5.0");
        messageBuilder.setMessageHeaders(headers);
       
        Message resultingMessage = messageBuilder.buildMessageContent(context, CitrusConstants.DEFAULT_MESSAGE_TYPE);
       
        Assert.assertEquals(resultingMessage.getPayload(), "TestMessagePayload");
        Assert.assertNotNull(resultingMessage.getHeader("intValue"));
        Assert.assertEquals(resultingMessage.getHeader("intValue"), new Integer(5));
        Assert.assertNotNull(resultingMessage.getHeader("longValue"));
        Assert.assertEquals(resultingMessage.getHeader("longValue"), new Long(5));
        Assert.assertNotNull(resultingMessage.getHeader("floatValue"));
        Assert.assertEquals(resultingMessage.getHeader("floatValue"), new Float(5.0f));
        Assert.assertNotNull(resultingMessage.getHeader("doubleValue"));
        Assert.assertEquals(resultingMessage.getHeader("doubleValue"), new Double(5.0));
        Assert.assertNotNull(resultingMessage.getHeader("boolValue"));
        Assert.assertEquals(resultingMessage.getHeader("boolValue"), new Boolean(true));
        Assert.assertNotNull(resultingMessage.getHeader("shortValue"));
        Assert.assertEquals(resultingMessage.getHeader("shortValue"), new Short("5"));
        Assert.assertNotNull(resultingMessage.getHeader("byteValue"));
        Assert.assertEquals(resultingMessage.getHeader("byteValue"), new Byte("1"));
        Assert.assertNotNull(resultingMessage.getHeader("stringValue"));
        Assert.assertEquals(resultingMessage.getHeader("stringValue"), new String("5.0"));
    }
View Full Code Here

        expect(vertxMessage.address()).andReturn("hello").once();
        expect(vertxMessage.replyAddress()).andReturn("answer").once();

        replay(vertxMessage);

        Message message = messageConverter.convertInbound(vertxMessage, new VertxEndpointConfiguration());

        Assert.assertEquals(message.getPayload(), "Hello Citrus!");
        Assert.assertEquals(message.getHeader(CitrusVertxMessageHeaders.VERTX_ADDRESS), "hello");
        Assert.assertEquals(message.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS), "answer");

        verify(vertxMessage);
    }
View Full Code Here

        headers.put("operation", "${operation}");
        messageBuilder.setMessageHeaders(headers);
       
        context.setVariable("operation", "unitTesting");
       
        Message resultingMessage = messageBuilder.buildMessageContent(context, CitrusConstants.DEFAULT_MESSAGE_TYPE);
       
        Assert.assertEquals(resultingMessage.getPayload(), "TestMessagePayload");
        Assert.assertNotNull(resultingMessage.getHeader("operation"));
        Assert.assertEquals(resultingMessage.getHeader("operation"), "unitTesting");
    }
View Full Code Here

   
    @Test
    public void testMessageBuilderWithHeaderData() {
        messageBuilder.getHeaderData().add("MessageHeaderData");
       
        Message resultingMessage = messageBuilder.buildMessageContent(context, CitrusConstants.DEFAULT_MESSAGE_TYPE);
       
        Assert.assertEquals(resultingMessage.getPayload(), "TestMessagePayload");
        Assert.assertEquals(resultingMessage.getHeaderData().size(), 1L);
        Assert.assertEquals(resultingMessage.getHeaderData().get(0), "MessageHeaderData");
    }
View Full Code Here

TOP

Related Classes of com.consol.citrus.message.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.