This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
commit cb5ec0b77de6de621b08de2e09b8df744cb46531 Author: Luca Burgazzoli <[email protected]> AuthorDate: Thu Jun 10 08:08:59 2021 +0200 yaml-dsl: remove support for configuring flow mode as it has been implemented in camel-quarkus --- .../camel/k/listener/YamlConfigurerConfigurer.java | 49 ------------------- .../org.apache.camel.k.listener.YamlConfigurer | 2 - .../apache/camel/k/listener/YamlConfigurer.java | 56 ---------------------- .../services/org.apache.camel.k.Runtime$Listener | 1 - .../camel/k/listener/YamlConfigurerTest.java | 50 ------------------- examples/kamelets-discovery/pom.xml | 4 +- itests/camel-k-itests-runtime/pom.xml | 4 ++ 7 files changed, 6 insertions(+), 160 deletions(-) diff --git a/camel-k-core/support/src/generated/java/org/apache/camel/k/listener/YamlConfigurerConfigurer.java b/camel-k-core/support/src/generated/java/org/apache/camel/k/listener/YamlConfigurerConfigurer.java deleted file mode 100644 index 39cade8..0000000 --- a/camel-k-core/support/src/generated/java/org/apache/camel/k/listener/YamlConfigurerConfigurer.java +++ /dev/null @@ -1,49 +0,0 @@ -/* Generated by camel build tools - do NOT edit this file! */ -package org.apache.camel.k.listener; - -import java.util.Map; - -import org.apache.camel.CamelContext; -import org.apache.camel.spi.ExtendedPropertyConfigurerGetter; -import org.apache.camel.spi.PropertyConfigurerGetter; -import org.apache.camel.spi.ConfigurerStrategy; -import org.apache.camel.spi.GeneratedPropertyConfigurer; -import org.apache.camel.util.CaseInsensitiveMap; -import org.apache.camel.k.listener.YamlConfigurer; - -/** - * Generated by camel build tools - do NOT edit this file! - */ -@SuppressWarnings("unchecked") -public class YamlConfigurerConfigurer extends org.apache.camel.support.component.PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { - - @Override - public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { - org.apache.camel.k.listener.YamlConfigurer target = (org.apache.camel.k.listener.YamlConfigurer) obj; - switch (ignoreCase ? name.toLowerCase() : name) { - case "deserializationmode": - case "DeserializationMode": target.setDeserializationMode(property(camelContext, java.lang.String.class, value)); return true; - default: return false; - } - } - - @Override - public Class<?> getOptionType(String name, boolean ignoreCase) { - switch (ignoreCase ? name.toLowerCase() : name) { - case "deserializationmode": - case "DeserializationMode": return java.lang.String.class; - default: return null; - } - } - - @Override - public Object getOptionValue(Object obj, String name, boolean ignoreCase) { - org.apache.camel.k.listener.YamlConfigurer target = (org.apache.camel.k.listener.YamlConfigurer) obj; - switch (ignoreCase ? name.toLowerCase() : name) { - case "deserializationmode": - case "DeserializationMode": return target.getDeserializationMode(); - default: return null; - } - } -} - diff --git a/camel-k-core/support/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.k.listener.YamlConfigurer b/camel-k-core/support/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.k.listener.YamlConfigurer deleted file mode 100644 index 88860b3..0000000 --- a/camel-k-core/support/src/generated/resources/META-INF/services/org/apache/camel/configurer/org.apache.camel.k.listener.YamlConfigurer +++ /dev/null @@ -1,2 +0,0 @@ -# Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.k.listener.YamlConfigurerConfigurer diff --git a/camel-k-core/support/src/main/java/org/apache/camel/k/listener/YamlConfigurer.java b/camel-k-core/support/src/main/java/org/apache/camel/k/listener/YamlConfigurer.java deleted file mode 100644 index 6b918f7..0000000 --- a/camel-k-core/support/src/main/java/org/apache/camel/k/listener/YamlConfigurer.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.k.listener; - -import org.apache.camel.k.Runtime; -import org.apache.camel.k.support.PropertiesSupport; -import org.apache.camel.spi.Configurer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@Configurer -public class YamlConfigurer extends AbstractPhaseListener { - public static final Logger LOGGER = LoggerFactory.getLogger(YamlConfigurer.class); - public static final String CAMEL_K_YAML_PROPERTIES_PREFIX = "camel.k.yaml."; - - private String deserializationMode = "FLOW"; - - public YamlConfigurer() { - super(Runtime.Phase.ConfigureContext); - } - - public String getDeserializationMode() { - return deserializationMode; - } - - public void setDeserializationMode(String deserializationMode) { - this.deserializationMode = deserializationMode; - } - - @Override - protected void accept(Runtime runtime) { - PropertiesSupport.bindProperties( - runtime.getCamelContext(), - this, - CAMEL_K_YAML_PROPERTIES_PREFIX, - true); - - runtime.getCamelContext().getGlobalOptions().put("CamelYamlDslDeserializationMode", getDeserializationMode()); - - LOGGER.info("CamelYamlDslDeserializationMode : {}", runtime.getCamelContext().getGlobalOption("CamelYamlDslDeserializationMode")); - } -} diff --git a/camel-k-core/support/src/main/resources/META-INF/services/org.apache.camel.k.Runtime$Listener b/camel-k-core/support/src/main/resources/META-INF/services/org.apache.camel.k.Runtime$Listener index 4701174..f0c50b7 100644 --- a/camel-k-core/support/src/main/resources/META-INF/services/org.apache.camel.k.Runtime$Listener +++ b/camel-k-core/support/src/main/resources/META-INF/services/org.apache.camel.k.Runtime$Listener @@ -16,6 +16,5 @@ # org.apache.camel.k.listener.ContextConfigurer -org.apache.camel.k.listener.YamlConfigurer org.apache.camel.k.listener.SourcesConfigurer org.apache.camel.k.listener.PropertiesConfigurer diff --git a/camel-k-core/support/src/test/java/org/apache/camel/k/listener/YamlConfigurerTest.java b/camel-k-core/support/src/test/java/org/apache/camel/k/listener/YamlConfigurerTest.java deleted file mode 100644 index 6336436..0000000 --- a/camel-k-core/support/src/test/java/org/apache/camel/k/listener/YamlConfigurerTest.java +++ /dev/null @@ -1,50 +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.k.listener; - -import org.apache.camel.CamelContext; -import org.apache.camel.impl.DefaultCamelContext; -import org.apache.camel.k.Runtime; -import org.junit.jupiter.api.Test; - -import static org.apache.camel.util.PropertiesHelper.asProperties; -import static org.assertj.core.api.Assertions.assertThat; - -public class YamlConfigurerTest { - @Test - public void yamlDeserializationModeShouldBeEnabledByDefault() { - CamelContext context = new DefaultCamelContext(); - - YamlConfigurer configuration = new YamlConfigurer(); - configuration.accept(Runtime.on(context)); - - assertThat(context.getGlobalOptions()).containsEntry("CamelYamlDslDeserializationMode", "FLOW"); - } - - @Test - public void yamlDeserializationModeShouldBeEnabledConfigurable() { - CamelContext context = new DefaultCamelContext(); - context.getPropertiesComponent().setInitialProperties(asProperties( - "camel.k.yaml.deserialization-mode", "CLASSIC" - )); - - YamlConfigurer configuration = new YamlConfigurer(); - configuration.accept(Runtime.on(context)); - - assertThat(context.getGlobalOptions()).containsEntry("CamelYamlDslDeserializationMode", "CLASSIC"); - } -} diff --git a/examples/kamelets-discovery/pom.xml b/examples/kamelets-discovery/pom.xml index 0b5f7a9..caa7c64 100644 --- a/examples/kamelets-discovery/pom.xml +++ b/examples/kamelets-discovery/pom.xml @@ -39,8 +39,8 @@ <artifactId>camel-k-runtime</artifactId> </dependency> <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-yaml-dsl</artifactId> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-yaml-dsl</artifactId> </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> diff --git a/itests/camel-k-itests-runtime/pom.xml b/itests/camel-k-itests-runtime/pom.xml index c6383f1..034c4c3 100644 --- a/itests/camel-k-itests-runtime/pom.xml +++ b/itests/camel-k-itests-runtime/pom.xml @@ -32,6 +32,10 @@ <groupId>org.apache.camel.k</groupId> <artifactId>camel-k-runtime</artifactId> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-yaml-dsl</artifactId> + </dependency> <dependency> <groupId>io.quarkus</groupId>
