You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/05/23 08:05:19 UTC
[32/34] camel git commit: CAMEL-9683: Made configuration of service
call easier
CAMEL-9683: Made configuration of service call easier
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0cdb8787
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0cdb8787
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0cdb8787
Branch: refs/heads/remoteServiceCall
Commit: 0cdb878741c5dc6301e052a97f399908c5102125
Parents: eac7a25
Author: Claus Ibsen <da...@apache.org>
Authored: Thu May 19 11:45:56 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon May 23 09:28:22 2016 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/CamelContext.java | 26 ++++++++
.../apache/camel/impl/DefaultCamelContext.java | 34 +++++++++++
.../camel/spi/ServiceCallConfiguration.java | 64 ++++++++++++++++++++
.../processor/KubernetesProcessorFactory.java | 13 +++-
.../processor/ServiceCallClientRouteTest.java | 13 +---
.../ServiceCallEnvironmentRouteTest.java | 12 +---
.../SpringServiceCallClientRouteTest.xml | 2 +-
.../SpringServiceCallEnvironmentRouteTest.xml | 2 +-
.../processor/RibbonProcessorFactory.java | 40 +++++++-----
.../RibbonServiceCallRegistryRouteTest.java | 13 +---
.../SpringRibbonServiceCallRouteTest.xml | 2 +-
11 files changed, 169 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/0cdb8787/camel-core/src/main/java/org/apache/camel/CamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/CamelContext.java b/camel-core/src/main/java/org/apache/camel/CamelContext.java
index d830e2d..e5d13fd 100644
--- a/camel-core/src/main/java/org/apache/camel/CamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/CamelContext.java
@@ -34,6 +34,7 @@ import org.apache.camel.model.DataFormatDefinition;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.model.RoutesDefinition;
+import org.apache.camel.model.remote.ServiceCallConfigurationDefinition;
import org.apache.camel.model.rest.RestDefinition;
import org.apache.camel.model.rest.RestsDefinition;
import org.apache.camel.spi.AsyncProcessorAwaitManager;
@@ -565,6 +566,31 @@ public interface CamelContext extends SuspendableService, RuntimeConfiguration {
Collection<RestConfiguration> getRestConfigurations();
/**
+ * Gets the service call configuration by the given name. If no name is given and there is only one configuration
+ * which matches the type then this configuration is returned.
+ *
+ * @param serviceName name of service, or <tt>null</tt> to return the default configuration
+ * @param type implementation of the configuration such as kubernetes, ribbon etc.
+ * @return the configuration, or <tt>null</tt> if no configuration has been registered
+ */
+ <T extends ServiceCallConfigurationDefinition> T getServiceCallConfiguration(String serviceName, Class<T> type);
+
+ /**
+ * Sets the default service call configuration
+ *
+ * @param configuration the configuration
+ */
+ void setServiceCallConfiguration(ServiceCallConfigurationDefinition configuration);
+
+ /**
+ * Adds the service call configuration
+ *
+ * @param serviceName name of the service
+ * @param configuration the configuration
+ */
+ void addServiceCallConfiguration(String serviceName, ServiceCallConfigurationDefinition configuration);
+
+ /**
* Returns the order in which the route inputs was started.
* <p/>
* The order may not be according to the startupOrder defined on the route.
http://git-wip-us.apache.org/repos/asf/camel/blob/0cdb8787/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 180fa99..38ee073 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -100,6 +100,7 @@ import org.apache.camel.model.ProcessorDefinitionHelper;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.model.RouteDefinitionHelper;
import org.apache.camel.model.RoutesDefinition;
+import org.apache.camel.model.remote.ServiceCallConfigurationDefinition;
import org.apache.camel.model.rest.RestDefinition;
import org.apache.camel.model.rest.RestsDefinition;
import org.apache.camel.processor.interceptor.BacklogDebugger;
@@ -206,6 +207,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
private final List<RouteDefinition> routeDefinitions = new ArrayList<RouteDefinition>();
private final List<RestDefinition> restDefinitions = new ArrayList<RestDefinition>();
private Map<String, RestConfiguration> restConfigurations = new ConcurrentHashMap<>();
+ private Map<String, ServiceCallConfigurationDefinition> serviceCallConfigurations = new ConcurrentHashMap<>();
private RestRegistry restRegistry = new DefaultRestRegistry();
private List<InterceptStrategy> interceptStrategies = new ArrayList<InterceptStrategy>();
private List<RoutePolicyFactory> routePolicyFactories = new ArrayList<RoutePolicyFactory>();
@@ -2551,6 +2553,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
public void addRestConfiguration(RestConfiguration restConfiguration) {
restConfigurations.put(restConfiguration.getComponent(), restConfiguration);
}
+
public RestConfiguration getRestConfiguration(String component, boolean defaultIfNotExist) {
if (component == null) {
component = "";
@@ -2566,6 +2569,37 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
return config;
}
+ @SuppressWarnings("unchecked")
+ public <T extends ServiceCallConfigurationDefinition> T getServiceCallConfiguration(String serviceName, Class<T> type) {
+ if (serviceName == null) {
+ serviceName = "";
+ }
+
+ ServiceCallConfigurationDefinition config = serviceCallConfigurations.get(serviceName);
+ if (config == null) {
+ for (ServiceCallConfigurationDefinition candidate : serviceCallConfigurations.values()) {
+ if (type == null || type.isInstance(candidate)) {
+ config = candidate;
+ break;
+ }
+ }
+ }
+
+ if (config != null) {
+ return type != null ? type.cast(config) : (T) config;
+ } else {
+ return null;
+ }
+ }
+
+ public void setServiceCallConfiguration(ServiceCallConfigurationDefinition configuration) {
+ serviceCallConfigurations.put("", configuration);
+ }
+
+ public void addServiceCallConfiguration(String serviceName, ServiceCallConfigurationDefinition configuration) {
+ serviceCallConfigurations.put(serviceName, configuration);
+ }
+
public List<InterceptStrategy> getInterceptStrategies() {
return interceptStrategies;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/0cdb8787/camel-core/src/main/java/org/apache/camel/spi/ServiceCallConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ServiceCallConfiguration.java b/camel-core/src/main/java/org/apache/camel/spi/ServiceCallConfiguration.java
new file mode 100644
index 0000000..7c46190
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/spi/ServiceCallConfiguration.java
@@ -0,0 +1,64 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.spi;
+
+/**
+ * Configuration use by calling remote services where the service is looked up in a service registry of some sorts,
+ * implemented by Camel components to support the Camel {@link org.apache.camel.model.remote.ServiceCallDefinition Service Call} EIP.
+ */
+@Deprecated
+public class ServiceCallConfiguration {
+
+ private String component;
+ private ServiceCallLoadBalancer loadBalancer;
+ private ServiceCallServerListStrategy serverListStrategy;
+
+ public String getComponent() {
+ return component;
+ }
+
+ /**
+ * Sets the name of the Camel component to use such as ribbon or kubernetes
+ */
+ public void setComponent(String component) {
+ this.component = component;
+ }
+
+ public ServiceCallLoadBalancer getLoadBalancer() {
+ return loadBalancer;
+ }
+
+ /**
+ * Sets a custom {@link org.apache.camel.spi.ServiceCallLoadBalancer} load balancer to use.
+ */
+ public void setLoadBalancer(ServiceCallLoadBalancer loadBalancer) {
+ this.loadBalancer = loadBalancer;
+ }
+
+ public ServiceCallServerListStrategy getServerListStrategy() {
+ return serverListStrategy;
+ }
+
+ /**
+ * Sets a custom {@link org.apache.camel.spi.ServiceCallServerListStrategy} strategy to obtain the list of active
+ * servers that provides the service which is being selected by the load balancer when calling the remote service.
+ */
+ public void setServerListStrategy(ServiceCallServerListStrategy serverListStrategy) {
+ this.serverListStrategy = serverListStrategy;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/0cdb8787/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java
index 6fb695b..3a1352e 100644
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/processor/KubernetesProcessorFactory.java
@@ -58,11 +58,20 @@ public class KubernetesProcessorFactory implements ProcessorFactory {
KubernetesConfigurationDefinition config = (KubernetesConfigurationDefinition) sc.getServiceCallConfiguration();
KubernetesConfigurationDefinition configRef = null;
if (sc.getServiceCallConfigurationRef() != null) {
- configRef = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), sc.getServiceCallConfigurationRef(), KubernetesConfigurationDefinition.class);
+ // lookup in registry first
+ configRef = CamelContextHelper.lookup(routeContext.getCamelContext(), sc.getServiceCallConfigurationRef(), KubernetesConfigurationDefinition.class);
+ if (configRef == null) {
+ // and fallback as service configuration
+ routeContext.getCamelContext().getServiceCallConfiguration(sc.getServiceCallConfigurationRef(), KubernetesConfigurationDefinition.class);
+ }
}
- // if no configuration explicit configured then try to lookup in registry by type and find the best candidate to use
+ // if no configuration explicit configured then use default
if (config == null && configRef == null) {
+ config = routeContext.getCamelContext().getServiceCallConfiguration(null, KubernetesConfigurationDefinition.class);
+ }
+ if (config == null) {
+ // if no default then try to find if there configuration in the registry of the given type
Set<KubernetesConfigurationDefinition> set = routeContext.getCamelContext().getRegistry().findByType(KubernetesConfigurationDefinition.class);
if (set != null) {
for (KubernetesConfigurationDefinition candidate : set) {
http://git-wip-us.apache.org/repos/asf/camel/blob/0cdb8787/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallClientRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallClientRouteTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallClientRouteTest.java
index 20485e5..b5e03e3 100644
--- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallClientRouteTest.java
+++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallClientRouteTest.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.kubernetes.processor;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.JndiRegistry;
import org.apache.camel.model.remote.KubernetesConfigurationDefinition;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Ignore;
@@ -27,14 +26,6 @@ import org.junit.Test;
@Ignore("Manual test")
public class ServiceCallClientRouteTest extends CamelTestSupport {
- private JndiRegistry registry;
-
- @Override
- protected JndiRegistry createRegistry() throws Exception {
- registry = super.createRegistry();
- return registry;
- }
-
@Test
public void testServiceCall() throws Exception {
getMockEndpoint("mock:result").expectedMessageCount(1);
@@ -58,8 +49,8 @@ public class ServiceCallClientRouteTest extends CamelTestSupport {
// lets use the built-in round robin (random is default)
config.setLoadBalancerRef("roundrobin");
- // add the config to the registry so service call can use it
- registry.bind("myConfig", config);
+ // register configuration
+ context.setServiceCallConfiguration(config);
from("direct:start")
.serviceCall("cdi-camel-jetty")
http://git-wip-us.apache.org/repos/asf/camel/blob/0cdb8787/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallEnvironmentRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallEnvironmentRouteTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallEnvironmentRouteTest.java
index 6d4fa57..9278b57 100644
--- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallEnvironmentRouteTest.java
+++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallEnvironmentRouteTest.java
@@ -27,14 +27,6 @@ import org.junit.Test;
@Ignore("Manual test")
public class ServiceCallEnvironmentRouteTest extends CamelTestSupport {
- private JndiRegistry registry;
-
- @Override
- protected JndiRegistry createRegistry() throws Exception {
- registry = super.createRegistry();
- return registry;
- }
-
@Test
public void testServiceCall() throws Exception {
getMockEndpoint("mock:result").expectedMessageCount(1);
@@ -52,8 +44,8 @@ public class ServiceCallEnvironmentRouteTest extends CamelTestSupport {
KubernetesConfigurationDefinition config = new KubernetesConfigurationDefinition();
config.setLookup("environment");
- // add the config to the registry so service call can use it
- registry.bind("myConfig", config);
+ // register configuration
+ context.setServiceCallConfiguration(config);
from("direct:start")
.serviceCall("cdi-camel-jetty")
http://git-wip-us.apache.org/repos/asf/camel/blob/0cdb8787/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallClientRouteTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallClientRouteTest.xml b/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallClientRouteTest.xml
index e9eda75..87162d9 100644
--- a/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallClientRouteTest.xml
+++ b/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallClientRouteTest.xml
@@ -25,7 +25,7 @@
<camelContext xmlns="http://camel.apache.org/schema/spring">
<!-- use client to lookup the service, which requires to setup a number of options -->
- <kubernetesConfiguration id="myConfig" masterUrl="http://172.28.128.80:8080" lookup="client"
+ <kubernetesConfiguration id="kubernetes" masterUrl="http://172.28.128.80:8080" lookup="client"
username="admin" password="admin" namespace="default" loadBalancerRef="roundrobin"/>
<route>
http://git-wip-us.apache.org/repos/asf/camel/blob/0cdb8787/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallEnvironmentRouteTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallEnvironmentRouteTest.xml b/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallEnvironmentRouteTest.xml
index 4546621..6f2f028 100644
--- a/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallEnvironmentRouteTest.xml
+++ b/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallEnvironmentRouteTest.xml
@@ -25,7 +25,7 @@
<camelContext xmlns="http://camel.apache.org/schema/spring">
<!-- use environment variables to lookup the service -->
- <kubernetesConfiguration id="myConfig" lookup="environment"/>
+ <kubernetesConfiguration id="kubernetes" lookup="environment"/>
<route>
<from uri="direct:start"/>
http://git-wip-us.apache.org/repos/asf/camel/blob/0cdb8787/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonProcessorFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonProcessorFactory.java b/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonProcessorFactory.java
index 3448527..e0821cf 100644
--- a/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonProcessorFactory.java
+++ b/components/camel-ribbon/src/main/java/org/apache/camel/component/ribbon/processor/RibbonProcessorFactory.java
@@ -26,6 +26,7 @@ import org.apache.camel.Processor;
import org.apache.camel.component.ribbon.RibbonConfiguration;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.PropertyDefinition;
+import org.apache.camel.model.remote.RibbonConfigurationDefinition;
import org.apache.camel.model.remote.ServiceCallConfigurationDefinition;
import org.apache.camel.model.remote.ServiceCallDefinition;
import org.apache.camel.spi.ProcessorFactory;
@@ -55,17 +56,26 @@ public class RibbonProcessorFactory implements ProcessorFactory {
String uri = sc.getUri();
ExchangePattern mep = sc.getPattern();
- ServiceCallConfigurationDefinition config = sc.getServiceCallConfiguration();
- ServiceCallConfigurationDefinition configRef = null;
+ RibbonConfigurationDefinition config = (RibbonConfigurationDefinition) sc.getServiceCallConfiguration();
+ RibbonConfigurationDefinition configRef = null;
if (sc.getServiceCallConfigurationRef() != null) {
- configRef = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), sc.getServiceCallConfigurationRef(), ServiceCallConfigurationDefinition.class);
+ // lookup in registry first
+ configRef = CamelContextHelper.lookup(routeContext.getCamelContext(), sc.getServiceCallConfigurationRef(), RibbonConfigurationDefinition.class);
+ if (configRef == null) {
+ // and fallback as service configuration
+ routeContext.getCamelContext().getServiceCallConfiguration(sc.getServiceCallConfigurationRef(), RibbonConfigurationDefinition.class);
+ }
}
- // if no configuration explicit configured then try to lookup in registry by type and find the best candidate to use
+ // if no configuration explicit configured then use default
if (config == null && configRef == null) {
- Set<ServiceCallConfigurationDefinition> set = routeContext.getCamelContext().getRegistry().findByType(ServiceCallConfigurationDefinition.class);
+ config = routeContext.getCamelContext().getServiceCallConfiguration(null, RibbonConfigurationDefinition.class);
+ }
+ if (config == null) {
+ // if no default then try to find if there configuration in the registry of the given type
+ Set<RibbonConfigurationDefinition> set = routeContext.getCamelContext().getRegistry().findByType(RibbonConfigurationDefinition.class);
if (set != null) {
- for (ServiceCallConfigurationDefinition candidate : set) {
+ for (RibbonConfigurationDefinition candidate : set) {
if (candidate.getComponent() == null || "ribbon".equals(candidate.getComponent())) {
config = candidate;
break;
@@ -74,15 +84,6 @@ public class RibbonProcessorFactory implements ProcessorFactory {
}
}
- // extract the properties from the configuration from the model
- Map<String, Object> parameters = new HashMap<>();
- if (configRef != null) {
- IntrospectionSupport.getProperties(configRef, parameters, null);
- }
- if (config != null) {
- IntrospectionSupport.getProperties(config, parameters, null);
- }
-
// component must either not be set, or if set then must be us
String component = config != null ? config.getComponent() : null;
if (component == null && configRef != null) {
@@ -92,6 +93,15 @@ public class RibbonProcessorFactory implements ProcessorFactory {
return null;
}
+ // extract the properties from the configuration from the model
+ Map<String, Object> parameters = new HashMap<>();
+ if (configRef != null) {
+ IntrospectionSupport.getProperties(configRef, parameters, null);
+ }
+ if (config != null) {
+ IntrospectionSupport.getProperties(config, parameters, null);
+ }
+
// and set them on the kubernetes configuration class
RibbonConfiguration rc = new RibbonConfiguration();
IntrospectionSupport.setProperties(rc, parameters);
http://git-wip-us.apache.org/repos/asf/camel/blob/0cdb8787/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallRegistryRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallRegistryRouteTest.java b/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallRegistryRouteTest.java
index 3a2c764..b1c7d4d 100644
--- a/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallRegistryRouteTest.java
+++ b/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallRegistryRouteTest.java
@@ -18,19 +18,10 @@ package org.apache.camel.component.ribbon.processor;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.JndiRegistry;
import org.apache.camel.model.remote.RibbonConfigurationDefinition;
public class RibbonServiceCallRegistryRouteTest extends RibbonServiceCallRouteTest {
- private JndiRegistry registry;
-
- @Override
- protected JndiRegistry createRegistry() throws Exception {
- registry = super.createRegistry();
- return registry;
- }
-
@Override
protected RoutesBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@@ -45,8 +36,8 @@ public class RibbonServiceCallRegistryRouteTest extends RibbonServiceCallRouteTe
RibbonConfigurationDefinition config = new RibbonConfigurationDefinition();
config.setServerListStrategy(servers);
- // add the config to the registry so service call can use it
- registry.bind("myConfig", config);
+ // register configuration
+ context.setServiceCallConfiguration(config);
from("direct:start")
.serviceCall("myService")
http://git-wip-us.apache.org/repos/asf/camel/blob/0cdb8787/components/camel-ribbon/src/test/resources/org/apache/camel/component/ribbon/processor/SpringRibbonServiceCallRouteTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-ribbon/src/test/resources/org/apache/camel/component/ribbon/processor/SpringRibbonServiceCallRouteTest.xml b/components/camel-ribbon/src/test/resources/org/apache/camel/component/ribbon/processor/SpringRibbonServiceCallRouteTest.xml
index a448e66..6b2df8d 100644
--- a/components/camel-ribbon/src/test/resources/org/apache/camel/component/ribbon/processor/SpringRibbonServiceCallRouteTest.xml
+++ b/components/camel-ribbon/src/test/resources/org/apache/camel/component/ribbon/processor/SpringRibbonServiceCallRouteTest.xml
@@ -32,7 +32,7 @@
<camelContext xmlns="http://camel.apache.org/schema/spring">
<!-- service call configuration to use ribbon -->
- <ribbonConfiguration id="myConfig" serverListStrategyRef="servers"/>
+ <ribbonConfiguration id="ribbon" serverListStrategyRef="servers"/>
<route>
<from uri="direct:start"/>