http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/InjectedTypeConverterTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/InjectedTypeConverterTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/InjectedTypeConverterTest.java
new file mode 100644
index 0000000..6e43984
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/InjectedTypeConverterTest.java
@@ -0,0 +1,103 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.camel.NoTypeConversionAvailableException;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.TypeConverter;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.cdi.bean.InjectedTypeConverterRoute;
+import org.apache.camel.cdi.converter.InjectedTypeConverter;
+import org.apache.camel.cdi.pojo.TypeConverterInput;
+import org.apache.camel.cdi.pojo.TypeConverterOutput;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(Arquillian.class)
+public class InjectedTypeConverterTest {
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test class
+            .addClass(InjectedTypeConverterRoute.class)
+            // Type converter
+            .addClass(InjectedTypeConverter.class)
+            // No need as Camel CDI automatically registers the type converter 
bean
+            //.addAsManifestResource(new 
StringAsset("org.apache.camel.cdi.se.converter"), 
ArchivePaths.create("services/org/apache/camel/TypeConverter"))
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named("properties")
+    private static PropertiesComponent configuration() {
+        Properties properties = new Properties();
+        properties.put("property1", "value 1");
+        properties.put("property2", "value 2");
+        PropertiesComponent component = new PropertiesComponent();
+        component.setInitialProperties(properties);
+        return component;
+    }
+
+    @Test
+    public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate 
inbound,
+                                     @Uri("mock:outbound") MockEndpoint 
outbound) throws InterruptedException {
+        outbound.expectedMessageCount(1);
+
+        TypeConverterInput input = new TypeConverterInput();
+        input.setProperty("property value is [{{property1}}]");
+        
+        inbound.sendBody(input);
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
+        
assertThat(outbound.getExchanges().get(0).getIn().getBody(TypeConverterOutput.class).getProperty(),
 is(equalTo("property value is [value 1]")));
+    }
+
+    @Test
+    public void convertWithTypeConverter(TypeConverter converter) throws 
NoTypeConversionAvailableException {
+        TypeConverterInput input = new TypeConverterInput();
+        input.setProperty("property value is [{{property2}}]");
+
+        TypeConverterOutput output = 
converter.mandatoryConvertTo(TypeConverterOutput.class, input);
+
+        assertThat(output.getProperty(), is(equalTo("property value is [value 
2]")));
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/ManualCamelContextTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/ManualCamelContextTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/ManualCamelContextTest.java
new file mode 100644
index 0000000..31cacd7
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/ManualCamelContextTest.java
@@ -0,0 +1,117 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import java.util.concurrent.TimeUnit;
+import javax.inject.Inject;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.ServiceStatus;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.cdi.bean.ManualCamelRoute;
+import org.apache.camel.cdi.bean.SimpleCamelRoute;
+import org.apache.camel.cdi.qualifier.Manual;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(Arquillian.class)
+public class ManualCamelContextTest {
+
+    @Inject
+    @Uri("direct:start")
+    private ProducerTemplate inbound;
+
+    @Inject
+    @Uri("mock:result")
+    private MockEndpoint outbound;
+
+    @Inject
+    @Uri("direct:manual")
+    private ProducerTemplate manual;
+
+    @Inject
+    @Uri("mock:manual")
+    private MockEndpoint mock;
+
+    @Inject
+    @Manual
+    private ManualCamelRoute builder;
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test classes
+            .addClasses(SimpleCamelRoute.class, ManualCamelRoute.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    @InSequence(1)
+    public void verifyContext(CamelContext context) {
+        assertThat("Number of routes is incorrect!", 
context.getRoutes().size(), is(equalTo(1)));
+        assertThat("Configured route is incorrect!", 
context.getRouteStatus("simple"), is(equalTo(ServiceStatus.Started)));
+    }
+
+    @Test
+    @InSequence(2)
+    public void addManualRoute(CamelContext context) throws Exception {
+        context.addRoutes(builder);
+
+        assertThat("Number of routes is incorrect!", 
context.getRoutes().size(), is(equalTo(2)));
+        assertThat("Configured route is incorrect!", 
context.getRouteStatus("manual"), is(equalTo(ServiceStatus.Started)));
+    }
+
+    @Test
+    @InSequence(3)
+    public void sendMessageToInbound() throws InterruptedException {
+        outbound.expectedMessageCount(1);
+        outbound.expectedBodiesReceived("test");
+
+        inbound.sendBody("test");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
+    }
+
+    @Test
+    @InSequence(4)
+    public void sendMessageToManual() throws InterruptedException {
+        mock.expectedMessageCount(1);
+        mock.expectedBodiesReceived("manual");
+
+        manual.sendBody("manual");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, mock);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MockEndpointTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MockEndpointTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MockEndpointTest.java
new file mode 100644
index 0000000..7bf0ba7
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MockEndpointTest.java
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import java.util.concurrent.TimeUnit;
+import javax.inject.Inject;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.cdi.Mock;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.cdi.bean.DefaultCamelContextBean;
+import org.apache.camel.cdi.bean.MockAnnotationRoute;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(Arquillian.class)
+public class MockEndpointTest {
+
+    @Inject
+    private DefaultCamelContextBean defaultCamelContext;
+
+    @Inject
+    @Uri("direct:start")
+    private ProducerTemplate defaultInbound;
+
+    @Inject
+    @Mock("mock:result")
+    private MockEndpoint defaultOutbound;
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test classes
+            .addClasses(DefaultCamelContextBean.class, 
MockAnnotationRoute.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    public void verifyCamelContext() {
+        assertThat(defaultCamelContext.getName(), is(equalTo("camel-cdi")));
+        assertThat(defaultOutbound.getCamelContext().getName(), 
is(equalTo(defaultCamelContext.getName())));
+    }
+
+    @Test
+    public void sendMessageToInbound() throws InterruptedException {
+        defaultOutbound.expectedMessageCount(1);
+        defaultOutbound.expectedBodiesReceived("test");
+        defaultOutbound.expectedHeaderReceived("foo", "bar");
+
+        defaultInbound.sendBodyAndHeader("test", "foo", "bar");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, defaultOutbound);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiCamelContextProducerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiCamelContextProducerTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiCamelContextProducerTest.java
new file mode 100644
index 0000000..ebfbf70
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiCamelContextProducerTest.java
@@ -0,0 +1,168 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import java.util.concurrent.TimeUnit;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.cdi.ContextName;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.cdi.bean.DefaultCamelContextBean;
+import org.apache.camel.cdi.bean.FirstCamelContextRoute;
+import org.apache.camel.cdi.bean.UriEndpointRoute;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static 
org.apache.camel.cdi.expression.ExchangeExpression.fromCamelContext;
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(Arquillian.class)
+public class MultiCamelContextProducerTest {
+
+    @Produces
+    @ApplicationScoped
+    @ContextName("first")
+    private static CamelContext firstContext = new DefaultCamelContext();
+
+    @Inject
+    // Support bean class injection for custom beans
+    private DefaultCamelContextBean defaultCamelContext;
+
+    @Inject @Uri("direct:inbound")
+    private ProducerTemplate defaultInbound;
+
+    @Inject @Uri("mock:outbound")
+    private MockEndpoint defaultOutbound;
+
+    @Inject @ContextName("first")
+    private CamelContext firstCamelContext;
+
+    @Inject @ContextName("first") @Uri("direct:inbound")
+    private ProducerTemplate firstInbound;
+
+    @Inject @ContextName("first") @Uri("mock:outbound")
+    private MockEndpoint firstOutbound;
+
+    @Inject @ContextName("second")
+    private CamelContext secondCamelContext;
+
+    @Inject @ContextName("second") @Uri("direct:inbound")
+    private ProducerTemplate secondInbound;
+
+    @Inject @ContextName("second") @Uri("mock:outbound")
+    private MockEndpoint secondOutbound;
+
+    @Produces
+    @ApplicationScoped
+    @ContextName("second")
+    private static CamelContext secondContext() {
+        return new DefaultCamelContext();
+    }
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test classes
+            .addClasses(
+                DefaultCamelContextBean.class,
+                UriEndpointRoute.class,
+                FirstCamelContextRoute.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    @InSequence(1)
+    public void verifyCamelContexts() {
+        assertThat(defaultCamelContext.getName(), is(equalTo("camel-cdi")));
+        assertThat(firstCamelContext.getName(), is(equalTo("first")));
+        assertThat(secondCamelContext.getName(), is(equalTo("second")));
+
+        assertThat(defaultOutbound.getCamelContext().getName(), 
is(equalTo(defaultCamelContext.getName())));
+        assertThat(firstOutbound.getCamelContext().getName(), 
is(equalTo(firstCamelContext.getName())));
+        assertThat(secondOutbound.getCamelContext().getName(), 
is(equalTo(secondCamelContext.getName())));
+    }
+
+    @Test
+    @InSequence(2)
+    public void configureCamelContexts() throws Exception {
+        secondCamelContext.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:inbound").setHeader("context").constant("second").to("mock:outbound");
+            }
+        });
+    }
+
+    @Test
+    @InSequence(3)
+    public void sendMessageToDefaultCamelContextInbound() throws 
InterruptedException {
+        defaultOutbound.expectedMessageCount(1);
+        defaultOutbound.expectedBodiesReceived("test-default");
+        
defaultOutbound.message(0).exchange().matches(fromCamelContext("camel-cdi"));
+
+        defaultInbound.sendBody("test-default");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, defaultOutbound);
+    }
+
+    @Test
+    @InSequence(4)
+    public void sendMessageToFirstCamelContextInbound() throws 
InterruptedException {
+        firstOutbound.expectedMessageCount(1);
+        firstOutbound.expectedBodiesReceived("test-first");
+        firstOutbound.expectedHeaderReceived("context", "first");
+        firstOutbound.message(0).exchange().matches(fromCamelContext("first"));
+
+        firstInbound.sendBody("test-first");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, firstOutbound);
+    }
+
+    @Test
+    @InSequence(5)
+    public void sendMessageToSecondCamelContextInbound() throws 
InterruptedException {
+        secondOutbound.expectedMessageCount(1);
+        secondOutbound.expectedBodiesReceived("test-second");
+        secondOutbound.expectedHeaderReceived("context", "second");
+        
secondOutbound.message(0).exchange().matches(fromCamelContext("second"));
+
+        secondInbound.sendBody("test-second");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, secondOutbound);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiCamelContextTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiCamelContextTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiCamelContextTest.java
new file mode 100644
index 0000000..2eafb09
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiCamelContextTest.java
@@ -0,0 +1,159 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import java.util.concurrent.TimeUnit;
+import javax.inject.Inject;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.cdi.ContextName;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.cdi.bean.DefaultCamelContextBean;
+import org.apache.camel.cdi.bean.FirstCamelContextBean;
+import org.apache.camel.cdi.bean.FirstCamelContextRoute;
+import org.apache.camel.cdi.bean.SecondCamelContextBean;
+import org.apache.camel.cdi.bean.UriEndpointRoute;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static 
org.apache.camel.cdi.expression.ExchangeExpression.fromCamelContext;
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(Arquillian.class)
+public class MultiCamelContextTest {
+
+    @Inject
+    // Support bean class injection for custom beans
+    private DefaultCamelContextBean defaultCamelContext;
+
+    @Inject @Uri("direct:inbound")
+    private ProducerTemplate defaultInbound;
+
+    @Inject @Uri("mock:outbound")
+    private MockEndpoint defaultOutbound;
+
+    @Inject @ContextName("first")
+    private CamelContext firstCamelContext;
+
+    @Inject @ContextName("first") @Uri("direct:inbound")
+    private ProducerTemplate firstInbound;
+
+    @Inject @ContextName("first") @Uri("mock:outbound")
+    private MockEndpoint firstOutbound;
+
+    @Inject @ContextName("second")
+    private CamelContext secondCamelContext;
+
+    @Inject @ContextName("second") @Uri("direct:inbound")
+    private ProducerTemplate secondInbound;
+
+    @Inject @ContextName("second") @Uri("mock:outbound")
+    private MockEndpoint secondOutbound;
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test classes
+            .addClasses(
+                DefaultCamelContextBean.class,
+                UriEndpointRoute.class,
+                FirstCamelContextBean.class,
+                FirstCamelContextRoute.class,
+                SecondCamelContextBean.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    @InSequence(1)
+    public void verifyCamelContexts() {
+        assertThat(defaultCamelContext.getName(), is(equalTo("camel-cdi")));
+        assertThat(firstCamelContext.getName(), is(equalTo("first")));
+        assertThat(secondCamelContext.getName(), is(equalTo("second")));
+
+        assertThat(defaultOutbound.getCamelContext().getName(), 
is(equalTo(defaultCamelContext.getName())));
+        assertThat(firstOutbound.getCamelContext().getName(), 
is(equalTo(firstCamelContext.getName())));
+        assertThat(secondOutbound.getCamelContext().getName(), 
is(equalTo(secondCamelContext.getName())));
+    }
+
+    @Test
+    @InSequence(2)
+    public void configureCamelContexts() throws Exception {
+        secondCamelContext.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:inbound").setHeader("context").constant("second").to("mock:outbound");
+            }
+        });
+
+        secondCamelContext.startAllRoutes();
+    }
+
+    @Test
+    @InSequence(3)
+    public void sendMessageToDefaultCamelContextInbound() throws 
InterruptedException {
+        defaultOutbound.expectedMessageCount(1);
+        defaultOutbound.expectedBodiesReceived("test-default");
+        
defaultOutbound.message(0).exchange().matches(fromCamelContext("camel-cdi"));
+
+        defaultInbound.sendBody("test-default");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, defaultOutbound);
+    }
+
+    @Test
+    @InSequence(4)
+    public void sendMessageToFirstCamelContextInbound() throws 
InterruptedException {
+        firstOutbound.expectedMessageCount(1);
+        firstOutbound.expectedBodiesReceived("test-first");
+        firstOutbound.expectedHeaderReceived("context", "first");
+        firstOutbound.message(0).exchange().matches(fromCamelContext("first"));
+
+        firstInbound.sendBody("test-first");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, firstOutbound);
+    }
+
+    @Test
+    @InSequence(5)
+    public void sendMessageToSecondCamelContextInbound() throws 
InterruptedException {
+        secondOutbound.expectedMessageCount(1);
+        secondOutbound.expectedBodiesReceived("test-second");
+        secondOutbound.expectedHeaderReceived("context", "second");
+        
secondOutbound.message(0).exchange().matches(fromCamelContext("second"));
+
+        secondInbound.sendBody("test-second");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, secondOutbound);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEndpointInjectTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEndpointInjectTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEndpointInjectTest.java
new file mode 100644
index 0000000..5ce8eb3
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEndpointInjectTest.java
@@ -0,0 +1,137 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import java.util.concurrent.TimeUnit;
+import javax.inject.Inject;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.cdi.ContextName;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.cdi.bean.DefaultCamelContextBean;
+import org.apache.camel.cdi.bean.EndpointInjectRoute;
+import org.apache.camel.cdi.bean.FirstCamelContextBean;
+import org.apache.camel.cdi.bean.FirstCamelContextEndpointInjectRoute;
+import org.apache.camel.cdi.bean.SecondCamelContextBean;
+import org.apache.camel.cdi.bean.SecondCamelContextEndpointInjectRoute;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static 
org.apache.camel.cdi.expression.ExchangeExpression.fromCamelContext;
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+
+@RunWith(Arquillian.class)
+public class MultiContextEndpointInjectTest {
+
+    @Inject
+    private CamelContext defaultCamelContext;
+
+    @Inject @Uri("direct:inbound")
+    private ProducerTemplate defaultInbound;
+
+    @Inject @Uri("mock:outbound")
+    private MockEndpoint defaultOutbound;
+
+    @Inject @ContextName("first")
+    private CamelContext firstCamelContext;
+
+    @Inject @ContextName("first") @Uri("direct:inbound")
+    private ProducerTemplate firstInbound;
+
+    @Inject @ContextName("first") @Uri("mock:outbound")
+    private MockEndpoint firstOutbound;
+
+    @Inject @ContextName("second")
+    private CamelContext secondCamelContext;
+
+    @Inject @ContextName("second") @Uri("direct:inbound")
+    private ProducerTemplate secondInbound;
+
+    @Inject @ContextName("second") @Uri("mock:outbound")
+    private MockEndpoint secondOutbound;
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test classes
+            .addClasses(
+                DefaultCamelContextBean.class,
+                EndpointInjectRoute.class,
+                FirstCamelContextBean.class,
+                FirstCamelContextEndpointInjectRoute.class,
+                SecondCamelContextBean.class,
+                SecondCamelContextEndpointInjectRoute.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    @InSequence(1)
+    public void configureCamelContexts() throws Exception {
+        secondCamelContext.startAllRoutes();
+    }
+
+    @Test
+    @InSequence(2)
+    public void sendMessageToDefaultCamelContextInbound() throws 
InterruptedException {
+        defaultOutbound.expectedMessageCount(1);
+        defaultOutbound.expectedBodiesReceived("test-default");
+        
defaultOutbound.message(0).exchange().matches(fromCamelContext("camel-cdi"));
+
+        defaultInbound.sendBody("test-default");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, defaultOutbound);
+    }
+
+    @Test
+    @InSequence(3)
+    public void sendMessageToFirstCamelContextInbound() throws 
InterruptedException {
+        firstOutbound.expectedMessageCount(1);
+        firstOutbound.expectedBodiesReceived("test-first");
+        firstOutbound.expectedHeaderReceived("context", "first");
+        firstOutbound.message(0).exchange().matches(fromCamelContext("first"));
+
+        firstInbound.sendBody("test-first");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, firstOutbound);
+    }
+
+    @Test
+    @InSequence(4)
+    public void sendMessageToSecondCamelContextInbound() throws 
InterruptedException {
+        secondOutbound.expectedMessageCount(1);
+        secondOutbound.expectedBodiesReceived("test-second");
+        secondOutbound.expectedHeaderReceived("context", "second");
+        
secondOutbound.message(0).exchange().matches(fromCamelContext("second"));
+
+        secondInbound.sendBody("test-second");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, secondOutbound);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventEndpointTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventEndpointTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventEndpointTest.java
new file mode 100644
index 0000000..c6b51af
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventEndpointTest.java
@@ -0,0 +1,190 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.cdi.ContextName;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.cdi.bean.FirstCamelContextBean;
+import org.apache.camel.cdi.bean.FirstCamelContextEventConsumingRoute;
+import org.apache.camel.cdi.bean.FirstCamelContextEventProducingRoute;
+import org.apache.camel.cdi.bean.SecondCamelContextBean;
+import org.apache.camel.cdi.bean.SecondCamelContextEventConsumingRoute;
+import org.apache.camel.cdi.bean.SecondCamelContextEventProducingRoute;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.hamcrest.Matchers;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+import static org.hamcrest.Matchers.contains;
+import static org.junit.Assert.assertThat;
+
+@RunWith(Arquillian.class)
+public class MultiContextEventEndpointTest {
+
+    @Inject
+    @ContextName("first")
+    @Uri("mock:consumeString")
+    private MockEndpoint firstConsumeString;
+
+    @Inject
+    @ContextName("second")
+    @Uri("mock:consumeString")
+    private MockEndpoint secondConsumeString;
+
+    @Inject
+    @ContextName("first")
+    @Uri("direct:produceString")
+    private ProducerTemplate firstProduceString;
+
+    @Inject
+    @ContextName("second")
+    @Uri("direct:produceString")
+    private ProducerTemplate secondProduceString;
+
+    @Inject
+    private Event<Object> objectEvent;
+
+    @Inject
+    private EventObserver observer;
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test classes
+            .addClasses(
+                FirstCamelContextBean.class,
+                FirstCamelContextEventConsumingRoute.class,
+                FirstCamelContextEventProducingRoute.class,
+                SecondCamelContextBean.class,
+                SecondCamelContextEventConsumingRoute.class,
+                SecondCamelContextEventProducingRoute.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    @InSequence(1)
+    public void configureCamelContexts(@ContextName("second") CamelContext 
secondContext) throws Exception {
+        secondContext.startAllRoutes();
+    }
+
+    @Test
+    @InSequence(2)
+    public void sendEventsToConsumers() throws InterruptedException {
+        firstConsumeString.expectedMessageCount(1);
+        firstConsumeString.expectedBodiesReceived("testFirst");
+
+        secondConsumeString.expectedMessageCount(2);
+        secondConsumeString.expectedBodiesReceived("testSecond1", 
"testSecond2");
+
+        objectEvent.select(String.class, new 
ContextName.Literal("first")).fire("testFirst");
+        objectEvent.select(String.class, new 
ContextName.Literal("second")).fire("testSecond1");
+        objectEvent.select(String.class, new 
ContextName.Literal("second")).fire("testSecond2");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, firstConsumeString, 
secondConsumeString);
+    }
+
+    @Test
+    @InSequence(3)
+    public void sendMessagesToProducers() {
+        firstProduceString.sendBody("testFirst");
+        secondProduceString.sendBody("testSecond");
+
+        assertThat(observer.getObjectEvents(), 
Matchers.<Object>contains("testFirst", "testSecond"));
+        assertThat(observer.getStringEvents(), contains("testFirst", 
"testSecond"));
+        assertThat(observer.getFirstStringEvents(), contains("testFirst"));
+        assertThat(observer.secondStringEvents(), contains("testSecond"));
+    }
+
+    @Before
+    public void resetCollectedEvents() {
+        observer.reset();
+    }
+
+    @ApplicationScoped
+    static class EventObserver {
+
+        private final List<Object> objectEvents = new ArrayList<>();
+
+        private final List<String> stringEvents = new ArrayList<>();
+
+        private final List<String> firstStringEvents = new ArrayList<>();
+
+        private final List<String> secondStringEvents = new ArrayList<>();
+
+        void collectObjectEvents(@Observes Object event) {
+            objectEvents.add(event);
+        }
+
+        void collectStringEvents(@Observes String event) {
+            stringEvents.add(event);
+        }
+
+        void collectFirstStringEvents(@Observes @ContextName("first") String 
event) {
+            firstStringEvents.add(event);
+        }
+
+        void collectSecondStringEvents(@Observes @ContextName("second") String 
event) {
+            secondStringEvents.add(event);
+        }
+
+        List<Object> getObjectEvents() {
+            return objectEvents;
+        }
+
+        List<String> getStringEvents() {
+            return stringEvents;
+        }
+
+        List<String> getFirstStringEvents() {
+            return firstStringEvents;
+        }
+
+        List<String> secondStringEvents() {
+            return secondStringEvents;
+        }
+
+        void reset() {
+            objectEvents.clear();
+            stringEvents.clear();
+            firstStringEvents.clear();
+            secondStringEvents.clear();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventNotifierTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventNotifierTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventNotifierTest.java
new file mode 100644
index 0000000..57d24fe
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventNotifierTest.java
@@ -0,0 +1,300 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.cdi.ContextName;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.cdi.bean.DefaultCamelContextBean;
+import org.apache.camel.cdi.bean.FirstCamelContextBean;
+import org.apache.camel.cdi.bean.FirstCamelContextRoute;
+import org.apache.camel.cdi.bean.SecondCamelContextBean;
+import org.apache.camel.cdi.bean.UriEndpointRoute;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.management.event.AbstractExchangeEvent;
+import org.apache.camel.management.event.CamelContextStartedEvent;
+import org.apache.camel.management.event.CamelContextStartingEvent;
+import org.apache.camel.management.event.ExchangeCompletedEvent;
+import org.apache.camel.management.event.ExchangeCreatedEvent;
+import org.apache.camel.management.event.ExchangeSendingEvent;
+import org.apache.camel.management.event.ExchangeSentEvent;
+import org.hamcrest.Matchers;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static 
org.apache.camel.cdi.expression.ExchangeExpression.fromCamelContext;
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+import static org.hamcrest.Matchers.everyItem;
+import static org.hamcrest.Matchers.hasSize;
+import static org.junit.Assert.assertThat;
+
+@RunWith(Arquillian.class)
+public class MultiContextEventNotifierTest {
+
+    @Inject
+    // Support bean class injection for custom beans
+    private DefaultCamelContextBean defaultCamelContext;
+
+    @Inject @Uri("direct:inbound")
+    private ProducerTemplate defaultInbound;
+
+    @Inject @Uri("mock:outbound")
+    private MockEndpoint defaultOutbound;
+
+    @Produces @ApplicationScoped
+    private List<Class> defaultFiredEvents = new ArrayList<>();
+
+
+    @Inject @ContextName("first")
+    private CamelContext firstCamelContext;
+
+    @Inject @ContextName("first") @Uri("direct:inbound")
+    private ProducerTemplate firstInbound;
+
+    @Inject @ContextName("first") @Uri("mock:outbound")
+    private MockEndpoint firstOutbound;
+
+    @Produces @ApplicationScoped @ContextName("first")
+    private List<Class> firstFiredEvents = new ArrayList<>();
+
+
+    @Inject @ContextName("second")
+    private CamelContext secondCamelContext;
+
+    @Inject @ContextName("second") @Uri("direct:inbound")
+    private ProducerTemplate secondInbound;
+
+    @Inject @ContextName("second") @Uri("mock:outbound")
+    private MockEndpoint secondOutbound;
+
+    @Produces @ApplicationScoped @ContextName("second")
+    private List<Class> secondFiredEvents = new ArrayList<>();
+
+
+    @Produces @ApplicationScoped @Any @Named("anyContext")
+    private List<Class> anyFiredEvents = new ArrayList<>();
+
+
+    private void onAnyContextStartingEvent(@Observes CamelContextStartingEvent 
event, @Named("anyContext") List<Class> events) {
+        events.add(CamelContextStartingEvent.class);
+    }
+
+    private void onAnyContextStartedEvent(@Observes CamelContextStartedEvent 
event, @Named("anyContext") List<Class> events) {
+        events.add(CamelContextStartedEvent.class);
+    }
+
+    private void onAnyExchangeEvent(@Observes AbstractExchangeEvent event, 
@Named("anyContext") List<Class> events) {
+        events.add(event.getClass());
+    }
+
+
+    private void onDefaultContextStartingEvent(@Observes @Default 
CamelContextStartingEvent event, List<Class> events) {
+        events.add(CamelContextStartingEvent.class);
+    }
+
+    private void onDefaultContextStartedEvent(@Observes @Default 
CamelContextStartedEvent event, List<Class> events) {
+        events.add(CamelContextStartedEvent.class);
+    }
+
+    private void onDefaultExchangeEvent(@Observes @Default 
AbstractExchangeEvent event, List<Class> events) {
+        events.add(event.getClass());
+    }
+
+
+    private void onFirstContextStartingEvent(@Observes @ContextName("first") 
CamelContextStartingEvent event, @ContextName("first") List<Class> events) {
+        events.add(CamelContextStartingEvent.class);
+    }
+
+    private void onFirstContextStartedEvent(@Observes @ContextName("first") 
CamelContextStartedEvent event, @ContextName("first") List<Class> events) {
+        events.add(CamelContextStartedEvent.class);
+    }
+
+    private void onFirstExchangeEvent(@Observes @ContextName("first") 
AbstractExchangeEvent event, @ContextName("first") List<Class> events) {
+        events.add(event.getClass());
+    }
+
+
+    private void onSecondContextStartingEvent(@Observes @ContextName("second") 
CamelContextStartingEvent event, @ContextName("second") List<Class> events) {
+        events.add(CamelContextStartingEvent.class);
+    }
+
+    private void onSecondContextStartedEvent(@Observes @ContextName("second") 
CamelContextStartedEvent event, @ContextName("second") List<Class> events) {
+        events.add(CamelContextStartedEvent.class);
+    }
+
+    private void onSecondExchangeEvent(@Observes @ContextName("second") 
AbstractExchangeEvent event, @ContextName("second") List<Class> events) {
+        events.add(event.getClass());
+    }
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test classes
+            .addClasses(
+                DefaultCamelContextBean.class,
+                UriEndpointRoute.class,
+                FirstCamelContextBean.class,
+                FirstCamelContextRoute.class,
+                SecondCamelContextBean.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    @InSequence(1)
+    public void configureCamelContexts(List<Class> defaultEvents,
+                                       @ContextName("first") List<Class> 
firstEvents,
+                                       @ContextName("second") List<Class> 
secondEvents,
+                                       @Named("anyContext") List<Class> 
anyEvents) throws Exception {
+        secondCamelContext.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:inbound").setHeader("context").constant("second").to("mock:outbound");
+            }
+        });
+
+        secondCamelContext.startAllRoutes();
+
+        assertThat("Events fired for any contexts are incorrect", anyEvents,
+            everyItem(
+                Matchers.<Class>isOneOf(
+                    CamelContextStartingEvent.class,
+                    CamelContextStartedEvent.class)));
+        assertThat("Events fired for default context are incorrect", 
defaultEvents,
+            Matchers.<Class>contains(
+                CamelContextStartingEvent.class,
+                CamelContextStartedEvent.class));
+        assertThat("Events fired for first context are incorrect", firstEvents,
+            Matchers.<Class>contains(
+                CamelContextStartingEvent.class,
+                CamelContextStartedEvent.class));
+        assertThat("Events fired for second context are incorrect", 
secondEvents,
+            Matchers.<Class>contains(
+                CamelContextStartingEvent.class,
+                CamelContextStartedEvent.class));
+    }
+
+    @Test
+    @InSequence(2)
+    public void sendMessageToDefaultCamelContextInbound(List<Class> events) 
throws InterruptedException {
+        defaultOutbound.expectedMessageCount(1);
+        defaultOutbound.expectedBodiesReceived("test-default");
+        
defaultOutbound.message(0).exchange().matches(fromCamelContext("camel-cdi"));
+
+        defaultInbound.sendBody("test-default");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, defaultOutbound);
+
+        assertThat("Events fired are incorrect", events,
+            Matchers.<Class>contains(
+                CamelContextStartingEvent.class,
+                CamelContextStartedEvent.class,
+                ExchangeSendingEvent.class,
+                ExchangeCreatedEvent.class,
+                ExchangeSendingEvent.class,
+                ExchangeSentEvent.class,
+                ExchangeCompletedEvent.class,
+                ExchangeSentEvent.class));
+    }
+
+    @Test
+    @InSequence(3)
+    public void sendMessageToFirstCamelContextInbound(@ContextName("first") 
List<Class> events) throws InterruptedException {
+        firstOutbound.expectedMessageCount(1);
+        firstOutbound.expectedBodiesReceived("test-first");
+        firstOutbound.expectedHeaderReceived("context", "first");
+        firstOutbound.message(0).exchange().matches(fromCamelContext("first"));
+
+        firstInbound.sendBody("test-first");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, firstOutbound);
+
+        assertThat("Events fired are incorrect", events,
+            Matchers.<Class>contains(
+                CamelContextStartingEvent.class,
+                CamelContextStartedEvent.class,
+                ExchangeSendingEvent.class,
+                ExchangeCreatedEvent.class,
+                ExchangeSendingEvent.class,
+                ExchangeSentEvent.class,
+                ExchangeCompletedEvent.class,
+                ExchangeSentEvent.class));
+    }
+
+    @Test
+    @InSequence(4)
+    public void sendMessageToSecondCamelContextInbound(@ContextName("second") 
List<Class> events) throws InterruptedException {
+        secondOutbound.expectedMessageCount(1);
+        secondOutbound.expectedBodiesReceived("test-second");
+        secondOutbound.expectedHeaderReceived("context", "second");
+        
secondOutbound.message(0).exchange().matches(fromCamelContext("second"));
+
+        secondInbound.sendBody("test-second");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, secondOutbound);
+
+        assertThat("Events fired are incorrect", events,
+            Matchers.<Class>contains(
+                CamelContextStartingEvent.class,
+                CamelContextStartedEvent.class,
+                ExchangeSendingEvent.class,
+                ExchangeCreatedEvent.class,
+                ExchangeSendingEvent.class,
+                ExchangeSentEvent.class,
+                ExchangeCompletedEvent.class,
+                ExchangeSentEvent.class));
+    }
+
+    @Test
+    @InSequence(5)
+    public void stopCamelContexts(List<Class> defaultEvents,
+                                  @ContextName("first") List<Class> 
firstEvents,
+                                  @ContextName("second") List<Class> 
secondEvents,
+                                  @Named("anyContext") List<Class> anyEvents) 
throws Exception {
+        defaultCamelContext.stop();
+        firstCamelContext.stop();
+        secondCamelContext.stop();
+
+        assertThat("Events count fired for default context are incorrect", 
defaultEvents, hasSize(8));
+        assertThat("Events count fired for first context are incorrect", 
firstEvents, hasSize(8));
+        assertThat("Events count fired for second context are incorrect", 
secondEvents, hasSize(8));
+        assertThat("Events count fired for any contexts are incorrect", 
anyEvents, hasSize(24));
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextProduceTemplateTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextProduceTemplateTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextProduceTemplateTest.java
new file mode 100644
index 0000000..730c065
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextProduceTemplateTest.java
@@ -0,0 +1,157 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import java.util.concurrent.TimeUnit;
+import javax.inject.Inject;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.cdi.ContextName;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.cdi.bean.DefaultCamelContextBean;
+import org.apache.camel.cdi.bean.FirstCamelContextBean;
+import org.apache.camel.cdi.bean.FirstCamelContextProduceTemplateBean;
+import org.apache.camel.cdi.bean.ProduceTemplateBean;
+import org.apache.camel.cdi.bean.SecondCamelContextBean;
+import org.apache.camel.cdi.bean.SecondCamelContextProduceTemplateBean;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static 
org.apache.camel.cdi.expression.ExchangeExpression.fromCamelContext;
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+
+@RunWith(Arquillian.class)
+public class MultiContextProduceTemplateTest {
+
+    @Inject
+    private CamelContext defaultCamelContext;
+
+    @Inject @Uri("direct:inbound")
+    private ProducerTemplate defaultInbound;
+
+    @Inject @Uri("mock:outbound")
+    private MockEndpoint defaultOutbound;
+
+    @Inject @ContextName("first")
+    private CamelContext firstCamelContext;
+
+    @Inject @ContextName("first") @Uri("direct:inbound")
+    private ProducerTemplate firstInbound;
+
+    @Inject @ContextName("first") @Uri("mock:outbound")
+    private MockEndpoint firstOutbound;
+
+    @Inject @ContextName("second")
+    private CamelContext secondCamelContext;
+
+    @Inject @ContextName("second") @Uri("direct:inbound")
+    private ProducerTemplate secondInbound;
+
+    @Inject @ContextName("second") @Uri("mock:outbound")
+    private MockEndpoint secondOutbound;
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test classes
+            .addClasses(
+                DefaultCamelContextBean.class,
+                ProduceTemplateBean.class,
+                FirstCamelContextBean.class,
+                FirstCamelContextProduceTemplateBean.class,
+                SecondCamelContextBean.class,
+                SecondCamelContextProduceTemplateBean.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    @InSequence(1)
+    public void configureCamelContexts() throws Exception {
+        defaultCamelContext.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:inbound").bean(ProduceTemplateBean.class);
+            }
+        });
+
+        firstCamelContext.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:inbound").bean(FirstCamelContextProduceTemplateBean.class);
+            }
+        });
+
+        secondCamelContext.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:inbound").bean(SecondCamelContextProduceTemplateBean.class);
+            }
+        });
+
+        secondCamelContext.startAllRoutes();
+    }
+
+    @Test
+    @InSequence(2)
+    public void sendMessageToDefaultCamelContextInbound() throws 
InterruptedException {
+        defaultOutbound.expectedMessageCount(1);
+        defaultOutbound.expectedBodiesReceived("test-processed");
+        
defaultOutbound.message(0).exchange().matches(fromCamelContext("camel-cdi"));
+
+        defaultInbound.sendBody("test");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, defaultOutbound);
+    }
+
+    @Test
+    @InSequence(3)
+    public void sendMessageToFirstCamelContextInbound() throws 
InterruptedException {
+        firstOutbound.expectedMessageCount(1);
+        firstOutbound.expectedBodiesReceived("test-first");
+        firstOutbound.message(0).exchange().matches(fromCamelContext("first"));
+
+        firstInbound.sendBody("test");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, firstOutbound);
+    }
+
+    @Test
+    @InSequence(4)
+    public void sendMessageToSecondCamelContextInbound() throws 
InterruptedException {
+        secondOutbound.expectedMessageCount(1);
+        secondOutbound.expectedBodiesReceived("test-second");
+        
secondOutbound.message(0).exchange().matches(fromCamelContext("second"));
+
+        secondInbound.sendBody("test");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, secondOutbound);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextPropertyInjectTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextPropertyInjectTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextPropertyInjectTest.java
new file mode 100644
index 0000000..024a304
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextPropertyInjectTest.java
@@ -0,0 +1,193 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.cdi.ContextName;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.cdi.bean.DefaultCamelContextBean;
+import org.apache.camel.cdi.bean.FirstCamelContextBean;
+import org.apache.camel.cdi.bean.FirstCamelContextPropertyInjectBean;
+import org.apache.camel.cdi.bean.PropertyInjectBean;
+import org.apache.camel.cdi.bean.SecondCamelContextBean;
+import org.apache.camel.cdi.bean.SecondCamelContextPropertyInjectBean;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(Arquillian.class)
+public class MultiContextPropertyInjectTest {
+
+    @Inject
+    private CamelContext defaultCamelContext;
+
+    @Inject @Uri("direct:in")
+    private ProducerTemplate defaultInbound;
+
+    @Inject @Uri("mock:out")
+    private MockEndpoint defaultOutbound;
+
+    @Inject @ContextName("first")
+    private CamelContext firstCamelContext;
+
+    @Inject @ContextName("first") @Uri("direct:in")
+    private ProducerTemplate firstInbound;
+
+    @Inject @ContextName("first") @Uri("mock:out")
+    private MockEndpoint firstOutbound;
+
+    @Inject @ContextName("second")
+    private CamelContext secondCamelContext;
+
+    @Inject @ContextName("second") @Uri("direct:in")
+    private ProducerTemplate secondInbound;
+
+    @Inject @ContextName("second") @Uri("mock:out")
+    private MockEndpoint secondOutbound;
+
+    @Produces
+    @ApplicationScoped
+    @Named("properties")
+    private static PropertiesComponent configuration() {
+        Properties properties = new Properties();
+        properties.put("property", "default");
+        PropertiesComponent component = new PropertiesComponent();
+        component.setInitialProperties(properties);
+        return component;
+    }
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test classes
+            .addClasses(
+                DefaultCamelContextBean.class,
+                PropertyInjectBean.class,
+                FirstCamelContextBean.class,
+                FirstCamelContextPropertyInjectBean.class,
+                SecondCamelContextBean.class,
+                SecondCamelContextPropertyInjectBean.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    @InSequence(1)
+    public void configureCamelContexts() throws Exception {
+        defaultCamelContext.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:in").bean(PropertyInjectBean.class).to("mock:out");
+            }
+        });
+
+        firstCamelContext.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:in").bean(FirstCamelContextPropertyInjectBean.class).to("mock:out");
+            }
+        });
+
+        secondCamelContext.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:in").bean(SecondCamelContextPropertyInjectBean.class).to("mock:out");
+            }
+        });
+
+        secondCamelContext.startAllRoutes();
+    }
+
+    @Test
+    @InSequence(2)
+    public void sendMessageToDefaultCamelContextInbound() throws 
InterruptedException {
+        defaultOutbound.expectedMessageCount(1);
+        defaultOutbound.expectedBodiesReceived("test");
+        defaultOutbound.expectedHeaderReceived("header", "default");
+
+        defaultInbound.sendBody("test");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, defaultOutbound);
+    }
+
+    @Test
+    @InSequence(3)
+    public void retrieveReferenceFromDefaultCamelContext(PropertyInjectBean 
bean) {
+        assertThat(bean.getProperty(), is(equalTo("default")));
+    }
+
+    @Test
+    @InSequence(4)
+    public void sendMessageToFirstCamelContextInbound() throws 
InterruptedException {
+        firstOutbound.expectedMessageCount(1);
+        firstOutbound.expectedBodiesReceived("test");
+        firstOutbound.expectedHeaderReceived("header", "default");
+
+        firstInbound.sendBody("test");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, firstOutbound);
+    }
+
+    @Test
+    @InSequence(5)
+    public void 
retrieveReferenceFromFirstCamelContext(FirstCamelContextPropertyInjectBean 
bean) {
+        assertThat(bean.getProperty(), is(equalTo("default")));
+    }
+
+    @Test
+    @InSequence(6)
+    public void sendMessageToSecondCamelContextInbound() throws 
InterruptedException {
+        secondOutbound.expectedMessageCount(1);
+        secondOutbound.expectedBodiesReceived("test");
+        secondOutbound.expectedHeaderReceived("header", "default");
+
+        secondInbound.sendBody("test");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, secondOutbound);
+    }
+
+    @Test
+    @InSequence(7)
+    public void 
retrieveReferenceFromSecondCamelContext(SecondCamelContextPropertyInjectBean 
bean) {
+        assertThat(bean.getProperty(), is(equalTo("default")));
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/NamedCamelBeanTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/NamedCamelBeanTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/NamedCamelBeanTest.java
new file mode 100644
index 0000000..cb93c55
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/NamedCamelBeanTest.java
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.cdi.bean.NamedCamelBean;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+
+@RunWith(Arquillian.class)
+public class NamedCamelBeanTest {
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test class
+            .addClass(NamedCamelBean.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    @InSequence(1)
+    public void configureCamelContext(CamelContext context) throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:inbound").bean("beanName").to("mock:outbound");
+            }
+        });
+    }
+
+    @Test
+    @InSequence(2)
+    public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate 
in, @Uri("mock:outbound") MockEndpoint out) throws InterruptedException {
+        out.expectedMessageCount(1);
+        out.expectedBodiesReceived("test-processed");
+        
+        in.sendBody("test");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, out);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/NamedCamelContextTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/NamedCamelContextTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/NamedCamelContextTest.java
new file mode 100644
index 0000000..92adb38
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/NamedCamelContextTest.java
@@ -0,0 +1,114 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasProperty;
+import static org.junit.Assert.assertThat;
+
+@RunWith(Arquillian.class)
+public class NamedCamelContextTest {
+
+    @Named
+    @Produces
+    @ApplicationScoped
+    private CamelContext emptyNamedFieldContext = new DefaultCamelContext();
+
+    @Produces
+    @ApplicationScoped
+    @Named("named-field-context")
+    private CamelContext namedFieldContext = new DefaultCamelContext();
+
+    @Named
+    @Produces
+    @ApplicationScoped
+    private CamelContext getEmptyNamedGetterContext() {
+        return new DefaultCamelContext();
+    }
+
+    @Named
+    @Produces
+    @ApplicationScoped
+    private CamelContext getEmptyNamedMethodContext() {
+        return new DefaultCamelContext();
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named("named-getter-context")
+    private CamelContext getNamedGetterContext() {
+        return new DefaultCamelContext();
+    }
+
+    @Produces
+    @ApplicationScoped
+    @Named("named-method-context")
+    private CamelContext getNamedMethodContext() {
+        return new DefaultCamelContext();
+    }
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    public void verifyCamelContexts(Instance<CamelContext> contexts) {
+        assertThat(contexts, containsInAnyOrder(
+            hasProperty("name", equalTo("emptyNamedFieldContext")),
+            hasProperty("name", equalTo("emptyNamedGetterContext")),
+            hasProperty("name", equalTo("emptyNamedMethodContext")),
+            hasProperty("name", equalTo("named-field-context")),
+            hasProperty("name", equalTo("named-getter-context")),
+            hasProperty("name", equalTo("named-method-context")),
+            hasProperty("name", equalTo("emptyNamedBeanContext")),
+            hasProperty("name", equalTo("named-bean-context"))
+        ));
+    }
+
+    @Named
+    @ApplicationScoped
+    static class EmptyNamedBeanContext extends DefaultCamelContext {
+    }
+
+    @ApplicationScoped
+    @Named("named-bean-context")
+    static class NamedBeanContext extends DefaultCamelContext {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/ProduceTemplateTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/ProduceTemplateTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/ProduceTemplateTest.java
new file mode 100644
index 0000000..77e9cef
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/ProduceTemplateTest.java
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.cdi.bean.ProduceTemplateBean;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+
+@RunWith(Arquillian.class)
+public class ProduceTemplateTest {
+
+    @Deployment
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test class
+            .addClass(ProduceTemplateBean.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    @InSequence(1)
+    public void configureCamelContext(CamelContext context) throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:inbound").bean(ProduceTemplateBean.class);
+            }
+        });
+    }
+
+    @Test
+    @InSequence(2)
+    public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate 
in,
+                                     @Uri("mock:outbound") MockEndpoint out) 
throws InterruptedException {
+        out.expectedMessageCount(1);
+        out.expectedBodiesReceived("test-processed");
+        
+        in.sendBody("test");
+
+        assertIsSatisfied(2L, TimeUnit.SECONDS, out);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/PropertiesLocationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/PropertiesLocationTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/PropertiesLocationTest.java
new file mode 100644
index 0000000..a6ec82f
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/PropertiesLocationTest.java
@@ -0,0 +1,102 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(Arquillian.class)
+public class PropertiesLocationTest {
+
+    @Deployment(name = "single-location")
+    public static Archive<?> deployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test class
+            .addClass(SingleLocation.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    // TODO: reactivate when ARQ-1255 is fixed
+    /*
+    @Deployment(name = "multiple-locations")
+    public static Archive<?> multipleLocationsDeployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test classes
+            .addClass(MultipleLocations.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+    */
+
+    @Test
+    @OperateOnDeployment("single-location")
+    public void resolvePropertyFromLocation(CamelContext context) throws 
Exception {
+        assertThat("Property from classpath location does not resolve!", 
context.resolvePropertyPlaceholders("{{header.message}}"), is(equalTo("message 
from file")));
+    }
+
+    /*
+    @Test
+    @OperateOnDeployment("multiple-locations")
+    public void resolvePropertyFromLocations(CamelContext context) throws 
Exception {
+        assertThat("Property from classpath locations does not resolve!", 
context.resolvePropertyPlaceholders("{{foo.property}}"), 
is(equalTo("foo.value")));
+        assertThat("Property from classpath locations does not resolve!", 
context.resolvePropertyPlaceholders("{{bar.property}}"), 
is(equalTo("bar.value")));
+    }
+    */
+}
+
+class SingleLocation {
+
+    @Produces
+    @ApplicationScoped
+    @Named("properties")
+    private static PropertiesComponent configuration() {
+        return new PropertiesComponent("classpath:placeholder.properties");
+    }
+}
+
+class MultipleLocations {
+
+    @Produces
+    @ApplicationScoped
+    @Named("properties")
+    private static PropertiesComponent configuration() {
+        return new PropertiesComponent("classpath:foo.properties", 
"classpath:bar.properties");
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/PropertiesMultipleLocationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/PropertiesMultipleLocationTest.java
 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/PropertiesMultipleLocationTest.java
new file mode 100644
index 0000000..3f038a4
--- /dev/null
+++ 
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/PropertiesMultipleLocationTest.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.cdi.test;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.cdi.CdiCamelExtension;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(Arquillian.class)
+public class PropertiesMultipleLocationTest {
+
+    @Deployment(name = "multiple-locations")
+    public static Archive<?> multipleLocationsDeployment() {
+        return ShrinkWrap.create(JavaArchive.class)
+            // Camel CDI
+            .addPackage(CdiCamelExtension.class.getPackage())
+            // Test class
+            .addClass(MultipleLocations.class)
+            // Bean archive deployment descriptor
+            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Test
+    @OperateOnDeployment("multiple-locations")
+    public void resolvePropertyFromLocations(CamelContext context) throws 
Exception {
+        assertThat("Property from classpath locations does not resolve!", 
context.resolvePropertyPlaceholders("{{foo.property}}"), 
is(equalTo("foo.value")));
+        assertThat("Property from classpath locations does not resolve!", 
context.resolvePropertyPlaceholders("{{bar.property}}"), 
is(equalTo("bar.value")));
+    }
+}

Reply via email to