You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2016/12/27 21:05:21 UTC
[1/4] camel git commit: CAMEL-10464: @ContextName CDI qualifier
should be repeatable
Repository: camel
Updated Branches:
refs/heads/master 1ce745ba1 -> 2d3446993
CAMEL-10464: @ContextName CDI qualifier should be repeatable
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2d344699
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2d344699
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2d344699
Branch: refs/heads/master
Commit: 2d344699357357053a50660e0378d03f4c748ed6
Parents: c1a3820
Author: Antonin Stefanutti <an...@stefanutti.fr>
Authored: Tue Dec 27 22:02:31 2016 +0100
Committer: Antonin Stefanutti <an...@stefanutti.fr>
Committed: Tue Dec 27 22:04:35 2016 +0100
----------------------------------------------------------------------
components/camel-cdi/pom.xml | 17 +++
.../java/org/apache/camel/cdi/ContextName.java | 2 +
.../java/org/apache/camel/cdi/ContextNames.java | 28 +++++
.../MultiCamelContextReusedRouteCdi20Test.java | 118 +++++++++++++++++++
4 files changed, 165 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2d344699/components/camel-cdi/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-cdi/pom.xml b/components/camel-cdi/pom.xml
index 26b328f..fbec4cc 100644
--- a/components/camel-cdi/pom.xml
+++ b/components/camel-cdi/pom.xml
@@ -186,6 +186,7 @@
<configuration>
<excludes>
<exclude>**/*Cdi12Test.java</exclude>
+ <exclude>**/*Cdi20Test.java</exclude>
</excludes>
</configuration>
</plugin>
@@ -232,6 +233,20 @@
<profile>
<id>weld-1.2</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/*Cdi20Test.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<!-- provided dependencies -->
@@ -307,6 +322,7 @@
<configuration>
<excludes>
<exclude>**/*Cdi12Test.java</exclude>
+ <exclude>**/*Cdi20Test.java</exclude>
<!-- OWB does not call the InjectionTarget#preDestroy method -->
<exclude>**/UnstoppedCamelContext*Test.java</exclude>
<!-- Reactivate when OWB-1155 is fixed -->
@@ -373,6 +389,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
+ <exclude>**/*Cdi20Test.java</exclude>
<!-- Reactivate when OWB-1155 is fixed -->
<exclude>**/ProgrammaticLookupTest.java</exclude>
<!-- Reactivate when OWB-1126 is fixed -->
http://git-wip-us.apache.org/repos/asf/camel/blob/2d344699/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java
index 1ca4e1f..99d5743 100644
--- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java
+++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java
@@ -17,6 +17,7 @@
package org.apache.camel.cdi;
import java.lang.annotation.ElementType;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@@ -64,6 +65,7 @@ import javax.inject.Qualifier;
*
*/
@Qualifier
+@Repeatable(ContextNames.class)
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
public @interface ContextName {
http://git-wip-us.apache.org/repos/asf/camel/blob/2d344699/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextNames.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextNames.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextNames.java
new file mode 100644
index 0000000..ddd071c
--- /dev/null
+++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextNames.java
@@ -0,0 +1,28 @@
+/**
+ * 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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
+public @interface ContextNames {
+ ContextName[] value();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/2d344699/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiCamelContextReusedRouteCdi20Test.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiCamelContextReusedRouteCdi20Test.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiCamelContextReusedRouteCdi20Test.java
new file mode 100644
index 0000000..bea038f
--- /dev/null
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiCamelContextReusedRouteCdi20Test.java
@@ -0,0 +1,118 @@
+/**
+ * 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.FirstCamelContextBean;
+import org.apache.camel.cdi.bean.SecondNamedCamelContextBean;
+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.cdi.expression.ExchangeExpression.fromCamelContext;
+import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied;
+
+@RunWith(Arquillian.class)
+public class MultiCamelContextReusedRouteCdi20Test {
+
+ @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(FirstCamelContextBean.class, SecondNamedCamelContextBean.class)
+ // Bean archive deployment descriptor
+ .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+ @Test
+ public void sendMessageToFirstCamelContextInbound() throws InterruptedException {
+ firstOutbound.expectedMessageCount(1);
+ firstOutbound.expectedBodiesReceived("test-first");
+ firstOutbound.expectedHeaderReceived("context", "test");
+ firstOutbound.message(0).exchange().matches(fromCamelContext("first"));
+
+ firstInbound.sendBody("test-first");
+
+ assertIsSatisfied(2L, TimeUnit.SECONDS, firstOutbound);
+ }
+
+ @Test
+ public void sendMessageToSecondCamelContextInbound() throws InterruptedException {
+ secondOutbound.expectedMessageCount(1);
+ secondOutbound.expectedBodiesReceived("test-second");
+ secondOutbound.expectedHeaderReceived("context", "test");
+ secondOutbound.message(0).exchange().matches(fromCamelContext("second"));
+
+ secondInbound.sendBody("test-second");
+
+ assertIsSatisfied(2L, TimeUnit.SECONDS, secondOutbound);
+ }
+
+ @ContextName("first")
+ @ContextName("second")
+ static class ReusedRouteBuilder extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ from("direct:inbound").setHeader("context").constant("test").to("mock:outbound");
+ }
+ }
+}
\ No newline at end of file
[2/4] camel git commit: Upgrade Weld 3.x to version 3.0.0.Beta1
Posted by as...@apache.org.
Upgrade Weld 3.x to version 3.0.0.Beta1
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7b4fedaa
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7b4fedaa
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7b4fedaa
Branch: refs/heads/master
Commit: 7b4fedaa1c55d9ea64a19568f7e936a9fbd9c2c0
Parents: 6fc0518
Author: Antonin Stefanutti <an...@stefanutti.fr>
Authored: Tue Dec 27 16:43:29 2016 +0100
Committer: Antonin Stefanutti <an...@stefanutti.fr>
Committed: Tue Dec 27 22:04:35 2016 +0100
----------------------------------------------------------------------
parent/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/7b4fedaa/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 36453df..70969bc 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -626,7 +626,7 @@
<vysper-version>0.7</vysper-version>
<weld1-version>1.1.28.Final</weld1-version>
<weld2-version>2.4.1.Final</weld2-version>
- <weld3-version>3.0.0.Alpha17</weld3-version>
+ <weld3-version>3.0.0.Beta1</weld3-version>
<werken-xpath-bundle-version>0.9.4_5</werken-xpath-bundle-version>
<wiremock-version>2.4.1</wiremock-version>
<woodstox-version>4.4.1</woodstox-version>
[3/4] camel git commit: Camel CDI: fix compatibility with CDI 2.0
Posted by as...@apache.org.
Camel CDI: fix compatibility with CDI 2.0
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c1a3820d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c1a3820d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c1a3820d
Branch: refs/heads/master
Commit: c1a3820d9a8561f831309fc76ecdd3786f791a54
Parents: 7b4feda
Author: Antonin Stefanutti <an...@stefanutti.fr>
Authored: Tue Dec 27 21:55:34 2016 +0100
Committer: Antonin Stefanutti <an...@stefanutti.fr>
Committed: Tue Dec 27 22:04:35 2016 +0100
----------------------------------------------------------------------
.../org/apache/camel/cdi/AnnotatedDelegate.java | 19 ++++++++++---------
.../org/apache/camel/cdi/SyntheticAnnotated.java | 15 +++++++++------
2 files changed, 19 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c1a3820d/components/camel-cdi/src/main/java/org/apache/camel/cdi/AnnotatedDelegate.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/AnnotatedDelegate.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/AnnotatedDelegate.java
index 53f3d0e..25f83ed 100644
--- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/AnnotatedDelegate.java
+++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/AnnotatedDelegate.java
@@ -20,6 +20,8 @@ import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.HashSet;
import java.util.Set;
+import static java.util.stream.Collectors.toSet;
+
import javax.enterprise.inject.spi.Annotated;
import static org.apache.camel.cdi.CdiSpiHelper.isAnnotationType;
@@ -40,46 +42,45 @@ class AnnotatedDelegate implements Annotated {
this.annotations = delegate.getAnnotations();
}
- @Override
public <T extends Annotation> T getAnnotation(Class<T> type) {
return annotations.stream()
.filter(isAnnotationType(type))
- .findAny()
+ .findFirst()
.map(type::cast)
.orElse(null);
}
- @Override
+ public <T extends Annotation> Set<T> getAnnotations(Class<T> type) {
+ return annotations.stream()
+ .filter(isAnnotationType(type))
+ .map(type::cast)
+ .collect(toSet());
+ }
+
public Set<Annotation> getAnnotations() {
return annotations;
}
- @Override
public Type getBaseType() {
return delegate.getBaseType();
}
- @Override
public Set<Type> getTypeClosure() {
return delegate.getTypeClosure();
}
- @Override
public boolean isAnnotationPresent(Class<? extends Annotation> type) {
return annotations.stream().anyMatch(isAnnotationType(type));
}
- @Override
public String toString() {
return delegate.toString();
}
- @Override
public int hashCode() {
return delegate.hashCode();
}
- @Override
public boolean equals(Object object) {
return delegate.equals(object);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c1a3820d/components/camel-cdi/src/main/java/org/apache/camel/cdi/SyntheticAnnotated.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/SyntheticAnnotated.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/SyntheticAnnotated.java
index 0faafde..9afa412 100644
--- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/SyntheticAnnotated.java
+++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/SyntheticAnnotated.java
@@ -24,6 +24,7 @@ import java.util.Set;
import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableSet;
+import static java.util.stream.Collectors.toSet;
import javax.enterprise.inject.spi.Annotated;
@@ -52,31 +53,33 @@ final class SyntheticAnnotated implements Annotated {
annotations.add(annotation);
}
- @Override
public Type getBaseType() {
return type;
}
- @Override
public Set<Type> getTypeClosure() {
return unmodifiableSet(types);
}
- @Override
public Set<Annotation> getAnnotations() {
return unmodifiableSet(annotations);
}
- @Override
public <T extends Annotation> T getAnnotation(Class<T> type) {
return annotations.stream()
.filter(isAnnotationType(type))
- .findAny()
+ .findFirst()
.map(type::cast)
.orElse(null);
}
- @Override
+ public <T extends Annotation> Set<T> getAnnotations(Class<T> type) {
+ return annotations.stream()
+ .filter(isAnnotationType(type))
+ .map(type::cast)
+ .collect(toSet());
+ }
+
public boolean isAnnotationPresent(Class<? extends Annotation> type) {
return annotations.stream().anyMatch(isAnnotationType(type));
}
[4/4] camel git commit: Upgrade CDI 2 API to version 2.0.Beta1
Posted by as...@apache.org.
Upgrade CDI 2 API to version 2.0.Beta1
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6fc0518e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6fc0518e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6fc0518e
Branch: refs/heads/master
Commit: 6fc0518edc6e62acdf8d7badcee545bf59064082
Parents: 1ce745b
Author: Antonin Stefanutti <an...@stefanutti.fr>
Authored: Tue Dec 27 16:42:13 2016 +0100
Committer: Antonin Stefanutti <an...@stefanutti.fr>
Committed: Tue Dec 27 22:04:35 2016 +0100
----------------------------------------------------------------------
parent/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/6fc0518e/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 2e21057..36453df 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -100,7 +100,7 @@
<cdi-api-1.0-version>1.0-SP4</cdi-api-1.0-version>
<cdi-api-1.1-version>1.1</cdi-api-1.1-version>
<cdi-api-1.2-version>1.2</cdi-api-1.2-version>
- <cdi-api-2.0-version>2.0-EDR2</cdi-api-2.0-version>
+ <cdi-api-2.0-version>2.0.Beta1</cdi-api-2.0-version>
<cglib-bundle-version>3.2.4_1</cglib-bundle-version>
<cglib-version>3.2.4</cglib-version>
<chronicle-bytes-version>1.7.25</chronicle-bytes-version>