Repository: camel Updated Branches: refs/heads/master a2b42aac2 -> 4941e7fac
http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/springboot/KubernetesReplicationControllersComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/springboot/KubernetesReplicationControllersComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/springboot/KubernetesReplicationControllersComponentAutoConfiguration.java new file mode 100644 index 0000000..36e6fb1 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/springboot/KubernetesReplicationControllersComponentAutoConfiguration.java @@ -0,0 +1,132 @@ +/** + * 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.kubernetes.replication_controllers.springboot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.kubernetes.replication_controllers.KubernetesReplicationControllersComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spi.HasId; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.GroupCondition; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.apache.camel.util.IntrospectionSupport; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@Conditional({ + ConditionalOnCamelContextAndAutoConfigurationBeans.class, + KubernetesReplicationControllersComponentAutoConfiguration.GroupConditions.class}) +@AutoConfigureAfter(CamelAutoConfiguration.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class, + KubernetesReplicationControllersComponentConfiguration.class}) +public class KubernetesReplicationControllersComponentAutoConfiguration { + + private static final Logger LOGGER = LoggerFactory + .getLogger(KubernetesReplicationControllersComponentAutoConfiguration.class); + @Autowired + private ApplicationContext applicationContext; + @Autowired + private CamelContext camelContext; + @Autowired + private KubernetesReplicationControllersComponentConfiguration configuration; + @Autowired(required = false) + private List<ComponentCustomizer<KubernetesReplicationControllersComponent>> customizers; + + static class GroupConditions extends GroupCondition { + public GroupConditions() { + super("camel.component", + "camel.component.kubernetes-replication-controllers"); + } + } + + @Lazy + @Bean(name = "kubernetes-replication-controllers-component") + @ConditionalOnMissingBean(KubernetesReplicationControllersComponent.class) + public KubernetesReplicationControllersComponent configureKubernetesReplicationControllersComponent() + throws Exception { + KubernetesReplicationControllersComponent component = new KubernetesReplicationControllersComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), component, parameters); + if (ObjectHelper.isNotEmpty(customizers)) { + for (ComponentCustomizer<KubernetesReplicationControllersComponent> customizer : customizers) { + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator + .evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.kubernetes-replication-controllers.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator + .evaluate(applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.kubernetes-replication-controllers.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } + } + } + return component; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/springboot/KubernetesReplicationControllersComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/springboot/KubernetesReplicationControllersComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/springboot/KubernetesReplicationControllersComponentConfiguration.java new file mode 100644 index 0000000..1c01f28 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/springboot/KubernetesReplicationControllersComponentConfiguration.java @@ -0,0 +1,51 @@ +/** + * 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.kubernetes.replication_controllers.springboot; + +import javax.annotation.Generated; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The Kubernetes Replication Controllers component provides a producer to + * execute kubernetes replication controller operations and a consumer to + * consume replication controller events. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.kubernetes-replication-controllers") +public class KubernetesReplicationControllersComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether the component should resolve property placeholders on itself when + * starting. Only properties which are of String type can use property + * placeholders. + */ + private Boolean resolvePropertyPlaceholders = true; + + public Boolean getResolvePropertyPlaceholders() { + return resolvePropertyPlaceholders; + } + + public void setResolvePropertyPlaceholders( + Boolean resolvePropertyPlaceholders) { + this.resolvePropertyPlaceholders = resolvePropertyPlaceholders; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/resources_quota/springboot/KubernetesResourcesQuotaComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/resources_quota/springboot/KubernetesResourcesQuotaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/resources_quota/springboot/KubernetesResourcesQuotaComponentAutoConfiguration.java new file mode 100644 index 0000000..3b2b52b --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/resources_quota/springboot/KubernetesResourcesQuotaComponentAutoConfiguration.java @@ -0,0 +1,132 @@ +/** + * 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.kubernetes.resources_quota.springboot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.kubernetes.resources_quota.KubernetesResourcesQuotaComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spi.HasId; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.GroupCondition; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.apache.camel.util.IntrospectionSupport; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@Conditional({ + ConditionalOnCamelContextAndAutoConfigurationBeans.class, + KubernetesResourcesQuotaComponentAutoConfiguration.GroupConditions.class}) +@AutoConfigureAfter(CamelAutoConfiguration.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class, + KubernetesResourcesQuotaComponentConfiguration.class}) +public class KubernetesResourcesQuotaComponentAutoConfiguration { + + private static final Logger LOGGER = LoggerFactory + .getLogger(KubernetesResourcesQuotaComponentAutoConfiguration.class); + @Autowired + private ApplicationContext applicationContext; + @Autowired + private CamelContext camelContext; + @Autowired + private KubernetesResourcesQuotaComponentConfiguration configuration; + @Autowired(required = false) + private List<ComponentCustomizer<KubernetesResourcesQuotaComponent>> customizers; + + static class GroupConditions extends GroupCondition { + public GroupConditions() { + super("camel.component", + "camel.component.kubernetes-resources-quota"); + } + } + + @Lazy + @Bean(name = "kubernetes-resources-quota-component") + @ConditionalOnMissingBean(KubernetesResourcesQuotaComponent.class) + public KubernetesResourcesQuotaComponent configureKubernetesResourcesQuotaComponent() + throws Exception { + KubernetesResourcesQuotaComponent component = new KubernetesResourcesQuotaComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), component, parameters); + if (ObjectHelper.isNotEmpty(customizers)) { + for (ComponentCustomizer<KubernetesResourcesQuotaComponent> customizer : customizers) { + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator + .evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.kubernetes-resources-quota.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator + .evaluate(applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.kubernetes-resources-quota.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } + } + } + return component; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/resources_quota/springboot/KubernetesResourcesQuotaComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/resources_quota/springboot/KubernetesResourcesQuotaComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/resources_quota/springboot/KubernetesResourcesQuotaComponentConfiguration.java new file mode 100644 index 0000000..3bd992c --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/resources_quota/springboot/KubernetesResourcesQuotaComponentConfiguration.java @@ -0,0 +1,50 @@ +/** + * 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.kubernetes.resources_quota.springboot; + +import javax.annotation.Generated; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The Kubernetes Resources Quota component provides a producer to execute + * kubernetes resources quota operations. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.kubernetes-resources-quota") +public class KubernetesResourcesQuotaComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether the component should resolve property placeholders on itself when + * starting. Only properties which are of String type can use property + * placeholders. + */ + private Boolean resolvePropertyPlaceholders = true; + + public Boolean getResolvePropertyPlaceholders() { + return resolvePropertyPlaceholders; + } + + public void setResolvePropertyPlaceholders( + Boolean resolvePropertyPlaceholders) { + this.resolvePropertyPlaceholders = resolvePropertyPlaceholders; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/secrets/springboot/KubernetesSecretsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/secrets/springboot/KubernetesSecretsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/secrets/springboot/KubernetesSecretsComponentAutoConfiguration.java new file mode 100644 index 0000000..b87874e --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/secrets/springboot/KubernetesSecretsComponentAutoConfiguration.java @@ -0,0 +1,130 @@ +/** + * 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.kubernetes.secrets.springboot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.kubernetes.secrets.KubernetesSecretsComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spi.HasId; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.GroupCondition; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.apache.camel.util.IntrospectionSupport; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class, + KubernetesSecretsComponentAutoConfiguration.GroupConditions.class}) +@AutoConfigureAfter(CamelAutoConfiguration.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class, + KubernetesSecretsComponentConfiguration.class}) +public class KubernetesSecretsComponentAutoConfiguration { + + private static final Logger LOGGER = LoggerFactory + .getLogger(KubernetesSecretsComponentAutoConfiguration.class); + @Autowired + private ApplicationContext applicationContext; + @Autowired + private CamelContext camelContext; + @Autowired + private KubernetesSecretsComponentConfiguration configuration; + @Autowired(required = false) + private List<ComponentCustomizer<KubernetesSecretsComponent>> customizers; + + static class GroupConditions extends GroupCondition { + public GroupConditions() { + super("camel.component", "camel.component.kubernetes-secrets"); + } + } + + @Lazy + @Bean(name = "kubernetes-secrets-component") + @ConditionalOnMissingBean(KubernetesSecretsComponent.class) + public KubernetesSecretsComponent configureKubernetesSecretsComponent() + throws Exception { + KubernetesSecretsComponent component = new KubernetesSecretsComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), component, parameters); + if (ObjectHelper.isNotEmpty(customizers)) { + for (ComponentCustomizer<KubernetesSecretsComponent> customizer : customizers) { + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator + .evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.kubernetes-secrets.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator + .evaluate(applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.kubernetes-secrets.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } + } + } + return component; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/secrets/springboot/KubernetesSecretsComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/secrets/springboot/KubernetesSecretsComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/secrets/springboot/KubernetesSecretsComponentConfiguration.java new file mode 100644 index 0000000..c8df844 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/secrets/springboot/KubernetesSecretsComponentConfiguration.java @@ -0,0 +1,50 @@ +/** + * 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.kubernetes.secrets.springboot; + +import javax.annotation.Generated; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The Kubernetes Secrets component provides a producer to execute kubernetes + * secret operations. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.kubernetes-secrets") +public class KubernetesSecretsComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether the component should resolve property placeholders on itself when + * starting. Only properties which are of String type can use property + * placeholders. + */ + private Boolean resolvePropertyPlaceholders = true; + + public Boolean getResolvePropertyPlaceholders() { + return resolvePropertyPlaceholders; + } + + public void setResolvePropertyPlaceholders( + Boolean resolvePropertyPlaceholders) { + this.resolvePropertyPlaceholders = resolvePropertyPlaceholders; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/services/springboot/KubernetesServicesComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/services/springboot/KubernetesServicesComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/services/springboot/KubernetesServicesComponentAutoConfiguration.java new file mode 100644 index 0000000..0317314 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/services/springboot/KubernetesServicesComponentAutoConfiguration.java @@ -0,0 +1,130 @@ +/** + * 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.kubernetes.services.springboot; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import org.apache.camel.CamelContext; +import org.apache.camel.component.kubernetes.services.KubernetesServicesComponent; +import org.apache.camel.spi.ComponentCustomizer; +import org.apache.camel.spi.HasId; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.ComponentConfigurationProperties; +import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; +import org.apache.camel.spring.boot.util.GroupCondition; +import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator; +import org.apache.camel.util.IntrospectionSupport; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +/** + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@Configuration +@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class, + KubernetesServicesComponentAutoConfiguration.GroupConditions.class}) +@AutoConfigureAfter(CamelAutoConfiguration.class) +@EnableConfigurationProperties({ComponentConfigurationProperties.class, + KubernetesServicesComponentConfiguration.class}) +public class KubernetesServicesComponentAutoConfiguration { + + private static final Logger LOGGER = LoggerFactory + .getLogger(KubernetesServicesComponentAutoConfiguration.class); + @Autowired + private ApplicationContext applicationContext; + @Autowired + private CamelContext camelContext; + @Autowired + private KubernetesServicesComponentConfiguration configuration; + @Autowired(required = false) + private List<ComponentCustomizer<KubernetesServicesComponent>> customizers; + + static class GroupConditions extends GroupCondition { + public GroupConditions() { + super("camel.component", "camel.component.kubernetes-services"); + } + } + + @Lazy + @Bean(name = "kubernetes-services-component") + @ConditionalOnMissingBean(KubernetesServicesComponent.class) + public KubernetesServicesComponent configureKubernetesServicesComponent() + throws Exception { + KubernetesServicesComponent component = new KubernetesServicesComponent(); + component.setCamelContext(camelContext); + Map<String, Object> parameters = new HashMap<>(); + IntrospectionSupport.getProperties(configuration, parameters, null, + false); + for (Map.Entry<String, Object> entry : parameters.entrySet()) { + Object value = entry.getValue(); + Class<?> paramClass = value.getClass(); + if (paramClass.getName().endsWith("NestedConfiguration")) { + Class nestedClass = null; + try { + nestedClass = (Class) paramClass.getDeclaredField( + "CAMEL_NESTED_CLASS").get(null); + HashMap<String, Object> nestedParameters = new HashMap<>(); + IntrospectionSupport.getProperties(value, nestedParameters, + null, false); + Object nestedProperty = nestedClass.newInstance(); + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), nestedProperty, + nestedParameters); + entry.setValue(nestedProperty); + } catch (NoSuchFieldException e) { + } + } + } + IntrospectionSupport.setProperties(camelContext, + camelContext.getTypeConverter(), component, parameters); + if (ObjectHelper.isNotEmpty(customizers)) { + for (ComponentCustomizer<KubernetesServicesComponent> customizer : customizers) { + boolean useCustomizer = (customizer instanceof HasId) + ? HierarchicalPropertiesEvaluator + .evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.kubernetes-services.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator + .evaluate(applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.kubernetes-services.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } + } + } + return component; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/services/springboot/KubernetesServicesComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/services/springboot/KubernetesServicesComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/services/springboot/KubernetesServicesComponentConfiguration.java new file mode 100644 index 0000000..bfe86c3 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/services/springboot/KubernetesServicesComponentConfiguration.java @@ -0,0 +1,50 @@ +/** + * 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.kubernetes.services.springboot; + +import javax.annotation.Generated; +import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The Kubernetes Service Accounts component provides a producer to execute + * service operations and a consumer to consume service events. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo") +@ConfigurationProperties(prefix = "camel.component.kubernetes-services") +public class KubernetesServicesComponentConfiguration + extends + ComponentConfigurationPropertiesCommon { + + /** + * Whether the component should resolve property placeholders on itself when + * starting. Only properties which are of String type can use property + * placeholders. + */ + private Boolean resolvePropertyPlaceholders = true; + + public Boolean getResolvePropertyPlaceholders() { + return resolvePropertyPlaceholders; + } + + public void setResolvePropertyPlaceholders( + Boolean resolvePropertyPlaceholders) { + this.resolvePropertyPlaceholders = resolvePropertyPlaceholders; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentConfiguration.java index edc583e..bef29c3 100644 --- a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentConfiguration.java @@ -21,7 +21,7 @@ import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; import org.springframework.boot.context.properties.ConfigurationProperties; /** - * The kubernetes component allows to work with Kubernetes PaaS. + * Use splitted kubernetes components instead of this composite component. * * Generated by camel-package-maven-plugin - do not edit this file! */ http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesCloudAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesCloudAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesCloudAutoConfiguration.java deleted file mode 100644 index 0124e32..0000000 --- a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesCloudAutoConfiguration.java +++ /dev/null @@ -1,107 +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.kubernetes.springboot.cloud; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.PostConstruct; - -import org.apache.camel.CamelContext; -import org.apache.camel.cloud.ServiceDiscovery; -import org.apache.camel.component.kubernetes.cloud.KubernetesServiceDiscoveryFactory; -import org.apache.camel.model.cloud.springboot.KubernetesServiceCallServiceDiscoveryConfigurationCommon; -import org.apache.camel.model.cloud.springboot.KubernetesServiceCallServiceDiscoveryConfigurationProperties; -import org.apache.camel.spring.boot.CamelAutoConfiguration; -import org.apache.camel.spring.boot.util.GroupCondition; -import org.apache.camel.util.IntrospectionSupport; -import org.springframework.beans.factory.BeanCreationException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.boot.autoconfigure.AutoConfigureAfter; -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Conditional; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Lazy; - -@Configuration -@ConditionalOnBean(CamelAutoConfiguration.class) -@Conditional(KubernetesCloudAutoConfiguration.Condition.class) -@AutoConfigureAfter(CamelAutoConfiguration.class) -@EnableConfigurationProperties(KubernetesServiceCallServiceDiscoveryConfigurationProperties.class) -public class KubernetesCloudAutoConfiguration { - @Autowired - private CamelContext camelContext; - @Autowired - private KubernetesServiceCallServiceDiscoveryConfigurationProperties configuration; - @Autowired - private ConfigurableBeanFactory beanFactory; - - @Lazy - @Bean(name = "kubernetes-service-discovery") - @ConditionalOnClass(CamelContext.class) - public ServiceDiscovery configureServiceDiscoveryFactory() throws Exception { - KubernetesServiceDiscoveryFactory factory = new KubernetesServiceDiscoveryFactory(); - - IntrospectionSupport.setProperties( - camelContext, - camelContext.getTypeConverter(), - factory, - IntrospectionSupport.getNonNullProperties(configuration)); - - return factory.newInstance(camelContext); - } - - @PostConstruct - public void postConstruct() { - if (beanFactory != null) { - Map<String, Object> parameters = new HashMap<>(); - - for (Map.Entry<String, KubernetesServiceCallServiceDiscoveryConfigurationCommon> entry : configuration.getConfigurations().entrySet()) { - // clean up params - parameters.clear(); - - // The instance factory - KubernetesServiceDiscoveryFactory factory = new KubernetesServiceDiscoveryFactory(); - - try { - IntrospectionSupport.getProperties(entry.getValue(), parameters, null, false); - IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), factory, parameters); - - beanFactory.registerSingleton(entry.getKey(), factory.newInstance(camelContext)); - } catch (Exception e) { - throw new BeanCreationException(entry.getKey(), e.getMessage(), e); - } - } - } - } - - // ******************************* - // Condition - // ******************************* - - public static class Condition extends GroupCondition { - public Condition() { - super( - "camel.cloud.kubernetes", - "camel.cloud.kubernetes.service-discovery" - ); - } - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json deleted file mode 100644 index ad5b211..0000000 --- a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "properties": [ - { - "defaultValue": true, - "name": "camel.component.kubernetes.enabled", - "description": "Enable kubernetes component", - "type": "java.lang.Boolean" - } - ] -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/resources/META-INF/spring.factories ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/resources/META-INF/spring.factories index 68b7ae9..4323838 100644 --- a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/resources/META-INF/spring.factories +++ b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/resources/META-INF/spring.factories @@ -14,6 +14,30 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --------------------------------------------------------------------------- + org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.component.kubernetes.services.springboot.KubernetesServicesComponentAutoConfiguration,\ +org.apache.camel.component.kubernetes.namespaces.springboot.KubernetesNamespacesComponentAutoConfiguration,\ +org.apache.camel.component.kubernetes.resources_quota.springboot.KubernetesResourcesQuotaComponentAutoConfiguration,\ +org.apache.camel.component.kubernetes.nodes.springboot.KubernetesNodesComponentAutoConfiguration,\ +org.apache.camel.component.kubernetes.builds.springboot.KubernetesBuildsComponentAutoConfiguration,\ +org.apache.camel.component.kubernetes.pods.springboot.KubernetesPodsComponentAutoConfiguration,\ +org.apache.camel.component.kubernetes.secrets.springboot.KubernetesSecretsComponentAutoConfiguration,\ org.apache.camel.component.kubernetes.springboot.KubernetesComponentAutoConfiguration,\ -org.apache.camel.component.kubernetes.springboot.cloud.KubernetesCloudAutoConfiguration +org.apache.camel.component.kubernetes.replication_controllers.springboot.KubernetesReplicationControllersComponentAutoConfiguration,\ +org.apache.camel.component.kubernetes.persistent_volumes.springboot.KubernetesPersistentVolumesComponentAutoConfiguration,\ +org.apache.camel.component.kubernetes.build_configs.springboot.KubernetesBuildConfigsComponentAutoConfiguration,\ +org.apache.camel.component.kubernetes.config_maps.springboot.KubernetesConfigMapsComponentAutoConfiguration,\ +org.apache.camel.component.kubernetes.persistent_volumes_claims.springboot.KubernetesPersistentVolumesClaimsComponentAutoConfiguration + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesServiceDiscoveryDisabledTest.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesServiceDiscoveryDisabledTest.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesServiceDiscoveryDisabledTest.java deleted file mode 100644 index 79f7a84..0000000 --- a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesServiceDiscoveryDisabledTest.java +++ /dev/null @@ -1,64 +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.kubernetes.springboot.cloud; - -import java.util.Map; - -import org.apache.camel.cloud.ServiceDiscovery; -import org.apache.camel.model.cloud.springboot.KubernetesServiceCallServiceDiscoveryConfigurationProperties; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Configuration; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@DirtiesContext -@SpringBootApplication -@SpringBootTest( - classes = { - KubernetesServiceDiscoveryEnabledTest.TestConfiguration.class - }, - properties = { - "debug=false", - "camel.cloud.kubernetes.service-discovery.enabled=false" -}) -public class KubernetesServiceDiscoveryDisabledTest { - @Autowired - ApplicationContext context; - - @Test - public void testConfiguration() throws Exception { - Map<String, ?> beans; - - beans = context.getBeansOfType(KubernetesServiceCallServiceDiscoveryConfigurationProperties.class); - Assert.assertTrue(beans.isEmpty()); - - beans = context.getBeansOfType(ServiceDiscovery.class); - Assert.assertFalse(beans.isEmpty()); - Assert.assertFalse(beans.containsKey("kubernetes-service-discovery")); - } - - @Configuration - public static class TestConfiguration { - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesServiceDiscoveryEnabledTest.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesServiceDiscoveryEnabledTest.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesServiceDiscoveryEnabledTest.java deleted file mode 100644 index 19e4c80..0000000 --- a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesServiceDiscoveryEnabledTest.java +++ /dev/null @@ -1,65 +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.kubernetes.springboot.cloud; - -import java.util.Map; - -import org.apache.camel.cloud.ServiceDiscovery; -import org.apache.camel.model.cloud.springboot.KubernetesServiceCallServiceDiscoveryConfigurationProperties; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.Configuration; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@DirtiesContext -@SpringBootApplication -@SpringBootTest( - classes = { - KubernetesServiceDiscoveryEnabledTest.TestConfiguration.class - }, - properties = { - "debug=false", - "camel.cloud.kubernetes.service-discovery.enabled=true" -}) -public class KubernetesServiceDiscoveryEnabledTest { - @Autowired - ApplicationContext context; - - @Test - public void testConfiguration() throws Exception { - Map<String, ?> beans; - - beans = context.getBeansOfType(KubernetesServiceCallServiceDiscoveryConfigurationProperties.class); - Assert.assertFalse(beans.isEmpty()); - Assert.assertEquals(1, beans.size()); - - beans = context.getBeansOfType(ServiceDiscovery.class); - Assert.assertFalse(beans.isEmpty()); - Assert.assertTrue(beans.containsKey("kubernetes-service-discovery")); - } - - @Configuration - public static class TestConfiguration { - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/resources/application.properties ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/resources/application.properties b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/resources/application.properties deleted file mode 100644 index 33406d2..0000000 --- a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.main.banner-mode=off http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/resources/logback.xml ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/resources/logback.xml b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/resources/logback.xml deleted file mode 100644 index 51f53c7..0000000 --- a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/test/resources/logback.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ---> -<configuration> - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <!-- encoders are assigned the type - ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> - <encoder> - <pattern>%d{HH:mm:ss.SSS} [%-15.15thread] %-5level %-30.30logger - %msg%n</pattern> - </encoder> - </appender> - - <appender name="FILE" class="ch.qos.logback.core.FileAppender"> - <encoder> - <pattern>%d{HH:mm:ss.SSS} [%-15.15thread] %-5level %-30.30logger - %msg%n</pattern> - </encoder> - <file>target/camel-kubernetes-starter-test.log</file> - </appender> - - <root level="INFO"> - <appender-ref ref="FILE"/> - </root> - -</configuration> \ No newline at end of file
