Search in sources :

Example 46 with SimpleRegistry

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

the class BlueprintComponentResolverTest method testOsgiResolverFindComponentFallbackTest.

@Test
public void testOsgiResolverFindComponentFallbackTest() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("allstar-component", new SampleComponent(true));
    CamelContext camelContext = new DefaultCamelContext(registry);
    BlueprintComponentResolver resolver = new BlueprintComponentResolver(null);
    Component component = resolver.resolveComponent("allstar", camelContext);
    assertNotNull("We should find the super component", component);
    assertTrue("We should get the super component here", component instanceof SampleComponent);
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) Component(org.apache.camel.Component) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 47 with SimpleRegistry

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

the class OsgiLanguageResolverTest method testOsgiResolverFindLanguageFallbackTest.

@Test
public void testOsgiResolverFindLanguageFallbackTest() throws IOException {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("fuffy-language", new SampleLanguage(true));
    CamelContext camelContext = new DefaultCamelContext(registry);
    OsgiLanguageResolver resolver = new OsgiLanguageResolver(getBundleContext());
    Language language = resolver.resolveLanguage("fuffy", camelContext);
    assertNotNull("We should find fuffy language", language);
    assertTrue("We should find the fallback language", ((SampleLanguage) language).isFallback());
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Language(org.apache.camel.spi.Language) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 48 with SimpleRegistry

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

the class OsgiLanguageResolverTest method testOsgiResolverFindLanguageDoubleFallbackTest.

@Test
public void testOsgiResolverFindLanguageDoubleFallbackTest() throws IOException {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("fuffy", new SampleLanguage(false));
    registry.put("fuffy-language", new SampleLanguage(true));
    CamelContext camelContext = new DefaultCamelContext(registry);
    OsgiLanguageResolver resolver = new OsgiLanguageResolver(getBundleContext());
    Language language = resolver.resolveLanguage("fuffy", camelContext);
    assertNotNull("We should find fuffy language", language);
    assertFalse("We should NOT find the fallback language", ((SampleLanguage) language).isFallback());
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Language(org.apache.camel.spi.Language) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 49 with SimpleRegistry

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

the class OsgiComponentResolverTest method testOsgiResolverFindLanguageDoubleFallbackTest.

@Test
public void testOsgiResolverFindLanguageDoubleFallbackTest() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("allstar", new SampleComponent(false));
    registry.put("allstar-component", new SampleComponent(true));
    CamelContext camelContext = new DefaultCamelContext(registry);
    OsgiComponentResolver resolver = new OsgiComponentResolver(getBundleContext());
    Component component = resolver.resolveComponent("allstar", camelContext);
    assertNotNull("We should find the super component", component);
    assertTrue("We should get the super component here", component instanceof SampleComponent);
    assertFalse("We should NOT find the fallback component", ((SampleComponent) component).isFallback());
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) Component(org.apache.camel.Component) FileComponent(org.apache.camel.component.file.FileComponent) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 50 with SimpleRegistry

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

the class OsgiComponentResolverTest method testOsgiResolverFindComponentFallbackTest.

@Test
public void testOsgiResolverFindComponentFallbackTest() throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    registry.put("allstar-component", new SampleComponent(true));
    CamelContext camelContext = new DefaultCamelContext(registry);
    OsgiComponentResolver resolver = new OsgiComponentResolver(getBundleContext());
    Component component = resolver.resolveComponent("allstar", camelContext);
    assertNotNull("We should find the super component", component);
    assertTrue("We should get the super component here", component instanceof SampleComponent);
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) Component(org.apache.camel.Component) FileComponent(org.apache.camel.component.file.FileComponent) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Aggregations

SimpleRegistry (org.apache.camel.impl.SimpleRegistry)60 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)57 CamelContext (org.apache.camel.CamelContext)35 Test (org.junit.Test)25 RouteBuilder (org.apache.camel.builder.RouteBuilder)14 Before (org.junit.Before)8 FailedToCreateRouteException (org.apache.camel.FailedToCreateRouteException)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 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 Properties (java.util.Properties)2 ConnectionFactory (javax.jms.ConnectionFactory)2 FileComponent (org.apache.camel.component.file.FileComponent)2 HystrixConfigurationDefinition (org.apache.camel.model.HystrixConfigurationDefinition)2