You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/04/24 16:59:55 UTC

[1/8] camel git commit: CAMEL-11191: Service Call - XML configuration of static servers called servers instead of server

Repository: camel
Updated Branches:
  refs/heads/master 3ffd940a7 -> 09f6ada3b


CAMEL-11191: Service Call - XML configuration of static servers called servers instead of server


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

Branch: refs/heads/master
Commit: dcf982f647704cfad0a8743920c33e8da7d5d051
Parents: 3ffd940
Author: lburgazzoli <lb...@gmail.com>
Authored: Mon Apr 24 15:33:00 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Mon Apr 24 15:33:00 2017 +0200

----------------------------------------------------------------------
 ...istServiceCallServiceFilterConfiguration.java | 19 -------------------
 ...ServiceCallServiceDiscoveryConfiguration.java | 19 -------------------
 2 files changed, 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/dcf982f6/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java b/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java
index ea67c25..1d1a101 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.model.cloud;
 
-import java.util.ArrayList;
 import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -55,17 +54,6 @@ public class BlacklistServiceCallServiceFilterConfiguration extends ServiceCallS
         this.servers = servers;
     }
 
-    /**
-     * Sets the server list;
-     */
-    public void addServer(String server) {
-        if (this.servers == null) {
-            this.servers = new ArrayList<>();
-        }
-
-        this.servers.add(server);
-    }
-
     // *************************************************************************
     // Fluent API
     // *************************************************************************
@@ -77,11 +65,4 @@ public class BlacklistServiceCallServiceFilterConfiguration extends ServiceCallS
         setServers(servers);
         return this;
     }
-    /**
-     * Add a server to the list of servers
-     */
-    public BlacklistServiceCallServiceFilterConfiguration server(String server) {
-        addServer(server);
-        return this;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/dcf982f6/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java b/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java
index ce50c2f..0c5dae1 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java
@@ -17,7 +17,6 @@
 
 package org.apache.camel.model.cloud;
 
-import java.util.ArrayList;
 import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -56,17 +55,6 @@ public class StaticServiceCallServiceDiscoveryConfiguration extends ServiceCallS
         this.servers = servers;
     }
 
-    /**
-     * Sets the server list;
-     */
-    public void addServer(String server) {
-        if (this.servers == null) {
-            this.servers = new ArrayList<>();
-        }
-
-        this.servers.add(server);
-    }
-
     // *************************************************************************
     // Fluent API
     // *************************************************************************
@@ -78,11 +66,4 @@ public class StaticServiceCallServiceDiscoveryConfiguration extends ServiceCallS
         setServers(servers);
         return this;
     }
-    /**
-     * Add a server to the list of servers
-     */
-    public StaticServiceCallServiceDiscoveryConfiguration server(String server) {
-        addServer(server);
-        return this;
-    }
 }
\ No newline at end of file


[7/8] camel git commit: Fix tests

Posted by lb...@apache.org.
Fix tests


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

Branch: refs/heads/master
Commit: f08a3005f3061b11b9405cd4e6dfb32ef80c5aaa
Parents: 419cbdc
Author: lburgazzoli <lb...@gmail.com>
Authored: Mon Apr 24 18:53:28 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Mon Apr 24 18:53:28 2017 +0200

----------------------------------------------------------------------
 .../component/jetty/cloud/JettyServiceCallRouteTest.java     | 8 ++++----
 .../netty4/http/cloud/Netty4HttpServiceCallRouteTest.java    | 8 ++++----
 .../component/ribbon/cloud/RibbonServiceDefinition.java      | 6 ++++--
 .../camel/component/ribbon/cloud/RibbonServerListTest.java   | 2 +-
 .../ribbon/cloud/RibbonServiceCallRouteDslTest.java          | 4 ++--
 .../undertow/cloud/UndertowServiceCallRouteTest.java         | 8 ++++----
 6 files changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f08a3005/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/cloud/JettyServiceCallRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/cloud/JettyServiceCallRouteTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/cloud/JettyServiceCallRouteTest.java
