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: Simplify ServiceDiscovery interface
Date Wed, 01 Mar 2017 17:53:12 GMT
Repository: camel
Updated Branches:
  refs/heads/master 5c614ac16 -> 58bb110aa


Simplify ServiceDiscovery interface


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

Branch: refs/heads/master
Commit: 58bb110aa053392783317ba43e10be7f554119a2
Parents: 6ff9303
Author: lburgazzoli <lburgazzoli@gmail.com>
Authored: Wed Mar 1 18:52:40 2017 +0100
Committer: lburgazzoli <lburgazzoli@gmail.com>
Committed: Wed Mar 1 18:52:50 2017 +0100

----------------------------------------------------------------------
 .../org/apache/camel/cloud/ServiceDiscovery.java   | 17 +++--------------
 .../camel/impl/cloud/CachingServiceDiscovery.java  | 11 +++--------
 .../camel/impl/cloud/ChainedServiceDiscovery.java  | 11 ++---------
 .../camel/impl/cloud/DefaultLoadBalancer.java      |  2 +-
 .../camel/impl/cloud/DefaultServiceDiscovery.java  |  7 +------
 .../camel/impl/cloud/StaticServiceDiscovery.java   |  2 +-
 .../impl/cloud/CachingServiceDiscoveryTest.java    | 12 ++++++------
 .../impl/cloud/ChainedServiceDiscoveryTest.java    | 12 ++++++------
 .../consul/cloud/ConsulServiceDiscovery.java       |  2 +-
 .../consul/cloud/ConsulServiceDiscoveryTest.java   |  2 +-
 .../component/dns/cloud/DnsServiceDiscovery.java   |  2 +-
 .../dns/cloud/DnsServiceDiscoveryTest.java         |  3 +--
 .../etcd/cloud/EtcdOnDemandServiceDiscovery.java   |  2 +-
 .../etcd/cloud/EtcdWatchServiceDiscovery.java      |  2 +-
 .../etcd/cloud/EtcdServiceDiscoveryTest.java       |  8 ++++----
 .../cloud/KubernetesClientServiceDiscovery.java    |  2 +-
 .../cloud/KubernetesDnsServiceDiscovery.java       |  2 +-
 .../cloud/KubernetesEnvServiceDiscovery.java       |  2 +-
 .../component/ribbon/cloud/RibbonLoadBalancer.java |  4 ++--
 .../cloud/netflix/CamelCloudNetflixServerList.java |  4 ++--
 .../spring/cloud/CamelCloudDiscoveryClient.java    |  2 +-
 .../spring/cloud/CamelCloudServiceDiscovery.java   |  9 ++-------
 22 files changed, 43 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/camel-core/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java b/camel-core/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java
