CAMEL-9683: Separate configuration of k8s and ribbon to have their own model.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ff68851c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ff68851c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ff68851c Branch: refs/heads/remoteServiceCall Commit: ff68851c09fe7e9a1c3d5baeb851faa611d88cca Parents: c97e816 Author: Claus Ibsen <davscl...@apache.org> Authored: Tue May 17 16:22:20 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Mon May 23 09:27:33 2016 +0200 ---------------------------------------------------------------------- .../KubernetesConfigurationDefinition.java | 320 +++++++++++++++++++ .../remote/RibbonConfigurationDefinition.java | 48 +++ .../ServiceCallConfigurationDefinition.java | 292 ++--------------- .../model/remote/ServiceCallDefinition.java | 18 +- .../org/apache/camel/model/remote/jaxb.index | 2 + .../blueprint/CamelContextFactoryBean.java | 6 +- .../processor/ServiceCallRouteTest.java | 4 +- .../processor/SpringServiceCallRouteTest.xml | 4 +- .../RibbonServiceCallKubernetesRouteTest.java | 56 ---- .../RibbonServiceCallRegistryRouteTest.java | 4 +- .../processor/RibbonServiceCallRouteTest.java | 2 +- .../RibbonServiceCallUpdateRouteTest.java | 2 +- .../SpringRibbonServiceCallRouteTest.xml | 2 +- .../camel/spring/CamelContextFactoryBean.java | 6 +- .../spring/handler/CamelNamespaceHandler.java | 8 +- 15 files changed, 425 insertions(+), 349 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/camel-core/src/main/java/org/apache/camel/model/remote/KubernetesConfigurationDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/remote/KubernetesConfigurationDefinition.java b/camel-core/src/main/java/org/apache/camel/model/remote/KubernetesConfigurationDefinition.java new file mode 100644 index 0000000..0a8726b --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/model/remote/KubernetesConfigurationDefinition.java @@ -0,0 +1,320 @@ +/** + * 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.model.remote; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +import org.apache.camel.spi.Metadata; + +/** + * Kubernetes remote service call configuration + */ +@Metadata(label = "eip,routing,remote") +@XmlRootElement(name = "kubernetesConfiguration") +@XmlAccessorType(XmlAccessType.FIELD) +public class KubernetesConfigurationDefinition extends ServiceCallConfigurationDefinition { + + @XmlAttribute + @Metadata(required = "true") + private String masterUrl; + @XmlAttribute + private String namespace; + @XmlAttribute + private String apiVersion; + @XmlAttribute @Metadata(label = "security") + private String username; + @XmlAttribute @Metadata(label = "security") + private String password; + @XmlAttribute @Metadata(label = "security") + private String oauthToken; + @XmlAttribute @Metadata(label = "security") + private String caCertData; + @XmlAttribute @Metadata(label = "security") + private String caCertFile; + @XmlAttribute @Metadata(label = "security") + private String clientCertData; + @XmlAttribute @Metadata(label = "security") + private String clientCertFile; + @XmlAttribute @Metadata(label = "security") + private String clientKeyAlgo; + @XmlAttribute @Metadata(label = "security") + private String clientKeyData; + @XmlAttribute @Metadata(label = "security") + private String clientKeyFile; + @XmlAttribute @Metadata(label = "security") + private String clientKeyPassphrase; + @XmlAttribute @Metadata(label = "security") + private Boolean trustCerts; + + public KubernetesConfigurationDefinition() { + } + + public KubernetesConfigurationDefinition(ServiceCallDefinition parent) { + super(parent); + } + + // Getter/Setter + // ------------------------------------------------------------------------- + + + public String getMasterUrl() { + return masterUrl; + } + + public void setMasterUrl(String masterUrl) { + this.masterUrl = masterUrl; + } + + public String getNamespace() { + return namespace; + } + + public void setNamespace(String namespace) { + this.namespace = namespace; + } + + public String getApiVersion() { + return apiVersion; + } + + public void setApiVersion(String apiVersion) { + this.apiVersion = apiVersion; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getOauthToken() { + return oauthToken; + } + + public void setOauthToken(String oauthToken) { + this.oauthToken = oauthToken; + } + + public String getCaCertData() { + return caCertData; + } + + public void setCaCertData(String caCertData) { + this.caCertData = caCertData; + } + + public String getCaCertFile() { + return caCertFile; + } + + public void setCaCertFile(String caCertFile) { + this.caCertFile = caCertFile; + } + + public String getClientCertData() { + return clientCertData; + } + + public void setClientCertData(String clientCertData) { + this.clientCertData = clientCertData; + } + + public String getClientCertFile() { + return clientCertFile; + } + + public void setClientCertFile(String clientCertFile) { + this.clientCertFile = clientCertFile; + } + + public String getClientKeyAlgo() { + return clientKeyAlgo; + } + + public void setClientKeyAlgo(String clientKeyAlgo) { + this.clientKeyAlgo = clientKeyAlgo; + } + + public String getClientKeyData() { + return clientKeyData; + } + + public void setClientKeyData(String clientKeyData) { + this.clientKeyData = clientKeyData; + } + + public String getClientKeyFile() { + return clientKeyFile; + } + + public void setClientKeyFile(String clientKeyFile) { + this.clientKeyFile = clientKeyFile; + } + + public String getClientKeyPassphrase() { + return clientKeyPassphrase; + } + + public void setClientKeyPassphrase(String clientKeyPassphrase) { + this.clientKeyPassphrase = clientKeyPassphrase; + } + + public Boolean getTrustCerts() { + return trustCerts; + } + + public void setTrustCerts(Boolean trustCerts) { + this.trustCerts = trustCerts; + } + + // Fluent API + // ------------------------------------------------------------------------- + + /** + * Sets the URL to the master + */ + public KubernetesConfigurationDefinition masterUrl(String masterUrl) { + setMasterUrl(masterUrl); + return this; + } + + /** + * Sets the namespace to use + */ + public KubernetesConfigurationDefinition namespace(String namespace) { + setNamespace(namespace); + return this; + } + + /** + * Sets the API version + */ + public KubernetesConfigurationDefinition apiVersion(String apiVersion) { + setApiVersion(apiVersion); + return this; + } + + /** + * Sets the username for authentication + */ + public KubernetesConfigurationDefinition username(String username) { + setUsername(username); + return this; + } + + /** + * Sets the password for authentication + */ + public KubernetesConfigurationDefinition password(String password) { + setPassword(password); + return this; + } + + /** + * Sets the OAUTH token for authentication (instead of username/password) + */ + public KubernetesConfigurationDefinition oauthToken(String oauthToken) { + setOauthToken(oauthToken); + return this; + } + + /** + * Sets the Certificate Authority data + */ + public KubernetesConfigurationDefinition caCertData(String caCertData) { + setCaCertData(caCertData); + return this; + } + + /** + * Sets the Certificate Authority data that are loaded from the file + */ + public KubernetesConfigurationDefinition caCertFile(String caCertFile) { + setCaCertFile(caCertFile); + return this; + } + + /** + * Sets the Client Certificate data + */ + public KubernetesConfigurationDefinition clientCertData(String clientCertData) { + setClientCertData(clientCertData); + return this; + } + + /** + * Sets the Client Certificate data that are loaded from the file + */ + public KubernetesConfigurationDefinition clientCertFile(String clientCertFile) { + setClientCertFile(clientCertFile); + return this; + } + + /** + * Sets the Client Keystore algorithm, such as RSA. + */ + public KubernetesConfigurationDefinition clientKeyAlgo(String clientKeyAlgo) { + setClientKeyAlgo(clientKeyAlgo); + return this; + } + + /** + * Sets the Client Keystore data + */ + public KubernetesConfigurationDefinition clientKeyData(String clientKeyData) { + setClientKeyData(clientKeyData); + return this; + } + + /** + * Sets the Client Keystore data that are loaded from the file + */ + public KubernetesConfigurationDefinition clientKeyFile(String clientKeyFile) { + setClientKeyFile(clientKeyFile); + return this; + } + + /** + * Sets the Client Keystore passphrase + */ + public KubernetesConfigurationDefinition clientKeyPassphrase(String clientKeyPassphrase) { + setClientKeyPassphrase(clientKeyPassphrase); + return this; + } + + /** + * Sets whether to turn on trust certificate check + */ + public KubernetesConfigurationDefinition trustCerts(boolean trustCerts) { + setTrustCerts(trustCerts); + return this; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/camel-core/src/main/java/org/apache/camel/model/remote/RibbonConfigurationDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/remote/RibbonConfigurationDefinition.java b/camel-core/src/main/java/org/apache/camel/model/remote/RibbonConfigurationDefinition.java new file mode 100644 index 0000000..2cc5ea2 --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/model/remote/RibbonConfigurationDefinition.java @@ -0,0 +1,48 @@ +/** + * 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.model.remote; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + +import org.apache.camel.spi.Metadata; + +/** + * Ribbon remote service call configuration + */ +@Metadata(label = "eip,routing,remote") +@XmlRootElement(name = "ribbonConfiguration") +@XmlAccessorType(XmlAccessType.FIELD) +public class RibbonConfigurationDefinition extends ServiceCallConfigurationDefinition { + + public RibbonConfigurationDefinition() { + } + + public RibbonConfigurationDefinition(ServiceCallDefinition parent) { + super(parent); + } + + // Getter/Setter + // ------------------------------------------------------------------------- + + + + // Fluent API + // ------------------------------------------------------------------------- + +} http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallConfigurationDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallConfigurationDefinition.java b/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallConfigurationDefinition.java index 6fb0363..4b51bd7 100644 --- a/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallConfigurationDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallConfigurationDefinition.java @@ -18,14 +18,18 @@ package org.apache.camel.model.remote; import java.util.ArrayList; import java.util.List; +import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; +import javax.xml.namespace.QName; import org.apache.camel.model.IdentifiedType; +import org.apache.camel.model.OtherAttributesAware; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.PropertyDefinition; import org.apache.camel.spi.Metadata; @@ -35,45 +39,15 @@ import org.apache.camel.spi.ServiceCallServerListStrategy; /** * Remote service call configuration */ -@Metadata(label = "eip,routing") +@Metadata(label = "eip,routing,remote") @XmlRootElement(name = "serviceCallConfiguration") @XmlAccessorType(XmlAccessType.FIELD) -public class ServiceCallConfigurationDefinition extends IdentifiedType { +public abstract class ServiceCallConfigurationDefinition extends IdentifiedType implements OtherAttributesAware { @XmlTransient private ServiceCallDefinition parent; @XmlAttribute private String component; - @XmlAttribute @Metadata(required = "true") - private String masterUrl; - @XmlAttribute - private String namespace; - @XmlAttribute - private String apiVersion; - @XmlAttribute @Metadata(label = "security") - private String username; - @XmlAttribute @Metadata(label = "security") - private String password; - @XmlAttribute @Metadata(label = "security") - private String oauthToken; - @XmlAttribute @Metadata(label = "security") - private String caCertData; - @XmlAttribute @Metadata(label = "security") - private String caCertFile; - @XmlAttribute @Metadata(label = "security") - private String clientCertData; - @XmlAttribute @Metadata(label = "security") - private String clientCertFile; - @XmlAttribute @Metadata(label = "security") - private String clientKeyAlgo; - @XmlAttribute @Metadata(label = "security") - private String clientKeyData; - @XmlAttribute @Metadata(label = "security") - private String clientKeyFile; - @XmlAttribute @Metadata(label = "security") - private String clientKeyPassphrase; - @XmlAttribute @Metadata(label = "security") - private Boolean trustCerts; @XmlAttribute private String loadBalancerRef; @XmlTransient @@ -84,6 +58,9 @@ public class ServiceCallConfigurationDefinition extends IdentifiedType { private ServiceCallServerListStrategy serverListStrategy; @XmlElement(name = "clientProperty") @Metadata(label = "advanced") private List<PropertyDefinition> properties; + // use xs:any to support optional property placeholders + @XmlAnyAttribute + private Map<QName, Object> otherAttributes; public ServiceCallConfigurationDefinition() { } @@ -95,7 +72,6 @@ public class ServiceCallConfigurationDefinition extends IdentifiedType { // Getter/Setter // ------------------------------------------------------------------------- - public String getComponent() { return component; } @@ -104,126 +80,6 @@ public class ServiceCallConfigurationDefinition extends IdentifiedType { this.component = component; } - public String getMasterUrl() { - return masterUrl; - } - - public void setMasterUrl(String masterUrl) { - this.masterUrl = masterUrl; - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - public String getApiVersion() { - return apiVersion; - } - - public void setApiVersion(String apiVersion) { - this.apiVersion = apiVersion; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getCaCertData() { - return caCertData; - } - - public void setCaCertData(String caCertData) { - this.caCertData = caCertData; - } - - public String getCaCertFile() { - return caCertFile; - } - - public void setCaCertFile(String caCertFile) { - this.caCertFile = caCertFile; - } - - public String getClientCertData() { - return clientCertData; - } - - public void setClientCertData(String clientCertData) { - this.clientCertData = clientCertData; - } - - public String getClientCertFile() { - return clientCertFile; - } - - public void setClientCertFile(String clientCertFile) { - this.clientCertFile = clientCertFile; - } - - public String getClientKeyAlgo() { - return clientKeyAlgo; - } - - public void setClientKeyAlgo(String clientKeyAlgo) { - this.clientKeyAlgo = clientKeyAlgo; - } - - public String getClientKeyData() { - return clientKeyData; - } - - public void setClientKeyData(String clientKeyData) { - this.clientKeyData = clientKeyData; - } - - public String getClientKeyFile() { - return clientKeyFile; - } - - public void setClientKeyFile(String clientKeyFile) { - this.clientKeyFile = clientKeyFile; - } - - public String getClientKeyPassphrase() { - return clientKeyPassphrase; - } - - public void setClientKeyPassphrase(String clientKeyPassphrase) { - this.clientKeyPassphrase = clientKeyPassphrase; - } - - public String getOauthToken() { - return oauthToken; - } - - public void setOauthToken(String oauthToken) { - this.oauthToken = oauthToken; - } - - public Boolean getTrustCerts() { - return trustCerts; - } - - public void setTrustCerts(Boolean trustCerts) { - this.trustCerts = trustCerts; - } - public String getLoadBalancerRef() { return loadBalancerRef; } @@ -264,6 +120,16 @@ public class ServiceCallConfigurationDefinition extends IdentifiedType { this.properties = properties; } + @Override + public Map<QName, Object> getOtherAttributes() { + return otherAttributes; + } + + @Override + public void setOtherAttributes(Map<QName, Object> otherAttributes) { + this.otherAttributes = otherAttributes; + } + // Fluent API // ------------------------------------------------------------------------- @@ -276,126 +142,6 @@ public class ServiceCallConfigurationDefinition extends IdentifiedType { } /** - * Sets the URL to the master - */ - public ServiceCallConfigurationDefinition masterUrl(String masterUrl) { - setMasterUrl(masterUrl); - return this; - } - - /** - * Sets the namespace to use - */ - public ServiceCallConfigurationDefinition namespace(String namespace) { - setNamespace(namespace); - return this; - } - - /** - * Sets the API version - */ - public ServiceCallConfigurationDefinition apiVersion(String apiVersion) { - setApiVersion(apiVersion); - return this; - } - - /** - * Sets the username for authentication - */ - public ServiceCallConfigurationDefinition username(String username) { - setUsername(username); - return this; - } - - /** - * Sets the password for authentication - */ - public ServiceCallConfigurationDefinition password(String password) { - setPassword(password); - return this; - } - - /** - * Sets the OAUTH token for authentication (instead of username/password) - */ - public ServiceCallConfigurationDefinition oauthToken(String oauthToken) { - setOauthToken(oauthToken); - return this; - } - - /** - * Sets the Certificate Authority data - */ - public ServiceCallConfigurationDefinition caCertData(String caCertData) { - setCaCertData(caCertData); - return this; - } - - /** - * Sets the Certificate Authority data that are loaded from the file - */ - public ServiceCallConfigurationDefinition caCertFile(String caCertFile) { - setCaCertFile(caCertFile); - return this; - } - - /** - * Sets the Client Certificate data - */ - public ServiceCallConfigurationDefinition clientCertData(String clientCertData) { - setClientCertData(clientCertData); - return this; - } - - /** - * Sets the Client Certificate data that are loaded from the file - */ - public ServiceCallConfigurationDefinition clientCertFile(String clientCertFile) { - setClientCertFile(clientCertFile); - return this; - } - - /** - * Sets the Client Keystore algorithm, such as RSA. - */ - public ServiceCallConfigurationDefinition clientKeyAlgo(String clientKeyAlgo) { - setClientKeyAlgo(clientKeyAlgo); - return this; - } - - /** - * Sets the Client Keystore data - */ - public ServiceCallConfigurationDefinition clientKeyData(String clientKeyData) { - setClientKeyData(clientKeyData); - return this; - } - - /** - * Sets the Client Keystore data that are loaded from the file - */ - public ServiceCallConfigurationDefinition clientKeyFile(String clientKeyFile) { - setClientKeyFile(clientKeyFile); - return this; - } - - /** - * Sets the Client Keystore passphrase - */ - public ServiceCallConfigurationDefinition clientKeyPassphrase(String clientKeyPassphrase) { - setClientKeyPassphrase(clientKeyPassphrase); - return this; - } - - /** - * Sets whether to turn on trust certificate check - */ - public ServiceCallConfigurationDefinition trustCerts(boolean trustCerts) { - setTrustCerts(trustCerts); - return this; - } - - /** * Sets a reference to a custom {@link org.apache.camel.spi.ServiceCallLoadBalancer} to use. */ public ServiceCallConfigurationDefinition loadBalancer(String loadBalancerRef) { http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallDefinition.java b/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallDefinition.java index c923128..c5b668c 100644 --- a/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/remote/ServiceCallDefinition.java @@ -126,13 +126,23 @@ public class ServiceCallDefinition extends NoOutputDefinition<ServiceCallDefinit } /** - * Configures the Service Call EIP + * Configures the Service Call EIP using Kubernetes * <p/> * Use <tt>end</tt> when configuration is complete, to return back to the Service Call EIP. */ - public ServiceCallConfigurationDefinition serviceCallConfiguration() { - serviceCallConfiguration = new ServiceCallConfigurationDefinition(this); - return serviceCallConfiguration; + public KubernetesConfigurationDefinition kubernetesConfiguration() { + serviceCallConfiguration = new KubernetesConfigurationDefinition(this); + return (KubernetesConfigurationDefinition) serviceCallConfiguration; + } + + /** + * Configures the Service Call EIP using Ribbon + * <p/> + * Use <tt>end</tt> when configuration is complete, to return back to the Service Call EIP. + */ + public RibbonConfigurationDefinition ribbonConfiguration() { + serviceCallConfiguration = new RibbonConfigurationDefinition(this); + return (RibbonConfigurationDefinition) serviceCallConfiguration; } /** http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/camel-core/src/main/resources/org/apache/camel/model/remote/jaxb.index ---------------------------------------------------------------------- diff --git a/camel-core/src/main/resources/org/apache/camel/model/remote/jaxb.index b/camel-core/src/main/resources/org/apache/camel/model/remote/jaxb.index index 498dc90..29147c2 100644 --- a/camel-core/src/main/resources/org/apache/camel/model/remote/jaxb.index +++ b/camel-core/src/main/resources/org/apache/camel/model/remote/jaxb.index @@ -14,5 +14,7 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## ------------------------------------------------------------------------ +KubernetesConfigurationDefinition +RibbonConfigurationDefinition ServiceCallDefinition ServiceCallConfigurationDefinition http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java ---------------------------------------------------------------------- diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java index 362f057..d04ca11 100644 --- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java +++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java @@ -58,7 +58,8 @@ import org.apache.camel.model.RouteContextRefDefinition; import org.apache.camel.model.RouteDefinition; import org.apache.camel.model.ThreadPoolProfileDefinition; import org.apache.camel.model.dataformat.DataFormatsDefinition; -import org.apache.camel.model.remote.ServiceCallConfigurationDefinition; +import org.apache.camel.model.remote.KubernetesConfigurationDefinition; +import org.apache.camel.model.remote.RibbonConfigurationDefinition; import org.apache.camel.model.rest.RestConfigurationDefinition; import org.apache.camel.model.rest.RestDefinition; import org.apache.camel.spi.PackageScanFilter; @@ -143,7 +144,8 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Blu private CamelStreamCachingStrategyDefinition camelStreamCachingStrategy; @XmlElements({ @XmlElement(name = "hystrixConfiguration", type = HystrixConfigurationDefinition.class, required = false), - @XmlElement(name = "serviceCallConfiguration", type = ServiceCallConfigurationDefinition.class, required = false), + @XmlElement(name = "kubernetesConfiguration", type = KubernetesConfigurationDefinition.class, required = false), + @XmlElement(name = "ribbonConfiguration", type = RibbonConfigurationDefinition.class, required = false), @XmlElement(name = "template", type = CamelProducerTemplateFactoryBean.class, required = false), @XmlElement(name = "consumerTemplate", type = CamelConsumerTemplateFactoryBean.class, required = false), @XmlElement(name = "proxy", type = CamelProxyFactoryBean.class, required = false), http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallRouteTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallRouteTest.java index 2c1ca37..b8bfdae 100644 --- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallRouteTest.java +++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/processor/ServiceCallRouteTest.java @@ -19,7 +19,7 @@ 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.ServiceCallConfigurationDefinition; +import org.apache.camel.model.remote.KubernetesConfigurationDefinition; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Ignore; import org.junit.Test; @@ -49,7 +49,7 @@ public class ServiceCallRouteTest extends CamelTestSupport { return new RouteBuilder() { @Override public void configure() throws Exception { - ServiceCallConfigurationDefinition config = new ServiceCallConfigurationDefinition(); + KubernetesConfigurationDefinition config = new KubernetesConfigurationDefinition(); config.setMasterUrl("https://fabric8-master.vagrant.f8:8443"); config.setUsername("admin"); config.setPassword("admin"); http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallRouteTest.xml ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallRouteTest.xml b/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallRouteTest.xml index 3cb0a2f..efab9d1 100644 --- a/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallRouteTest.xml +++ b/components/camel-kubernetes/src/test/resources/org/apache/camel/component/kubernetes/processor/SpringServiceCallRouteTest.xml @@ -25,8 +25,8 @@ <camelContext xmlns="http://camel.apache.org/schema/spring"> <!-- service call configuration to use ribbon --> - <serviceCallConfiguration id="myConfig" masterUrl="https://fabric8-master.vagrant.f8:8443" - username="admin" password="admin" namespace="default" loadBalancerRef="roundrobin"/> + <kubernetesConfiguration id="myConfig" masterUrl="https://fabric8-master.vagrant.f8:8443" + username="admin" password="admin" namespace="default" loadBalancerRef="roundrobin"/> <route> <from uri="direct:start"/> http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallKubernetesRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallKubernetesRouteTest.java b/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallKubernetesRouteTest.java deleted file mode 100644 index 2dff71c..0000000 --- a/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallKubernetesRouteTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * 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.processor; - -import org.apache.camel.RoutesBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.model.remote.ServiceCallConfigurationDefinition; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Ignore; -import org.junit.Test; - -@Ignore("Manual test") -public class RibbonServiceCallKubernetesRouteTest extends CamelTestSupport { - - @Test - public void testServiceCall() throws Exception { - getMockEndpoint("mock:result").expectedMessageCount(1); - - template.sendBody("direct:start", "Hello World"); - - assertMockEndpointsSatisfied(); - } - - @Override - protected RoutesBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - ServiceCallConfigurationDefinition config = new ServiceCallConfigurationDefinition(); - config.setMasterUrl("https://fabric8-master.vagrant.f8:8443"); - config.setUsername("admin"); - config.setPassword("admin"); - config.setNamespace("default"); - - from("direct:start") - .serviceCall("cdi-camel-jetty") - .to("mock:result"); - } - }; - } -} - http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/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 39e75ff..3a2c764 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 @@ -19,7 +19,7 @@ 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.ServiceCallConfigurationDefinition; +import org.apache.camel.model.remote.RibbonConfigurationDefinition; public class RibbonServiceCallRegistryRouteTest extends RibbonServiceCallRouteTest { @@ -42,7 +42,7 @@ public class RibbonServiceCallRegistryRouteTest extends RibbonServiceCallRouteTe servers.addServer("localhost", 9091); // configure camel service call - ServiceCallConfigurationDefinition config = new ServiceCallConfigurationDefinition(); + RibbonConfigurationDefinition config = new RibbonConfigurationDefinition(); config.setServerListStrategy(servers); // add the config to the registry so service call can use it http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallRouteTest.java b/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallRouteTest.java index 90134a3..a3abc29 100644 --- a/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallRouteTest.java +++ b/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallRouteTest.java @@ -48,7 +48,7 @@ public class RibbonServiceCallRouteTest extends CamelTestSupport { servers.addServer("localhost", 9091); from("direct:start") - .serviceCall().name("myService").serviceCallConfiguration().serverListStrategy(servers).end() + .serviceCall().name("myService").ribbonConfiguration().serverListStrategy(servers).end() .to("mock:result"); from("jetty:http://localhost:9090") http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallUpdateRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallUpdateRouteTest.java b/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallUpdateRouteTest.java index 589e830..a37f5bc 100644 --- a/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallUpdateRouteTest.java +++ b/components/camel-ribbon/src/test/java/org/apache/camel/component/ribbon/processor/RibbonServiceCallUpdateRouteTest.java @@ -73,7 +73,7 @@ public class RibbonServiceCallUpdateRouteTest extends CamelTestSupport { from("direct:start") .serviceCall().name("myService") // lets update quick so we do not have to sleep so much in the tests - .serviceCallConfiguration().serverListStrategy(servers).clientProperty("ServerListRefreshInterval", "250").end() + .ribbonConfiguration().serverListStrategy(servers).clientProperty("ServerListRefreshInterval", "250").end() .to("mock:result"); from("jetty:http://localhost:9090").routeId("9090") http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/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 a06a670..a448e66 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 --> - <serviceCallConfiguration id="myConfig" serverListStrategyRef="servers"/> + <ribbonConfiguration id="myConfig" serverListStrategyRef="servers"/> <route> <from uri="direct:start"/> http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java index 227cd2e..89d2502 100644 --- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java +++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java @@ -57,7 +57,8 @@ import org.apache.camel.model.RouteContextRefDefinition; import org.apache.camel.model.RouteDefinition; import org.apache.camel.model.ThreadPoolProfileDefinition; import org.apache.camel.model.dataformat.DataFormatsDefinition; -import org.apache.camel.model.remote.ServiceCallConfigurationDefinition; +import org.apache.camel.model.remote.KubernetesConfigurationDefinition; +import org.apache.camel.model.remote.RibbonConfigurationDefinition; import org.apache.camel.model.rest.RestConfigurationDefinition; import org.apache.camel.model.rest.RestDefinition; import org.apache.camel.spi.PackageScanFilter; @@ -153,7 +154,8 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr private CamelJMXAgentDefinition camelJMXAgent; @XmlElements({ @XmlElement(name = "hystrixConfiguration", type = HystrixConfigurationDefinition.class, required = false), - @XmlElement(name = "serviceCallConfiguration", type = ServiceCallConfigurationDefinition.class, required = false), + @XmlElement(name = "kubernetesConfiguration", type = KubernetesConfigurationDefinition.class, required = false), + @XmlElement(name = "ribbonConfiguration", type = RibbonConfigurationDefinition.class, required = false), @XmlElement(name = "template", type = CamelProducerTemplateFactoryBean.class, required = false), @XmlElement(name = "consumerTemplate", type = CamelConsumerTemplateFactoryBean.class, required = false), @XmlElement(name = "proxy", type = CamelProxyFactoryDefinition.class, required = false), http://git-wip-us.apache.org/repos/asf/camel/blob/ff68851c/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java index ae119ff..855d6d3 100644 --- a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java +++ b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java @@ -40,7 +40,8 @@ import org.apache.camel.impl.DefaultCamelContextNameStrategy; import org.apache.camel.model.FromDefinition; import org.apache.camel.model.HystrixConfigurationDefinition; import org.apache.camel.model.SendDefinition; -import org.apache.camel.model.remote.ServiceCallConfigurationDefinition; +import org.apache.camel.model.remote.KubernetesConfigurationDefinition; +import org.apache.camel.model.remote.RibbonConfigurationDefinition; import org.apache.camel.spi.CamelContextNameStrategy; import org.apache.camel.spi.NamespaceAware; import org.apache.camel.spring.CamelBeanPostProcessor; @@ -140,12 +141,13 @@ public class CamelNamespaceHandler extends NamespaceHandlerSupport { addBeanDefinitionParser("threadPool", CamelThreadPoolFactoryBean.class, true, true); addBeanDefinitionParser("redeliveryPolicyProfile", CamelRedeliveryPolicyFactoryBean.class, true, true); - // jmx agent, stream caching, hystrix, service call configuration and property placeholder cannot be used outside of the camel context + // jmx agent, stream caching, hystrix, service call configurations and property placeholder cannot be used outside of the camel context addBeanDefinitionParser("jmxAgent", CamelJMXAgentDefinition.class, false, false); addBeanDefinitionParser("streamCaching", CamelStreamCachingStrategyDefinition.class, false, false); addBeanDefinitionParser("propertyPlaceholder", CamelPropertyPlaceholderDefinition.class, false, false); addBeanDefinitionParser("hystrixConfiguration", HystrixConfigurationDefinition.class, false, false); - addBeanDefinitionParser("serviceCallConfiguration", ServiceCallConfigurationDefinition.class, false, false); + addBeanDefinitionParser("kubernetesConfiguration", KubernetesConfigurationDefinition.class, false, false); + addBeanDefinitionParser("ribbonConfiguration", RibbonConfigurationDefinition.class, false, false); // errorhandler could be the sub element of camelContext or defined outside camelContext BeanDefinitionParser errorHandlerParser = new ErrorHandlerDefinitionParser();