Package com.consol.citrus.message

Examples of com.consol.citrus.message.Message


        reset(endpoint, consumer, endpointConfiguration);
        expect(endpoint.createConsumer()).andReturn(consumer).anyTimes();
        expect(endpoint.getEndpointConfiguration()).andReturn(endpointConfiguration).anyTimes();
        expect(endpointConfiguration.getTimeout()).andReturn(5000L).anyTimes();
       
        Message message = new DefaultMessage("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
                        + "<html>"
                            + "<body>"
                                + "<p>Hello TestFramework!</p>"
                            + "</body>"
                        + "</html>");
View Full Code Here


        reset(endpoint, consumer, endpointConfiguration);
        expect(endpoint.createConsumer()).andReturn(consumer).anyTimes();
        expect(endpoint.getEndpointConfiguration()).andReturn(endpointConfiguration).anyTimes();
        expect(endpointConfiguration.getTimeout()).andReturn(5000L).anyTimes();
       
        Message message = new DefaultMessage("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"org/w3/xhtml/xhtml1-strict.dtd\">"
                        + "<html xmlns=\"http://www.w3.org/1999/xhtml\">"
                            + "<head>"
                                + "<title>Sample XHTML content</title>"
                            + "</head>"   
                            + "<body>"
View Full Code Here

*/
public class XpathMessageConstructionInterceptorTest extends AbstractTestNGUnitTest {
   
    @Test
    public void testReplaceMessageValuesWithXPath() {
        Message message = new DefaultMessage("<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestMessage><Text>Hello World!</Text></TestMessage>");
       
        Map<String, String> xPathExpressions = new HashMap<String, String>();
        xPathExpressions.put("/TestMessage/Text", "Hello!");
       
        XpathMessageConstructionInterceptor interceptor = new XpathMessageConstructionInterceptor(xPathExpressions);
View Full Code Here

                .endsWith("<TestMessage><Text>Hello!</Text></TestMessage>"));
    }
   
    @Test
    public void testReplaceMessageValuesWithXPathAndDefaultNamespace() {
        Message message = new DefaultMessage("<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestMessage xmlns=\"http://www.citrusframework.org/test\">" +
                "<Text>Hello World!</Text>" +
                "</TestMessage>");
       
        Map<String, String> xPathExpressions = new HashMap<String, String>();
        xPathExpressions.put("/:TestMessage/:Text", "Hello!");
View Full Code Here

                .contains("<Text>Hello!</Text>"));
    }
   
    @Test
    public void testReplaceMessageValuesWithXPathAndNamespace() {
        Message message = new DefaultMessage("<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:TestMessage xmlns:ns0=\"http://www.citrusframework.org/test\">" +
                "<ns0:Text>Hello World!</ns0:Text>" +
                "</ns0:TestMessage>");
       
        Map<String, String> xPathExpressions = new HashMap<String, String>();
        xPathExpressions.put("/ns0:TestMessage/ns0:Text", "Hello!");
View Full Code Here

                .contains("<ns0:Text>Hello!</ns0:Text>"));
    }
   
    @Test
    public void testReplaceMessageValuesWithXPathAndNestedNamespace() {
        Message message = new DefaultMessage("<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:TestMessage xmlns:ns0=\"http://www.citrusframework.org/test\">" +
                "<ns1:Text xmlns:ns1=\"http://www.citrusframework.org/test/text\">Hello World!</ns1:Text>" +
                "</ns0:TestMessage>");
       
        Map<String, String> xPathExpressions = new HashMap<String, String>();
        xPathExpressions.put("/ns0:TestMessage/ns1:Text", "Hello!");
View Full Code Here

    @Test
    public void testPlainTextValidation() {
        PlainTextMessageValidator validator = new PlainTextMessageValidator();
       
        Message receivedMessage = new DefaultMessage("Hello World!");
        Message controlMessage = new DefaultMessage("Hello World!");
       
        validator.validateMessagePayload(receivedMessage, controlMessage, context);
    }
View Full Code Here

   
    @Test
    public void testPlainTextValidationVariableSupport() {
        PlainTextMessageValidator validator = new PlainTextMessageValidator();
       
        Message receivedMessage = new DefaultMessage("Hello World!");
        Message controlMessage = new DefaultMessage("Hello ${world}!");
       
        context.setVariable("world", "World");
       
        validator.validateMessagePayload(receivedMessage, controlMessage, context);
    }
View Full Code Here

    private GroovyJsonMessageValidator validator = new GroovyJsonMessageValidator();

    @Test
    public void testGroovyScriptValidation() throws ValidationException {
        Message message = new DefaultMessage("{\"person\":{\"name\":\"Christoph\",\"age\":31," +
            "\"pets\":[\"dog\",\"cat\"]}}");
       
        String validationScript = "assert json.size() == 1 \n" +
                                  "assert json.person.name == 'Christoph' \n" +
                                  "assert json.person.age == 31 \n" +
View Full Code Here

   
    @Test
    public void testPlainTextValidationWrongValue() {
        PlainTextMessageValidator validator = new PlainTextMessageValidator();
       
        Message receivedMessage = new DefaultMessage("Hello World!");
        Message controlMessage = new DefaultMessage("Hello Citrus!");
       
        try {
            validator.validateMessagePayload(receivedMessage, controlMessage, context);
        } catch (ValidationException e) {
            Assert.assertTrue(e.getMessage().contains("expected 'Hello Citrus!'"));
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.