index cdc4b53..284ac33 100644
--- a/camel-core/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java
+++ b/camel-core/src/main/java/org/apache/camel/cloud/ServiceDiscovery.java
@@ -27,22 +27,11 @@ import java.util.List;
 public interface ServiceDiscovery {
 
     /**
-     * Gets the initial list of services.
+     * Gets the list of services.
      * <p/>
-     * This method may return <tt>null</tt> or an empty list.
+     * This method may return an empty list.
      *
      * @param name the service name
      */
-    List<ServiceDefinition> getInitialListOfServices(String name);
-
-    /**
-     * Gets the updated list of services.
-     * <p/>
-     * This method can either be called on-demand prior to a service call, or have
-     * a background job that is scheduled to update the list, or a watcher
-     * that triggers when the list of services changes.
-     *
-     * @param name the service name
-     */
-    List<ServiceDefinition> getUpdatedListOfServices(String name);
+    List<ServiceDefinition> getServices(String name);
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java
b/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java
index ab0f7a9..dc99f88 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/cloud/CachingServiceDiscovery.java
@@ -51,7 +51,7 @@ public final class CachingServiceDiscovery implements ServiceDiscovery {
         this.timeout = timeout;
         this.cache = Caffeine.newBuilder()
             .expireAfterAccess(timeout, TimeUnit.MILLISECONDS)
-            .build(delegate::getUpdatedListOfServices);
+            .build(delegate::getServices);
     }
 
     public void setTimeout(long timeout, TimeUnit unit) {
@@ -73,13 +73,8 @@ public final class CachingServiceDiscovery implements ServiceDiscovery
{
     }
 
     @Override
-    public List<ServiceDefinition> getInitialListOfServices(String name) {
-        return delegate.getInitialListOfServices(name);
-    }
-
-    @Override
-    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
-        return cache.get(name);
+    public List<ServiceDefinition> getServices(String name) {
+        return delegate.getServices(name);
     }
 
     // **********************

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/camel-core/src/main/java/org/apache/camel/impl/cloud/ChainedServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/cloud/ChainedServiceDiscovery.java
b/camel-core/src/main/java/org/apache/camel/impl/cloud/ChainedServiceDiscovery.java
index a00fe5b..eee5a1f 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/cloud/ChainedServiceDiscovery.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/cloud/ChainedServiceDiscovery.java
@@ -36,16 +36,9 @@ public class ChainedServiceDiscovery implements ServiceDiscovery {
     }
 
     @Override
-    public List<ServiceDefinition> getInitialListOfServices(String name) {
+    public List<ServiceDefinition> getServices(String name) {
         return delegates.stream()
-            .flatMap(d -> d.getInitialListOfServices(name).stream())
-            .collect(Collectors.toList());
-    }
-
-    @Override
-    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
-        return delegates.stream()
-            .flatMap(d -> d.getInitialListOfServices(name).stream())
+            .flatMap(d -> d.getServices(name).stream())
             .collect(Collectors.toList());
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultLoadBalancer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultLoadBalancer.java
b/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultLoadBalancer.java
index 554e690..9fc8051 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultLoadBalancer.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultLoadBalancer.java
@@ -129,7 +129,7 @@ public class DefaultLoadBalancer
     public <T> T process(String serviceName, LoadBalancerFunction<T> function)
throws Exception {
         ServiceDefinition service;
 
-        List<ServiceDefinition> services = serviceDiscovery.getUpdatedListOfServices(serviceName);
+        List<ServiceDefinition> services = serviceDiscovery.getServices(serviceName);
         if (services == null || services.isEmpty()) {
             throw new RejectedExecutionException("No active services with name " + serviceName);
         } else {

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java
b/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java
index a3e386d..9be80ce 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/cloud/DefaultServiceDiscovery.java
@@ -31,12 +31,7 @@ public class DefaultServiceDiscovery
     private CamelContext camelContext;
 
     @Override
-    public List<ServiceDefinition> getInitialListOfServices(String name) {
-        return getUpdatedListOfServices(name);
-    }
-
-    @Override
-    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
+    public List<ServiceDefinition> getServices(String name) {
         return Collections.emptyList();
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java
b/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java
index 4394777..661823d 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/cloud/StaticServiceDiscovery.java
@@ -140,7 +140,7 @@ public class StaticServiceDiscovery extends DefaultServiceDiscovery {
     }
 
     @Override
-    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
+    public List<ServiceDefinition> getServices(String name) {
         return Collections.unmodifiableList(
             services.stream()
                 .filter(s -> Objects.isNull(s.getName()) || Objects.equals(name, s.getName()))

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/camel-core/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java
b/camel-core/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java
index 28bb00c..82a271c 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/cloud/CachingServiceDiscoveryTest.java
@@ -32,14 +32,14 @@ public class CachingServiceDiscoveryTest extends ContextTestSupport {
         CachingServiceDiscovery caching = CachingServiceDiscovery.wrap(discovery, 1, TimeUnit.SECONDS);
 
         discovery.addServer(new DefaultServiceDefinition("noname", "localhost", 1111));
-        Assert.assertEquals(1, caching.getUpdatedListOfServices("noname").size());
+        Assert.assertEquals(1, caching.getServices("noname").size());
         discovery.addServer(new DefaultServiceDefinition("noname", "localhost", 1112));
-        Assert.assertEquals(1, caching.getUpdatedListOfServices("noname").size());
+        Assert.assertEquals(1, caching.getServices("noname").size());
 
         // Let the cache expire
         Thread.sleep(1100);
 
-        Assert.assertEquals(2, caching.getUpdatedListOfServices("noname").size());
+        Assert.assertEquals(2, caching.getServices("noname").size());
     }
 
     @Test
@@ -55,13 +55,13 @@ public class CachingServiceDiscoveryTest extends ContextTestSupport {
         CachingServiceDiscovery caching = (CachingServiceDiscovery)cachingConf.newInstance(context);
         StaticServiceDiscovery delegate = (StaticServiceDiscovery)caching.getDelegate();
 
-        Assert.assertEquals(1, caching.getUpdatedListOfServices("no-name").size());
+        Assert.assertEquals(1, caching.getServices("no-name").size());
         delegate.addServer("no-name@localhost:1112");
-        Assert.assertEquals(1, caching.getUpdatedListOfServices("no-name").size());
+        Assert.assertEquals(1, caching.getServices("no-name").size());
 
         // Let the cache expire
         Thread.sleep(1100);
 
-        Assert.assertEquals(2, caching.getUpdatedListOfServices("no-name").size());
+        Assert.assertEquals(2, caching.getServices("no-name").size());
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/camel-core/src/test/java/org/apache/camel/impl/cloud/ChainedServiceDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/cloud/ChainedServiceDiscoveryTest.java
b/camel-core/src/test/java/org/apache/camel/impl/cloud/ChainedServiceDiscoveryTest.java
index 91377aa..d04d56c 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/cloud/ChainedServiceDiscoveryTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/cloud/ChainedServiceDiscoveryTest.java
@@ -36,8 +36,8 @@ public class ChainedServiceDiscoveryTest extends ContextTestSupport {
         discovery2.addServer(new DefaultServiceDefinition("discovery2", "localhost", 1114));
 
         ChainedServiceDiscovery discovery = ChainedServiceDiscovery.wrap(discovery1, discovery2);
-        Assert.assertEquals(3, discovery.getUpdatedListOfServices("discovery1").size());
-        Assert.assertEquals(1, discovery.getUpdatedListOfServices("discovery2").size());
+        Assert.assertEquals(3, discovery.getServices("discovery1").size());
+        Assert.assertEquals(1, discovery.getServices("discovery2").size());
     }
 
     @Test
@@ -53,8 +53,8 @@ public class ChainedServiceDiscoveryTest extends ContextTestSupport {
 
         ChainedServiceDiscovery discovery = (ChainedServiceDiscovery)multiConf.newInstance(context);
         Assert.assertEquals(2, discovery.getDelegates().size());
-        Assert.assertEquals(3, discovery.getUpdatedListOfServices("discovery1").size());
-        Assert.assertEquals(1, discovery.getUpdatedListOfServices("discovery2").size());
+        Assert.assertEquals(3, discovery.getServices("discovery1").size());
+        Assert.assertEquals(1, discovery.getServices("discovery2").size());
     }
 
     @Test
@@ -65,7 +65,7 @@ public class ChainedServiceDiscoveryTest extends ContextTestSupport {
 
         ChainedServiceDiscovery discovery = (ChainedServiceDiscovery)multiConf.newInstance(context);
         Assert.assertEquals(2, discovery.getDelegates().size());
-        Assert.assertEquals(3, discovery.getUpdatedListOfServices("discovery1").size());
-        Assert.assertEquals(1, discovery.getUpdatedListOfServices("discovery2").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/58bb110a/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
b/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
index 104f65a..c8f6b74 100644
--- a/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
+++ b/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
@@ -52,7 +52,7 @@ public final class ConsulServiceDiscovery extends DefaultServiceDiscovery
{
     }
 
     @Override
-    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
+    public List<ServiceDefinition> getServices(String name) {
         List<CatalogService> services = client.catalogClient()
             .getService(name, catalogOptions)
             .getResponse();

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscoveryTest.java
b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscoveryTest.java
index 8046f1d..e63a39f 100644
--- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscoveryTest.java
+++ b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscoveryTest.java
@@ -74,7 +74,7 @@ public class ConsulServiceDiscoveryTest {
         ConsulConfiguration configuration = new ConsulConfiguration(null);
         ServiceDiscovery discovery = new ConsulServiceDiscovery(configuration);
 
-        List<ServiceDefinition> services = discovery.getUpdatedListOfServices("my-service");
+        List<ServiceDefinition> services = discovery.getServices("my-service");
         assertNotNull(services);
         assertEquals(3, services.size());
 

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-dns/src/main/java/org/apache/camel/component/dns/cloud/DnsServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-dns/src/main/java/org/apache/camel/component/dns/cloud/DnsServiceDiscovery.java
b/components/camel-dns/src/main/java/org/apache/camel/component/dns/cloud/DnsServiceDiscovery.java
index 003fd8a..3f6cdf7 100644
--- a/components/camel-dns/src/main/java/org/apache/camel/component/dns/cloud/DnsServiceDiscovery.java
+++ b/components/camel-dns/src/main/java/org/apache/camel/component/dns/cloud/DnsServiceDiscovery.java
@@ -51,7 +51,7 @@ public final class DnsServiceDiscovery extends DefaultServiceDiscovery {
     }
 
     @Override
-    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
+    public List<ServiceDefinition> getServices(String name) {
         final Lookup lookup = cache.computeIfAbsent(name, this::createLookup);
         final Record[] records = lookup.run();
 

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-dns/src/test/java/org/apache/camel/component/dns/cloud/DnsServiceDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/components/camel-dns/src/test/java/org/apache/camel/component/dns/cloud/DnsServiceDiscoveryTest.java
b/components/camel-dns/src/test/java/org/apache/camel/component/dns/cloud/DnsServiceDiscoveryTest.java
index e204e95..df10083 100644
--- a/components/camel-dns/src/test/java/org/apache/camel/component/dns/cloud/DnsServiceDiscoveryTest.java
+++ b/components/camel-dns/src/test/java/org/apache/camel/component/dns/cloud/DnsServiceDiscoveryTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.dns.cloud;
 
 import java.util.List;
@@ -35,7 +34,7 @@ public class DnsServiceDiscoveryTest {
         configuration.setDomain("gmail.com");
         configuration.setProto("_tcp");
 
-        List<ServiceDefinition> services = discovery.getUpdatedListOfServices("_xmpp-server");
+        List<ServiceDefinition> services = discovery.getServices("_xmpp-server");
         assertNotNull(services);
         assertFalse(services.isEmpty());
 

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/cloud/EtcdOnDemandServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/cloud/EtcdOnDemandServiceDiscovery.java
b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/cloud/EtcdOnDemandServiceDiscovery.java
index 6eb5e9f..423506d 100644
--- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/cloud/EtcdOnDemandServiceDiscovery.java
+++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/cloud/EtcdOnDemandServiceDiscovery.java
@@ -28,7 +28,7 @@ public class EtcdOnDemandServiceDiscovery extends EtcdServiceDiscovery {
     }
 
     @Override
-    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
+    public List<ServiceDefinition> getServices(String name) {
         return getServices(s -> name.equalsIgnoreCase(s.getName()));
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/cloud/EtcdWatchServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/cloud/EtcdWatchServiceDiscovery.java
b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/cloud/EtcdWatchServiceDiscovery.java
index 587ee25..27c1c01 100644
--- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/cloud/EtcdWatchServiceDiscovery.java
+++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/cloud/EtcdWatchServiceDiscovery.java
@@ -53,7 +53,7 @@ public class EtcdWatchServiceDiscovery
     }
 
     @Override
-    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
+    public List<ServiceDefinition> getServices(String name) {
         List<ServiceDefinition> servers = serversRef.get();
         if (servers == null) {
             serversRef.set(getServices());

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/EtcdServiceDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/EtcdServiceDiscoveryTest.java
b/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/EtcdServiceDiscoveryTest.java
index 17ec0b2..432e68c 100644
--- a/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/EtcdServiceDiscoveryTest.java
+++ b/components/camel-etcd/src/test/java/org/apache/camel/component/etcd/cloud/EtcdServiceDiscoveryTest.java
@@ -70,7 +70,7 @@ public class EtcdServiceDiscoveryTest extends EtcdTestSupport {
         EtcdOnDemandServiceDiscovery strategy = new EtcdOnDemandServiceDiscovery(CONFIGURATION);
         strategy.start();
 
-        List<ServiceDefinition> type1 = strategy.getUpdatedListOfServices("serviceType-1");
+        List<ServiceDefinition> type1 = strategy.getServices("serviceType-1");
         assertEquals(3, type1.size());
         for (ServiceDefinition service : type1) {
             assertNotNull(service.getMetadata());
@@ -78,7 +78,7 @@ public class EtcdServiceDiscoveryTest extends EtcdTestSupport {
             assertTrue(service.getMetadata().containsKey("port_delta"));
         }
 
-        List<ServiceDefinition> type2 = strategy.getUpdatedListOfServices("serviceType-2");
+        List<ServiceDefinition> type2 = strategy.getServices("serviceType-2");
         assertEquals(2, type2.size());
         for (ServiceDefinition service : type2) {
             assertNotNull(service.getMetadata());
@@ -96,7 +96,7 @@ public class EtcdServiceDiscoveryTest extends EtcdTestSupport {
         EtcdWatchServiceDiscovery strategy = new EtcdWatchServiceDiscovery(CONFIGURATION);
         strategy.start();
 
-        assertEquals(1, strategy.getUpdatedListOfServices("serviceType-3").size());
+        assertEquals(1, strategy.getServices("serviceType-3").size());
 
         addServer(client, "serviceType-3");
         addServer(client, "serviceType-3");
@@ -104,7 +104,7 @@ public class EtcdServiceDiscoveryTest extends EtcdTestSupport {
 
         Thread.sleep(250);
 
-        assertEquals(3, strategy.getUpdatedListOfServices("serviceType-3").size());
+        assertEquals(3, strategy.getServices("serviceType-3").size());
 
         strategy.stop();
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java
index 0557cb1..d243218 100644
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java
@@ -46,7 +46,7 @@ public class KubernetesClientServiceDiscovery extends KubernetesServiceDiscovery
     }
 
     @Override
-    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
+    public List<ServiceDefinition> getServices(String name) {
         LOG.debug("Discovering endpoints from namespace: {} with name: {}", getNamespace(),
name);
         Endpoints endpoints = client.endpoints().inNamespace(getNamespace()).withName(name).get();
         List<ServiceDefinition> result = new ArrayList<>();

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesDnsServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesDnsServiceDiscovery.java
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesDnsServiceDiscovery.java
index 003bbdc..53b433a 100644
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesDnsServiceDiscovery.java
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesDnsServiceDiscovery.java
@@ -35,7 +35,7 @@ public class KubernetesDnsServiceDiscovery extends KubernetesServiceDiscovery
{
     }
 
     @Override
-    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
+    public List<ServiceDefinition> getServices(String name) {
         return this.cache.computeIfAbsent(name, key -> Collections.singletonList(newService(name)));
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesEnvServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesEnvServiceDiscovery.java
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesEnvServiceDiscovery.java
index 4a01318..f8cf453 100644
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesEnvServiceDiscovery.java
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesEnvServiceDiscovery.java
@@ -32,7 +32,7 @@ public class KubernetesEnvServiceDiscovery extends KubernetesServiceDiscovery
{
     }
 
     @Override
-    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
+    public List<ServiceDefinition> getServices(String name) {
         try {
             final CamelContext ctx = getCamelContext();
             final String host = ctx.resolvePropertyPlaceholders("{{service.host:" + name
+ "}}");

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/cloud/RibbonLoadBalancer.java
----------------------------------------------------------------------
diff --git a/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/cloud/RibbonLoadBalancer.java
b/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/cloud/RibbonLoadBalancer.java
index b08901d..b867eea 100644
--- a/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/cloud/RibbonLoadBalancer.java
+++ b/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/cloud/RibbonLoadBalancer.java
@@ -179,7 +179,7 @@ public class RibbonLoadBalancer
 
         @Override
         public List<RibbonServiceDefinition> getInitialListOfServers() {
-            List<ServiceDefinition> services = serviceDiscovery.getInitialListOfServices(serviceName);
+            List<ServiceDefinition> services = serviceDiscovery.getServices(serviceName);
             if (serviceFilter != null) {
                 services = serviceFilter.apply(services);
             }
@@ -189,7 +189,7 @@ public class RibbonLoadBalancer
 
         @Override
         public List<RibbonServiceDefinition> getUpdatedListOfServers() {
-            List<ServiceDefinition> services = serviceDiscovery.getUpdatedListOfServices(serviceName);
+            List<ServiceDefinition> services = serviceDiscovery.getServices(serviceName);
             if (serviceFilter != null) {
                 services = serviceFilter.apply(services);
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-spring-cloud-netflix/src/main/java/org/apache/camel/spring/cloud/netflix/CamelCloudNetflixServerList.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud-netflix/src/main/java/org/apache/camel/spring/cloud/netflix/CamelCloudNetflixServerList.java
b/components/camel-spring-cloud-netflix/src/main/java/org/apache/camel/spring/cloud/netflix/CamelCloudNetflixServerList.java
index 2266bb4..69534e0 100644
--- a/components/camel-spring-cloud-netflix/src/main/java/org/apache/camel/spring/cloud/netflix/CamelCloudNetflixServerList.java
+++ b/components/camel-spring-cloud-netflix/src/main/java/org/apache/camel/spring/cloud/netflix/CamelCloudNetflixServerList.java
@@ -68,7 +68,7 @@ public class CamelCloudNetflixServerList extends AbstractServerList<RibbonServic
             return Collections.emptyList();
         }
 
-        List<ServiceDefinition> services = serviceDiscovery.getInitialListOfServices(serviceId);
+        List<ServiceDefinition> services = serviceDiscovery.getServices(serviceId);
         if (serviceFilter != null) {
             services = serviceFilter.apply(services);
         }
@@ -82,7 +82,7 @@ public class CamelCloudNetflixServerList extends AbstractServerList<RibbonServic
             return Collections.emptyList();
         }
 
-        List<ServiceDefinition> services = serviceDiscovery.getUpdatedListOfServices(serviceId);
+        List<ServiceDefinition> services = serviceDiscovery.getServices(serviceId);
         if (serviceFilter != null) {
             services = serviceFilter.apply(services);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudDiscoveryClient.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudDiscoveryClient.java
b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudDiscoveryClient.java
index 3b8c627..4f0b4f5 100644
--- a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudDiscoveryClient.java
+++ b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudDiscoveryClient.java
@@ -58,7 +58,7 @@ public class CamelCloudDiscoveryClient implements DiscoveryClient {
 
     @Override
     public List<ServiceInstance> getInstances(String serviceId) {
-        return serviceDiscovery.getUpdatedListOfServices(serviceId).stream()
+        return serviceDiscovery.getServices(serviceId).stream()
             .map(s -> new DefaultServiceInstance(s.getName(), s.getHost(), s.getPort(),
false, s.getMetadata()))
             .collect(Collectors.toList());
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/58bb110a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscovery.java
b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscovery.java
index a787fc3..d67963c 100644
--- a/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscovery.java
+++ b/components/camel-spring-cloud/src/main/java/org/apache/camel/spring/cloud/CamelCloudServiceDiscovery.java
@@ -41,12 +41,7 @@ public class CamelCloudServiceDiscovery implements ServiceDiscovery {
     }
 
     @Override
-    public List<ServiceDefinition> getInitialListOfServices(String name) {
-        return delegate.getInitialListOfServices(name);
-    }
-
-    @Override
-    public List<ServiceDefinition> getUpdatedListOfServices(String name) {
-        return delegate.getUpdatedListOfServices(name);
+    public List<ServiceDefinition> getServices(String name) {
+        return delegate.getServices(name);
     }
 }


Mime
View raw message