camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lburgazz...@apache.org
Subject [1/2] camel git commit: Fix service-call global configuration
Date Sat, 25 Mar 2017 22:35:29 GMT
Repository: camel
Updated Branches:
  refs/heads/master 2e839f0c9 -> afca0b700


Fix service-call global configuration


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

Branch: refs/heads/master
Commit: 6db3f45d2354fd8bb2fc591ad740e28f4647677f
Parents: 2e839f0
Author: lburgazzoli <lburgazzoli@gmail.com>
Authored: Sat Mar 25 22:58:39 2017 +0100
Committer: lburgazzoli <lburgazzoli@gmail.com>
Committed: Sat Mar 25 22:58:39 2017 +0100

----------------------------------------------------------------------
 .../model/cloud/ServiceCallDefinition.java      | 30 +++++++++++++++-----
 components/camel-spring-boot/pom.xml            |  3 +-
 .../CamelCloudServiceCallExpressionTest.java    |  8 +++---
 ...CloudServiceCallGlobalConfigurationTest.java | 10 +++----
 .../boot/cloud/CamelCloudServiceCallTest.java   | 10 +++----
 5 files changed, 38 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6db3f45d/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
index 98a9bf7..448faf5 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
@@ -749,17 +749,33 @@ public class ServiceCallDefinition extends NoOutputDefinition<ServiceCallDefinit
 
         // The component is used to configure the default scheme to use (eg camel component
name).
         // The component configured on EIP takes precedence vs configured on configuration.
-        String scheme = this.component;
-        if (scheme == null) {
+        String endpointScheme = this.component;
+        if (endpointScheme == null) {
             ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext);
             if (conf != null) {
-                scheme = conf.getComponent();
+                endpointScheme = conf.getComponent();
             }
         }
