use of org.apache.camel.ProducerTemplate in project camel by apache.
the class LifecycleTest method testCamelContext.
@Test
public void testCamelContext() throws Exception {
CamelContext context = getCamelContext();
assertNotNull(context);
assertEquals("MyCamel", context.getName());
ProducerTemplate template = context.createProducerTemplate();
MockEndpoint mock = context.getEndpoint("mock:foo", MockEndpoint.class);
mock.expectedBodiesReceived("Hello World");
template.sendBody("seda:foo", "World");
mock.assertIsSatisfied();
template.stop();
}
use of org.apache.camel.ProducerTemplate in project camel by apache.
the class MultipleRoutesTest method testCamelContext.
@Test
public void testCamelContext() throws Exception {
CamelContext context = getCamelContext();
assertNotNull(context);
assertEquals("MyCamel", context.getName());
assertEquals(2, context.getRoutes().size());
ProducerTemplate template = context.createProducerTemplate();
MockEndpoint mock = context.getEndpoint("mock:foo", MockEndpoint.class);
mock.expectedMessageCount(1);
MockEndpoint mock2 = context.getEndpoint("mock:bar", MockEndpoint.class);
mock2.expectedMessageCount(1);
template.sendBody("seda:foo", "Hello World");
template.sendBody("direct:bar", "Bye World");
mock.assertIsSatisfied();
mock2.assertIsSatisfied();
template.stop();
}
use of org.apache.camel.ProducerTemplate in project camel by apache.
the class RoutesFromPackageScanTest method testRoutes.
@Test
public void testRoutes() throws Exception {
CamelContext context = getCamelContext();
assertNotNull(context);
assertEquals("MyCamel", context.getName());
assertEquals(2, context.getRoutes().size());
assertNotNull(context.getRoute("foo"));
assertNotNull(context.getRoute("bar"));
ProducerTemplate template = context.createProducerTemplate();
MockEndpoint mock = context.getEndpoint("mock:foo", MockEndpoint.class);
mock.expectedMessageCount(1);
MockEndpoint mock2 = context.getEndpoint("mock:bar", MockEndpoint.class);
mock2.expectedMessageCount(1);
template.sendBody("direct:foo", "Hello World");
template.sendBody("direct:bar", "Bye World");
mock.assertIsSatisfied();
mock2.assertIsSatisfied();
template.stop();
}
use of org.apache.camel.ProducerTemplate in project camel by apache.
the class RoutesFromXmlTest method testRoutes.
@Test
public void testRoutes() throws Exception {
CamelContext context = getCamelContext();
assertNotNull(context);
assertEquals("MyCamel", context.getName());
assertEquals(2, context.getRoutes().size());
ProducerTemplate template = context.createProducerTemplate();
MockEndpoint mock = context.getEndpoint("mock:foo", MockEndpoint.class);
mock.expectedMessageCount(1);
MockEndpoint mock2 = context.getEndpoint("mock:bar", MockEndpoint.class);
mock2.expectedMessageCount(1);
template.sendBody("direct:foo", "Hello World");
template.sendBody("direct:bar", "Bye World");
mock.assertIsSatisfied();
mock2.assertIsSatisfied();
template.stop();
}
use of org.apache.camel.ProducerTemplate in project camel by apache.
the class SingleRouteTest method testCamelContext.
@Test
public void testCamelContext() throws Exception {
CamelContext context = getCamelContext();
assertNotNull(context);
assertEquals("MyCamel", context.getName());
ProducerTemplate template = context.createProducerTemplate();
MockEndpoint mock = context.getEndpoint("mock:foo", MockEndpoint.class);
mock.expectedMessageCount(1);
template.sendBody("seda:foo", "Hello World");
mock.assertIsSatisfied();
template.stop();
}
Aggregations