You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/01/15 14:44:13 UTC
[5/9] camel git commit: CAMEL-9201: Improved Camel CDI component
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/PropertyEndpointRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/PropertyEndpointRoute.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/PropertyEndpointRoute.java
new file mode 100644
index 0000000..6d5ee7d
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/PropertyEndpointRoute.java
@@ -0,0 +1,30 @@
+/**
+ * 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.bean;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class PropertyEndpointRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ from("direct:{{from}}")
+ .routeId("route")
+ .setHeader("header").simple("properties:header.message")
+ .to("{{to}}");
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/PropertyInjectBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/PropertyInjectBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/PropertyInjectBean.java
new file mode 100644
index 0000000..e0cfbc4
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/PropertyInjectBean.java
@@ -0,0 +1,38 @@
+/**
+ * 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.bean;
+
+import java.util.Map;
+
+import org.apache.camel.Handler;
+import org.apache.camel.Headers;
+import org.apache.camel.PropertyInject;
+
+public class PropertyInjectBean {
+
+ @PropertyInject("property")
+ private String property;
+
+ @Handler
+ public void process(@Headers Map<String, Object> headers) {
+ headers.put("header", property);
+ }
+
+ public String getProperty() {
+ return property;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/RecipientListMethodBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/RecipientListMethodBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/RecipientListMethodBean.java
new file mode 100644
index 0000000..3e54e6a
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/RecipientListMethodBean.java
@@ -0,0 +1,34 @@
+/**
+ * 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.bean;
+
+import java.util.Arrays;
+import java.util.List;
+import javax.enterprise.context.ApplicationScoped;
+
+import org.apache.camel.Consume;
+import org.apache.camel.RecipientList;
+
+@ApplicationScoped
+public class RecipientListMethodBean {
+
+ @RecipientList
+ @Consume(uri = "direct:inbound")
+ public List<String> route() {
+ return Arrays.asList("mock:outbound1", "mock:outbound2");
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextBean.java
new file mode 100644
index 0000000..8f83e30
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextBean.java
@@ -0,0 +1,33 @@
+/**
+ * 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.bean;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+
+import org.apache.camel.cdi.ContextName;
+import org.apache.camel.impl.DefaultCamelContext;
+
+@ApplicationScoped
+@ContextName("second")
+public class SecondCamelContextBean extends DefaultCamelContext {
+
+ @PostConstruct
+ void postConstruct() {
+ setAutoStartup(false);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextEndpointInjectRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextEndpointInjectRoute.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextEndpointInjectRoute.java
new file mode 100644
index 0000000..9889786
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextEndpointInjectRoute.java
@@ -0,0 +1,34 @@
+/**
+ * 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.bean;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.ContextName;
+
+@ContextName("second")
+public class SecondCamelContextEndpointInjectRoute extends RouteBuilder {
+
+ @EndpointInject(uri = "direct:inbound", context = "second")
+ private Endpoint inbound;
+
+ @Override
+ public void configure() {
+ from(inbound).setHeader("context").constant("second").to("mock:outbound");
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextEventConsumingRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextEventConsumingRoute.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextEventConsumingRoute.java
new file mode 100644
index 0000000..45678a2
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextEventConsumingRoute.java
@@ -0,0 +1,38 @@
+/**
+ * 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.bean;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.CdiEventEndpoint;
+import org.apache.camel.cdi.ContextName;
+
+@ApplicationScoped
+@ContextName("second")
+public class SecondCamelContextEventConsumingRoute extends RouteBuilder {
+
+ @Inject
+ @ContextName("second")
+ private CdiEventEndpoint<String> stringCdiEventEndpoint;
+
+ @Override
+ public void configure() {
+ from(stringCdiEventEndpoint).to("mock:consumeString");
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextEventProducingRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextEventProducingRoute.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextEventProducingRoute.java
new file mode 100644
index 0000000..d856d22
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextEventProducingRoute.java
@@ -0,0 +1,38 @@
+/**
+ * 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.bean;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.CdiEventEndpoint;
+import org.apache.camel.cdi.ContextName;
+
+@ApplicationScoped
+@ContextName("second")
+public class SecondCamelContextEventProducingRoute extends RouteBuilder {
+
+ @Inject
+ @ContextName("second")
+ private CdiEventEndpoint<String> stringCdiEventEndpoint;
+
+ @Override
+ public void configure() {
+ from("direct:produceString").to(stringCdiEventEndpoint);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextProduceTemplateBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextProduceTemplateBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextProduceTemplateBean.java
new file mode 100644
index 0000000..fe97114
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextProduceTemplateBean.java
@@ -0,0 +1,30 @@
+/**
+ * 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.bean;
+
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+
+public class SecondCamelContextProduceTemplateBean {
+
+ @Produce(uri = "mock:outbound", context = "second")
+ private ProducerTemplate producer;
+
+ public void sendToProducer(String body) {
+ producer.sendBody(body + "-second");
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextPropertyInjectBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextPropertyInjectBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextPropertyInjectBean.java
new file mode 100644
index 0000000..b1006c4
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondCamelContextPropertyInjectBean.java
@@ -0,0 +1,38 @@
+/**
+ * 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.bean;
+
+import java.util.Map;
+
+import org.apache.camel.Handler;
+import org.apache.camel.Headers;
+import org.apache.camel.PropertyInject;
+
+public class SecondCamelContextPropertyInjectBean {
+
+ @PropertyInject(value = "property", context = "second")
+ private String property;
+
+ @Handler
+ public void process(@Headers Map<String, Object> headers) {
+ headers.put("header", property);
+ }
+
+ public String getProperty() {
+ return property;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondNamedCamelContextBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondNamedCamelContextBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondNamedCamelContextBean.java
new file mode 100644
index 0000000..711e475
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondNamedCamelContextBean.java
@@ -0,0 +1,29 @@
+/**
+ * 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.bean;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+
+import org.apache.camel.cdi.ContextName;
+import org.apache.camel.impl.DefaultCamelContext;
+
+@ApplicationScoped
+@Named("second")
+@ContextName("second")
+public class SecondNamedCamelContextBean extends DefaultCamelContext {
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondNamedCamelContextRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondNamedCamelContextRoute.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondNamedCamelContextRoute.java
new file mode 100644
index 0000000..fd78a1e
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SecondNamedCamelContextRoute.java
@@ -0,0 +1,29 @@
+/**
+ * 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.bean;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.ContextName;
+
+@ContextName("second")
+public class SecondNamedCamelContextRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ from("direct:in").transform(body().prepend("second-")).to("direct:out");
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SimpleCamelRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SimpleCamelRoute.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SimpleCamelRoute.java
new file mode 100644
index 0000000..48de1e7
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/SimpleCamelRoute.java
@@ -0,0 +1,40 @@
+/**
+ * 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.bean;
+
+import javax.inject.Inject;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.Uri;
+import org.apache.camel.component.mock.MockEndpoint;
+
+public class SimpleCamelRoute extends RouteBuilder {
+
+ @Inject
+ @Uri("direct:start")
+ private Endpoint direct;
+
+ @Inject
+ @Uri("mock:result")
+ private MockEndpoint mock;
+
+ @Override
+ public void configure() {
+ from(direct).routeId("simple").to(mock);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/UriEndpointRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/UriEndpointRoute.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/UriEndpointRoute.java
new file mode 100644
index 0000000..e75fe65
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/UriEndpointRoute.java
@@ -0,0 +1,30 @@
+/**
+ * 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.bean;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.apache.camel.builder.RouteBuilder;
+
+@ApplicationScoped
+public class UriEndpointRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ from("direct:inbound").routeId("uri-route").to("mock:outbound");
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/component/properties/PropertiesComponentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/component/properties/PropertiesComponentTest.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/component/properties/PropertiesComponentTest.java
deleted file mode 100644
index f6bd0b3..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/component/properties/PropertiesComponentTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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.component.properties;
-
-import org.apache.camel.cdi.CdiContextTestSupport;
-import org.junit.Test;
-
-/**
- * Verifies behavior of properties component in CDI environment.
- */
-public class PropertiesComponentTest extends CdiContextTestSupport {
-
- @Test
- public void shouldUseCdiProperties() throws Exception {
- assertTrue(context.getComponent("properties") instanceof CdiPropertiesComponent);
- String resolved = context.resolvePropertyPlaceholders("d{{directEndpoint}}b");
-
- assertEquals("ddirect:injectb", resolved);
- resolved = context.resolvePropertyPlaceholders("{{directEndpoint}}_{{directEndpoint}}");
-
- assertEquals("direct:inject_direct:inject", resolved);
- }
-
- @Test
- public void testNullArgument() throws Exception {
- assertNull(context.resolvePropertyPlaceholders(null));
- }
-
- @Test
- public void testTextWithNoPlaceholder() throws Exception {
- assertEquals("IamAnonymous", context.resolvePropertyPlaceholders("IamAnonymous"));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testUnknownNestedPlaceholder() throws Exception {
- context.resolvePropertyPlaceholders("{{IamAnonymous}}");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/converter/InjectedTypeConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/converter/InjectedTypeConverter.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/converter/InjectedTypeConverter.java
new file mode 100644
index 0000000..ef0b245
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/converter/InjectedTypeConverter.java
@@ -0,0 +1,42 @@
+/**
+ * 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.converter;
+
+import javax.inject.Inject;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Converter;
+import org.apache.camel.cdi.pojo.TypeConverterInput;
+import org.apache.camel.cdi.pojo.TypeConverterOutput;
+
+@Converter
+public final class InjectedTypeConverter {
+
+ private final CamelContext context;
+
+ @Inject
+ InjectedTypeConverter(CamelContext context) {
+ this.context = context;
+ }
+
+ @Converter
+ public TypeConverterOutput convert(TypeConverterInput input) throws Exception {
+ TypeConverterOutput output = new TypeConverterOutput();
+ output.setProperty(context.resolvePropertyPlaceholders(input.getProperty()));
+ return output;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/expression/ExchangeExpression.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/expression/ExchangeExpression.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/expression/ExchangeExpression.java
new file mode 100644
index 0000000..1576a74
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/expression/ExchangeExpression.java
@@ -0,0 +1,37 @@
+/**
+ * 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.expression;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Expression;
+import org.apache.camel.Predicate;
+import org.apache.camel.util.PredicateToExpressionAdapter;
+
+public final class ExchangeExpression {
+
+ private ExchangeExpression() {
+ }
+
+ public static Expression fromCamelContext(final String contextName) {
+ return new PredicateToExpressionAdapter(new Predicate() {
+ @Override
+ public boolean matches(Exchange exchange) {
+ return exchange.getContext().getName().equals(contextName);
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/EventPayload.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/EventPayload.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/EventPayload.java
new file mode 100644
index 0000000..8f7a6c8
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/EventPayload.java
@@ -0,0 +1,47 @@
+/**
+ * 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.pojo;
+
+public class EventPayload<T> {
+
+ private final T payload;
+
+ public EventPayload(T payload) {
+ this.payload = payload;
+ }
+
+ public T getPayload() {
+ return payload;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ EventPayload that = (EventPayload) o;
+ return payload.equals(that.payload);
+ }
+
+ @Override
+ public int hashCode() {
+ return payload.hashCode();
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/EventPayloadInteger.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/EventPayloadInteger.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/EventPayloadInteger.java
new file mode 100644
index 0000000..7bf8ed8
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/EventPayloadInteger.java
@@ -0,0 +1,24 @@
+/**
+ * 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.pojo;
+
+public class EventPayloadInteger extends EventPayload<Integer> {
+
+ public EventPayloadInteger(Integer payload) {
+ super(payload);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/EventPayloadString.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/EventPayloadString.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/EventPayloadString.java
new file mode 100644
index 0000000..0b2160a
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/EventPayloadString.java
@@ -0,0 +1,24 @@
+/**
+ * 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.pojo;
+
+public class EventPayloadString extends EventPayload<String> {
+
+ public EventPayloadString(String payload) {
+ super(payload);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/TypeConverterInput.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/TypeConverterInput.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/TypeConverterInput.java
new file mode 100644
index 0000000..e176abe
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/TypeConverterInput.java
@@ -0,0 +1,30 @@
+/**
+ * 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.pojo;
+
+public class TypeConverterInput {
+
+ private String property;
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/TypeConverterOutput.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/TypeConverterOutput.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/TypeConverterOutput.java
new file mode 100644
index 0000000..2b95d54
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/pojo/TypeConverterOutput.java
@@ -0,0 +1,30 @@
+/**
+ * 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.pojo;
+
+public class TypeConverterOutput {
+
+ private String property;
+
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/qualifier/BarQualifier.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/qualifier/BarQualifier.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/qualifier/BarQualifier.java
new file mode 100644
index 0000000..606f75f
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/qualifier/BarQualifier.java
@@ -0,0 +1,38 @@
+/**
+ * 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.qualifier;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Qualifier;
+
+@Qualifier
+@Documented
+@Retention(RUNTIME)
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+public @interface BarQualifier {
+
+ final class Literal extends AnnotationLiteral<BarQualifier> implements BarQualifier {
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/qualifier/FooQualifier.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/qualifier/FooQualifier.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/qualifier/FooQualifier.java
new file mode 100644
index 0000000..f606124
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/qualifier/FooQualifier.java
@@ -0,0 +1,38 @@
+/**
+ * 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.qualifier;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Qualifier;
+
+@Qualifier
+@Documented
+@Retention(RUNTIME)
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+public @interface FooQualifier {
+
+ final class Literal extends AnnotationLiteral<FooQualifier> implements FooQualifier {
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/qualifier/Manual.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/qualifier/Manual.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/qualifier/Manual.java
new file mode 100644
index 0000000..0d5d4e7
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/qualifier/Manual.java
@@ -0,0 +1,34 @@
+/**
+ * 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.qualifier;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import javax.inject.Qualifier;
+
+@Qualifier
+@Documented
+@Retention(RUNTIME)
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+public @interface Manual {
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/rule/ExpectedDeploymentException.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/rule/ExpectedDeploymentException.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/rule/ExpectedDeploymentException.java
new file mode 100644
index 0000000..b6c2b5f
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/rule/ExpectedDeploymentException.java
@@ -0,0 +1,105 @@
+/**
+ * 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.rule;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hamcrest.CoreMatchers;
+import org.hamcrest.Matcher;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.CoreMatchers.anyOf;
+import static org.hamcrest.Matchers.hasItem;
+import static org.junit.Assert.assertThat;
+
+public final class ExpectedDeploymentException implements TestRule {
+
+ private final List<Matcher<Throwable>> exceptions = new ArrayList<>();
+
+ private final List<Matcher<String>> messages = new ArrayList<>();
+
+ private final LogVerifier log = new LogVerifier();
+
+ private final TestRule chain;
+
+ private ExpectedDeploymentException() {
+ chain = RuleChain
+ .outerRule(log)
+ .around(new TestRule() {
+ @Override
+ public Statement apply(final Statement base, Description description) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ try {
+ base.evaluate();
+ } catch (Throwable exception) {
+ assertThat(exception, allOf(pecs(exceptions)));
+ try {
+ // OpenWebBeans logs the deployment exception details
+ // TODO: OpenWebBeans only log the root cause of exception thrown in producer methods
+ //assertThat(log.getMessages(), containsInRelativeOrder(pecs(messages)))
+ assertThat(log.getMessages(), anyOf(hasItems(messages)));
+ } catch (AssertionError error) {
+ // Weld stores the deployment exception details in the exception message
+ assertThat(exception.getMessage(), allOf(pecs(messages)));
+ }
+ }
+ }
+ };
+ }
+ });
+ }
+
+ public static ExpectedDeploymentException none() {
+ return new ExpectedDeploymentException();
+ }
+
+ public ExpectedDeploymentException expect(Class<? extends Throwable> type) {
+ exceptions.add(CoreMatchers.<Throwable>instanceOf(type));
+ return this;
+ }
+
+ public ExpectedDeploymentException expectMessage(Matcher<String> matcher) {
+ messages.add(matcher);
+ return this;
+ }
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ private <T> List<Matcher<? super T>> pecs(List<Matcher<T>> matchers) {
+ return new ArrayList<>((List) matchers);
+ }
+
+ private <T> Matcher<Iterable<? super T>>[] hasItems(List<Matcher<T>> matchers) {
+ @SuppressWarnings("unchecked")
+ Matcher<Iterable<? super T>>[] items = new Matcher[matchers.size()];
+ for (int i = 0; i < items.length; i++) {
+ items[i] = hasItem(matchers.get(i));
+ }
+ return items;
+ }
+
+ @Override
+ public Statement apply(Statement base, Description description) {
+ return chain.apply(base, description);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/rule/LogVerifier.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/rule/LogVerifier.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/rule/LogVerifier.java
new file mode 100644
index 0000000..804ae2c
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/rule/LogVerifier.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.rule;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.log4j.Appender;
+import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.spi.LoggingEvent;
+import org.junit.rules.Verifier;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+public class LogVerifier extends Verifier {
+
+ private final Appender appender;
+
+ private final List<String> messages = new ArrayList<>();
+
+ public LogVerifier() {
+ this.appender = new AppenderSkeleton() {
+ @Override
+ public void close() {
+ }
+
+ @Override
+ public boolean requiresLayout() {
+ return false;
+ }
+
+ @Override
+ protected void append(LoggingEvent event) {
+ messages.add(event.getRenderedMessage());
+ }
+ };
+ }
+
+ public List<String> getMessages() {
+ return Collections.unmodifiableList(messages);
+ }
+
+ @Override
+ public Statement apply(final Statement base, Description description) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ LogManager.getRootLogger().addAppender(appender);
+ try {
+ base.evaluate();
+ verify();
+ } finally {
+ LogManager.getRootLogger().removeAppender(appender);
+ appender.close();
+ }
+ }
+ };
+ }
+}
\ 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/store/Item.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Item.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Item.java
deleted file mode 100644
index 1b82fa0..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Item.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.store;
-
-import java.io.Serializable;
-
-public class Item implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private String name;
- private long price;
-
- public Item() {
- }
-
- public Item(String name, long price) {
- this.name = name;
- this.price = price;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the price
- */
- public long getPrice() {
- return price;
- }
-
- /**
- * @param price the price to set
- */
- public void setPrice(long price) {
- this.price = price;
- }
-
- // Simple equals implementation
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- Item other = (Item)obj;
- boolean nameMatch = name == null ? other.name == null : name.equals(other.name);
- return nameMatch && price == other.price;
- }
-
- @Override
- public int hashCode() {
- return name.hashCode() * 997 + (int)price;
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Products.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Products.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Products.java
deleted file mode 100644
index c91acdd..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Products.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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.store;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.inject.Named;
-
-@Named
-public class Products implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private List<Item> products = new ArrayList<Item>();
-
- public Products() {
- }
-
- @PostConstruct
- public void afterInit() {
- for (int i = 1; i < 10; i++) {
- Item item = new Item("Item-" + i, i * 1500L);
- products.add(item);
- }
- }
-
- @PreDestroy
- public void preDestroy() {
- products.clear();
- }
-
- /**
- * @return the products
- */
- public List<Item> getProducts() {
- return products;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/ShoppingBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/ShoppingBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/ShoppingBean.java
deleted file mode 100644
index 0b0639a..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/ShoppingBean.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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.store;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import javax.enterprise.inject.New;
-import javax.enterprise.inject.Produces;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-@Named
-public class ShoppingBean implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Inject
- private Products products;
- private List<Item> items = new ArrayList<Item>();
-
- public ShoppingBean() {
- }
-
- @Inject
- public ShoppingBean(@New Item defaultItem) {
- defaultItem.setName("Default Item");
- defaultItem.setPrice(1000L);
-
- items.add(defaultItem);
- }
-
- @Produces
- @Named("selectedItems")
- public List<Item> listSelectedItems() {
- return this.items;
- }
-
- @Produces
- @Named("allProducts")
- public List<Item> listAllProducts() {
- return this.products.getProducts();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CamelEndpointInjectedBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CamelEndpointInjectedBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CamelEndpointInjectedBean.java
deleted file mode 100644
index a8c623a..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CamelEndpointInjectedBean.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * 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.support;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.EndpointInject;
-import org.apache.camel.component.mock.MockEndpoint;
-
-public class CamelEndpointInjectedBean {
-
- @EndpointInject(uri = "direct:inject")
- Endpoint endpoint;
-
- @EndpointInject(uri = "mock:result")
- MockEndpoint mockEndpoint;
-
- public Endpoint getEndpoint() {
- return endpoint;
- }
-
- public MockEndpoint getMockEndpoint() {
- return mockEndpoint;
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CdiConfigFile.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CdiConfigFile.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CdiConfigFile.java
deleted file mode 100644
index e50418a..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CdiConfigFile.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.support;
-
-import org.apache.deltaspike.core.api.config.PropertyFileConfig;
-
-/**
- * Class which is used to retrieve camel properties files tp configure endpoints.
- * By default, it will check for the file META-INF/camel-properties
- */
-public class CdiConfigFile implements PropertyFileConfig {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public String getPropertyFileName() {
- return "META-INF/camel.properties";
- }
-
- @Override
- public boolean isOptional() {
- return false;
- }
-
-}
\ 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/support/CheeseComponentFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CheeseComponentFactory.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CheeseComponentFactory.java
deleted file mode 100644
index 601d2e1..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/CheeseComponentFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.support;
-
-import javax.enterprise.inject.Produces;
-import javax.inject.Named;
-
-import org.apache.camel.Component;
-import org.apache.camel.component.stub.StubComponent;
-
-/**
- * Stubs out the "cheese" component for testing
- */
-public class CheeseComponentFactory {
-
- @Produces
- @Named("cheese")
- public Component createCheeseComponent() {
- return new StubComponent();
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/ContextAwareBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/ContextAwareBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/ContextAwareBean.java
deleted file mode 100644
index c56e707..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/ContextAwareBean.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.support;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
-
-/**
- * Simple POJO interested in getting camel context.
- */
-public class ContextAwareBean implements CamelContextAware {
-
- private CamelContext camelContext;
-
- @Override
- public CamelContext getCamelContext() {
- return camelContext;
- }
-
- @Override
- public void setCamelContext(CamelContext camelContext) {
- this.camelContext = camelContext;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/EndpointInjectedBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/EndpointInjectedBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/EndpointInjectedBean.java
deleted file mode 100644
index 7f73aed..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/EndpointInjectedBean.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.support;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.EndpointInject;
-
-/**
- */
-public class EndpointInjectedBean {
-
- @EndpointInject(uri = "mock:blah")
- private Endpoint endpoint;
-
- public Endpoint getEndpoint() {
- return endpoint;
- }
-
- public void setEndpoint(Endpoint endpoint) {
- this.endpoint = endpoint;
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/EndpointUriInjectedBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/EndpointUriInjectedBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/EndpointUriInjectedBean.java
deleted file mode 100644
index 4d98b55..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/EndpointUriInjectedBean.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.support;
-
-import javax.inject.Inject;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.cdi.Uri;
-
-/**
- */
-public class EndpointUriInjectedBean {
-
- @Inject @Uri("mock:uriInjected")
- private Endpoint endpoint;
-
- @Inject @Uri("mock:anotherEndpoint")
- private Endpoint endpoint2;
-
- public Endpoint getEndpoint() {
- return endpoint;
- }
-
- public void setEndpoint(Endpoint endpoint) {
- this.endpoint = endpoint;
- }
-
- public Endpoint getEndpoint2() {
- return endpoint2;
- }
-
- public void setEndpoint2(Endpoint endpoint2) {
- this.endpoint2 = endpoint2;
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/EndpointUriPropertyInjectedBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/EndpointUriPropertyInjectedBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/EndpointUriPropertyInjectedBean.java
deleted file mode 100644
index a52dbc7..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/EndpointUriPropertyInjectedBean.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.support;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.EndpointInject;
-
-/**
- */
-public class EndpointUriPropertyInjectedBean {
-
- @EndpointInject(property = "injectUri")
- private Endpoint endpoint;
-
- public Endpoint getEndpoint() {
- return endpoint;
- }
-
- public void setEndpoint(Endpoint endpoint) {
- this.endpoint = endpoint;
- }
-
- public String getInjectUri() {
- return "mock:injectedByProperty";
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/MockEndpointInjectedBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/MockEndpointInjectedBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/MockEndpointInjectedBean.java
deleted file mode 100644
index 694c116..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/MockEndpointInjectedBean.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.support;
-
-import javax.inject.Inject;
-
-import org.apache.camel.cdi.Mock;
-import org.apache.camel.component.mock.MockEndpoint;
-
-public class MockEndpointInjectedBean {
-
- @Inject @Mock
- private MockEndpoint foo;
-
- @Inject @Mock("mock:something")
- private MockEndpoint bar;
-
- public MockEndpoint getBar() {
- return bar;
- }
-
- public MockEndpoint getFoo() {
- return foo;
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/NamedEndpointBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/NamedEndpointBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/NamedEndpointBean.java
deleted file mode 100644
index c3916ab..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/NamedEndpointBean.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.support;
-
-import javax.enterprise.inject.Produces;
-import javax.inject.Named;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.component.mock.MockComponent;
-import org.apache.camel.component.mock.MockEndpoint;
-
-/**
- */
-public class NamedEndpointBean {
- @Produces @Named("myNamedEndpoint")
- public Endpoint createEndpoint() {
- return new MockEndpoint("mock:nameInjected", new MockComponent());
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/ProduceInjectedBean.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/ProduceInjectedBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/ProduceInjectedBean.java
deleted file mode 100644
index 01ee579..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/ProduceInjectedBean.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.support;
-
-import javax.inject.Inject;
-
-import org.apache.camel.Produce;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.cdi.Uri;
-
-public class ProduceInjectedBean {
-
- @Produce(uri = "mock:foo")
- private ProducerTemplate producer;
-
- @Inject @Uri("mock:bar")
- private ProducerTemplate producer2;
-
- public ProducerTemplate getProducer() {
- return producer;
- }
-
- public ProducerTemplate getProducer2() {
- return producer2;
- }
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/0421c24d/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/AdvisedMockEndpointProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/AdvisedMockEndpointProducerTest.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/AdvisedMockEndpointProducerTest.java
new file mode 100644
index 0000000..4f454e3
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/AdvisedMockEndpointProducerTest.java
@@ -0,0 +1,96 @@
+/**
+ * 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.Uri;
+import org.apache.camel.cdi.bean.ManualStartupCamelContext;
+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 AdvisedMockEndpointProducerTest {
+
+ @Inject
+ @Uri("direct:inbound")
+ private ProducerTemplate inbound;
+
+ @Inject
+ @Uri("mock:outbound")
+ private MockEndpoint outbound;
+
+ @Inject
+ @Uri("mock:intercepted")
+ private MockEndpoint intercepted;
+
+ @Deployment
+ public static Archive<?> deployment() {
+ return ShrinkWrap.create(JavaArchive.class)
+ // Camel CDI
+ .addPackage(CdiCamelExtension.class.getPackage())
+ // Test class
+ .addClass(ManualStartupCamelContext.class)
+ // Bean archive deployment descriptor
+ .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+ @Test
+ @InSequence(1)
+ public void startCamelContext(CamelContext context) throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() {
+ interceptSendToEndpoint("mock:outbound")
+ .skipSendToOriginalEndpoint()
+ .log("Intercepting message [${body}] from mock endpoint")
+ .to("mock:intercepted");
+
+ from("direct:inbound").to("mock:outbound");
+ }
+ });
+
+ context.startAllRoutes();
+ }
+
+ @Test
+ @InSequence(2)
+ public void sendMessageToInbound() throws InterruptedException {
+ outbound.expectedMessageCount(0);
+ intercepted.expectedMessageCount(1);
+ intercepted.expectedBodiesReceived("test");
+
+ inbound.sendBody("test");
+
+ assertIsSatisfied(2L, TimeUnit.SECONDS, outbound, intercepted);
+ }
+}