-        if (scheme == null) {
+        if (endpointScheme == null) {
             ServiceCallConfigurationDefinition conf = retrieveDefaultConfig(camelContext);
             if (conf != null) {
-                scheme = conf.getComponent();
+                endpointScheme = conf.getComponent();
+            }
+        }
+
+        // The uri is used to tweak the uri.
+        // The uri configured on EIP takes precedence vs configured on configuration.
+        String endpointUri = this.uri;
+        if (endpointUri == null) {
+            ServiceCallConfigurationDefinition conf = retrieveConfig(camelContext);
+            if (conf != null) {
+                endpointUri = conf.getUri();
+            }
+        }
+        if (endpointUri == null) {
+            ServiceCallConfigurationDefinition conf = retrieveDefaultConfig(camelContext);
+            if (conf != null) {
+                endpointUri = conf.getUri();
             }
         }
 
@@ -769,8 +785,8 @@ public class ServiceCallDefinition extends NoOutputDefinition<ServiceCallDefinit
         return new DefaultServiceCallProcessor(
             camelContext,
             camelContext.resolvePropertyPlaceholders(name),
-            ObjectHelper.applyIfNotEmpty(scheme, camelContext::resolvePropertyPlaceholders,
() -> ServiceCallConstants.DEFAULT_COMPONENT),
-            ObjectHelper.applyIfNotEmpty(uri, camelContext::resolvePropertyPlaceholders,
() -> null),
+            ObjectHelper.applyIfNotEmpty(endpointScheme, camelContext::resolvePropertyPlaceholders,
() -> ServiceCallConstants.DEFAULT_COMPONENT),
+            ObjectHelper.applyIfNotEmpty(endpointUri, camelContext::resolvePropertyPlaceholders,
() -> null),
             pattern,
             loadBalancer,
             expression);

http://git-wip-us.apache.org/repos/asf/camel/blob/6db3f45d/components/camel-spring-boot/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/pom.xml b/components/camel-spring-boot/pom.xml
index f17f90f..f2cf091 100644
--- a/components/camel-spring-boot/pom.xml
+++ b/components/camel-spring-boot/pom.xml
@@ -72,7 +72,6 @@
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-web</artifactId>
       <optional>true</optional>
-      <version>${spring-boot-version}</version>
     </dependency>
 
     <!-- Testing dependencies -->
@@ -104,7 +103,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-netty4-http</artifactId>
+      <artifactId>camel-jetty</artifactId>
       <scope>test</scope>
     </dependency>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/6db3f45d/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallExpressionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallExpressionTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallExpressionTest.java
index 24a533a..ce4c037 100644
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallExpressionTest.java
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallExpressionTest.java
@@ -41,7 +41,7 @@ import org.springframework.test.context.junit4.SpringRunner;
     properties = {
         "service.name=custom-svc-list",
         "camel.cloud.load-balancer.enabled=false",
-        "camel.cloud.service-call.component=netty4-http",
+        "camel.cloud.service-call.component=jetty",
         "camel.cloud.service-call.expression=${header.CamelServiceCallScheme}:http://${header.CamelServiceCallServiceHost}:${header.CamelServiceCallServicePort}/hello",
         "camel.cloud.service-discovery.services[custom-svc-list]=localhost:9090,localhost:9091,localhost:9092",
         "camel.cloud.service-filter.blacklist[custom-svc-list]=localhost:9091",
@@ -73,13 +73,13 @@ public class CamelCloudServiceCallExpressionTest {
                     from("direct:start")
                         .serviceCall("{{service.name}}");
 
-                    from("netty4-http:http://localhost:9090/hello")
+                    from("jetty:http://localhost:9090/hello")
                         .transform()
                         .constant("9090");
-                    from("netty4-http:http://localhost:9091/hello")
+                    from("jetty:http://localhost:9091/hello")
                         .transform()
                         .constant("9091");
-                    from("netty4-http:http://localhost:9092/hello")
+                    from("jetty:http://localhost:9092/hello")
                         .transform()
                         .constant("9092");
                 }

http://git-wip-us.apache.org/repos/asf/camel/blob/6db3f45d/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallGlobalConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallGlobalConfigurationTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallGlobalConfigurationTest.java
index aef1ca8..e8b08cb 100644
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallGlobalConfigurationTest.java
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallGlobalConfigurationTest.java
@@ -41,7 +41,7 @@ import org.springframework.test.context.junit4.SpringRunner;
     properties = {
         "service.name=custom-svc-list",
         "camel.cloud.load-balancer.enabled=false",
-        "camel.cloud.service-call.uri=netty4-http:http://${service.name}",
+        "camel.cloud.service-call.uri=jetty:http://${service.name}/hello",
         "camel.cloud.service-call.service-discovery=sd",
         "camel.cloud.service-call.service-filter=sf",
         // this should not be taken into account
@@ -78,15 +78,15 @@ public class CamelCloudServiceCallGlobalConfigurationTest {
                 @Override
                 public void configure() throws Exception {
                     from("direct:start")
-                        .serviceCall("{{service.name}}/hello");
+                        .serviceCall("{{service.name}}");
 
-                    from("netty4-http:http://localhost:9090/hello")
+                    from("jetty:http://localhost:9090/hello")
                         .transform()
                         .constant("9090");
-                    from("netty4-http:http://localhost:9091/hello")
+                    from("jetty:http://localhost:9091/hello")
                         .transform()
                         .constant("9091");
-                    from("netty4-http:http://localhost:9092/hello")
+                    from("jetty:http://localhost:9092/hello")
                         .transform()
                         .constant("9092");
                 }

http://git-wip-us.apache.org/repos/asf/camel/blob/6db3f45d/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
index 216c37a..1409244 100644
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceCallTest.java
@@ -69,16 +69,16 @@ public class CamelCloudServiceCallTest {
                 public void configure() throws Exception {
                     from("direct:start")
                         .serviceCall()
-                            .name("custom-svc-list/hello")
-                            .uri("netty4-http:http://custom-svc-list");
+                            .name("custom-svc-list")
+                            .uri("jetty:http://custom-svc-list/hello");
 
-                    from("netty4-http:http://localhost:9090/hello")
+                    from("jetty:http://localhost:9090/hello")
                         .transform()
                         .constant("9090");
-                    from("netty4-http:http://localhost:9091/hello")
+                    from("jetty:http://localhost:9091/hello")
                         .transform()
                         .constant("9091");
-                    from("netty4-http:http://localhost:9092/hello")
+                    from("jetty:http://localhost:9092/hello")
                         .transform()
                         .constant("9092");
                 }


Mime
View raw message