Repository: camel
Updated Branches:
  refs/heads/master fdb508a84 -> 80f746dfd


http://git-wip-us.apache.org/repos/asf/camel/blob/80f746df/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/EtcdServiceCallRouteTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/EtcdServiceCallRouteTest.java
 
b/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/EtcdServiceCallRouteTest.java
index 766eeca..85b1d64 100644
--- 
a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/EtcdServiceCallRouteTest.java
+++ 
b/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/EtcdServiceCallRouteTest.java
@@ -27,8 +27,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import mousio.etcd4j.EtcdClient;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.cloud.ServiceDiscovery;
-import org.apache.camel.component.etcd.EtcdConfiguration;
 import org.apache.camel.component.etcd.EtcdHelper;
 import org.apache.camel.component.etcd.EtcdTestSupport;
 import org.junit.Test;
@@ -96,15 +94,12 @@ public class EtcdServiceCallRouteTest extends 
EtcdTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                EtcdConfiguration configuration = new EtcdConfiguration(null);
-                ServiceDiscovery discovery = new 
EtcdOnDemandServiceDiscovery(configuration);
-
                 from("direct:start")
                     .serviceCall()
                         .name(SERVICE_NAME)
-                        .component("http")
-                        .serviceDiscovery(discovery)
-                        .end()
+                        .etcdServiceDiscovery()
+                            .type("on-demand")
+                        .endParent()
                     
.to("log:org.apache.camel.component.etcd.processor.service?level=INFO&showAll=true&multiline=true")
                     .to("mock:result");
 

http://git-wip-us.apache.org/repos/asf/camel/blob/80f746df/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
new file mode 100644
index 0000000..c2f8b67
--- /dev/null
+++ 
b/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/cloud/RibbonServiceCallRouteDslTest.java
@@ -0,0 +1,65 @@
+/**
+ * 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.component.ribbon.cloud;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class RibbonServiceCallRouteDslTest extends CamelTestSupport {
+    @Test
+    public void testServiceCall() throws Exception {
+        getMockEndpoint("mock:9090").expectedMessageCount(1);
+        getMockEndpoint("mock:9091").expectedMessageCount(1);
+        getMockEndpoint("mock:result").expectedMessageCount(2);
+
+        String out = template.requestBody("direct:start", null, String.class);
+        String out2 = template.requestBody("direct:start", null, String.class);
+        assertEquals("9091", out);
+        assertEquals("9090", out2);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .serviceCall()
+                    .name("myService")
+                    .ribbonLoadBalancer()
+                        .end()
+                    .staticServiceDiscovery()
+                        .server("localhost:9090")
+                        .server("localhost:9091")
+                        .end()
+                    .end()
+                    .to("mock:result");
+                from("jetty:http://localhost:9090";)
+                    .to("mock:9090")
+                    .transform().constant("9090");
+                from("jetty:http://localhost:9091";)
+                    .to("mock:9091")
+                    .transform().constant("9091");
+            }
+        };
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/camel/blob/80f746df/components/camel-spring/src/test/java/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring/src/test/java/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.java
 
b/components/camel-spring/src/test/java/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.java
index fe3371e..97cac01 100644
--- 
a/components/camel-spring/src/test/java/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.java
+++ 
b/components/camel-spring/src/test/java/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.spring.cloud;
 
+import 
org.apache.camel.model.cloud.MultiServiceCallServiceDiscoveryConfiguration;
 import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
 import 
org.apache.camel.model.cloud.StaticServiceCallServiceDiscoveryConfiguration;
 import org.apache.camel.spring.SpringCamelContext;
@@ -24,6 +25,7 @@ import 
org.springframework.context.support.ClassPathXmlApplicationContext;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 public class ServiceCallConfigurationTest {
     @Test
@@ -42,10 +44,18 @@ public class ServiceCallConfigurationTest {
         assertNotNull("No ServiceCallConfiguration (2)", conf2);
         assertNotNull("No ServiceDiscoveryConfiguration (2)", 
conf2.getServiceDiscoveryConfiguration());
 
-        StaticServiceCallServiceDiscoveryConfiguration discovery2 = 
(StaticServiceCallServiceDiscoveryConfiguration)conf2.getServiceDiscoveryConfiguration();
-        assertEquals(2, discovery2.getServers().size());
-        assertEquals("localhost:9092", discovery2.getServers().get(0));
-        assertEquals("localhost:9093,localhost:9094", 
discovery2.getServers().get(1));
+        MultiServiceCallServiceDiscoveryConfiguration discovery2 = 
(MultiServiceCallServiceDiscoveryConfiguration)conf2.getServiceDiscoveryConfiguration();
+        assertEquals(2, discovery2.getServiceDiscoveryConfigurations().size());
+        assertTrue(discovery2.getServiceDiscoveryConfigurations().get(0) 
instanceof StaticServiceCallServiceDiscoveryConfiguration);
+        assertTrue(discovery2.getServiceDiscoveryConfigurations().get(1) 
instanceof StaticServiceCallServiceDiscoveryConfiguration);
+
+        StaticServiceCallServiceDiscoveryConfiguration sconf1 = 
(StaticServiceCallServiceDiscoveryConfiguration)discovery2.getServiceDiscoveryConfigurations().get(0);
+        assertEquals(1, sconf1.getServers().size());
+        assertEquals("localhost:9092", sconf1.getServers().get(0));
+
+        StaticServiceCallServiceDiscoveryConfiguration sconf2 = 
(StaticServiceCallServiceDiscoveryConfiguration)discovery2.getServiceDiscoveryConfigurations().get(1);
+        assertEquals(1, sconf2.getServers().size());
+        assertEquals("localhost:9093,localhost:9094", 
sconf2.getServers().get(0));
     }
 
     protected SpringCamelContext createContext(String classpathConfigFile) {

http://git-wip-us.apache.org/repos/asf/camel/blob/80f746df/components/camel-spring/src/test/resources/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-spring/src/test/resources/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.xml
 
b/components/camel-spring/src/test/resources/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.xml
index efc7711..d54348c 100644
--- 
a/components/camel-spring/src/test/resources/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.xml
+++ 
b/components/camel-spring/src/test/resources/org/apache/camel/spring/cloud/ServiceCallConfigurationTest.xml
@@ -32,10 +32,14 @@
     </serviceCallConfiguration>
 
     <serviceCallConfiguration id="conf2">
-      <staticServiceDiscovery>
-        <servers>localhost:9092</servers>
-        <servers>localhost:9093,localhost:9094</servers>
-      </staticServiceDiscovery>
+      <multiServiceDiscovery>
+        <staticServiceDiscovery>
+          <servers>localhost:9092</servers>
+        </staticServiceDiscovery>
+        <staticServiceDiscovery>
+          <servers>localhost:9093,localhost:9094</servers>
+        </staticServiceDiscovery>
+      </multiServiceDiscovery>
     </serviceCallConfiguration>
 
     <route id="test1">

Reply via email to