Package org.apache.camel.component.mock

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


    }
   
    @Test
    public void testSenderXmlData() throws Exception {       
        MockEndpoint result = getMockEndpoint("mock:result");
        result.reset();
        result.expectedMessageCount(4);
        template.sendBody("direct:endpoint", xmlData);
        assertMockEndpointsSatisfied();
        int i = 0;
        for (Exchange exchange : result.getExchanges()) {
View Full Code Here


    }
   
    @Test
    public void testToStringProcessor() throws Exception {
        MockEndpoint result = getMockEndpoint("mock:result");
        result.reset();
        result.expectedMessageCount(4);
        template.sendBody("direct:toString", xmlData);
        assertMockEndpointsSatisfied();
        int i = 0;
        for (Exchange exchange : result.getExchanges()) {
View Full Code Here

        };
    }
   
    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");
View Full Code Here

        Thread.sleep(2000);
        template.sendBody("direct:start", "B");

        result.assertIsSatisfied();

        result.reset();
        result.expectedBodiesReceived("B");

        // trigger seda:bar to complete now, which should signal
        // to the throttler to resume the seda:foo consumer, so B can get done
        latch.countDown();
View Full Code Here

            template.sendBody("seda:withoutConversion?concurrentConsumers=5", null);
            mockEndpoint.assertIsSatisfied();
            Object response = mockEndpoint.getReceivedExchanges().get(0).getIn().getBody();
            InputStream responseStream = assertIsInstanceOf(InputStream.class, response);
            responseStream.close();
            mockEndpoint.reset();
        }
    }

    protected void sendMessagesTo(String endpointName, int count) throws InterruptedException {
        MockEndpoint mockEndpoint = resolveMandatoryEndpoint("mock:results", MockEndpoint.class);
View Full Code Here

        assertMockEndpointsSatisfied();

        Thread.sleep(100);

        // reset mock and set new expectations
        mock.reset();
        mock.expectedMessageCount(0);

        // move file back
        sendFile(getFtpUrl(), "Hello World", "report.txt");
View Full Code Here

        mock.assertIsSatisfied();
        List<?> received = assertIsInstanceOf(List.class, mock.getReceivedExchanges().get(0).getIn().getBody());
        Map<?, ?> row = assertIsInstanceOf(Map.class, received.get(0));
        assertEquals(1, row.get("id"));
        assertEquals("ASF", row.get("license"));
        mock.reset();

        mock.expectedMessageCount(1);
        template.sendBodyAndHeader("direct:simple", 3, SqlConstants.SQL_QUERY, "select * from projects where id = ? order by id");
        mock.assertIsSatisfied();
        received = assertIsInstanceOf(List.class, mock.getReceivedExchanges().get(0).getIn().getBody());
View Full Code Here

        mock.assertIsSatisfied();

        // now change content in the file in the classpath and try again
        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/freemarker?fileExist=Override", "Bye ${headers.name}", Exchange.FILE_NAME, "hello.ftl");

        mock.reset();
        mock.expectedBodiesReceived("Bye Paris");

        template.sendBodyAndHeader("direct:a", "Body", "name", "Paris");
        mock.assertIsSatisfied();
    }
View Full Code Here

        mock.assertIsSatisfied();

        // now change content in the file in the classpath and try again
        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/freemarker?fileExist=Override", "Bye ${headers.name}", Exchange.FILE_NAME, "hello.ftl");

        mock.reset();
        // we must expected the original filecontent as the cache is enabled, so its Hello and not Bye
        mock.expectedBodiesReceived("Hello Paris");

        template.sendBodyAndHeader("direct:b", "Body", "name", "Paris");
        mock.assertIsSatisfied();
View Full Code Here

        mock.assertIsSatisfied();

        // now change content in the file in the classpath and try again .... with no delay
        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/freemarker?fileExist=Override", "Bye ${headers.name}", Exchange.FILE_NAME, "hello.ftl");

        mock.reset();
        // we must expected the original filecontent as the cache is enabled, so its Hello and not Bye
        mock.expectedBodiesReceived("Hello Paris");

        template.sendBodyAndHeader("direct:c", "Body", "name", "Paris");
        mock.assertIsSatisfied();
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.