Package org.apache.camel

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


                Producer producer;
                try {
                    producer = endpoint.createProducer();
                    producer.start();
                    producer.process(exchange);
                    producer.stop();
                } catch (Exception e) {
                    throw ObjectHelper.wrapRuntimeCamelException(e);
                }

                // return the OUT body, but check for exchange pattern
View Full Code Here


        boolean received = latch.await(5, TimeUnit.SECONDS);
        assertTrue("Did not receive the message!", received);
        assertNotNull(receivedExchange.getIn());
        assertEquals("!olleH", receivedExchange.getIn().getBody());

        producer.stop();
        context.stop();
        server.stop();
    }

    @Test
View Full Code Here

        boolean received = latch.await(5, TimeUnit.SECONDS);
        assertTrue("Did not receive the message!", received);
        assertNotNull(receivedExchange.getIn());
        assertEquals("!olleH", receivedExchange.getIn().getBody());

        producer.stop();
        context.stop();
        server.stop();
    }

    @Override
View Full Code Here

        // Everything is asynchronous.
        // We need to wait a second to make sure we get the message.
        //
        Thread.sleep(1000);
        // stop using our mock
        producer.stop();

        verify(mockConnector);

        assertMockEndpointsSatisfied();
    }
View Full Code Here

        exchange.getIn().setBody("Hello World this file will NOT be deleted");
        exchange.getIn().setHeader(Exchange.FILE_NAME, "hello.txt");
        Producer producer = endpoint.createProducer();
        producer.start();
        producer.process(exchange);
        producer.stop();

        // assert file is created
        File file = new File(FTP_ROOT_DIR + "/deletefile/hello.txt");
        file = file.getAbsoluteFile();
        assertTrue("The file should exists", file.exists());
View Full Code Here

        producer.process(exchange);

        String s = exchange.getOut().getBody(String.class);
        assertEquals(bye, s);

        producer.stop();
    }

    @Test
    public void testInvalidEncoding() throws Exception {
        final String uri = "mina2:tcp://localhost:{{port}}?textline=true&encoding=XXX&sync=false";
View Full Code Here

        field.setAccessible(true);
        IoSession session = (IoSession) field.get(producer);
        assertTrue("There should be a logger filter", session.getFilterChain().contains("logger"));

        assertMockEndpointsSatisfied();
        producer.stop();
    }

    @Test
    public void testLoggerOptionFalse() throws Exception {
        final String uri = "mina2:tcp://localhost:{{port}}?textline=true&minaLogger=false&sync=false";
View Full Code Here

        IoSession session = (IoSession) field.get(producer);
        assertFalse("There should NOT be a logger filter", session.getFilterChain().contains("logger"));

        assertMockEndpointsSatisfied();

        producer.stop();
    }

    @Test
    public void testNoLoggerOption() throws Exception {
        final String uri = "mina2:tcp://localhost:{{port}}?textline=true&sync=false";
View Full Code Here

        field.setAccessible(true);
        IoSession session = (IoSession) field.get(producer);
        assertFalse("There should NOT default be a logger filter", session.getFilterChain().contains("logger"));

        assertMockEndpointsSatisfied();
        producer.stop();
    }
}
View Full Code Here

        IoSession session = (IoSession) field.get(producer);
        assertTrue("There should be a test filter", session.getFilterChain().contains(TestFilter.class.getCanonicalName()));

        assertEquals("The filter should have been called twice (producer and consumer)", 2, TestFilter.called);

        producer.stop();
    }

    @Override
    protected Context createJndiContext() throws Exception {
        JndiContext answer = new JndiContext();
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.