Examples of assertExchangeReceived()


Examples of org.apache.camel.component.mock.MockEndpoint.assertExchangeReceived()

        // need some time for the mail to arrive on the inbox (consumed and sent to the mock)
        Thread.sleep(1000);

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);
        Exchange out = mock.assertExchangeReceived(0);
        mock.assertIsSatisfied();

        // plain text
        assertEquals("Hello World", out.getIn().getBody(String.class));
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.assertExchangeReceived()

        // need some time for the mail to arrive on the inbox (consumed and sent to the mock)
        Thread.sleep(1000);

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);
        Exchange out = mock.assertExchangeReceived(0);
        mock.assertIsSatisfied();

        // plain text
        assertEquals("<html><body><h1>Hello</h1>World</body></html>", out.getIn().getBody(String.class));
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.assertExchangeReceived()

        // need some time for the mail to arrive on the inbox (consumed and sent to the mock)
        Thread.sleep(2000);

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);
        Exchange out = mock.assertExchangeReceived(0);
        mock.assertIsSatisfied();

        // plain text
        assertEquals("Hello World", out.getIn().getBody(String.class));
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.assertExchangeReceived()

        // need some time for the mail to arrive on the inbox (consumed and sent to the mock)
        Thread.sleep(1000);

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);
        Exchange out = mock.assertExchangeReceived(0);
        mock.assertIsSatisfied();

        ByteArrayOutputStream baos = new ByteArrayOutputStream(((MailMessage)out.getIn()).getMessage().getSize());
        ((MailMessage)out.getIn()).getMessage().writeTo(baos);
        String dumpedMessage = baos.toString();
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.assertExchangeReceived()

    public void testTheContentType() throws Exception {
        MockEndpoint result = getMockEndpoint("mock:result");
        result.reset();
        HelloService client = getCXFClient();
        client.echo("hello world");       
        Map context = (Map)result.assertExchangeReceived(0).getIn().getHeaders().get("ResponseContext");
        assertNotNull("Expect to get the protocal header ", context.get("org.apache.cxf.message.Message.PROTOCOL_HEADERS"));
        Map protocalHeaders = (Map) context.get("org.apache.cxf.message.Message.PROTOCOL_HEADERS");
        assertEquals("Should get the content type", protocalHeaders.get("content-type").toString(), "[text/xml; charset=utf-8]");
        assertEquals("Should get the response code ", context.get("org.apache.cxf.message.Message.RESPONSE_CODE"), 200);
    }
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.assertExchangeReceived()

        Thread.sleep(1000);

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.assertIsSatisfied();

        Exchange out = mock.assertExchangeReceived(0);
        ByteArrayOutputStream baos = new ByteArrayOutputStream(((MailMessage)out.getIn()).getMessage().getSize());
        ((MailMessage)out.getIn()).getMessage().writeTo(baos);
        String dumpedMessage = baos.toString();
        assertTrue("There should have the " + expectString, dumpedMessage.indexOf(expectString) > 0);
        if (log.isTraceEnabled()) {
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.assertExchangeReceived()

    private void verifyTheRecivedEmail(String expectString) throws Exception {

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.assertIsSatisfied();

        Exchange out = mock.assertExchangeReceived(0);
        ByteArrayOutputStream baos = new ByteArrayOutputStream(((MailMessage)out.getIn()).getMessage().getSize());
        ((MailMessage)out.getIn()).getMessage().writeTo(baos);
        String dumpedMessage = baos.toString();
        assertTrue("There should have the " + expectString, dumpedMessage.indexOf(expectString) > 0);
        if (log.isTraceEnabled()) {
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.assertExchangeReceived()

        Thread.sleep(1000);

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.assertIsSatisfied();

        Exchange out = mock.assertExchangeReceived(0);
        ByteArrayOutputStream baos = new ByteArrayOutputStream(((MailMessage)out.getIn()).getMessage().getSize());
        ((MailMessage)out.getIn()).getMessage().writeTo(baos);
        String dumpedMessage = baos.toString();
        assertTrue("There should have the " + expectString, dumpedMessage.indexOf(expectString) > 0);
        if (log.isTraceEnabled()) {
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.assertExchangeReceived()

        result.reset();
        result.expectedMessageCount(1);
        HelloService client = getCXFClient();
        client.echo("hello world");
        assertMockEndpointsSatisfied();       
        Map context = (Map)result.assertExchangeReceived(0).getIn().getHeaders().get("ResponseContext");
        Map protocalHeaders = (Map) context.get("org.apache.cxf.message.Message.PROTOCOL_HEADERS");
        assertEquals("Should get the content type", protocalHeaders.get("content-type").toString(), "[text/xml; charset=utf-8]");
        assertEquals("Should get the response code ", context.get("org.apache.cxf.message.Message.RESPONSE_CODE"), 200);       
        assertEquals("Should get the content type", result.assertExchangeReceived(0).getIn().getHeaders().get("content-type"), "text/xml; charset=utf-8");       
    }
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.assertExchangeReceived()

        assertMockEndpointsSatisfied();       
        Map context = (Map)result.assertExchangeReceived(0).getIn().getHeaders().get("ResponseContext");
        Map protocalHeaders = (Map) context.get("org.apache.cxf.message.Message.PROTOCOL_HEADERS");
        assertEquals("Should get the content type", protocalHeaders.get("content-type").toString(), "[text/xml; charset=utf-8]");
        assertEquals("Should get the response code ", context.get("org.apache.cxf.message.Message.RESPONSE_CODE"), 200);       
        assertEquals("Should get the content type", result.assertExchangeReceived(0).getIn().getHeaders().get("content-type"), "text/xml; charset=utf-8");       
    }
   
    @Test
    public void testTheContentTypeOnTheWire() throws Exception {
        Exchange exchange = template.send(ROUTER_ADDRESS,  new Processor() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.