use of org.apache.camel.ProducerTemplate in project camel by apache.
the class ProducerTemplateAutoRegisterTest method testHasTemplate.
@Test
public void testHasTemplate() {
assertNotNull("Should have injected a producer template", template);
ProducerTemplate lookup = context.getRegistry().lookupByNameAndType("template", ProducerTemplate.class);
assertNotNull("Should lookup producer template", lookup);
}
use of org.apache.camel.ProducerTemplate in project camel by apache.
the class ProducerTemplateAutoRegisterTwoCamelContextsTest method testHasNoTemplateCamel1.
@Test
public void testHasNoTemplateCamel1() {
ProducerTemplate lookup = context1.getRegistry().lookupByNameAndType("template", ProducerTemplate.class);
assertNull("Should NOT lookup producer template", lookup);
}
use of org.apache.camel.ProducerTemplate in project camel by apache.
the class ProducerTemplateAutoRegisterTwoCamelContextsTest method testHasNoTemplateCamel2.
@Test
public void testHasNoTemplateCamel2() {
ProducerTemplate lookup = context2.getRegistry().lookupByNameAndType("template", ProducerTemplate.class);
assertNull("Should NOT lookup producer template", lookup);
}
use of org.apache.camel.ProducerTemplate in project camel by apache.
the class ProducerTemplateHasTwoTemplatesTest method testHasTwoTemplates.
@Test
public void testHasTwoTemplates() {
ProducerTemplate lookup = context.getRegistry().lookupByNameAndType("myTemplate", ProducerTemplate.class);
assertNotNull("Should lookup producer template", lookup);
ProducerTemplate lookup2 = context.getRegistry().lookupByNameAndType("myOtherTemplate", ProducerTemplate.class);
assertNotNull("Should lookup producer template", lookup2);
assertNotSame("Should not be same", lookup, lookup2);
}
use of org.apache.camel.ProducerTemplate in project camel by apache.
the class RouteAutoStartupPropertiesTest method testAutoStartupFalse.
public void testAutoStartupFalse() throws Exception {
ac = new ClassPathXmlApplicationContext("org/apache/camel/spring/config/RouteAutoStartupFalseTest.xml");
SpringCamelContext camel = ac.getBeansOfType(SpringCamelContext.class).values().iterator().next();
assertEquals(false, camel.getRouteStatus("foo").isStarted());
// now starting route manually
camel.startRoute("foo");
assertEquals(true, camel.getRouteStatus("foo").isStarted());
// and now we can send a message to the route and see that it works
MockEndpoint mock = camel.getEndpoint("mock:result", MockEndpoint.class);
mock.expectedMessageCount(1);
ProducerTemplate template = camel.createProducerTemplate();
template.start();
template.sendBody("direct:start", "Hello World");
template.stop();
mock.assertIsSatisfied();
}
Aggregations