use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class OsgiDataFormatResolverTest method testOsgiResolverFindDataFormatFallbackTest.
@Test
public void testOsgiResolverFindDataFormatFallbackTest() throws Exception {
SimpleRegistry registry = new SimpleRegistry();
registry.put("allstar-dataformat", new SampleDataFormat(true));
CamelContext camelContext = new DefaultCamelContext(registry);
OsgiDataFormatResolver resolver = new OsgiDataFormatResolver(getBundleContext());
DataFormat dataformat = resolver.resolveDataFormat("allstar", camelContext);
assertNotNull("We should find the super dataformat", dataformat);
assertTrue("We should get the super dataformat here", dataformat instanceof SampleDataFormat);
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class OsgiDataFormatResolverTest method testOsgiResolverFindLanguageDoubleFallbackTest.
@Test
public void testOsgiResolverFindLanguageDoubleFallbackTest() throws Exception {
SimpleRegistry registry = new SimpleRegistry();
registry.put("allstar", new SampleDataFormat(false));
registry.put("allstar-dataformat", new SampleDataFormat(true));
CamelContext camelContext = new DefaultCamelContext(registry);
OsgiDataFormatResolver resolver = new OsgiDataFormatResolver(getBundleContext());
DataFormat dataformat = resolver.resolveDataFormat("allstar", camelContext);
assertNotNull("We should find the super dataformat", dataformat);
assertTrue("We should get the super dataformat here", dataformat instanceof SampleDataFormat);
assertFalse("We should NOT find the fallback dataformat", ((SampleDataFormat) dataformat).isFallback());
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class ECDSASignatureTest 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.impl.DefaultCamelContext in project camel by apache.
the class SignatureTests 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.impl.DefaultCamelContext in project camel by apache.
the class CxfEndpointTest method testSettingClientBus.
@Test
public void testSettingClientBus() throws Exception {
ExtensionManagerBus bus = (ExtensionManagerBus) BusFactory.newInstance().createBus();
bus.setId("oldCXF");
BusFactory.setThreadDefaultBus(bus);
ExtensionManagerBus newBus = (ExtensionManagerBus) BusFactory.newInstance().createBus();
newBus.setId("newCXF");
CxfComponent cxfComponent = new CxfComponent(new DefaultCamelContext());
CxfEndpoint endpoint = (CxfEndpoint) cxfComponent.createEndpoint(routerEndpointURI);
endpoint.setBus(newBus);
CamelCxfClientImpl client = (CamelCxfClientImpl) endpoint.createClient();
assertEquals("CamelCxfClientImpl should has the same bus with CxfEndpoint", newBus, client.getBus());
endpoint = (CxfEndpoint) cxfComponent.createEndpoint(wsdlEndpointURI);
endpoint.setBus(newBus);
client = (CamelCxfClientImpl) endpoint.createClient();
assertEquals("CamelCxfClientImpl should has the same bus with CxfEndpoint", newBus, client.getBus());
}
Aggregations