use of org.apache.camel.Service in project camel by apache.
the class SpringMarshalDomainObjectJSONTest method createCamelContext.
protected CamelContext createCamelContext() throws Exception {
setUseRouteBuilder(false);
final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/dataformat/xstream/SpringMarshalDomainObjectJSONTest.xml");
setCamelContextService(new Service() {
public void start() throws Exception {
applicationContext.start();
}
public void stop() throws Exception {
applicationContext.stop();
}
});
return SpringCamelContext.springCamelContext(applicationContext);
}
use of org.apache.camel.Service in project camel by apache.
the class SpringMarshalListTest method createCamelContext.
protected CamelContext createCamelContext() throws Exception {
setUseRouteBuilder(false);
final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/dataformat/xstream/SpringMarshalListTest.xml");
setCamelContextService(new Service() {
public void start() throws Exception {
applicationContext.start();
}
public void stop() throws Exception {
applicationContext.stop();
}
});
return SpringCamelContext.springCamelContext(applicationContext);
}
use of org.apache.camel.Service in project camel by apache.
the class SpringXStreamConfigurationTest method createCamelContext.
protected CamelContext createCamelContext() throws Exception {
setUseRouteBuilder(false);
final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/dataformat/xstream/SpringXStreamConfigurationTest.xml");
setCamelContextService(new Service() {
public void start() throws Exception {
applicationContext.start();
}
public void stop() throws Exception {
applicationContext.stop();
}
});
return SpringCamelContext.springCamelContext(applicationContext);
}
use of org.apache.camel.Service in project camel by apache.
the class CamelJaxbSpringTest method createCamelContext.
protected CamelContext createCamelContext() throws Exception {
setUseRouteBuilder(false);
final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/jaxb/CamelJaxbTest.xml");
setCamelContextService(new Service() {
public void start() throws Exception {
applicationContext.start();
}
public void stop() throws Exception {
applicationContext.stop();
}
});
return SpringCamelContext.springCamelContext(applicationContext);
}
use of org.apache.camel.Service in project camel by apache.
the class JmsAutoStartupTest method testAutoStartup.
@Test
public void testAutoStartup() throws Exception {
Service service = context.getRoutes().get(0).getServices().get(0);
JmsConsumer consumer = (JmsConsumer) service;
assertEquals(false, consumer.getListenerContainer().isRunning());
MockEndpoint mock = getMockEndpoint("mock:result");
// should be stopped by default
mock.expectedMessageCount(0);
template.sendBody("activemq:queue:foo", "Hello World");
Thread.sleep(2000);
assertMockEndpointsSatisfied();
mock.reset();
mock.expectedBodiesReceived("Hello World");
// then start the listener so we can consume the persistent message
consumer.startListenerContainer();
assertMockEndpointsSatisfied();
}
Aggregations