use of org.apache.camel.CamelContext in project camel by apache.
the class SpringRemotingTwoCamelContextTest method testProxyWithTwoCamelContext.
public void testProxyWithTwoCamelContext() throws Exception {
AbstractXmlApplicationContext applicationContext = createApplicationContext();
CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext);
ISay proxy = applicationContext.getBean("sayProxy1", ISay.class);
String rc = proxy.say();
assertEquals("context-1", rc);
proxy = applicationContext.getBean("sayProxy2", ISay.class);
rc = proxy.say();
assertEquals("context-2", rc);
camelContext.stop();
IOHelper.close(applicationContext);
}
use of org.apache.camel.CamelContext in project camel by apache.
the class SpringRemotingBeanConverterTest method testBeanRoutes.
public void testBeanRoutes() throws Exception {
AbstractXmlApplicationContext applicationContext = createApplicationContext();
CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext);
Invoker invoker = applicationContext.getBean("invokerProxy", Invoker.class);
String response = invoker.invoke(new Bean.SubClass());
assertEquals("Hello from Sub", response);
camelContext.stop();
IOHelper.close(applicationContext);
}
use of org.apache.camel.CamelContext in project camel by apache.
the class BaseUrlRewriteTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
context.addComponent("properties", new PropertiesComponent("ref:prop"));
return context;
}
use of org.apache.camel.CamelContext in project camel by apache.
the class XmlSignatureTest method doSignatureRouteTest.
public Exchange doSignatureRouteTest(RouteBuilder builder, Exchange e, Map<String, Object> headers) throws Exception {
CamelContext context = new DefaultCamelContext();
try {
context.addRoutes(builder);
context.start();
MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
mock.setExpectedMessageCount(1);
ProducerTemplate template = context.createProducerTemplate();
if (e != null) {
template.send("direct:in", e);
} else {
template.sendBodyAndHeaders("direct:in", payload, headers);
}
assertMockEndpointsSatisfied();
return mock.getReceivedExchanges().get(0);
} finally {
context.stop();
}
}
use of org.apache.camel.CamelContext in project camel by apache.
the class CamelBlueprintTestSupport method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext answer = null;
Long timeout = getCamelContextCreationTimeout();
if (timeout == null) {
answer = CamelBlueprintHelper.getOsgiService(bundleContext, CamelContext.class);
} else if (timeout >= 0) {
answer = CamelBlueprintHelper.getOsgiService(bundleContext, CamelContext.class, timeout);
} else {
throw new IllegalArgumentException("getCamelContextCreationTimeout cannot return a negative value.");
}
// must override context so we use the correct one in testing
context = (ModelCamelContext) answer;
return answer;
}
Aggregations