Search in sources :

Example 1 with SimpleRegistry

use of org.apache.camel.impl.SimpleRegistry 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);
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) DataFormat(org.apache.camel.spi.DataFormat) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 2 with SimpleRegistry

use of org.apache.camel.impl.SimpleRegistry 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());
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) DataFormat(org.apache.camel.spi.DataFormat) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 3 with SimpleRegistry

use of org.apache.camel.impl.SimpleRegistry in project camel by apache.

the class GreaterCamelEjbPropertiesTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    // use simple registry to not conflict with jndi used by EJB
    CamelContext answer = new DefaultCamelContext(new SimpleRegistry());
    // enlist EJB component using JndiContext
    Properties properties = new Properties();
    properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
    EjbComponent ejb = answer.getComponent("ejb", EjbComponent.class);
    ejb.setProperties(properties);
    return answer;
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) Properties(java.util.Properties) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Example 4 with SimpleRegistry

use of org.apache.camel.impl.SimpleRegistry in project camel by apache.

the class SedaQueueFactoryTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry simpleRegistry = new SimpleRegistry();
    simpleRegistry.put("arrayQueueFactory", arrayQueueFactory);
    return new DefaultCamelContext(simpleRegistry);
}
Also used : SimpleRegistry(org.apache.camel.impl.SimpleRegistry) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Example 5 with SimpleRegistry

use of org.apache.camel.impl.SimpleRegistry in project camel by apache.

the class ManagedFromRestGetTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("dummy-test", new DummyRestConsumerFactory());
    return new DefaultCamelContext(registry);
}
Also used : SimpleRegistry(org.apache.camel.impl.SimpleRegistry) DummyRestConsumerFactory(org.apache.camel.component.rest.DummyRestConsumerFactory) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Aggregations

SimpleRegistry (org.apache.camel.impl.SimpleRegistry)64 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)61 CamelContext (org.apache.camel.CamelContext)40 Test (org.junit.Test)31 RouteBuilder (org.apache.camel.builder.RouteBuilder)14 Before (org.junit.Before)8 FailedToCreateRouteException (org.apache.camel.FailedToCreateRouteException)5 EchoRequest (org.opennms.core.rpc.echo.EchoRequest)5 EchoRpcModule (org.opennms.core.rpc.echo.EchoRpcModule)5 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)4 Component (org.apache.camel.Component)4 Exchange (org.apache.camel.Exchange)4 DummyRestConsumerFactory (org.apache.camel.component.rest.DummyRestConsumerFactory)4 DefaultExchange (org.apache.camel.impl.DefaultExchange)4 EchoResponse (org.opennms.core.rpc.echo.EchoResponse)4 HashMap (java.util.HashMap)3 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)3 SjmsComponent (org.apache.camel.component.sjms.SjmsComponent)3 Config (com.hazelcast.config.Config)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2