Search in sources :

Example 26 with ProducerTemplate

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);
}
Also used : ProducerTemplate(org.apache.camel.ProducerTemplate) Test(org.junit.Test)

Example 27 with ProducerTemplate

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);
}
Also used : ProducerTemplate(org.apache.camel.ProducerTemplate) Test(org.junit.Test)

Example 28 with ProducerTemplate

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);
}
Also used : ProducerTemplate(org.apache.camel.ProducerTemplate) Test(org.junit.Test)

Example 29 with ProducerTemplate

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);
}
Also used : ProducerTemplate(org.apache.camel.ProducerTemplate) Test(org.junit.Test)

Example 30 with ProducerTemplate

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();
}
Also used : ProducerTemplate(org.apache.camel.ProducerTemplate) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) SpringCamelContext(org.apache.camel.spring.SpringCamelContext)

Aggregations

ProducerTemplate (org.apache.camel.ProducerTemplate)130 Test (org.junit.Test)58 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)53 CamelContext (org.apache.camel.CamelContext)48 Exchange (org.apache.camel.Exchange)36 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)27 Deployment (org.activiti.engine.test.Deployment)16 RouteBuilder (org.apache.camel.builder.RouteBuilder)16 Processor (org.apache.camel.Processor)8 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)8 HashMap (java.util.HashMap)7 Task (org.activiti.engine.task.Task)7 Endpoint (org.apache.camel.Endpoint)7 File (java.io.File)6 ArrayList (java.util.ArrayList)5 Message (org.apache.camel.Message)4 List (java.util.List)3 ExecutorService (java.util.concurrent.ExecutorService)3 HistoricVariableInstance (org.activiti.engine.history.HistoricVariableInstance)3 ConsumerTemplate (org.apache.camel.ConsumerTemplate)3