camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/6] camel git commit: CAMEL-9201: Consistent style for qualifier literals
Date Tue, 23 Feb 2016 12:22:49 GMT
CAMEL-9201: Consistent style for qualifier literals


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/64cbbf00
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/64cbbf00
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/64cbbf00

Branch: refs/heads/master
Commit: 64cbbf00fd8fec123f7404a8c4a2924b02884d4a
Parents: 93631c8
Author: Antonin Stefanutti <antonin@stefanutti.fr>
Authored: Tue Feb 23 12:40:35 2016 +0100
Committer: Antonin Stefanutti <antonin@stefanutti.fr>
Committed: Tue Feb 23 12:48:23 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/cdi/CdiCamelBeanPostProcessor.java   | 2 +-
 .../src/main/java/org/apache/camel/cdi/ContextName.java        | 6 +++++-
 .../apache/camel/cdi/test/MultiContextEventEndpointTest.java   | 6 +++---
 .../src/test/java/org/apache/camel/itest/cdi/CamelCdiTest.java | 2 +-
 4 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/64cbbf00/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelBeanPostProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelBeanPostProcessor.java
b/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelBeanPostProcessor.java
index 85284fc..7d1a1b8 100644
--- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelBeanPostProcessor.java
+++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelBeanPostProcessor.java
@@ -110,7 +110,7 @@ final class CdiCamelBeanPostProcessor extends DefaultCamelBeanPostProcessor
{
 
     private CamelContext getOrLookupCamelContext(String contextName) {
         // TODO: proper support for custom context qualifiers
-        return BeanManagerHelper.getReferenceByType(manager, CamelContext.class, contextName.isEmpty()
? DefaultLiteral.INSTANCE : new ContextName.Literal(contextName));
+        return BeanManagerHelper.getReferenceByType(manager, CamelContext.class, contextName.isEmpty()
? DefaultLiteral.INSTANCE : ContextName.Literal.of(contextName));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/64cbbf00/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 2006e71..1ca4e1f 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
@@ -79,10 +79,14 @@ public @interface ContextName {
 
         private final String name;
 
-        public Literal(String name) {
+        private Literal(String name) {
             this.name = name;
         }
 
+        public static Literal of(String name) {
+            return new Literal(name);
+        }
+
         @Override
         public String value() {
             return name;

http://git-wip-us.apache.org/repos/asf/camel/blob/64cbbf00/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventEndpointTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventEndpointTest.java
b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventEndpointTest.java
index c6b51af..af54917 100644
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventEndpointTest.java
+++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MultiContextEventEndpointTest.java
@@ -113,9 +113,9 @@ public class MultiContextEventEndpointTest {
         secondConsumeString.expectedMessageCount(2);
         secondConsumeString.expectedBodiesReceived("testSecond1", "testSecond2");
 
-        objectEvent.select(String.class, new ContextName.Literal("first")).fire("testFirst");
-        objectEvent.select(String.class, new ContextName.Literal("second")).fire("testSecond1");
-        objectEvent.select(String.class, new ContextName.Literal("second")).fire("testSecond2");
+        objectEvent.select(String.class, ContextName.Literal.of("first")).fire("testFirst");
+        objectEvent.select(String.class, ContextName.Literal.of("second")).fire("testSecond1");
+        objectEvent.select(String.class, ContextName.Literal.of("second")).fire("testSecond2");
 
         assertIsSatisfied(2L, TimeUnit.SECONDS, firstConsumeString, secondConsumeString);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/64cbbf00/tests/camel-itest-cdi/src/test/java/org/apache/camel/itest/cdi/CamelCdiTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-cdi/src/test/java/org/apache/camel/itest/cdi/CamelCdiTest.java
b/tests/camel-itest-cdi/src/test/java/org/apache/camel/itest/cdi/CamelCdiTest.java
index bee1905..39aa971 100644
--- a/tests/camel-itest-cdi/src/test/java/org/apache/camel/itest/cdi/CamelCdiTest.java
+++ b/tests/camel-itest-cdi/src/test/java/org/apache/camel/itest/cdi/CamelCdiTest.java
@@ -142,7 +142,7 @@ public class CamelCdiTest {
     }
 
     protected CamelContext assertCamelContext(String contextName) {
-        CamelContext answer = camelContexts.select(new ContextName.Literal(contextName)).get();
+        CamelContext answer = camelContexts.select(ContextName.Literal.of(contextName)).get();
         assertTrue("CamelContext '" + contextName + "' is not started", answer.getStatus().isStarted());
         return answer;
     }


Mime
View raw message