index de57a14..4f3d43c 100644
--- a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/cloud/JettyServiceCallRouteTest.java
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/cloud/JettyServiceCallRouteTest.java
@@ -51,16 +51,16 @@ public class JettyServiceCallRouteTest extends CamelTestSupport {
                         .name("myService")
                         .component("jetty")
                         .staticServiceDiscovery()
-                            .server("myService@localhost:8081")
-                            .server("myService@localhost:8082")
+                            .servers("myService@localhost:8081")
+                            .servers("myService@localhost:8082")
                         .endParent();
 
                 from("direct:default")
                     .serviceCall()
                         .name("myService")
                         .staticServiceDiscovery()
-                            .server("myService@localhost:8081")
-                            .server("myService@localhost:8082")
+                            .servers("myService@localhost:8081")
+                            .servers("myService@localhost:8082")
                         .endParent();
 
                 from("jetty:http://localhost:8081")

http://git-wip-us.apache.org/repos/asf/camel/blob/f08a3005/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/cloud/Netty4HttpServiceCallRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/cloud/Netty4HttpServiceCallRouteTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/cloud/Netty4HttpServiceCallRouteTest.java
index 0a610e8..c1cb4ef 100644
--- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/cloud/Netty4HttpServiceCallRouteTest.java
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/cloud/Netty4HttpServiceCallRouteTest.java
@@ -51,16 +51,16 @@ public class Netty4HttpServiceCallRouteTest extends CamelTestSupport {
                         .name("myService")
                         .component("netty4-http")
                         .staticServiceDiscovery()
-                            .server("myService@localhost:8081")
-                            .server("myService@localhost:8082")
+                            .servers("myService@localhost:8081")
+                            .servers("myService@localhost:8082")
                         .endParent();
 
                 from("direct:default")
                     .serviceCall()
                         .name("myService")
                         .staticServiceDiscovery()
-                            .server("myService@localhost:8081")
-                            .server("myService@localhost:8082")
+                            .servers("myService@localhost:8081")
+                            .servers("myService@localhost:8082")
                         .endParent();
 
                 from("netty4-http:http://localhost:8081")

http://git-wip-us.apache.org/repos/asf/camel/blob/f08a3005/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/cloud/RibbonServiceDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/cloud/RibbonServiceDefinition.java b/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/cloud/RibbonServiceDefinition.java
index a7415ee..37098af 100644
--- a/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/cloud/RibbonServiceDefinition.java
+++ b/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/cloud/RibbonServiceDefinition.java
@@ -28,12 +28,14 @@ import org.apache.camel.impl.cloud.DefaultServiceHealth;
 import org.apache.camel.util.ObjectHelper;
 
 public class RibbonServiceDefinition extends Server implements ServiceDefinition {
+    private static final ServiceHealth DEFAULT_SERVICE_HEALTH = new DefaultServiceHealth();
+
     private String name;
     private ServiceHealth health;
     private Map<String, String> metaData;
 
     public RibbonServiceDefinition(String name, String host, int port) {
-        this(name, host, port, null, DefaultServiceHealth.INSTANCE);
+        this(name, host, port, null, DEFAULT_SERVICE_HEALTH);
     }
 
     public RibbonServiceDefinition(String name, String host, int port, ServiceHealth healt) {
@@ -41,7 +43,7 @@ public class RibbonServiceDefinition extends Server implements ServiceDefinition
     }
 
     public RibbonServiceDefinition(String name, String host, int port,  Map<String, String> meta) {
-        this(name, host, port, meta, DefaultServiceHealth.INSTANCE);
+        this(name, host, port, meta, DEFAULT_SERVICE_HEALTH);
     }
 
     public RibbonServiceDefinition(String name, String host, int port, Map<String, String> meta, ServiceHealth healt) {

http://git-wip-us.apache.org/repos/asf/camel/blob/f08a3005/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/cloud/RibbonServerListTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/cloud/RibbonServerListTest.java b/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/cloud/RibbonServerListTest.java
index a1f9c54..59cb4e0 100644
--- a/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/cloud/RibbonServerListTest.java
+++ b/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/cloud/RibbonServerListTest.java
@@ -37,7 +37,7 @@ public class RibbonServerListTest {
                     new RibbonServiceDefinition("unknown", "localhost", 9090),
                     new RibbonServiceDefinition("unknown", "localhost", 9091)
                 ),
-                PassThroughServiceFilter.INSTANCE))
+                new PassThroughServiceFilter()))
             .withRule(new RoundRobinRule())
             .buildDynamicServerListLoadBalancer();
 

