Package org.apache.camel

Examples of org.apache.camel.ProducerTemplate.stop()


        CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle20)", 10000);

        ProducerTemplate template = ctx.createProducerTemplate();
        Object out = template.requestBody("direct:a", "world");
        assertEquals("<hello>world</hello>", out);
        template.stop();
    }

    @Test
    public void testGetApplicationContextClassloader() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle22").start();
View Full Code Here


        mock.message(0).header("bar").isEqualTo(false);

        template.sendBody("direct:start", "<hello>World</hello>");

        mock.assertIsSatisfied();
        template.stop();
    }

    @Configuration
    public static Option[] configure() throws Exception {
View Full Code Here

        template.sendBody("direct:start", "Hello World");
        template.sendBody("direct:start", "Kaboom");

        mock.assertIsSatisfied();
        error.assertIsSatisfied();
        template.stop();
    }

    @Configuration
    public static Option[] configure() throws Exception {
View Full Code Here

        myTemplate.sendBodyAndHeader("file:target/foo", "Hello World", Exchange.FILE_NAME, "hello.txt");

        mock.assertIsSatisfied();

        myTemplate.stop();
    }

    @Configuration
    public static Option[] configure() throws Exception {
View Full Code Here

        ClassLoader tccl = mock.getExchanges().get(0).getProperty(ThreadContextClassLoaderBean.THREAD_CONTEXT_CLASS_LOADER, ClassLoader.class);
        assertNotNull("Exchange property containing TCCL should have been set", tccl);
        assertBundleDelegatingClassLoader(tccl);

        template.stop();
    }

    private void assertBundleDelegatingClassLoader(ClassLoader tccl) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
        // camel-blueprint does not export the BundleDelegatingClassLoader package so we need a little pinch of reflection here
        assertTrue("Expected a BundleDelegatingClassLoader instance", tccl.getClass().getName().contains("BundleDelegatingClassLoader"));
View Full Code Here

        Map<String, Object> headers = new HashMap<String, Object>();
        out = producer.requestBodyAndHeaders("Hello", headers);
        assertEquals("Bye Bye World", out);

        producer.stop();
    }

    public void testSendUsingDefaultEndpoint() throws Exception {
        ProducerTemplate producer = new DefaultProducerTemplate(context, context.getEndpoint("direct:in"));
        producer.start();
View Full Code Here

        Map<String, Object> headers = new HashMap<String, Object>();
        producer.sendBodyAndHeaders("Hello", headers);

        assertMockEndpointsSatisfied();

        producer.stop();
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
View Full Code Here

    public void sendBody(String endpointUri, String body) throws Exception {
        ProducerTemplate template = context.createProducerTemplate();
        try {
            template.sendBody(endpointUri, body);
        } finally {
            template.stop();
        }
    }

    @ManagedOperation(description = "Request body (in out)")
    public Object requestBody(String endpointUri, String body) throws Exception {
View Full Code Here

        ProducerTemplate template = context.createProducerTemplate();
        Object answer = null;
        try {
            answer = template.requestBody(endpointUri, body);
        } finally {
            template.stop();
        }
        return answer;
    }

}
View Full Code Here

        ProducerTemplate template = camelContext.createProducerTemplate();
        template.sendBodyAndHeader("jms:requestQueue", "Willem", CxfConstants.OPERATION_NAME, "greetMe");

        // Sleep a while and wait for the message whole processing
        Thread.sleep(4000);
        template.stop();

        MockEndpoint.assertIsSatisfied(camelContext);
        List<Exchange> list = resultEndpoint.getReceivedExchanges();
        assertEquals("Should get one message", list.size(), 1);
        for (Exchange exchange : list) {
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.