http://git-wip-us.apache.org/repos/asf/camel/blob/f08a3005/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/cloud/RibbonServiceCallRouteDslTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/cloud/RibbonServiceCallRouteDslTest.java b/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/cloud/RibbonServiceCallRouteDslTest.java
index f59379c..0a077be 100644
--- a/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/cloud/RibbonServiceCallRouteDslTest.java
+++ b/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/cloud/RibbonServiceCallRouteDslTest.java
@@ -47,8 +47,8 @@ public class RibbonServiceCallRouteDslTest extends CamelTestSupport {
                         .component("jetty")
                         .ribbonLoadBalancer()
                         .staticServiceDiscovery()
-                            .server("localhost:9090")
-                            .server("localhost:9091")
+                            .servers("localhost:9090")
+                            .servers("localhost:9091")
                         .endParent()
                     .to("mock:result");
                 from("jetty:http://localhost:9090")

http://git-wip-us.apache.org/repos/asf/camel/blob/f08a3005/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/cloud/UndertowServiceCallRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/cloud/UndertowServiceCallRouteTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/cloud/UndertowServiceCallRouteTest.java
index bab5b55..0b499c0 100644
--- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/cloud/UndertowServiceCallRouteTest.java
+++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/cloud/UndertowServiceCallRouteTest.java
@@ -51,16 +51,16 @@ public class UndertowServiceCallRouteTest extends CamelTestSupport {
                         .name("myService")
                         .component("undertow")
                         .staticServiceDiscovery()
-                            .server("myService@localhost:8081")
-                            .server("myService@localhost:8082")
+                            .servers("myService@localhost:8081")
+                            .servers("myService@localhost:8082")
                         .endParent();
 
                 from("direct:default")
                     .serviceCall()
                         .name("myService")
                         .staticServiceDiscovery()
-                            .server("myService@localhost:8081")
-                            .server("myService@localhost:8082")
+                            .servers("myService@localhost:8081")
+                            .servers("myService@localhost:8082")
                         .endParent();
 
                 from("undertow:http://localhost:8081")


[2/8] camel git commit: CAMEL-11192: Service Call - Some unused code in camel-core

Posted by lb...@apache.org.
CAMEL-11192: Service Call - Some unused code in camel-core


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

Branch: refs/heads/master
Commit: bb563eac0ad9ac6533b43e599a93f06befb083b6
Parents: dcf982f
Author: lburgazzoli <lb...@gmail.com>
Authored: Mon Apr 24 15:38:54 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Mon Apr 24 15:38:54 2017 +0200

----------------------------------------------------------------------
 .../org/apache/camel/impl/cloud/DefaultServiceDefinition.java   | 5 +++--
 .../java/org/apache/camel/impl/cloud/DefaultServiceHealth.java  | 2 --
 .../java/org/apache/camel/impl/cloud/HealthyServiceFilter.java  | 2 --
 .../org/apache/camel/impl/cloud/PassThroughServiceFilter.java   | 2 --
 4 files changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bb563eac/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java b/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java
index 74c306d..beed3cf 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDefinition.java
@@ -24,6 +24,7 @@ import org.apache.camel.cloud.ServiceDefinition;
 import org.apache.camel.cloud.ServiceHealth;
 
 public class DefaultServiceDefinition implements ServiceDefinition {
+    private static final ServiceHealth DEFAULT_SERVICE_HEALTH = new DefaultServiceHealth();
 
     private final String name;
     private final String host;
@@ -36,7 +37,7 @@ public class DefaultServiceDefinition implements ServiceDefinition {
         this.host = host;
         this.port = port;
         this.meta = Collections.emptyMap();
-        this.health = DefaultServiceHealth.INSTANCE;
+        this.health = DEFAULT_SERVICE_HEALTH;
     }
 
     public DefaultServiceDefinition(String name, String host, int port, ServiceHealth health) {
@@ -52,7 +53,7 @@ public class DefaultServiceDefinition implements ServiceDefinition {
         this.host = host;
         this.port = port;
         this.meta = meta != null ? Collections.unmodifiableMap(new HashMap<>(meta)) : Collections.emptyMap();
-        this.health = DefaultServiceHealth.INSTANCE;
+        this.health = DEFAULT_SERVICE_HEALTH;
     }
 
     public DefaultServiceDefinition(String name, String host, int port, Map<String, String> meta, ServiceHealth health) {

http://git-wip-us.apache.org/repos/asf/camel/blob/bb563eac/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java b/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java
index 5bba70d..9a55b15 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceHealth.java
@@ -23,8 +23,6 @@ import java.util.Map;
 import org.apache.camel.cloud.ServiceHealth;
 
 public class DefaultServiceHealth implements ServiceHealth {
-    public static final ServiceHealth INSTANCE = new DefaultServiceHealth();
-
     private final boolean healthy;
     private final Map<String, String> meta;
 

http://git-wip-us.apache.org/repos/asf/camel/blob/bb563eac/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java b/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java
index c33d5aa..bc39362 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/cloud/HealthyServiceFilter.java
@@ -23,8 +23,6 @@ import org.apache.camel.cloud.ServiceDefinition;
 import org.apache.camel.cloud.ServiceFilter;
 
 public class HealthyServiceFilter implements ServiceFilter {
-    public static final ServiceFilter INSTANCE = new HealthyServiceFilter();
-
     @Override
     public List<ServiceDefinition> apply(List<ServiceDefinition> services) {
         return services.stream().filter(s -> s.getHealth().isHealthy()).collect(Collectors.toList());

http://git-wip-us.apache.org/repos/asf/camel/blob/bb563eac/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java b/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java
index 3152a57..752cb91 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/cloud/PassThroughServiceFilter.java
@@ -22,8 +22,6 @@ import org.apache.camel.cloud.ServiceDefinition;
 import org.apache.camel.cloud.ServiceFilter;
 
 public class PassThroughServiceFilter implements ServiceFilter {
-    public static final ServiceFilter INSTANCE = new PassThroughServiceFilter();
-
     @Override
     public List<ServiceDefinition> apply(List<ServiceDefinition> services) {
         return services;


[3/8] camel git commit: CAMEL-11190: Service Call - Allow to configure static server list from a property placholder

Posted by lb...@apache.org.
CAMEL-11190: Service Call - Allow to configure static server list from a property placholder


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

Branch: refs/heads/master
Commit: 76481d98774959fae7db6741a67cc9e0fecd8eb9
Parents: bb563ea
Author: lburgazzoli <lb...@gmail.com>
Authored: Mon Apr 24 16:39:57 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Mon Apr 24 16:49:47 2017 +0200

----------------------------------------------------------------------
 .../impl/cloud/BlacklistServiceFilter.java      |  5 +++
 ...stServiceCallServiceFilterConfiguration.java | 40 ++++++++++++++++++++
 .../ServiceCallConfigurationDefinition.java     |  7 ++++
 .../ServiceCallExpressionConfiguration.java     | 17 +++++++++
 .../ServiceCallServiceChooserConfiguration.java | 17 +++++++++
 ...erviceCallServiceDiscoveryConfiguration.java | 17 +++++++++
 .../ServiceCallServiceFilterConfiguration.java  | 17 +++++++++
 ...iceCallServiceLoadBalancerConfiguration.java | 17 +++++++++
 ...erviceCallServiceDiscoveryConfiguration.java | 40 ++++++++++++++++++++
 .../cloud/AggregatingServiceDiscoveryTest.java  | 15 ++++++++
 .../cloud/ServiceCallConfigurationTest.java     | 34 ++++++++++++++++-
 11 files changed, 224 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/76481d98/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java b/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java
index 5a9a295..1df142c 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/cloud/BlacklistServiceFilter.java
@@ -18,6 +18,7 @@ package org.apache.camel.impl.cloud;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -108,6 +109,10 @@ public class BlacklistServiceFilter implements ServiceFilter {
         return services.stream().filter(s -> !this.services.contains(s)).collect(Collectors.toList());
     }
 
+    List<ServiceDefinition> getBlacklistedServices() {
+        return Collections.unmodifiableList(this.services);
+    }
+
     // *************************************************************************
     // Helpers
     // *************************************************************************

http://git-wip-us.apache.org/repos/asf/camel/blob/76481d98/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java b/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java
index 1d1a101..385b80b 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java
@@ -16,13 +16,19 @@
  */
 package org.apache.camel.model.cloud;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.spi.Metadata;
+import org.apache.camel.util.ObjectHelper;
 
 @Metadata(label = "routing,cloud,service-filter")
 @XmlRootElement(name = "blacklistServiceFilter")
@@ -65,4 +71,38 @@ public class BlacklistServiceCallServiceFilterConfiguration extends ServiceCallS
         setServers(servers);
         return this;
     }
+
+    /**
+     * Sets the server list;
+     */
+    public BlacklistServiceCallServiceFilterConfiguration servers(String servers) {
+        if (ObjectHelper.isNotEmpty(servers)) {
+            String[] parts = servers.split(",");
+
+            if (this.servers == null) {
+                this.servers = new ArrayList<>();
+            }
+
+            this.servers.addAll(Arrays.asList(parts));
+        }
+
+        return this;
+    }
+
+    // *************************************************************************
+    // Utilities
+    // *************************************************************************
+
+    protected void postProcessFactoryParameters(CamelContext camelContext, Map<String, Object> parameters) throws Exception  {
+        List<String> servers = List.class.cast(parameters.get("servers"));
+
+        if (ObjectHelper.isNotEmpty(servers)) {
+            final ListIterator<String> it = servers.listIterator();
+            while (it.hasNext()) {
+                it.set(camelContext.resolvePropertyPlaceholders(it.next()));
+            }
+
+            parameters.put("servers", servers);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/76481d98/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java
index 2d8fc96..984bdd1 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java
@@ -587,6 +587,13 @@ public class ServiceCallConfigurationDefinition extends IdentifiedType {
         return conf;
     }
 
+    public BlacklistServiceCallServiceFilterConfiguration blacklistFilet() {
+        BlacklistServiceCallServiceFilterConfiguration conf = new BlacklistServiceCallServiceFilterConfiguration();
+        setServiceFilterConfiguration(conf);
+
+        return conf;
+    }
+
     public ServiceCallConfigurationDefinition customFilter(String serviceFilter) {
         CustomServiceCallServiceFilterConfiguration conf = new CustomServiceCallServiceFilterConfiguration();
         conf.setServiceFilterRef(serviceFilter);

http://git-wip-us.apache.org/repos/asf/camel/blob/76481d98/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
index 1565b1b..8118233 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallExpressionConfiguration.java
@@ -246,6 +246,23 @@ public class ServiceCallExpressionConfiguration extends IdentifiedType implement
                     Map<String, Object> parameters = new HashMap<>();
                     IntrospectionSupport.getProperties(this, parameters, null, false);
 
+                    parameters.replaceAll(
+                        (k, v) -> {
+                            if (v != null && v instanceof String) {
+                                try {
+                                    v = camelContext.resolvePropertyPlaceholders((String) v);
+                                } catch (Exception e) {
+                                    throw new IllegalArgumentException(
+                                        String.format("Exception while resolving %s (%s)", k, v.toString()),
+                                        e
+                                    );
+                                }
+                            }
+
+                            return v;
+                        }
+                    );
+
                     // Convert properties to Map<String, String>
                     parameters.put("properties", getPropertiesAsMap(camelContext));
 

http://git-wip-us.apache.org/repos/asf/camel/blob/76481d98/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java
index 0228f72..e349409 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceChooserConfiguration.java
@@ -162,6 +162,23 @@ public class ServiceCallServiceChooserConfiguration extends IdentifiedType imple
                 Map<String, Object> parameters = new HashMap<>();
                 IntrospectionSupport.getProperties(this, parameters, null, false);
 
+                parameters.replaceAll(
+                    (k, v) -> {
+                        if (v != null && v instanceof String) {
+                            try {
+                                v = camelContext.resolvePropertyPlaceholders((String) v);
+                            } catch (Exception e) {
+                                throw new IllegalArgumentException(
+                                    String.format("Exception while resolving %s (%s)", k, v.toString()),
+                                    e
+                                );
+                            }
+                        }
+
+                        return v;
+                    }
+                );
+
                 // Convert properties to Map<String, String>
                 parameters.put("properties", getPropertiesAsMap(camelContext));
 

http://git-wip-us.apache.org/repos/asf/camel/blob/76481d98/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java
index 49e6c84..6e3a685 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceDiscoveryConfiguration.java
@@ -169,6 +169,23 @@ public class ServiceCallServiceDiscoveryConfiguration extends IdentifiedType imp
                 Map<String, Object> parameters = new HashMap<>();
                 IntrospectionSupport.getProperties(this, parameters, null, false);
 
+                parameters.replaceAll(
+                    (k, v) -> {
+                        if (v != null && v instanceof String) {
+                            try {
+                                v = camelContext.resolvePropertyPlaceholders((String) v);
+                            } catch (Exception e) {
+                                throw new IllegalArgumentException(
+                                    String.format("Exception while resolving %s (%s)", k, v.toString()),
+                                    e
+                                );
+                            }
+                        }
+
+                        return v;
+                    }
+                );
+
                 // Convert properties to Map<String, String>
                 parameters.put("properties", getPropertiesAsMap(camelContext));
 

http://git-wip-us.apache.org/repos/asf/camel/blob/76481d98/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java
index afb2e94..60b9938 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceFilterConfiguration.java
@@ -162,6 +162,23 @@ public class ServiceCallServiceFilterConfiguration extends IdentifiedType implem
                 Map<String, Object> parameters = new HashMap<>();
                 IntrospectionSupport.getProperties(this, parameters, null, false);
 
+                parameters.replaceAll(
+                    (k, v) -> {
+                        if (v != null && v instanceof String) {
+                            try {
+                                v = camelContext.resolvePropertyPlaceholders((String) v);
+                            } catch (Exception e) {
+                                throw new IllegalArgumentException(
+                                    String.format("Exception while resolving %s (%s)", k, v.toString()),
+                                    e
+                                );
+                            }
+                        }
+
+                        return v;
+                    }
+                );
+
                 // Convert properties to Map<String, String>
                 parameters.put("properties", getPropertiesAsMap(camelContext));
 

http://git-wip-us.apache.org/repos/asf/camel/blob/76481d98/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java
index a1057a4..094e2f5 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallServiceLoadBalancerConfiguration.java
@@ -162,6 +162,23 @@ public class ServiceCallServiceLoadBalancerConfiguration extends IdentifiedType
                 Map<String, Object> parameters = new HashMap<>();
                 IntrospectionSupport.getProperties(this, parameters, null, false);
 
+                parameters.replaceAll(
+                    (k, v) -> {
+                        if (v != null && v instanceof String) {
+                            try {
+                                v = camelContext.resolvePropertyPlaceholders((String) v);
+                            } catch (Exception e) {
+                                throw new IllegalArgumentException(
+                                    String.format("Exception while resolving %s (%s)", k, v.toString()),
+                                    e
+                                );
+                            }
+                        }
+
+                        return v;
+                    }
+                );
+
                 // Convert properties to Map<String, String>
                 parameters.put("properties", getPropertiesAsMap(camelContext));
 

http://git-wip-us.apache.org/repos/asf/camel/blob/76481d98/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java b/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java
index 0c5dae1..d35a00c 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java
@@ -17,13 +17,19 @@
 
 package org.apache.camel.model.cloud;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
+import org.apache.camel.CamelContext;
 import org.apache.camel.spi.Metadata;
+import org.apache.camel.util.ObjectHelper;
 
 @Metadata(label = "routing,cloud,service-discovery")
 @XmlRootElement(name = "staticServiceDiscovery")
@@ -66,4 +72,38 @@ public class StaticServiceCallServiceDiscoveryConfiguration extends ServiceCallS
         setServers(servers);
         return this;
     }
+
+    /**
+     * Sets the server list;
+     */
+    public StaticServiceCallServiceDiscoveryConfiguration servers(String servers) {
+        if (ObjectHelper.isNotEmpty(servers)) {
+            String[] parts = servers.split(",");
+
+            if (this.servers == null) {
+                this.servers = new ArrayList<>();
+            }
+
+            this.servers.addAll(Arrays.asList(parts));
+        }
+
+        return this;
+    }
+
+    // *************************************************************************
+    // Utilities
+    // *************************************************************************
+
+    protected void postProcessFactoryParameters(CamelContext camelContext, Map<String, Object> parameters) throws Exception  {
+        List<String> servers = List.class.cast(parameters.get("servers"));
+
+        if (ObjectHelper.isNotEmpty(servers)) {
+            final ListIterator<String> it = servers.listIterator();
+            while (it.hasNext()) {
+                it.set(camelContext.resolvePropertyPlaceholders(it.next()));
+            }
+
+            parameters.put("servers", servers);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/76481d98/camel-core/src/test/java/org/apache/camel/impl/cloud/AggregatingServiceDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/cloud/AggregatingServiceDiscoveryTest.java b/camel-core/src/test/java/org/apache/camel/impl/cloud/AggregatingServiceDiscoveryTest.java
index 76a5a59..8fe4249 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/cloud/AggregatingServiceDiscoveryTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/cloud/AggregatingServiceDiscoveryTest.java
@@ -68,4 +68,19 @@ public class AggregatingServiceDiscoveryTest extends ContextTestSupport {
         Assert.assertEquals(3, discovery.getServices("discovery1").size());
         Assert.assertEquals(1, discovery.getServices("discovery2").size());
     }
+
+    @Test
+    public void testMultiServiceDiscoveryConfigurationWithPlaceholders() throws Exception {
+        System.setProperty("svc-list-1", "discovery1@localhost:1111,discovery1@localhost:1112");
+        System.setProperty("svc-list-2", "discovery1@localhost:1113,discovery2@localhost:1114");
+
+        AggregatingServiceCallServiceDiscoveryConfiguration multiConf = new AggregatingServiceCallServiceDiscoveryConfiguration();
+        multiConf.staticServiceDiscovery().servers("{{svc-list-1}}");
+        multiConf.staticServiceDiscovery().servers("{{svc-list-2}}");
+
+        AggregatingServiceDiscovery discovery = (AggregatingServiceDiscovery)multiConf.newInstance(context);
+        Assert.assertEquals(2, discovery.getDelegates().size());
+        Assert.assertEquals(3, discovery.getServices("discovery1").size());
+        Assert.assertEquals(1, discovery.getServices("discovery2").size());
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/76481d98/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java b/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
index 67c0105..dc60788 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
@@ -16,12 +16,14 @@
  */
 package org.apache.camel.impl.cloud;
 
+import java.util.List;
 import java.util.UUID;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Processor;
 import org.apache.camel.Route;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cloud.ServiceDefinition;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.SimpleRegistry;
 import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
@@ -282,8 +284,15 @@ public class ServiceCallConfigurationTest {
         try {
             System.setProperty("scall.name", "service-name");
             System.setProperty("scall.scheme", "file");
+            System.setProperty("scall.servers1", "hello-service@localhost:8081,hello-service@localhost:8082");
+            System.setProperty("scall.servers2", "hello-svc@localhost:8083,hello-svc@localhost:8084");
+            System.setProperty("scall.filter", "hello-svc@localhost:8083");
+
+            ServiceCallConfigurationDefinition global = new ServiceCallConfigurationDefinition();
+            global.blacklistFilet().servers("{{scall.filter}}");
 
             context = new DefaultCamelContext();
+            context.setServiceCallConfiguration(global);
             context.addRoutes(new RouteBuilder() {
                 @Override
                 public void configure() throws Exception {
@@ -293,7 +302,10 @@ public class ServiceCallConfigurationTest {
                             .name("{{scall.name}}")
                             .component("{{scall.scheme}}")
                             .uri("direct:{{scall.name}}")
-                            .serviceDiscovery(new StaticServiceDiscovery())
+                            .staticServiceDiscovery()
+                                .servers("{{scall.servers1}}")
+                                .servers("{{scall.servers2}}")
+                                .end()
                         .end();
                 }
             });
@@ -308,6 +320,21 @@ public class ServiceCallConfigurationTest {
             Assert.assertEquals("file", proc.getScheme());
             Assert.assertEquals("direct:service-name", proc.getUri());
 
+            DefaultServiceLoadBalancer lb = (DefaultServiceLoadBalancer)proc.getLoadBalancer();
+
+            Assert.assertTrue(lb.getServiceFilter() instanceof BlacklistServiceFilter);
+            BlacklistServiceFilter filter = (BlacklistServiceFilter)lb.getServiceFilter();
+            List<ServiceDefinition> blacklist = filter.getBlacklistedServices();
+            Assert.assertEquals(1, blacklist.size());
+
+            Assert.assertTrue(lb.getServiceDiscovery() instanceof StaticServiceDiscovery);
+
+            List<ServiceDefinition> services1 = lb.getServiceDiscovery().getServices("hello-service");
+            Assert.assertEquals(2,  filter.apply(services1).size());
+
+            List<ServiceDefinition> services2 = lb.getServiceDiscovery().getServices("hello-svc");
+            Assert.assertEquals(1, filter.apply(services2).size());
+
         } finally {
             if (context != null) {
                 context.stop();
@@ -315,7 +342,10 @@ public class ServiceCallConfigurationTest {
 
             // Cleanup system properties
             System.clearProperty("scall.name");
-            System.clearProperty("scall.component");
+            System.clearProperty("scall.scheme");
+            System.clearProperty("scall.servers1");
+            System.clearProperty("scall.servers2");
+            System.clearProperty("scall.filter");
         }
 
         context.stop();


[6/8] camel git commit: ServiceCall: improve EIP documentation

Posted by lb...@apache.org.
ServiceCall: improve EIP documentation


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

Branch: refs/heads/master
Commit: 419cbdc1dac00fcf5bc86ad4179c33ea00cc8149
Parents: 4b97e0a
Author: lburgazzoli <lb...@gmail.com>
Authored: Mon Apr 24 17:29:21 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Mon Apr 24 17:29:21 2017 +0200

----------------------------------------------------------------------
 .../src/main/docs/eips/serviceCall-eip.adoc     | 104 +++++++++++++++++++
 1 file changed, 104 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/419cbdc1/camel-core/src/main/docs/eips/serviceCall-eip.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/eips/serviceCall-eip.adoc b/camel-core/src/main/docs/eips/serviceCall-eip.adoc
index 0874eef..0925c6b 100644
--- a/camel-core/src/main/docs/eips/serviceCall-eip.adoc
+++ b/camel-core/src/main/docs/eips/serviceCall-eip.adoc
@@ -115,6 +115,56 @@ The Service Call EIP can be configured through the following options:
 
 In addition to ref/binding configuration style you can leverage specific configuration DSL to customize specific options:
 
+* *Static Service Discovery:*
++
+This service discovery implementation does not query any external services to find out the list of services associated to a named service but keep them in memory. Each service should be provided in the following form:
++
+[source]
+----
+    [service@]host:port
+----
++
+TIP: The ``service`` part is used to discrimintate aginst the services but if not provided it acks like a wildcard so each non named service will be returned whatever the service name is. This is useful if you ahve a single service so the service name is redundant.
++
+NOTE: this implementation is provided by ``camel-core`` artifact.
++
+*Available options:*
++
+[width="100%",cols="3,1m,6",options="header"]
+|=======================================================================
+| Name | Java Type | Description
+| servers | String | A comma separated list of servers in the form: [service@]host:port,[service@]host2:port,[service@]host3:port
+|=======================================================================
++
+[source,java]
+.Java DSL Example
+----
+from("direct:start")
+    .serviceCall("foo")
+        .staticServiceDiscovery()
+            .servers("service1@host1:80,service1@host2:80")
+            .servers("service2@host1:8080,service2@host2:8080,service2@host3:8080")
+            .end()
+    .to("mock:result");
+----
++
+[source,xml]
+.XML DSL Example
+----
+<camelContext xmlns="http://camel.apache.org/schema/spring">
+  <route>
+    <from uri="direct:start"/>
+    <serviceCall name="foo">
+      <staticServiceDiscovery>
+        <servers>service1@host1:80,service1@host2:80</servers>
+        <servers>service2@host1:8080,service2@host2:8080,service2@host3:8080</servers>
+      </staticServiceDiscovery>
+    </serviceCall
+    <to uri="mock:result"/>
+  </route>
+</camelContext>
+----
+
 * *Consul Service Discovery:*
 +
 To leverage Consul for Service Discover, maven users will need to add the following dependency to their pom.xml
@@ -334,6 +384,60 @@ from("direct:start")
 </camelContext>
 ----
 
+* *Blacklist Service Filter:*
++
+This service filter implementation removes the listed services from those found by the service discovery. Each service should be provided in the following form:
++
+[source]
+----
+    [service@]host:port
+----
++
+NOTE: The services are removed if they fully match.
++
+*Available options:*
++
+[width="100%",cols="3,1m,6",options="header"]
+|=======================================================================
+| Name | Java Type | Description
+| servers | String | A comma separated list of servers to blacklist: [service@]host:port,[service@]host2:port,[service@]host3:port
+|=======================================================================
++
+[source,java]
+.Java DSL Example
+----
+from("direct:start")
+    .serviceCall("foo")
+        .staticServiceDiscovery()
+            .servers("service1@host1:80,service1@host2:80")
+            .servers("service2@host1:8080,service2@host2:8080,service2@host3:8080")
+            .end()
+        .blacklistFilter()
+            .servers("service2@host2:8080")
+            .end()
+    .to("mock:result");
+----
++
+[source,xml]
+.XML DSL Example
+----
+<camelContext xmlns="http://camel.apache.org/schema/spring">
+  <route>
+    <from uri="direct:start"/>
+    <serviceCall name="foo">
+      <staticServiceDiscovery>
+        <servers>service1@host1:80,service1@host2:80</servers>
+        <servers>service2@host1:8080,service2@host2:8080,service2@host3:8080</servers>
+      </staticServiceDiscovery>
+      <blacklistServiceFilter>
+        <servers>service2@host2:8080</servers>
+      </blacklistServiceFilter>
+    </serviceCall
+    <to uri="mock:result"/>
+  </route>
+</camelContext>
+----
+
 ### Load Balancer
 
 The Service Call EIP comes with its own Load Balancer which is istantiated by default if a custome one is not configured and glues Service Discovery, Service Filer, Service Chooser and Service Expression togheter to load balance requests among the available services.


[5/8] camel git commit: Fix typo

Posted by lb...@apache.org.
Fix typo


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

Branch: refs/heads/master
Commit: 4b97e0a7d515a8af91607e62a69971dab5db8f92
Parents: d504641
Author: lburgazzoli <lb...@gmail.com>
Authored: Mon Apr 24 17:29:07 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Mon Apr 24 17:29:07 2017 +0200

----------------------------------------------------------------------
 .../camel/model/cloud/ServiceCallConfigurationDefinition.java | 2 +-
 .../org/apache/camel/model/cloud/ServiceCallDefinition.java   | 7 +++++++
 .../apache/camel/impl/cloud/ServiceCallConfigurationTest.java | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4b97e0a7/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java
index 984bdd1..d74b3a8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallConfigurationDefinition.java
@@ -587,7 +587,7 @@ public class ServiceCallConfigurationDefinition extends IdentifiedType {
         return conf;
     }
 
-    public BlacklistServiceCallServiceFilterConfiguration blacklistFilet() {
+    public BlacklistServiceCallServiceFilterConfiguration blacklistFilter() {
         BlacklistServiceCallServiceFilterConfiguration conf = new BlacklistServiceCallServiceFilterConfiguration();
         setServiceFilterConfiguration(conf);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/4b97e0a7/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 483cd46..283d701 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
@@ -676,6 +676,13 @@ public class ServiceCallDefinition extends NoOutputDefinition<ServiceCallDefinit
         return conf;
     }
 
+    public BlacklistServiceCallServiceFilterConfiguration blacklistFilter() {
+        BlacklistServiceCallServiceFilterConfiguration conf = new BlacklistServiceCallServiceFilterConfiguration();
+        setServiceFilterConfiguration(conf);
+
+        return conf;
+    }
+
     public ServiceCallDefinition customFilter(String serviceFilter) {
         CustomServiceCallServiceFilterConfiguration conf = new CustomServiceCallServiceFilterConfiguration();
         conf.setServiceFilterRef(serviceFilter);

http://git-wip-us.apache.org/repos/asf/camel/blob/4b97e0a7/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java b/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
index dc60788..96ba820 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
@@ -289,7 +289,7 @@ public class ServiceCallConfigurationTest {
             System.setProperty("scall.filter", "hello-svc@localhost:8083");
 
             ServiceCallConfigurationDefinition global = new ServiceCallConfigurationDefinition();
-            global.blacklistFilet().servers("{{scall.filter}}");
+            global.blacklistFilter().servers("{{scall.filter}}");
 
             context = new DefaultCamelContext();
             context.setServiceCallConfiguration(global);


[8/8] camel git commit: Add camel-undertow-starter log configuration to redirect test logs fo file

Posted by lb...@apache.org.
Add camel-undertow-starter log configuration to redirect test logs fo file


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

Branch: refs/heads/master
Commit: 09f6ada3b82a8614bcf43f179b95872b81b37ce0
Parents: f08a300
Author: lburgazzoli <lb...@gmail.com>
Authored: Mon Apr 24 18:59:13 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Mon Apr 24 18:59:13 2017 +0200

----------------------------------------------------------------------
 .../src/test/resources/logback.xml              | 39 ++++++++++++++++++++
 1 file changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/09f6ada3/platforms/spring-boot/components-starter/camel-undertow-starter/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-undertow-starter/src/test/resources/logback.xml b/platforms/spring-boot/components-starter/camel-undertow-starter/src/test/resources/logback.xml
new file mode 100644
index 0000000..81595a2
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-undertow-starter/src/test/resources/logback.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<configuration>
+
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <!-- encoders are assigned the type
+         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%-15.15thread] %-5level %-30.30logger - %msg%n</pattern>
+    </encoder>
+  </appender>
+
+  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%-15.15thread] %-5level %-30.30logger - %msg%n</pattern>
+    </encoder>
+    <file>target/camel-undertow-starter-test.log</file>
+  </appender>
+
+  <root level="INFO">
+    <appender-ref ref="FILE"/>
+  </root>
+
+</configuration>


[4/8] camel git commit: ServiceCall: add javadoc for static service list and blacklist service filter

Posted by lb...@apache.org.
ServiceCall: add javadoc for static service list and blacklist service filter


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

Branch: refs/heads/master
Commit: d5046415159a3356c7dda2b58660435fa41c7dc4
Parents: 76481d9
Author: lburgazzoli <lb...@gmail.com>
Authored: Mon Apr 24 17:05:48 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Mon Apr 24 17:05:48 2017 +0200

----------------------------------------------------------------------
 ...stServiceCallServiceFilterConfiguration.java | 23 +++++++++++++++++---
 ...erviceCallServiceDiscoveryConfiguration.java | 21 +++++++++++++++---
 2 files changed, 38 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d5046415/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java b/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java
index 385b80b..5173051 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/BlacklistServiceCallServiceFilterConfiguration.java
@@ -54,7 +54,14 @@ public class BlacklistServiceCallServiceFilterConfiguration extends ServiceCallS
     }
 
     /**
-     * Sets the server list;
+     * Sets the server blacklist.
+     * 
+     * Each entry can be a list of servers separated by comma in the format:
+     *
+     *   [service@]host:port,[service@]host2:port,[service@]host3:port
+     *
+     * @param servers a list of servers.
+     * @return this instance
      */
     public void setServers(List<String> servers) {
         this.servers = servers;
@@ -65,7 +72,14 @@ public class BlacklistServiceCallServiceFilterConfiguration extends ServiceCallS
     // *************************************************************************
 
     /**
-     * Sets the server list;
+     * Sets the server blacklist.
+     *
+     * Each entry can be a list of servers separated by comma in the format:
+     *
+     *   [service@]host:port,[service@]host2:port,[service@]host3:port
+     *
+     * @param servers a list of servers.
+     * @return this instance
      */
     public BlacklistServiceCallServiceFilterConfiguration servers(List<String> servers) {
         setServers(servers);
@@ -73,7 +87,10 @@ public class BlacklistServiceCallServiceFilterConfiguration extends ServiceCallS
     }
 
     /**
-     * Sets the server list;
+     * Sets the server blacklist.
+     *
+     * @param servers a list of servers separated by comma in the format: [service@]host:port,[service@]host2:port,[service@]host3:port
+     * @return this instance
      */
     public BlacklistServiceCallServiceFilterConfiguration servers(String servers) {
         if (ObjectHelper.isNotEmpty(servers)) {

http://git-wip-us.apache.org/repos/asf/camel/blob/d5046415/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java b/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java
index d35a00c..724ad24 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/StaticServiceCallServiceDiscoveryConfiguration.java
@@ -55,7 +55,13 @@ public class StaticServiceCallServiceDiscoveryConfiguration extends ServiceCallS
     }
 
     /**
-     * Sets the server list;
+     * Sets the server list.
+     * Each entry can be a list of servers separated by comma in the format:
+     *
+     *   [service@]host:port,[service@]host2:port,[service@]host3:port
+     *
+     * @param servers a list of servers.
+     * @return this instance
      */
     public void setServers(List<String> servers) {
         this.servers = servers;
@@ -66,7 +72,13 @@ public class StaticServiceCallServiceDiscoveryConfiguration extends ServiceCallS
     // *************************************************************************
 
     /**
-     * Sets the server list;
+     * Sets the server list.
+     * Each entry can be a list of servers separated by comma in the format:
+     *
+     *   [service@]host:port,[service@]host2:port,[service@]host3:port
+     *
+     * @param servers a list of servers.
+     * @return this instance
      */
     public StaticServiceCallServiceDiscoveryConfiguration servers(List<String> servers) {
         setServers(servers);
@@ -74,7 +86,10 @@ public class StaticServiceCallServiceDiscoveryConfiguration extends ServiceCallS
     }
 
     /**
-     * Sets the server list;
+     * Sets the server list.
+     *
+     * @param servers a list of servers separated by comma in the format: [service@]host:port,[service@]host2:port,[service@]host3:port
+     * @return this instance
      */
     public StaticServiceCallServiceDiscoveryConfiguration servers(String servers) {
         if (ObjectHelper.isNotEmpty(servers)) {