[camel-k-runtime] branch master updated: chore: fix readme badges
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new a221fa2 chore: fix readme badges a221fa2 is described below commit a221fa2061e9049bee87556cee78277269609e16 Author: Luca Burgazzoli AuthorDate: Tue Nov 10 12:10:53 2020 +0100 chore: fix readme badges --- README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index 372373b..b783a6b 100644 --- a/README.adoc +++ b/README.adoc @@ -1,7 +1,7 @@ Apache Camel K Runtime == -image:https://img.shields.io/maven-central/v/org.apache.camel.k/camel-k-runtime.svg["Maven Central", link="http://search.maven.org/#search%7Cga%7C1%7Corg.apache.camel.k";] +image:https://img.shields.io/maven-central/v/org.apache.camel.k/camel-k-runtime-bom.svg["Maven Central", link="http://search.maven.org/#search%7Cga%7C1%7Corg.apache.camel.k";] image:https://img.shields.io/github/license/openshift/origin.svg?maxAge=2592000["Licensed under Apache License version 2.0", link="https://www.apache.org/licenses/LICENSE-2.0";] image:https://img.shields.io/badge/zulip-join_chat-brightgreen.svg["Chat on Zulip", link="https://camel.zulipchat.com";] image:https://github.com/apache/camel-k-runtime/workflows/Build/badge.svg["Build Status", link="https://github.com/apache/camel-k-runtime/actions?query=workflow%3ABuild";]
[camel-k-runtime] branch master updated: chore: fix readme badges
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new a221fa2 chore: fix readme badges a221fa2 is described below commit a221fa2061e9049bee87556cee78277269609e16 Author: Luca Burgazzoli AuthorDate: Tue Nov 10 12:10:53 2020 +0100 chore: fix readme badges --- README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index 372373b..b783a6b 100644 --- a/README.adoc +++ b/README.adoc @@ -1,7 +1,7 @@ Apache Camel K Runtime == -image:https://img.shields.io/maven-central/v/org.apache.camel.k/camel-k-runtime.svg["Maven Central", link="http://search.maven.org/#search%7Cga%7C1%7Corg.apache.camel.k";] +image:https://img.shields.io/maven-central/v/org.apache.camel.k/camel-k-runtime-bom.svg["Maven Central", link="http://search.maven.org/#search%7Cga%7C1%7Corg.apache.camel.k";] image:https://img.shields.io/github/license/openshift/origin.svg?maxAge=2592000["Licensed under Apache License version 2.0", link="https://www.apache.org/licenses/LICENSE-2.0";] image:https://img.shields.io/badge/zulip-join_chat-brightgreen.svg["Chat on Zulip", link="https://camel.zulipchat.com";] image:https://github.com/apache/camel-k-runtime/workflows/Build/badge.svg["Build Status", link="https://github.com/apache/camel-k-runtime/actions?query=workflow%3ABuild";]
[camel-k-runtime] branch master updated: chore: fix readme badges
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new a221fa2 chore: fix readme badges a221fa2 is described below commit a221fa2061e9049bee87556cee78277269609e16 Author: Luca Burgazzoli AuthorDate: Tue Nov 10 12:10:53 2020 +0100 chore: fix readme badges --- README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index 372373b..b783a6b 100644 --- a/README.adoc +++ b/README.adoc @@ -1,7 +1,7 @@ Apache Camel K Runtime == -image:https://img.shields.io/maven-central/v/org.apache.camel.k/camel-k-runtime.svg["Maven Central", link="http://search.maven.org/#search%7Cga%7C1%7Corg.apache.camel.k";] +image:https://img.shields.io/maven-central/v/org.apache.camel.k/camel-k-runtime-bom.svg["Maven Central", link="http://search.maven.org/#search%7Cga%7C1%7Corg.apache.camel.k";] image:https://img.shields.io/github/license/openshift/origin.svg?maxAge=2592000["Licensed under Apache License version 2.0", link="https://www.apache.org/licenses/LICENSE-2.0";] image:https://img.shields.io/badge/zulip-join_chat-brightgreen.svg["Chat on Zulip", link="https://camel.zulipchat.com";] image:https://github.com/apache/camel-k-runtime/workflows/Build/badge.svg["Build Status", link="https://github.com/apache/camel-k-runtime/actions?query=workflow%3ABuild";]
[camel-k-runtime] 02/04: Remove initial properties method from Runtime
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit f58f929245bbf60cc58f51296d7f1f33b7c42e66 Author: Luca Burgazzoli AuthorDate: Tue Nov 10 09:50:37 2020 +0100 Remove initial properties method from Runtime --- .../src/main/java/org/apache/camel/k/Runtime.java | 34 -- .../apache/camel/k/support/DelegatingRuntime.java | 26 - .../org/apache/camel/k/quarkus/Application.java| 5 3 files changed, 65 deletions(-) diff --git a/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java b/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java index b194804..f22e475 100644 --- a/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java +++ b/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java @@ -16,12 +16,9 @@ */ package org.apache.camel.k; -import java.util.Arrays; -import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Properties; -import java.util.stream.Collectors; import org.apache.camel.CamelContext; import org.apache.camel.Ordered; @@ -45,23 +42,6 @@ public interface Runtime extends HasCamelContext, AutoCloseable { return getCamelContext().getRegistry(); } -default void setInitialProperties(Properties properties) { - getCamelContext().getPropertiesComponent().setInitialProperties(properties); -} - -default void setInitialProperties(Map properties) { -Properties p = new Properties(); -p.putAll(properties); - -setInitialProperties(p); -} - -default void setInitialProperties(String key, String value, String... keyVals) { -setInitialProperties( -mapOf(HashMap::new, key, value, keyVals) -); -} - default void setProperties(Properties properties) { getCamelContext().getPropertiesComponent().setOverrideProperties(properties); } @@ -87,20 +67,6 @@ public interface Runtime extends HasCamelContext, AutoCloseable { } } -default void setPropertiesLocations(Collection locations) { -getCamelContext().getPropertiesComponent().setLocation( -locations.stream() -.map(location -> location.startsWith("file:") ? location : "file:" + location) -.distinct() -.sorted() -.collect(Collectors.joining(",")) -); -} - -default void setPropertiesLocations(String... locations) { -setPropertiesLocations(Arrays.asList(locations)); -} - /** * Lifecycle method used to stops the entire integration. */ diff --git a/camel-k-core/support/src/main/java/org/apache/camel/k/support/DelegatingRuntime.java b/camel-k-core/support/src/main/java/org/apache/camel/k/support/DelegatingRuntime.java index 9cce10f..c853d77 100644 --- a/camel-k-core/support/src/main/java/org/apache/camel/k/support/DelegatingRuntime.java +++ b/camel-k-core/support/src/main/java/org/apache/camel/k/support/DelegatingRuntime.java @@ -16,7 +16,6 @@ */ package org.apache.camel.k.support; -import java.util.Collection; import java.util.Map; import java.util.Properties; @@ -43,21 +42,6 @@ public class DelegatingRuntime implements Runtime { } @Override -public void setInitialProperties(Properties properties) { -runtime.setInitialProperties(properties); -} - -@Override -public void setInitialProperties(Map properties) { -runtime.setInitialProperties(properties); -} - -@Override -public void setInitialProperties(String key, String value, String... keyVals) { -runtime.setInitialProperties(key, value, keyVals); -} - -@Override public void setProperties(Properties properties) { runtime.setProperties(properties); } @@ -78,16 +62,6 @@ public class DelegatingRuntime implements Runtime { } @Override -public void setPropertiesLocations(Collection locations) { -runtime.setPropertiesLocations(locations); -} - -@Override -public void setPropertiesLocations(String... locations) { -runtime.setPropertiesLocations(locations); -} - -@Override public void stop() throws Exception { runtime.stop(); } diff --git a/camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/Application.java b/camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/Application.java index 91c89b8..50da099 100644 --- a/camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/Application.java +++ b/camel-k-runtime/runtime/src/main/java/org/apache/camel/k/quarkus/Application.java @@ -64,11 +64,6 @@ public final class Application { } @Override -public void setInitialProperties(Properties properties) { -mai
[camel-k-runtime] branch master updated (1c51d30 -> 8ccfd07)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git. from 1c51d30 Updated CHANGELOG.md new b9719f2 Leveragte MP Config to load application and user properties new f58f929 Remove initial properties method from Runtime new a9c1eab Add jvadoc to Runtime new 8ccfd07 Cleanup SourceLoader The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../src/main/java/org/apache/camel/k/Runtime.java | 74 +++ .../main/java/org/apache/camel/k/SourceLoader.java | 1 - .../camel/k/listener/PropertiesConfigurer.java | 8 -- .../apache/camel/k/support/DelegatingRuntime.java | 26 -- .../apache/camel/k/support/PropertiesSupport.java | 103 - .../org/apache/camel/k/support/RuntimeSupport.java | 84 + .../org/apache/camel/k/quarkus/Application.java| 5 - .../k/quarkus/ApplicationConfigSourceProvider.java | 21 ++--- .../org/apache/camel/k/quarkus/it/Application.java | 24 + .../org/apache/camel/k/quarkus/it/RuntimeTest.java | 23 + .../src/test/resources/conf.d/003/flat-property| 1 + 11 files changed, 134 insertions(+), 236 deletions(-) create mode 100644 itests/camel-k-itests-runtime/src/test/resources/conf.d/003/flat-property
[camel-k-runtime] 01/04: Leveragte MP Config to load application and user properties
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit b9719f275aa8502e487f0ccb2c30e03a8a012130 Author: Luca Burgazzoli AuthorDate: Tue Nov 10 09:41:20 2020 +0100 Leveragte MP Config to load application and user properties --- .../camel/k/listener/PropertiesConfigurer.java | 8 -- .../apache/camel/k/support/PropertiesSupport.java | 103 - .../org/apache/camel/k/support/RuntimeSupport.java | 84 + .../k/quarkus/ApplicationConfigSourceProvider.java | 21 ++--- .../org/apache/camel/k/quarkus/it/Application.java | 24 + .../org/apache/camel/k/quarkus/it/RuntimeTest.java | 23 + .../src/test/resources/conf.d/003/flat-property| 1 + 7 files changed, 97 insertions(+), 167 deletions(-) diff --git a/camel-k-core/support/src/main/java/org/apache/camel/k/listener/PropertiesConfigurer.java b/camel-k-core/support/src/main/java/org/apache/camel/k/listener/PropertiesConfigurer.java index 5baeb4a..2dadca5 100644 --- a/camel-k-core/support/src/main/java/org/apache/camel/k/listener/PropertiesConfigurer.java +++ b/camel-k-core/support/src/main/java/org/apache/camel/k/listener/PropertiesConfigurer.java @@ -20,7 +20,6 @@ import org.apache.camel.Ordered; import org.apache.camel.k.Runtime; import org.apache.camel.k.support.Constants; import org.apache.camel.k.support.KubernetesPropertiesFunction; -import org.apache.camel.k.support.PropertiesSupport; public class PropertiesConfigurer extends AbstractPhaseListener { public PropertiesConfigurer() { @@ -34,13 +33,6 @@ public class PropertiesConfigurer extends AbstractPhaseListener { @Override protected void accept(Runtime runtime) { -runtime.setInitialProperties( -PropertiesSupport.loadApplicationProperties() -); -runtime.setPropertiesLocations( -PropertiesSupport.resolveUserPropertiesLocations() -); - // // Register properties functions to resolve k8s secrets or config maps like: // diff --git a/camel-k-core/support/src/main/java/org/apache/camel/k/support/PropertiesSupport.java b/camel-k-core/support/src/main/java/org/apache/camel/k/support/PropertiesSupport.java index b88d64d..43a93e4 100644 --- a/camel-k-core/support/src/main/java/org/apache/camel/k/support/PropertiesSupport.java +++ b/camel-k-core/support/src/main/java/org/apache/camel/k/support/PropertiesSupport.java @@ -16,22 +16,9 @@ */ package org.apache.camel.k.support; -import java.io.IOException; -import java.io.Reader; -import java.nio.file.FileVisitResult; -import java.nio.file.FileVisitor; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.SimpleFileVisitor; -import java.nio.file.attribute.BasicFileAttributes; -import java.util.Collection; import java.util.HashMap; -import java.util.LinkedHashSet; import java.util.Map; -import java.util.Objects; import java.util.Properties; -import java.util.Set; import java.util.function.Predicate; import org.apache.camel.CamelContext; @@ -41,7 +28,6 @@ import org.apache.camel.spi.PropertiesComponent; import org.apache.camel.spi.PropertyConfigurer; import org.apache.camel.support.PropertyBindingSupport; import org.apache.camel.support.service.ServiceHelper; -import org.apache.camel.util.ObjectHelper; public final class PropertiesSupport { private PropertiesSupport() { @@ -103,93 +89,4 @@ public final class PropertiesSupport { return target; } -public static String resolveApplicationPropertiesLocation() { -return System.getProperty(Constants.PROPERTY_CAMEL_K_CONF, System.getenv(Constants.ENV_CAMEL_K_CONF)); -} - -public static Properties loadApplicationProperties() { -final String conf = resolveApplicationPropertiesLocation(); -final Properties properties = new Properties(); - -if (ObjectHelper.isEmpty(conf)) { -return properties; -} - -try { -Path confPath = Paths.get(conf); - -if (Files.exists(confPath)) { -try (Reader reader = Files.newBufferedReader(confPath)) { -properties.load(reader); -} -} -} catch (IOException e) { -throw new RuntimeException(e); -} - -return properties; -} - -public static String resolveUserPropertiesLocation() { -return System.getProperty(Constants.PROPERTY_CAMEL_K_CONF_D, System.getenv(Constants.ENV_CAMEL_K_CONF_D)); -} - -public static Properties loadUserProperties() { -final Properties properties = new Properties(); - -try { -for (String location: resolveUserPropertiesLocations()) { -try (Reader reader = Files.newBufferedReader(Paths.get(location
[camel-k-runtime] 03/04: Add jvadoc to Runtime
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit a9c1eabfc25814c3cb476014f92bd00c3d181f47 Author: Luca Burgazzoli AuthorDate: Tue Nov 10 09:58:02 2020 +0100 Add jvadoc to Runtime --- .../src/main/java/org/apache/camel/k/Runtime.java | 40 -- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java b/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java index f22e475..9b301a6 100644 --- a/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java +++ b/camel-k-core/api/src/main/java/org/apache/camel/k/Runtime.java @@ -30,7 +30,14 @@ import org.apache.camel.spi.Registry; import static org.apache.camel.util.CollectionHelper.mapOf; public interface Runtime extends HasCamelContext, AutoCloseable { - +/** + * Returns the camel context adapting it to the specialized type. + * + * @see HasCamelContext#getCamelContext() + * @see CamelContext#adapt(Class) + * + * @return the camel context. + */ default T getCamelContext(Class type) { return getCamelContext().adapt(type); } @@ -42,10 +49,22 @@ public interface Runtime extends HasCamelContext, AutoCloseable { return getCamelContext().getRegistry(); } +/** + * Sets a special list of properties that take precedence and will use first, if a property exist. + * + * @see org.apache.camel.spi.PropertiesComponent#setOverrideProperties(Properties) + * @param properties the properties to set + */ default void setProperties(Properties properties) { getCamelContext().getPropertiesComponent().setOverrideProperties(properties); } +/** + * Sets a special list of properties that take precedence and will use first, if a property exist. + * + * @see org.apache.camel.spi.PropertiesComponent#setOverrideProperties(Properties) + * @param properties the properties to set + */ default void setProperties(Map properties) { Properties p = new Properties(); p.putAll(properties); @@ -53,12 +72,27 @@ public interface Runtime extends HasCamelContext, AutoCloseable { setProperties(p); } -default void setProperties(String key, String value, String... keyVals) { +/** + * Sets a special list of properties that take precedence and will use first, if a property exist. + * + * @see org.apache.camel.spi.PropertiesComponent#setOverrideProperties(Properties) + * @param key the mapping's key + * @param value the mapping's value + * @param entries containing the keys and values from which the map is populated + * + */ +default void setProperties(String key, String value, String... entries) { setProperties( -mapOf(HashMap::new, key, value, keyVals) +mapOf(HashMap::new, key, value, entries) ); } +/** + * Sets a special list of properties that take precedence and will use first, if a property exist. + * + * @see org.apache.camel.spi.PropertiesComponent#setOverrideProperties(Properties) + * @param builder the builder which will create the routes + */ default void addRoutes(RoutesBuilder builder) { try { getCamelContext().addRoutes(builder);
[camel-k-runtime] 04/04: Cleanup SourceLoader
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit 8ccfd0799e72c14ec253591d3cedfc67626e5920 Author: Luca Burgazzoli AuthorDate: Tue Nov 10 09:59:07 2020 +0100 Cleanup SourceLoader --- camel-k-core/api/src/main/java/org/apache/camel/k/SourceLoader.java | 1 - 1 file changed, 1 deletion(-) diff --git a/camel-k-core/api/src/main/java/org/apache/camel/k/SourceLoader.java b/camel-k-core/api/src/main/java/org/apache/camel/k/SourceLoader.java index 0b15130..602de98 100644 --- a/camel-k-core/api/src/main/java/org/apache/camel/k/SourceLoader.java +++ b/camel-k-core/api/src/main/java/org/apache/camel/k/SourceLoader.java @@ -34,7 +34,6 @@ public interface SourceLoader { * @param runtime the runtime. * @param source the source to load. * @return the RoutesBuilder. - * @throws Exception */ RoutesBuilder load(Runtime runtime, Source source);
[camel-k-runtime] branch master updated: build(deps-dev): bump spock-core
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new 15bad32 build(deps-dev): bump spock-core 15bad32 is described below commit 15bad326252f47a116f67f1bf6db0a15fd27be8f Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> AuthorDate: Mon Nov 2 20:04:52 2020 + build(deps-dev): bump spock-core Bumps spock-core from 2.0-M3-groovy-3.0 to 2.0-M4-groovy-3.0. Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index da193ed..ffef518 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ 0.9.13 3.0.6 1.4.10 -2.0-M3-groovy-3.0 +2.0-M4-groovy-3.0 2.3.1 2.3.0.1 2.8.8
[camel-k-runtime] branch master updated: kamelet: ensure URL encoded values is properly handled
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new ee0e96e kamelet: ensure URL encoded values is properly handled ee0e96e is described below commit ee0e96eb5184355344db623f20de2f172f43466b Author: Luca Burgazzoli AuthorDate: Fri Oct 30 18:08:45 2020 +0100 kamelet: ensure URL encoded values is properly handled --- .../camel/component/kamelet/KameletComponent.java | 115 ++--- .../component/kamelet/KameletPropertiesTest.java | 16 +++ 2 files changed, 116 insertions(+), 15 deletions(-) diff --git a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java index 6908f30..7f243af 100644 --- a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java +++ b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java @@ -16,6 +16,7 @@ */ package org.apache.camel.component.kamelet; +import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -23,6 +24,7 @@ import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.camel.AfterPropertiesConfigured; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.RuntimeCamelException; @@ -33,10 +35,11 @@ import org.apache.camel.spi.Metadata; import org.apache.camel.spi.PropertiesComponent; import org.apache.camel.spi.annotations.Component; import org.apache.camel.support.DefaultComponent; +import org.apache.camel.support.DefaultEndpoint; import org.apache.camel.support.LifecycleStrategySupport; import org.apache.camel.support.service.ServiceHelper; -import org.apache.camel.util.StringHelper; import org.apache.camel.util.URISupport; +import org.apache.camel.util.UnsafeUriCharactersEncoder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -65,6 +68,102 @@ public class KameletComponent extends DefaultComponent { } @Override +public Endpoint createEndpoint(String uri, Map properties) throws Exception { +// need to encode before its safe to parse with java.net.Uri +String encodedUri = UnsafeUriCharactersEncoder.encode(uri); +URI u = new URI(encodedUri); +String path; +if (u.getScheme() != null) { +// if there is a scheme then there is also a path +path = URISupport.extractRemainderPath(u, useRawUri()); +} else { +// this uri has no context-path as the leading text is the component name (scheme) +path = null; +} + +// use encoded or raw uri? +Map parameters; +if (useRawUri()) { +// when using raw uri then the query is taking from the uri as is +String query; +int idx = uri.indexOf('?'); +if (idx > -1) { +query = uri.substring(idx + 1); +} else { +query = u.getRawQuery(); +} +// and use method parseQuery +parameters = URISupport.parseQuery(query, true); +} else { +// however when using the encoded (default mode) uri then the query, +// is taken from the URI (ensures values is URI encoded) +// and use method parseParameters +parameters = URISupport.parseParameters(u); +} +if (properties != null) { +parameters.putAll(properties); +} +// This special property is only to identify endpoints in a unique manner +parameters.remove("hash"); + +// use encoded or raw uri? +uri = useRawUri() ? uri : encodedUri; + +validateURI(uri, path, parameters); +if (LOGGER.isTraceEnabled()) { +// at trace level its okay to have parameters logged, that may contain passwords +LOGGER.trace("Creating endpoint uri=[{}], path=[{}], parameters=[{}]", URISupport.sanitizeUri(uri), +URISupport.sanitizePath(path), parameters); +} else if (LOGGER.isDebugEnabled()) { +// but at debug level only output sanitized uris +LOGGER.debug("Creating endpoint uri=[{}], path=[{}]", URISupport.sanitizeUri(uri), URISupport.sanitizePath(path)); +} + +// extract these global options and infer their value based on global/component level configuration +boolean basic = getAndRemoveParameter(parameters, "basicPropertyBinding", boolean.class, isBasicPropertyBinding() +? isBasicPropertyBinding() : getCamelContext().ge
[camel-k-runtime] branch master updated: Can't set Knative broker name #535
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new 2d422a7 Can't set Knative broker name #535 2d422a7 is described below commit 2d422a7c5776ab9266e4b37024bd2a870811816b Author: Luca Burgazzoli AuthorDate: Mon Oct 26 12:28:55 2020 +0100 Can't set Knative broker name #535 --- .../camel/component/knative/spi/Knative.java | 1 + .../component/knative/http/KnativeHttpTest.java| 43 +- .../knative/KnativeComponentConfigurer.java| 13 --- .../knative/KnativeEndpointConfigurer.java | 10 ++--- .../apache/camel/component/knative/knative.json| 11 +++--- .../component/knative/KnativeConfiguration.java| 23 +--- .../camel/component/knative/KnativeEndpoint.java | 23 +++- .../knative/ce/AbstractCloudEventProcessor.java| 6 +-- 8 files changed, 88 insertions(+), 42 deletions(-) diff --git a/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/Knative.java b/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/Knative.java index dea93d9..18248af 100644 --- a/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/Knative.java +++ b/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/Knative.java @@ -28,6 +28,7 @@ public final class Knative { public static final String KNATIVE_TYPE = "knative.type"; public static final String KNATIVE_EVENT_TYPE = "knative.event.type"; public static final String KNATIVE_KIND = "knative.kind"; +public static final String KNATIVE_NAME = "knative.name"; public static final String KNATIVE_API_VERSION = "knative.apiVersion"; public static final String KNATIVE_REPLY = "knative.reply"; public static final String CONTENT_TYPE = "content.type"; diff --git a/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java b/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java index 8b1a163..fbb276c 100644 --- a/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java +++ b/components/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java @@ -38,6 +38,7 @@ import org.apache.camel.ProducerTemplate; import org.apache.camel.RuntimeCamelException; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.knative.KnativeComponent; +import org.apache.camel.component.knative.KnativeEndpoint; import org.apache.camel.component.knative.spi.CloudEvent; import org.apache.camel.component.knative.spi.CloudEvents; import org.apache.camel.component.knative.spi.Knative; @@ -1061,7 +1062,7 @@ public class KnativeHttpTest { @ParameterizedTest @EnumSource(CloudEvents.class) -void testEventsWithTypeAndVersion(CloudEvent ce) throws Exception { +void testEventsWithResourceRef(CloudEvent ce) throws Exception { configureKnativeComponent( context, ce, @@ -1073,7 +1074,8 @@ public class KnativeHttpTest { Knative.KNATIVE_EVENT_TYPE, "org.apache.camel.event", Knative.CONTENT_TYPE, "text/plain", Knative.KNATIVE_KIND, "MyObject", -Knative.KNATIVE_API_VERSION, "v1" +Knative.KNATIVE_API_VERSION, "v1", +Knative.KNATIVE_NAME, "myName1" )), sourceEvent( "default", @@ -1081,19 +1083,33 @@ public class KnativeHttpTest { Knative.KNATIVE_EVENT_TYPE, "org.apache.camel.event", Knative.CONTENT_TYPE, "text/plain", Knative.KNATIVE_KIND, "MyOtherObject", -Knative.KNATIVE_API_VERSION, "v2" +Knative.KNATIVE_API_VERSION, "v2", +Knative.KNATIVE_NAME, "myName2" )) ); RouteBuilder.addRoutes(context, b -> { b.from("direct:source") -.to("knative:event/myEvent?kind=MyObject&apiVersion=v1"); -b.from("knative:event/myEvent?kind=MyOtherObject&apiVersion=v2") + .to("knative:event/myEvent?kind=MyObject&apiVersion=v1&name=myName1"); + b.from("knative:event/m
[camel-k] branch master updated: Make inspect subcommand run locally.
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git The following commit(s) were added to refs/heads/master by this push: new 7801299 Make inspect subcommand run locally. 7801299 is described below commit 7801299658978f8135647ac050d9a376b24137c4 Author: Doru Bercea AuthorDate: Fri Oct 23 16:14:36 2020 -0400 Make inspect subcommand run locally. --- pkg/cmd/inspect.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/cmd/inspect.go b/pkg/cmd/inspect.go index 1342128..f899c95 100644 --- a/pkg/cmd/inspect.go +++ b/pkg/cmd/inspect.go @@ -52,6 +52,9 @@ func newCmdInspect(rootCmdOptions *RootCmdOptions) (*cobra.Command, *inspectCmdO return nil }, + Annotations: map[string]string{ + offlineCommandLabel: "true", + }, } cmd.Flags().StringP("output", "o", "", "Output format. One of: json|yaml")
[camel-k-runtime] branch master updated: build(actions): fix cancel stale workflow job
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new a1a8226 build(actions): fix cancel stale workflow job a1a8226 is described below commit a1a82260dc859ad4073d27ed58b52ad61b4c8f8d Author: Luca Burgazzoli AuthorDate: Fri Oct 23 17:41:49 2020 +0200 build(actions): fix cancel stale workflow job --- .github/workflows/ci-build-cleanup.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-build-cleanup.yaml b/.github/workflows/ci-build-cleanup.yaml index 650a010..5ae197a 100644 --- a/.github/workflows/ci-build-cleanup.yaml +++ b/.github/workflows/ci-build-cleanup.yaml @@ -30,4 +30,4 @@ jobs: uses: n1hility/cancel-previous-runs@v2 with: token: ${{ secrets.GITHUB_TOKEN }} - workflow: ci-build.yaml + workflow: ci-build.yml
[camel-k-runtime] branch master updated: build(actions): cancel stale workflow runs
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new 107a970 build(actions): cancel stale workflow runs 107a970 is described below commit 107a97001b31f154a8e16bd219de6c435cc46c8c Author: Luca Burgazzoli AuthorDate: Fri Oct 23 14:38:12 2020 +0200 build(actions): cancel stale workflow runs --- .github/workflows/ci-build-cleanup.yaml | 33 + 1 file changed, 33 insertions(+) diff --git a/.github/workflows/ci-build-cleanup.yaml b/.github/workflows/ci-build-cleanup.yaml new file mode 100644 index 000..650a010 --- /dev/null +++ b/.github/workflows/ci-build-cleanup.yaml @@ -0,0 +1,33 @@ +# +# 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. +# + +name: Cancel Stale Workflow Runs +on: + schedule: +# Run every 30 minutes +- cron: '*/30 * * * *' + +jobs: + cancel-runs: +if: github.repository == 'apache/camel-k-runtime' +runs-on: ubuntu-latest +steps: + - name: Cancel Previous Runs +uses: n1hility/cancel-previous-runs@v2 +with: + token: ${{ secrets.GITHUB_TOKEN }} + workflow: ci-build.yaml
[camel-k-runtime] 01/03: kamelet: use raw url
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit ad66520a48959463820cd410ccd1dfb6a2744cfd Author: Luca Burgazzoli AuthorDate: Fri Oct 23 12:13:48 2020 +0200 kamelet: use raw url --- .../org/apache/camel/component/kamelet/KameletComponent.java | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java index f072686..6908f30 100644 --- a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java +++ b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java @@ -35,6 +35,7 @@ import org.apache.camel.spi.annotations.Component; import org.apache.camel.support.DefaultComponent; import org.apache.camel.support.LifecycleStrategySupport; import org.apache.camel.support.service.ServiceHelper; +import org.apache.camel.util.StringHelper; import org.apache.camel.util.URISupport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -124,7 +125,7 @@ public class KameletComponent extends DefaultComponent { // determine the parameters that the kamelet should take by using the original // uri as we need to preserve the original format. -final String query = URISupport.extractQuery(uri); +final String query = StringHelper.after(uri, "?"); final Map queryParams = URISupport.parseQuery(query, true, true); // replace resolved params with the original ones @@ -175,6 +176,12 @@ public class KameletComponent extends DefaultComponent { } @Override +public boolean useRawUri() { +// should use encoded uri by default +return true; +} + +@Override protected void doInit() throws Exception { getCamelContext().addLifecycleStrategy(lifecycleHandler);
[camel-k-runtime] branch master updated (6c152a1 -> 1e36b99)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git. from 6c152a1 yaml: regen new ad66520 kamelet: use raw url new 511f53b build(actions): disable http keepalive new 1e36b99 build(actions): remove leftovers The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .github/workflows/ci-build.yml | 16 +++- .github/workflows/pr-validate.yml| 10 -- .../apache/camel/component/kamelet/KameletComponent.java | 9 - 3 files changed, 23 insertions(+), 12 deletions(-)
[camel-k-runtime] 02/03: build(actions): disable http keepalive
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit 511f53bc66c40f711064035074feffc4b2776852 Author: Luca Burgazzoli AuthorDate: Fri Oct 23 12:57:18 2020 +0200 build(actions): disable http keepalive --- .github/workflows/ci-build.yml| 10 +++--- .github/workflows/pr-validate.yml | 10 -- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index e2aa863..f3906d7 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -16,6 +16,10 @@ # name: Build +env: + MAVEN_OPTS: -Xmx3000m + MAVEN_ARGS: -V -ntp -Dhttp.keepAlive=false -e + on: push: branches: @@ -70,7 +74,7 @@ jobs: version: ${{ matrix.java }} - name: Build on ${{ matrix.java }} run: | - ./mvnw -V -B -ntp clean install + ./mvnw ${MAVEN_ARGS} -B clean install build-native: runs-on: ubuntu-latest needs: build @@ -109,7 +113,7 @@ jobs: run: tar -xzf maven-repo-${{ github.run_id }}-${{ github.run_number }}.tgz -C ~ - name: Integration Test - ${{ matrix.native-image-project }} run: | - ./mvnw -V -B -ntp -nsu clean install \ + ./mvnw ${MAVEN_ARGS} -B -nsu clean install \ -Dnative \ -Dnative-image.xmx=6g \ -Ddocker \ @@ -128,7 +132,7 @@ jobs: with: version: '11' - name: Deploy to ASF Snapshots Repository - run: ./mvnw -V clean deploy -DskipTests -DskipITs --settings .github/asf-deploy-settings.xml + run: ./mvnw ${MAVEN_ARGS} clean deploy -DskipTests -DskipITs --settings .github/asf-deploy-settings.xml # # JS build disabled as fails for OOM diff --git a/.github/workflows/pr-validate.yml b/.github/workflows/pr-validate.yml index 58ce713..b041abc 100644 --- a/.github/workflows/pr-validate.yml +++ b/.github/workflows/pr-validate.yml @@ -16,6 +16,10 @@ # name: Validate PR +env: + MAVEN_OPTS: -Xmx3000m + MAVEN_ARGS: -V -ntp -Dhttp.keepAlive=false -e + on: pull_request: branches: @@ -36,7 +40,9 @@ jobs: version: '11' - name: mvn package run: | -./mvnw -ntp clean verify \ +./mvnw ${MAVEN_ARGS} \ + -Dhttp.keepAlive=false \ -Dcheckstyle.failOnViolation=true \ -DskipTests \ - -Psourcecheck,license + -Psourcecheck,license \ + clean verify
[camel-k-runtime] 03/03: build(actions): remove leftovers
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit 1e36b99256331984ef0d71e3a24d49e065b7c7d7 Author: Luca Burgazzoli AuthorDate: Fri Oct 23 12:57:37 2020 +0200 build(actions): remove leftovers --- .github/workflows/ci-build.yml | 6 -- 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index f3906d7..c6d4d1a 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -133,9 +133,3 @@ jobs: version: '11' - name: Deploy to ASF Snapshots Repository run: ./mvnw ${MAVEN_ARGS} clean deploy -DskipTests -DskipITs --settings .github/asf-deploy-settings.xml - -# -# JS build disabled as fails for OOM -# relates to: https://github.com/oracle/graal/issues/2129 -# -
[camel-k-runtime] 01/02: yaml: auto wrap secret values wit RAW
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit 1e691680c163e71968baa409120d2c8909af10ad Author: Luca Burgazzoli AuthorDate: Thu Oct 22 16:42:54 2020 +0200 yaml: auto wrap secret values wit RAW --- .../camel/k/loader/yaml/parser/FromStepParser.java | 7 +- .../k/loader/yaml/parser/RouteStepParser.java | 10 ++- .../k/loader/yaml/parser/ToDynamicStepParser.java | 2 +- .../camel/k/loader/yaml/parser/ToStepParser.java | 2 +- .../k/loader/yaml/parser/WireTapStepParser.java| 2 +- .../k/loader/yaml/support/StepParserSupport.java | 41 --- camel-k-loader-yaml/camel-k-loader-yaml/pom.xml| 10 +++ .../loader/yaml/RoutesWithPlaceholdersTest.groovy | 1 + .../k/loader/yaml/RoutesWithSecretsTest.groovy | 81 ++ .../camel/k/loader/yaml/parser/FromTest.groovy | 57 ++- .../camel/k/loader/yaml/parser/ToTest.groovy | 45 .../routes/RoutesWithSecretsTest_route.yaml| 27 .../RoutesWithSecretsTest_route_property.yaml | 27 .../routes/RoutesWithSecretsTest_route_raw.yaml| 27 14 files changed, 318 insertions(+), 21 deletions(-) diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FromStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FromStepParser.java index 9d05fb0..cd2b55f 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FromStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FromStepParser.java @@ -36,9 +36,10 @@ public class FromStepParser implements StartStepParser { throw new IllegalArgumentException("Either uri or scheme must be set"); } -String uri = definition.uri != null -? StepParserSupport.createEndpointUri(definition.uri, definition.parameters) -: StepParserSupport.createEndpointUri(context.getCamelContext(), definition.scheme, definition.parameters); +String uri = StepParserSupport.createEndpointUri( +context.getCamelContext(), +definition.uri != null ? definition.uri : definition.scheme, +definition.parameters); // as this is a start converter, steps are mandatory StepParserSupport.notNull(definition.steps, "steps"); diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RouteStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RouteStepParser.java index a13f02c..9c18760 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RouteStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RouteStepParser.java @@ -38,14 +38,16 @@ public class RouteStepParser implements StartStepParser { throw new IllegalArgumentException("Either uri or scheme must be set"); } -String uri = definition.from.uri != null -? StepParserSupport.createEndpointUri(definition.from.uri, definition.from.parameters) -: StepParserSupport.createEndpointUri(context.getCamelContext(), definition.from.scheme, definition.from.parameters); +String uri = StepParserSupport.createEndpointUri( +context.getCamelContext(), +definition.from.uri != null ? definition.from.uri : definition.from.scheme, +definition.from.parameters); RouteDefinition route = context.builder().from(uri); ObjectHelper.ifNotEmpty(definition.id, route::routeId); ObjectHelper.ifNotEmpty(definition.group, route::routeGroup); +ObjectHelper.ifNotEmpty(definition.autoStartup, route::autoStartup); // as this is a start converter, steps are mandatory StepParserSupport.notNull(definition.steps, "steps"); @@ -63,6 +65,8 @@ public class RouteStepParser implements StartStepParser { public String id; @JsonProperty public String group; +@JsonProperty +public Boolean autoStartup; @JsonProperty(required = true) public From from; @JsonProperty(required = true) diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToDynamicStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToDynamicStepParser.java index 183e915..2c9ab13 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/ja
[camel-k-runtime] 02/02: yaml: regen
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit 6c152a121cf39d8f3c1310acf0c9780b04c172a4 Author: Luca Burgazzoli AuthorDate: Thu Oct 22 16:43:08 2020 +0200 yaml: regen --- .../camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json| 3 +++ 1 file changed, 3 insertions(+) diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json b/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json index 3e90bc7..cdc91e0 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json @@ -2885,6 +2885,9 @@ "org.apache.camel.k.loader.yaml.parser.RouteStepParser$Definition" : { "type" : "object", "properties" : { + "auto-startup" : { +"type" : "boolean" + }, "from" : { "$ref" : "#/items/definitions/org.apache.camel.k.loader.yaml.parser.RouteStepParser$From" },
[camel-k-runtime] branch master updated (9461bb9 -> a124ef2)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git. from 9461bb9 Updated CHANGELOG.md add a124ef2 Groovy - such property: DELEGATE_FIRST when mapping beans #529 No new revisions were added by this update. Summary of changes: .../camel/k/loader/groovy/dsl/Support.groovy | 10 --- .../groovy/GroovySourceLoaderIssuesTest.groovy | 32 -- .../github-529.groovy} | 23 +++- 3 files changed, 28 insertions(+), 37 deletions(-) copy camel-k-loader-xml/src/test/groovy/org/apache/camel/k/loader/xml/XmlSourceLoaderTest.groovy => camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/GroovySourceLoaderIssuesTest.groovy (59%) copy camel-k-loader-groovy/src/test/resources/{routes-with-beans.groovy => issues/github-529.groovy} (72%)
[camel-k-runtime] branch master updated (a124ef2 -> 6fe6a1c)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git. from a124ef2 Groovy - such property: DELEGATE_FIRST when mapping beans #529 add 6fe6a1c kamelet: ensure properties are correctly propagated to the route template engine No new revisions were added by this update. Summary of changes: components/camel-kamelet/pom.xml | 5 ++ .../camel/component/kamelet/KameletComponent.java | 9 +++ .../component/kamelet/KameletPropertiesTest.java | 69 +- 3 files changed, 81 insertions(+), 2 deletions(-)
[camel-k-runtime] branch master updated (6fe6a1c -> 6c152a1)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git. from 6fe6a1c kamelet: ensure properties are correctly propagated to the route template engine new 1e69168 yaml: auto wrap secret values wit RAW new 6c152a1 yaml: regen The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../camel/k/loader/yaml/parser/FromStepParser.java | 7 +- .../k/loader/yaml/parser/RouteStepParser.java | 10 ++- .../k/loader/yaml/parser/ToDynamicStepParser.java | 2 +- .../camel/k/loader/yaml/parser/ToStepParser.java | 2 +- .../k/loader/yaml/parser/WireTapStepParser.java| 2 +- .../k/loader/yaml/support/StepParserSupport.java | 41 --- camel-k-loader-yaml/camel-k-loader-yaml/pom.xml| 10 +++ .../src/generated/resources/camel-yaml-dsl.json| 3 + .../loader/yaml/RoutesWithPlaceholdersTest.groovy | 1 + .../k/loader/yaml/RoutesWithSecretsTest.groovy | 81 ++ .../camel/k/loader/yaml/parser/FromTest.groovy | 57 ++- .../camel/k/loader/yaml/parser/ToTest.groovy | 45 ...route.yaml => RoutesWithSecretsTest_route.yaml} | 11 +-- ...l => RoutesWithSecretsTest_route_property.yaml} | 11 +-- ...e.yaml => RoutesWithSecretsTest_route_raw.yaml} | 11 +-- 15 files changed, 261 insertions(+), 33 deletions(-) create mode 100644 camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithSecretsTest.groovy copy camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/{RoutesWithPlaceholdersTest_route.yaml => RoutesWithSecretsTest_route.yaml} (79%) copy camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/{RoutesWithPlaceholdersTest_route.yaml => RoutesWithSecretsTest_route_property.yaml} (78%) copy camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/{RoutesWithPlaceholdersTest_route.yaml => RoutesWithSecretsTest_route_raw.yaml} (78%)
[camel] 01/02: CAMEL-15722: endpoint uri builder: add an option to URL encode the returned uri or not
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git commit 35b17c47cb14bc1e266a4a469e78d6c2ab25f211 Author: Luca Burgazzoli AuthorDate: Wed Oct 21 12:11:26 2020 +0200 CAMEL-15722: endpoint uri builder: add an option to URL encode the returned uri or not --- .../org/apache/camel/spi/EndpointUriFactory.java | 14 +++- .../catalog/CustomEndpointUriFactoryTest.java | 74 +++--- .../component/EndpointUriFactorySupport.java | 4 +- .../packaging/EndpointUriFactoryGenerator.java | 4 +- 4 files changed, 83 insertions(+), 13 deletions(-) diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/EndpointUriFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/EndpointUriFactory.java index 1eb4d99..35530e6 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/EndpointUriFactory.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/EndpointUriFactory.java @@ -42,7 +42,19 @@ public interface EndpointUriFactory extends CamelContextAware { * @param properties endpoint options * @returnthe constructed endpoint uri */ -String buildUri(String scheme, Map properties) throws URISyntaxException; +default String buildUri(String scheme, Map properties) throws URISyntaxException { +return buildUri(scheme, properties, true); +} + +/** + * Assembles an endpoint uri for the given component name with the given parameters. + * + * @param scheme the component name + * @param properties endpoint options + * @param encode whether to URL encode the returned uri or not + * @returnthe constructed endpoint uri + */ +String buildUri(String scheme, Map properties, boolean encode) throws URISyntaxException; /** * Returns all the names this endpoint supports. diff --git a/core/camel-core/src/test/java/org/apache/camel/catalog/CustomEndpointUriFactoryTest.java b/core/camel-core/src/test/java/org/apache/camel/catalog/CustomEndpointUriFactoryTest.java index a6eafaf..97bb0c7 100644 --- a/core/camel-core/src/test/java/org/apache/camel/catalog/CustomEndpointUriFactoryTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/catalog/CustomEndpointUriFactoryTest.java @@ -215,6 +215,27 @@ public class CustomEndpointUriFactoryTest extends ContextTestSupport { } @Test +public void testCQLAssembler() throws Exception { +EndpointUriFactory assembler = new MyCQLAssembler(); +assembler.setCamelContext(context); + +Map params = new LinkedHashMap<>(); +params.put("host", "localhost"); +params.put("keyspace", "test"); +params.put("cql", "insert into test_data(id, text) values (now(), ?)"); + +Assertions.assertEquals( + "cql:localhost/test?cql=insert+into+test_data%28id%2C+text%29+values+%28now%28%29%2C+%3F%29", +assembler.buildUri("cql", new LinkedHashMap<>(params))); +Assertions.assertEquals( + "cql:localhost/test?cql=insert+into+test_data%28id%2C+text%29+values+%28now%28%29%2C+%3F%29", +assembler.buildUri("cql", new LinkedHashMap<>(params), true)); +Assertions.assertEquals( +"cql:localhost/test?cql=insert into test_data(id, text) values (now(), ?)", +assembler.buildUri("cql", new LinkedHashMap<>(params), false)); +} + +@Test public void testJmsSecrets() throws Exception { EndpointUriFactory assembler = new MyJmsxAssembler(); assembler.setCamelContext(context); @@ -239,7 +260,7 @@ public class CustomEndpointUriFactoryTest extends ContextTestSupport { } @Override -public String buildUri(String scheme, Map properties) +public String buildUri(String scheme, Map properties, boolean encode) throws URISyntaxException { // begin from syntax String uri = SYNTAX; @@ -248,7 +269,7 @@ public class CustomEndpointUriFactoryTest extends ContextTestSupport { uri = buildPathParameter(SYNTAX, uri, "name", null, true, properties); uri = buildPathParameter(SYNTAX, uri, "port", 8080, false, properties); // append remainder parameters -uri = buildQueryParameters(uri, properties); +uri = buildQueryParameters(uri, properties, encode); return uri; } @@ -280,7 +301,7 @@ public class CustomEndpointUriFactoryTest extends ContextTestSupport { } @Override -public String buildUri(String scheme, Map properties) +public String buildUri(String scheme, Map properties
[camel] branch master updated (e9696b5 -> 4a5c4b8)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel.git. from e9696b5 Polished new 35b17c4 CAMEL-15722: endpoint uri builder: add an option to URL encode the returned uri or not new 4a5c4b8 CAMEL-15722: Regen The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../activemq/ActiveMQEndpointUriFactory.java | 4 +- .../component/ahc/ws/WsEndpointUriFactory.java | 4 +- .../camel/component/ahc/AhcEndpointUriFactory.java | 4 +- .../component/amqp/AMQPEndpointUriFactory.java | 4 +- .../component/apns/ApnsEndpointUriFactory.java | 4 +- .../arangodb/ArangoDbEndpointUriFactory.java | 4 +- .../camel/component/as2/AS2EndpointUriFactory.java | 4 +- .../asterisk/AsteriskEndpointUriFactory.java | 4 +- .../atlasmap/AtlasMapEndpointUriFactory.java | 4 +- .../component/atmos/AtmosEndpointUriFactory.java | 4 +- .../websocket/WebsocketEndpointUriFactory.java | 4 +- .../component/atom/AtomEndpointUriFactory.java | 4 +- .../client/map/AtomixMapEndpointUriFactory.java| 4 +- .../AtomixMessagingEndpointUriFactory.java | 4 +- .../multimap/AtomixMultiMapEndpointUriFactory.java | 4 +- .../queue/AtomixQueueEndpointUriFactory.java | 4 +- .../client/set/AtomixSetEndpointUriFactory.java| 4 +- .../value/AtomixValueEndpointUriFactory.java | 4 +- .../component/avro/AvroEndpointUriFactory.java | 4 +- .../component/aws/cw/CwEndpointUriFactory.java | 4 +- .../component/aws/ddb/DdbEndpointUriFactory.java | 4 +- .../aws/ddbstream/DdbStreamEndpointUriFactory.java | 4 +- .../component/aws/ec2/EC2EndpointUriFactory.java | 4 +- .../component/aws/ecs/ECSEndpointUriFactory.java | 4 +- .../component/aws/eks/EKSEndpointUriFactory.java | 4 +- .../component/aws/iam/IAMEndpointUriFactory.java | 4 +- .../KinesisFirehoseEndpointUriFactory.java | 4 +- .../aws/kinesis/KinesisEndpointUriFactory.java | 4 +- .../component/aws/kms/KMSEndpointUriFactory.java | 4 +- .../aws/lambda/LambdaEndpointUriFactory.java | 4 +- .../component/aws/mq/MQEndpointUriFactory.java | 4 +- .../component/aws/msk/MSKEndpointUriFactory.java | 4 +- .../component/aws/s3/S3EndpointUriFactory.java | 4 +- .../component/aws/sdb/SdbEndpointUriFactory.java | 4 +- .../component/aws/ses/SesEndpointUriFactory.java | 4 +- .../component/aws/sns/SnsEndpointUriFactory.java | 4 +- .../component/aws/sqs/SqsEndpointUriFactory.java | 4 +- .../component/aws/swf/SWFEndpointUriFactory.java | 4 +- .../aws/translate/TranslateEndpointUriFactory.java | 4 +- .../aws2/athena/Athena2EndpointUriFactory.java | 4 +- .../component/aws2/cw/Cw2EndpointUriFactory.java | 4 +- .../component/aws2/ddb/Ddb2EndpointUriFactory.java | 4 +- .../ddbstream/Ddb2StreamEndpointUriFactory.java| 4 +- .../aws2/ec2/AWS2EC2EndpointUriFactory.java| 4 +- .../component/aws2/ecs/ECS2EndpointUriFactory.java | 4 +- .../component/aws2/eks/EKS2EndpointUriFactory.java | 4 +- .../eventbridge/EventbridgeEndpointUriFactory.java | 4 +- .../component/aws2/iam/IAM2EndpointUriFactory.java | 4 +- .../KinesisFirehose2EndpointUriFactory.java| 4 +- .../aws2/kinesis/Kinesis2EndpointUriFactory.java | 4 +- .../component/aws2/kms/KMS2EndpointUriFactory.java | 4 +- .../aws2/lambda/Lambda2EndpointUriFactory.java | 4 +- .../component/aws2/mq/MQ2EndpointUriFactory.java | 4 +- .../component/aws2/msk/MSK2EndpointUriFactory.java | 4 +- .../aws2/s3/AWS2S3EndpointUriFactory.java | 4 +- .../component/aws2/ses/Ses2EndpointUriFactory.java | 4 +- .../component/aws2/sns/Sns2EndpointUriFactory.java | 4 +- .../component/aws2/sqs/Sqs2EndpointUriFactory.java | 4 +- .../component/aws2/sts/STS2EndpointUriFactory.java | 4 +- .../translate/Translate2EndpointUriFactory.java| 4 +- .../eventhubs/EventHubsEndpointUriFactory.java | 4 +- .../azure/storage/blob/BlobEndpointUriFactory.java | 4 +- .../storage/queue/QueueEndpointUriFactory.java | 4 +- .../azure/blob/BlobServiceEndpointUriFactory.java | 4 +- .../queue/QueueServiceEndpointUriFactory.java | 4 +- .../validator/BeanValidatorEndpointUriFactory.java | 4 +- .../component/bean/BeanEndpointUriFactory.java | 4 +- .../beanclass/ClassEndpointUriFactory.java | 4 +- .../beanstalk/BeanstalkEndpointUriFactory.java | 4 +- .../component/bonita/BonitaEndpointUriFactory.java | 4 +- .../camel/component/box/BoxEndpointUriFactory.java | 4 +- .../braintree/BraintreeEndpointUriFactory.java | 4 +- .../component/browse/BrowseEndpointUriFactory.jav
[camel-k-runtime] 01/04: chore(deps): update to camel-quarkus 1.3.0
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit cfd08e6c7f3b537b224753c72551ec4d8d9ace40 Author: Luca Burgazzoli AuthorDate: Thu Oct 15 16:14:29 2020 +0200 chore(deps): update to camel-quarkus 1.3.0 --- components/camel-knative/camel-knative/pom.xml | 3 +++ pom.xml| 14 -- tooling/camel-k-test/pom.xml | 4 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/components/camel-knative/camel-knative/pom.xml b/components/camel-knative/camel-knative/pom.xml index 0d59bc1..df1b560 100644 --- a/components/camel-knative/camel-knative/pom.xml +++ b/components/camel-knative/camel-knative/pom.xml @@ -103,6 +103,8 @@ + org.codehaus.mojo build-helper-maven-plugin diff --git a/pom.xml b/pom.xml index 831da1b..da193ed 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ org.apache.camel camel-dependencies -3.5.0 +3.6.0 4.0.0 @@ -38,12 +38,12 @@ 11 11 -3.5.0 +3.6.0 -1.1.0 +1.3.0 20.2.0 -1.8.0.Final +1.9.0.Final 0.9.13 @@ -55,7 +55,6 @@ 2.8.8 3.1.0 1.4.0 -1.0.0 1.13.0 @@ -748,11 +747,6 @@ ${junit-jupiter-version} -org.junit-pioneer -junit-pioneer -${junit-pioneer-version} - - org.assertj assertj-core ${assertj-version} diff --git a/tooling/camel-k-test/pom.xml b/tooling/camel-k-test/pom.xml index a9b5285..b9e434c 100644 --- a/tooling/camel-k-test/pom.xml +++ b/tooling/camel-k-test/pom.xml @@ -33,10 +33,6 @@ org.junit.jupiter junit-jupiter - -org.junit-pioneer -junit-pioneer - org.assertj
[camel-k-runtime] branch master updated (45ed5e1 -> c88d959)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git. from 45ed5e1 Updated CHANGELOG.md new cfd08e6 chore(deps): update to camel-quarkus 1.3.0 new be89158 yaml: use EndpointUriFactory to compute endpoint uri new 77ca0b7 yaml: use URISupport to create query string new c88d959 Regen The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../k/loader/yaml/support/StepParserSupport.java | 35 +- camel-k-loader-yaml/camel-k-loader-yaml/pom.xml| 5 - .../src/generated/resources/camel-yaml-dsl.json| 20 +- .../generated/resources/camel-yaml-endpoint.json | 805 + .../k/loader/yaml/RoutesWithEndpointTest.groovy| 4 +- .../routes/RoutesWithEndpointTest_from.yaml| 2 +- .../routes/RoutesWithEndpointTest_route.yaml | 2 +- .../health/HealthContextCustomizerConfigurer.java | 17 +- .../TracingContextCustomizerConfigurer.java| 17 +- .../apache/camel/k/SourceDefinitionConfigurer.java | 29 +- .../k/listener/SourcesConfigurerConfigurer.java| 11 +- .../CronSourceLoaderInterceptorConfigurer.java | 15 +- ...formHttpServiceContextCustomizerConfigurer.java | 25 +- ...tiveSinkBindingContextCustomizerConfigurer.java | 17 +- .../WebhookContextCustomizerConfigurer.java| 11 +- .../kamelet/KameletComponentConfigurer.java| 19 +- .../kamelet/KameletEndpointConfigurer.java | 29 +- .../apache/camel/component/kamelet/kamelet.json| 13 +- components/camel-knative/camel-knative/pom.xml | 3 + .../knative/KnativeComponentConfigurer.java| 43 +- .../knative/KnativeEndpointConfigurer.java | 45 +- .../apache/camel/component/knative/knative.json| 9 +- .../component/wrap/WrapComponentConfigurer.java| 15 +- .../component/wrap/WrapEndpointConfigurer.java | 22 +- .../org/apache/camel/component/wrap/wrap.json | 5 +- pom.xml| 14 +- tooling/camel-k-test/pom.xml | 4 - 27 files changed, 608 insertions(+), 628 deletions(-)
[camel-k-runtime] 04/04: Regen
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit c88d959d0a82b446773c7e88a37cbe9292e06439 Author: Luca Burgazzoli AuthorDate: Mon Oct 19 14:39:24 2020 +0200 Regen --- .../src/generated/resources/camel-yaml-dsl.json| 20 +- .../generated/resources/camel-yaml-endpoint.json | 805 + .../health/HealthContextCustomizerConfigurer.java | 17 +- .../TracingContextCustomizerConfigurer.java| 17 +- .../apache/camel/k/SourceDefinitionConfigurer.java | 29 +- .../k/listener/SourcesConfigurerConfigurer.java| 11 +- .../CronSourceLoaderInterceptorConfigurer.java | 15 +- ...formHttpServiceContextCustomizerConfigurer.java | 25 +- ...tiveSinkBindingContextCustomizerConfigurer.java | 17 +- .../WebhookContextCustomizerConfigurer.java| 11 +- .../kamelet/KameletComponentConfigurer.java| 19 +- .../kamelet/KameletEndpointConfigurer.java | 29 +- .../apache/camel/component/kamelet/kamelet.json| 13 +- .../knative/KnativeComponentConfigurer.java| 43 +- .../knative/KnativeEndpointConfigurer.java | 45 +- .../apache/camel/component/knative/knative.json| 9 +- .../component/wrap/WrapComponentConfigurer.java| 15 +- .../component/wrap/WrapEndpointConfigurer.java | 22 +- .../org/apache/camel/component/wrap/wrap.json | 5 +- 19 files changed, 576 insertions(+), 591 deletions(-) diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json b/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json index 4d18bdd..3e90bc7 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json @@ -169,6 +169,10 @@ "header-name" : { "type" : "string" }, +"option" : { + "type" : "string", + "enum" : [ "DEFAULT_PATH_LEAF_TO_NULL", "ALWAYS_RETURN_LIST", "AS_PATH_LIST", "SUPPRESS_EXCEPTIONS", "REQUIRE_PROPERTIES" ] +}, "result-type" : { "type" : "string" }, @@ -224,6 +228,10 @@ "ref" : { "type" : "string" }, +"scope" : { + "type" : "string", + "enum" : [ "Singleton", "Request", "Prototype" ] +}, "expression" : { "type" : "string" }, @@ -405,6 +413,9 @@ "object-model" : { "type" : "string" }, +"pre-compile" : { + "type" : "string" +}, "result-type" : { "type" : "string", "enum" : [ "NUMBER", "STRING", "BOOLEAN", "NODESET", "NODE" ] @@ -466,7 +477,8 @@ "type" : "string" }, "mode" : { - "type" : "string" + "type" : "string", + "enum" : [ "i", "w", "u", "t" ] }, "expression" : { "type" : "string" @@ -1612,6 +1624,9 @@ "allow-empty-directory" : { "type" : "string" }, + "max-decompressed-size" : { +"type" : "string" + }, "preserve-path-elements" : { "type" : "string" }, @@ -1947,6 +1962,9 @@ "allow-empty-directory" : { "type" : "string" }, + "max-decompressed-size" : { +"type" : "string" + }, "preserve-path-elements" : { "type" : "string" }, diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-endpoint.json b/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-endpoint.json index a5baa42..0fe105c 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-endpoint.json +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-endpoint.j
[camel-k-runtime] 03/04: yaml: use URISupport to create query string
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit 77ca0b7d61b6dac9d9d09beddf2ebabe4cada025 Author: Luca Burgazzoli AuthorDate: Mon Oct 19 14:51:39 2020 +0200 yaml: use URISupport to create query string --- .../camel/k/loader/yaml/support/StepParserSupport.java | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/support/StepParserSupport.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/support/StepParserSupport.java index 017ad30..fc44afe 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/support/StepParserSupport.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/support/StepParserSupport.java @@ -19,7 +19,6 @@ package org.apache.camel.k.loader.yaml.support; import java.net.URISyntaxException; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import org.apache.camel.CamelContext; import org.apache.camel.ExtendedCamelContext; @@ -31,6 +30,7 @@ import org.apache.camel.model.OutputNode; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.spi.EndpointUriFactory; import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.URISupport; public final class StepParserSupport { private StepParserSupport() { @@ -74,13 +74,15 @@ public final class StepParserSupport { String answer = uri; if (parameters != null) { -String queryString = parameters.entrySet().stream() -.filter(entry -> entry.getValue() != null) -.map(entry -> String.format("%s=%s", entry.getKey(), entry.getValue())) -.collect(Collectors.joining("&")); - -if (ObjectHelper.isNotEmpty(queryString)) { -answer += "?" + queryString; +String queryString; + +try { +queryString = URISupport.createQueryString(parameters, false); +if (ObjectHelper.isNotEmpty(queryString)) { +answer += "?" + queryString; +} +} catch (URISyntaxException e) { +throw new IllegalArgumentException(e); } }
[camel-k-runtime] 02/04: yaml: use EndpointUriFactory to compute endpoint uri
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit be8915851a1403c2c1428ab6ae4cfedb90381b68 Author: Luca Burgazzoli AuthorDate: Mon Oct 19 14:35:47 2020 +0200 yaml: use EndpointUriFactory to compute endpoint uri --- .../camel/k/loader/yaml/support/StepParserSupport.java | 17 +++-- camel-k-loader-yaml/camel-k-loader-yaml/pom.xml | 5 - .../camel/k/loader/yaml/RoutesWithEndpointTest.groovy | 4 ++-- .../resources/routes/RoutesWithEndpointTest_from.yaml | 2 +- .../resources/routes/RoutesWithEndpointTest_route.yaml | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/support/StepParserSupport.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/support/StepParserSupport.java index 1889c18..017ad30 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/support/StepParserSupport.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/support/StepParserSupport.java @@ -17,10 +17,8 @@ package org.apache.camel.k.loader.yaml.support; import java.net.URISyntaxException; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.stream.Collectors; import org.apache.camel.CamelContext; @@ -31,6 +29,7 @@ import org.apache.camel.k.loader.yaml.spi.StepParser; import org.apache.camel.k.loader.yaml.spi.StepParserException; import org.apache.camel.model.OutputNode; import org.apache.camel.model.ProcessorDefinition; +import org.apache.camel.spi.EndpointUriFactory; import org.apache.camel.util.ObjectHelper; public final class StepParserSupport { @@ -89,11 +88,17 @@ public final class StepParserSupport { } public static String createEndpointUri(CamelContext context, String scheme, Map parameters) { -try { -Map params = new HashMap<>(); -parameters.forEach((k, v) -> params.put(k, Objects.toString(v))); +final EndpointUriFactory factory = context.adapt(ExtendedCamelContext.class).getEndpointUriFactory(scheme); -return context.adapt(ExtendedCamelContext.class).getRuntimeCamelCatalog().asEndpointUri(scheme, params, false); +if (factory == null) { +throw new IllegalArgumentException("Cannot compute endpoint URI: unable to find an EndpointUriFactory for scheme " + scheme); +} +if (!factory.isEnabled(scheme)) { +throw new IllegalArgumentException("Cannot compute endpoint URI: scheme " + scheme + " is not enabled"); +} + +try { +return factory.buildUri(scheme, parameters); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/pom.xml b/camel-k-loader-yaml/camel-k-loader-yaml/pom.xml index 3fd3c70..4b6f176 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/pom.xml +++ b/camel-k-loader-yaml/camel-k-loader-yaml/pom.xml @@ -36,11 +36,6 @@ -org.apache.camel -camel-core-catalog - - - org.apache.camel.k camel-k-runtime-core diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithEndpointTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithEndpointTest.groovy index 1f9cbfc..f27ab3b 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithEndpointTest.groovy +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithEndpointTest.groovy @@ -43,7 +43,7 @@ class RoutesWithEndpointTest extends TestSupport { timeout == 1_234_000 } with (te, TelegramEndpoint) { -endpointUri == 'telegram://bots?authorizationToken=%23property:telegram.token' +endpointUri == 'telegram://bots?authorizationToken=RAW(myToken+)' configuration.authorizationToken == 'myToken+' } with (me, MockEndpoint) { @@ -74,7 +74,7 @@ class RoutesWithEndpointTest extends TestSupport { timeout == 1_234_000 } with (te, TelegramEndpoint) { -endpointUri == 'telegram://bots?authorizationToken=%23property:telegram.token' +endpointUri == 'telegram://bots?authorizationToken=RAW(myToken+)' configuration.authorizationToken == 'myT
[camel-k-runtime] branch master updated: build(deps): bump gmavenplus-plugin from 1.10.1 to 1.11.0
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new dfacae8 build(deps): bump gmavenplus-plugin from 1.10.1 to 1.11.0 dfacae8 is described below commit dfacae8a10baca35d5d50f070663a44ad0dce982 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> AuthorDate: Mon Oct 12 19:02:55 2020 + build(deps): bump gmavenplus-plugin from 1.10.1 to 1.11.0 Bumps [gmavenplus-plugin](https://github.com/groovy/GMavenPlus) from 1.10.1 to 1.11.0. - [Release notes](https://github.com/groovy/GMavenPlus/releases) - [Commits](https://github.com/groovy/GMavenPlus/compare/1.10.1...1.11.0) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c7b66df..831da1b 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 2.2.14 -1.10.1 +1.11.0 3.8.1 3.0.0-M5 1.7.0
[camel] branch master updated: route template: add template parameters to RouteTemplateDefinition::Converter function
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/master by this push: new 671adc2 route template: add template parameters to RouteTemplateDefinition::Converter function 671adc2 is described below commit 671adc2d97453bd6080e9fa04bf4317d4375df3f Author: Luca Burgazzoli AuthorDate: Mon Oct 19 18:41:31 2020 +0200 route template: add template parameters to RouteTemplateDefinition::Converter function --- .../java/org/apache/camel/impl/DefaultModel.java | 18 +- .../camel/model/RouteTemplateDefinition.java | 40 ++ .../camel/builder/RouteTemplateConverterTest.java | 34 +++--- 3 files changed, 73 insertions(+), 19 deletions(-) diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java index f545d28..b1d2d02 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java @@ -223,10 +223,11 @@ public class DefaultModel implements Model { throw new IllegalArgumentException("Cannot find RouteTemplate with id " + routeTemplateId); } -StringJoiner templatesBuilder = new StringJoiner(", "); final Map prop = new HashMap<>(); // include default values first from the template (and validate that we have inputs for all required parameters) if (target.getTemplateParameters() != null) { +StringJoiner templatesBuilder = new StringJoiner(", "); + for (RouteTemplateParameterDefinition temp : target.getTemplateParameters()) { if (temp.getDefaultValue() != null) { prop.put(temp.getName(), temp.getDefaultValue()); @@ -237,18 +238,19 @@ public class DefaultModel implements Model { } } } +if (templatesBuilder.length() > 0) { +throw new IllegalArgumentException( +"Route template " + routeTemplateId + " the following mandatory parameters must be provided: " + + templatesBuilder.toString()); +} } -if (templatesBuilder.length() > 0) { -throw new IllegalArgumentException( -"Route template " + routeTemplateId + " the following mandatory parameters must be provided: " - + templatesBuilder.toString()); -} + // then override with user parameters if (parameters != null) { prop.putAll(parameters); } -RouteTemplateDefinition.Converter converter = RouteTemplateDefinition::asRouteDefinition; +RouteTemplateDefinition.Converter converter = RouteTemplateDefinition.Converter.DEFAULT_CONVERTER; for (Map.Entry entry : routeTemplateConverters.entrySet()) { final String key = entry.getKey(); @@ -266,7 +268,7 @@ public class DefaultModel implements Model { } } -RouteDefinition def = converter.apply(target); +RouteDefinition def = converter.apply(target, prop); if (routeId != null) { def.setId(routeId); } diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/RouteTemplateDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/RouteTemplateDefinition.java index c4c1252..e5fa49f 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/model/RouteTemplateDefinition.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/RouteTemplateDefinition.java @@ -17,6 +17,7 @@ package org.apache.camel.model; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -30,7 +31,6 @@ import org.apache.camel.Endpoint; import org.apache.camel.builder.EndpointConsumerBuilder; import org.apache.camel.spi.AsEndpointUri; import org.apache.camel.spi.Metadata; -import org.apache.camel.util.function.ThrowingFunction; /** * Defines a route template (parameterized routes) @@ -46,14 +46,14 @@ public class RouteTemplateDefinition extends OptionalIdentifiedDefinition { @XmlElement(name = "route", required = true) private RouteDefinition route = new RouteDefinition(); -public void setTemplateParameters(List templateParameters) { -this.templateParameters = templateParameters; -} - public List getTemplateParameters() { return templateParameters; } +public void setTemplateParameters(List templateParameters) {
[camel-kafka-connector] 01/06: core: remove unused methods from TaskHelper
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit 22a5f56dea6c35fcb112a33c83044085885c06e9 Author: Luca Burgazzoli AuthorDate: Thu Oct 15 11:56:48 2020 +0200 core: remove unused methods from TaskHelper --- .../camel/kafkaconnector/utils/TaskHelper.java | 28 --- .../camel/kafkaconnector/utils/TaskHelperTest.java | 98 -- 2 files changed, 126 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java b/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java index 78e489d..ecdb5a3 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java @@ -69,30 +69,6 @@ public final class TaskHelper { return rcc.asEndpointUri(componentSchema, filteredProps, false); } -public static String buildUrl(Map props, String componentSchema, String endpointPropertiesPrefix, String pathPropertiesPrefix) { -final String urlPath = createUrlPathFromProperties(props, pathPropertiesPrefix); -final String endpointOptions = createEndpointOptionsFromProperties(props, endpointPropertiesPrefix); - -return componentSchema + ":" + urlPath + endpointOptions; -} - -public static String createEndpointOptionsFromProperties(Map props, String prefix) { -return props.keySet().stream() -.filter(k -> k.startsWith(prefix)) -.map(k -> k.replace(prefix, "") + "=" + props.get(k)) -.reduce((o1, o2) -> o1 + "&" + o2) -.map(result -> result.isEmpty() ? "" : "?" + result) -.orElse(""); -} - -public static String createUrlPathFromProperties(Map props, String prefix) { -return props.keySet().stream() -.filter(k -> k.startsWith(prefix)) -.map(props::get) -.reduce((p1, p2) -> p1 + ":" + p2) -.orElse(""); -} - public static Map mergeProperties(Map defaultProps, Map loadedProps) { if (loadedProps == null && defaultProps == null) { return Collections.emptyMap(); @@ -110,10 +86,6 @@ public final class TaskHelper { } } -private static String getStringPrefix(String s) { -return s.lastIndexOf(".") > 0 ? s.substring(0, s.lastIndexOf(".")) : ""; -} - private static Boolean stringStartWithOneOfPrefixes(String s, Set prefixes) { if (s == null || prefixes == null) { return false; diff --git a/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java b/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java index bc0f537..5da421c 100644 --- a/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java +++ b/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java @@ -117,104 +117,6 @@ public class TaskHelperTest { } @Test -public void testCreateEndpointOptionsFromProperties() { -Map props = new HashMap() { -{ -put("prefix.key1", "value1"); -put("notprefix.key2", "value2"); -} -}; - -String result = TaskHelper.createEndpointOptionsFromProperties(props, "prefix."); - -assertEquals("?key1=value1", result); -} - -@Test -public void testCreateEndpointOptionsFromPropertiesConcatenation() { -Map props = new HashMap() { -{ -put("prefix.key1", "value1"); -put("prefix.key2", "value2"); -} -}; - -String result = TaskHelper.createEndpointOptionsFromProperties(props, "prefix."); - -assertEquals("?key1=value1&key2=value2", result); -} - -@Test -public void testCreateEndpointOptionsFromPropertiesEmpty() { -Map props = new HashMap() { -{ -put("prefix.key1", "value1"); -put("notprefix.key2", "value2"); -} -}; - -String result = TaskHelper.createEndpointOptionsFromProperties(props, "anotherprefix"); - -assertEquals("", result); -} - -@Test -public void testCreateUrlPathFromProperties() { -Map props = new HashMap() { -{ -put("prefix.key1", "value1"); -put("notprefix.key2", "value2"); -
[camel-kafka-connector] 04/06: TaskHelperTest: replace raw Map with generic version
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit 1ccc60ac26b67244bb86e95bae9628b2e608c766 Author: Luca Burgazzoli AuthorDate: Thu Oct 15 12:22:40 2020 +0200 TaskHelperTest: replace raw Map with generic version --- .../org/apache/camel/kafkaconnector/utils/TaskHelperTest.java | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java b/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java index 8cb949f..14d162a 100644 --- a/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java +++ b/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java @@ -42,7 +42,7 @@ public class TaskHelperTest { @Test public void testMergePropertiesNull() { -Map result = TaskHelper.mergeProperties(null, null); +Map result = TaskHelper.mergeProperties(null, null); assertEquals(Collections.EMPTY_MAP, result); } @@ -61,7 +61,7 @@ public class TaskHelperTest { } }; -Map result = TaskHelper.mergeProperties(defaults, loaded); +Map result = TaskHelper.mergeProperties(defaults, loaded); assertTrue(result.containsKey("property")); assertTrue(result.containsKey("anotherProperty")); @@ -83,7 +83,7 @@ public class TaskHelperTest { } }; -Map result = TaskHelper.mergeProperties(defaults, loaded); +Map result = TaskHelper.mergeProperties(defaults, loaded); assertTrue(result.containsKey("property")); assertEquals("loadedValue", result.get("property")); @@ -107,7 +107,7 @@ public class TaskHelperTest { } }; -Map result = TaskHelper.mergeProperties(defaults, loaded); +Map result = TaskHelper.mergeProperties(defaults, loaded); assertEquals("defaultValue", result.get("property")); assertEquals("#class:my.package.MyOtherClass", result.get("camel.component.x.objectProperty"));
[camel-kafka-connector] 05/06: TaskHelperTest: replace double brace initialization with Camel's helpers
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit 176244bff17db1f5d7734c83e1505d7d6c966755 Author: Luca Burgazzoli AuthorDate: Thu Oct 15 12:27:27 2020 +0200 TaskHelperTest: replace double brace initialization with Camel's helpers --- .../camel/kafkaconnector/utils/TaskHelperTest.java | 78 +++--- 1 file changed, 25 insertions(+), 53 deletions(-) diff --git a/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java b/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java index 14d162a..91087dc 100644 --- a/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java +++ b/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java @@ -18,7 +18,6 @@ package org.apache.camel.kafkaconnector.utils; import java.net.URISyntaxException; import java.util.Collections; -import java.util.HashMap; import java.util.Map; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; @@ -33,6 +32,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.ext.LoggerWrapper; +import static org.apache.camel.util.CollectionHelper.mapOf; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; @@ -49,18 +49,8 @@ public class TaskHelperTest { @Test public void testMergePropertiesDefaultAreAdded() { -Map defaults = new HashMap() { -{ -put("property", "defaultValue"); -} -}; - -Map loaded = new HashMap() { -{ -put("anotherProperty", "loadedValue"); -} -}; - +Map defaults = mapOf("property", "defaultValue"); +Map loaded = mapOf("anotherProperty", "loadedValue"); Map result = TaskHelper.mergeProperties(defaults, loaded); assertTrue(result.containsKey("property")); @@ -71,18 +61,8 @@ public class TaskHelperTest { @Test public void testMergePropertiesLoadedHavePrecedence() { -Map defaults = new HashMap() { -{ -put("property", "defaultValue"); -} -}; - -Map loaded = new HashMap() { -{ -put("property", "loadedValue"); -} -}; - +Map defaults = mapOf("property", "defaultValue"); +Map loaded = mapOf("property", "loadedValue"); Map result = TaskHelper.mergeProperties(defaults, loaded); assertTrue(result.containsKey("property")); @@ -91,21 +71,17 @@ public class TaskHelperTest { @Test public void testMergePropertiesLoadedHavePrecedenceWithPrefixFiltering() { -Map defaults = new HashMap() { -{ -put("property", "defaultValue"); -put("camel.component.x.objectProperty", "#class:my.package.MyClass"); -put("camel.component.x.objectProperty.field", "defaultValue"); -} -}; - -Map loaded = new HashMap() { -{ -put("camel.component.x.objectProperty", "#class:my.package.MyOtherClass"); -put("camel.component.x.objectProperty.anotherField", "loadedValue"); -put("camel.component.x.normalProperty", "loadedValue"); -} -}; +Map defaults = mapOf( +"property", "defaultValue", +"camel.component.x.objectProperty", "#class:my.package.MyClass", +"camel.component.x.objectProperty.field", "defaultValue" +); + +Map loaded = mapOf( +"camel.component.x.objectProperty", "#class:my.package.MyOtherClass", +"camel.component.x.objectProperty.anotherField", "loadedValue", +"camel.component.x.normalProperty", "loadedValue" +); Map result = TaskHelper.mergeProperties(defaults, loaded); @@ -120,24 +96,20 @@ public class TaskHelperTest { public void testBuildUrlWithRuntimeCatalog() throws URISyntaxException { DefaultCamelContext dcc = new DefaultCamelContext(); RuntimeCamelCatalog rcc = dcc.adapt(ExtendedCamelContext.class).getRuntimeCamelCatalog(); -Map props = new HashMap() { -{ -put("camel.source.path.name", "test"); -
[camel-kafka-connector] 06/06: TaskHelperTest: iuse assertFalse instead of negated assertTrue
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit 9d6db1472264e43a00c00f5ae1962507187d8c85 Author: Luca Burgazzoli AuthorDate: Thu Oct 15 12:28:58 2020 +0200 TaskHelperTest: iuse assertFalse instead of negated assertTrue --- .../java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java b/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java index 91087dc..26ca86e 100644 --- a/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java +++ b/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java @@ -35,6 +35,7 @@ import org.slf4j.ext.LoggerWrapper; import static org.apache.camel.util.CollectionHelper.mapOf; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -89,7 +90,7 @@ public class TaskHelperTest { assertEquals("#class:my.package.MyOtherClass", result.get("camel.component.x.objectProperty")); assertEquals("loadedValue", result.get("camel.component.x.objectProperty.anotherField")); assertEquals("loadedValue", result.get("camel.component.x.normalProperty")); - assertTrue(!result.containsKey("camel.component.x.objectProperty.field")); + assertFalse(result.containsKey("camel.component.x.objectProperty.field")); } @Test
[camel-kafka-connector] branch master updated (b5b38c7 -> 9d6db14)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git. from b5b38c7 Updated CHANGELOG.md new 22a5f56 core: remove unused methods from TaskHelper new 7a0e751 core: compute content log level once upon startup new 72bc2f1 TaskHelperTest: cleanup MyLogger class new 1ccc60a TaskHelperTest: replace raw Map with generic version new 176244b TaskHelperTest: replace double brace initialization with Camel's helpers new 9d6db14 TaskHelperTest: iuse assertFalse instead of negated assertTrue The 6 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/camel/kafkaconnector/CamelSinkTask.java | 14 +- .../camel/kafkaconnector/CamelSourceTask.java | 14 +- .../camel/kafkaconnector/utils/TaskHelper.java | 86 ++- .../camel/kafkaconnector/utils/TaskHelperTest.java | 263 + 4 files changed, 102 insertions(+), 275 deletions(-)
[camel-kafka-connector] 03/06: TaskHelperTest: cleanup MyLogger class
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit 72bc2f1891095235fd3f8e291927fe247bb44039 Author: Luca Burgazzoli AuthorDate: Thu Oct 15 12:21:11 2020 +0200 TaskHelperTest: cleanup MyLogger class --- .../org/apache/camel/kafkaconnector/utils/TaskHelperTest.java | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java b/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java index f8e4758..8cb949f 100644 --- a/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java +++ b/core/src/test/java/org/apache/camel/kafkaconnector/utils/TaskHelperTest.java @@ -176,8 +176,8 @@ public class TaskHelperTest { assertThat(logger.getEvents().poll()).isNotNull().contains(partName); } -class MyLogger extends LoggerWrapper { -private Queue events = new ConcurrentLinkedQueue(); +static class MyLogger extends LoggerWrapper { +private final Queue events = new ConcurrentLinkedQueue<>(); public MyLogger(Logger logger, String fqcn) { super(logger, fqcn); @@ -188,9 +188,7 @@ public class TaskHelperTest { } private void log(LoggingLevel level, String msg) { -StringBuilder sb = new StringBuilder() -.append(level).append(" ").append(msg); -events.add(sb.toString()); +events.add(level + " " + msg); } @Override
[camel-kafka-connector] 02/06: core: compute content log level once upon startup
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit 7a0e751ee9ee2643627a344465e954765676f7e0 Author: Luca Burgazzoli AuthorDate: Thu Oct 15 12:18:27 2020 +0200 core: compute content log level once upon startup --- .../apache/camel/kafkaconnector/CamelSinkTask.java | 14 - .../camel/kafkaconnector/CamelSourceTask.java | 14 - .../camel/kafkaconnector/utils/TaskHelper.java | 58 --- .../camel/kafkaconnector/utils/TaskHelperTest.java | 66 -- 4 files changed, 67 insertions(+), 85 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java index 25d94f1..e64ee16 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java @@ -25,6 +25,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; import org.apache.camel.ExtendedCamelContext; +import org.apache.camel.LoggingLevel; import org.apache.camel.ProducerTemplate; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.kafkaconnector.utils.CamelKafkaConnectMain; @@ -55,8 +56,8 @@ public class CamelSinkTask extends SinkTask { private CamelKafkaConnectMain cms; private ProducerTemplate producer; -private CamelSinkConnectorConfig config; private Endpoint localEndpoint; +private LoggingLevel loggingLevel = LoggingLevel.OFF; @Override public String version() { @@ -68,7 +69,14 @@ public class CamelSinkTask extends SinkTask { try { LOG.info("Starting CamelSinkTask connector task"); Map actualProps = TaskHelper.mergeProperties(getDefaultConfig(), props); -config = getCamelSinkConnectorConfig(actualProps); +CamelSinkConnectorConfig config = getCamelSinkConnectorConfig(actualProps); + +try { +String levelStr = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_CONTENT_LOG_LEVEL_CONF); +loggingLevel = LoggingLevel.valueOf(levelStr.toUpperCase()); +} catch (Exception e) { +LOG.debug("Invalid value for " + CamelSinkConnectorConfig.CAMEL_SINK_CONTENT_LOG_LEVEL_CONF + "property"); +} String remoteUrl = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_URL_CONF); final String marshaller = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_MARSHAL_CONF); @@ -124,7 +132,7 @@ public class CamelSinkTask extends SinkTask { @Override public void put(Collection sinkRecords) { for (SinkRecord record : sinkRecords) { -TaskHelper.logRecordContent(LOG, record, config); +TaskHelper.logRecordContent(LOG, loggingLevel, record); Exchange exchange = new DefaultExchange(producer.getCamelContext()); exchange.getMessage().setBody(record.value()); diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java index c793f1b..247edd3 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java @@ -27,6 +27,7 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.ExtendedCamelContext; +import org.apache.camel.LoggingLevel; import org.apache.camel.PollingConsumer; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.kafkaconnector.utils.CamelKafkaConnectMain; @@ -52,12 +53,12 @@ public class CamelSourceTask extends SourceTask { private static final String LOCAL_URL = "direct:end"; private CamelKafkaConnectMain cms; -private CamelSourceConnectorConfig config; private PollingConsumer consumer; private String[] topics; private Long maxBatchPollSize; private Long maxPollDuration; private String camelMessageHeaderKey; +private LoggingLevel loggingLevel = LoggingLevel.OFF; @Override public String version() { @@ -69,7 +70,14 @@ public class CamelSourceTask extends SourceTask { try { LOG.info("Starting CamelSourceTask connector task"); Map actualProps = TaskHelper.mergeProperties(getDefaultConfig(), props); -config = getCamelSourceConnectorConfig(actualProps); +CamelSourceConnectorConfig config = getCamelSourceConnectorConfig(actualProps); + +try { +String levelStr = config.getString(CamelSourceConnectorConfig.CAMEL_SOURCE_CONTENT_LOG_LEVEL_CONF); +
[camel-k] branch master updated: Add suport for gists #1740
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git The following commit(s) were added to refs/heads/master by this push: new b3ae436 Add suport for gists #1740 b3ae436 is described below commit b3ae43691dea0afa6eb05a9a46c9d486f13656e4 Author: Luca Burgazzoli AuthorDate: Mon Oct 5 15:53:54 2020 +0200 Add suport for gists #1740 --- .../ROOT/pages/running/run-from-github.adoc| 57 +- e2e/common/run_test.go | 64 +-- go.mod | 2 + go.sum | 4 + pkg/cmd/modeline.go| 106 +-- pkg/cmd/modeline_test.go | 8 +- pkg/cmd/run.go | 96 ++ pkg/cmd/util.go| 13 ++ pkg/cmd/{util_getter.go => util_content.go}| 75 +--- pkg/cmd/util_sources.go| 201 + pkg/util/util.go | 12 ++ 11 files changed, 448 insertions(+), 190 deletions(-) diff --git a/docs/modules/ROOT/pages/running/run-from-github.adoc b/docs/modules/ROOT/pages/running/run-from-github.adoc index 5f071b6..1d606b8 100644 --- a/docs/modules/ROOT/pages/running/run-from-github.adoc +++ b/docs/modules/ROOT/pages/running/run-from-github.adoc @@ -1,25 +1,64 @@ [[run-from-github]] = Run from GitHub -It is possible to run integrations from GitHub with a dedicated URL -syntax: +It is possible to run integrations from a GitHub repository or Gist with dedicated URL syntax: -``` +== Repository + +.Syntax +[source] + kamel run github:$user/$repo/$path?branch=$branch -``` + As example, running the following command -``` + +[source] + kamel run github:apache/camel-k/examples/Sample.java -``` + is equivalent to: -``` +[source] + kamel run https://raw.githubusercontent.com/apache/camel-k/master/examples/Sample.java -``` + but does not require to type the full GitHub RAW URL. -Declaring the branch query param is not required and defaults to `master` if not explicit set. \ No newline at end of file +Declaring the branch query param is not required and defaults to `master` if not explicit set. + +== Gist + +.Syntax +[source] + +kamel run https://gist.github.com/${user-id}/${gist-id} +kamel run gist:${gist-id} + + +camel-k will add any file that is part of the Gist as a source. + +As example, assuming there are two files listed as part of a Gist, beans.yaml and routes.yaml, then the following command + + +[source] + +kamel run gist:${gist-id} + + +is equivalent to: + +[source] + +kamel run \ + https://gist.githubusercontent.com/${user-id}/${gist-id}/raw/${...}/beans.yaml \ + https://gist.githubusercontent.com/${user-id}/${gist-id}/raw/${...}/routes.yaml + + +[NOTE] + +GitHub applies rate limiting to its APIs and as Authenticated requests get a higher rate limit, the camel-k cli honour the env var GITHUB_TOKEN and if it is found, then it is used for GitHub authentication. + \ No newline at end of file diff --git a/e2e/common/run_test.go b/e2e/common/run_test.go index 1309bf8..3cb833d 100644 --- a/e2e/common/run_test.go +++ b/e2e/common/run_test.go @@ -44,24 +44,6 @@ func TestRunSimpleExamples(t *testing.T) { Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) }) - t.Run("run java from GitHub", func(t *testing.T) { - RegisterTestingT(t) - Expect(Kamel("run", "-n", ns, "github:apache/camel-k/e2e/common/files/Java.java").Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) - Eventually(IntegrationCondition(ns, "java", camelv1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(v1.ConditionTrue)) - Eventually(IntegrationLogs(ns, "java"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) - Expect(Kamel("delete", "--all", "-n", ns).Execute()).Should(BeNil()) - }) - - t.Run("run java from GitHub (RAW)", func(t *testing.T) { - RegisterTestingT(t) - Expect(Kamel("run", "-n", ns, "https://raw.githubusercontent.com/apache/camel-k/master/e2e/common/files/Java.java";).Execute()).Should(BeNil()) - Eventually(IntegrationPodPhase(ns, "java"), TestTimeoutMedium).Should(Equal(v1.PodRunning)) -
[camel-k] branch master updated (08a6498 -> 0cc8d94)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git. from 08a6498 Updated CHANGELOG.md new 9da5cd1 chore(build): remove reference to staging repo new 0cc8d94 chore(build): rebuild cache to avoid stale dependencies on ci The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: script/Makefile | 2 +- script/build_catalog.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
[camel-k] 02/02: chore(build): rebuild cache to avoid stale dependencies on ci
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git commit 0cc8d9442e2f8d02b5cb4ee58af57ea8f38914ce Author: Luca Burgazzoli AuthorDate: Mon Oct 12 14:33:18 2020 +0200 chore(build): rebuild cache to avoid stale dependencies on ci --- script/build_catalog.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/script/build_catalog.sh b/script/build_catalog.sh index a29a0e8..dc5f8ca 100755 --- a/script/build_catalog.sh +++ b/script/build_catalog.sh @@ -26,6 +26,7 @@ if [ "$#" -ge 1 ]; then -Dcatalog.path=${rootdir}/deploy \ -Druntime.version=$runtimeVersion \ -B \ +-U \ "$@" else echo "usage: $0 runtime.version catalog.runtime [staging.repo]"
[camel-k] 01/02: chore(build): remove reference to staging repo
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git commit 9da5cd164ab568cb945add63db21148df477b778 Author: Luca Burgazzoli AuthorDate: Mon Oct 12 12:26:35 2020 +0200 chore(build): remove reference to staging repo --- script/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/Makefile b/script/Makefile index ea48457..48bfd6a 100644 --- a/script/Makefile +++ b/script/Makefile @@ -30,7 +30,7 @@ LINT_DEADLINE := 10m # Used to push pre-release artifacts STAGING_IMAGE_NAME := docker.io/camelk/camel-k -STAGING_RUNTIME_REPO := https://repository.apache.org/content/repositories/orgapachecamel-1251 +STAGING_RUNTIME_REPO := # Define here the repo containing the default Kamelet catalog (if any) KAMELET_CATALOG_REPO :=
[camel] 01/02: CAMEL-15664: Automatically wrap secret properites with RAW when computing the URI
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git commit 24a6e274347be6a8b0819b278e1e0321accc54be Author: Luca Burgazzoli AuthorDate: Fri Oct 9 23:50:03 2020 +0200 CAMEL-15664: Automatically wrap secret properites with RAW when computing the URI --- .../org/apache/camel/spi/EndpointUriFactory.java | 5 ++ .../camel/catalog/impl/AbstractCamelCatalog.java | 41 ++- .../catalog/CustomEndpointUriFactoryTest.java | 80 -- .../camel/catalog/RuntimeCamelCatalogTest.java | 32 + .../component/EndpointUriFactorySupport.java | 10 +++ .../packaging/EndpointUriFactoryGenerator.java | 75 +++- 6 files changed, 220 insertions(+), 23 deletions(-) diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/EndpointUriFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/EndpointUriFactory.java index a5f2dbf..1eb4d99 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/EndpointUriFactory.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/EndpointUriFactory.java @@ -50,6 +50,11 @@ public interface EndpointUriFactory extends CamelContextAware { Set propertyNames(); /** + * Returns the names of the secret properties this endpoin supports. + */ +Set secretPropertyNames(); + +/** * Whether the endpoint is lenient or not. * * @see Endpoint#isLenientProperties() diff --git a/core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/AbstractCamelCatalog.java b/core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/AbstractCamelCatalog.java index c765f49..1a7571a 100644 --- a/core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/AbstractCamelCatalog.java +++ b/core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/AbstractCamelCatalog.java @@ -32,6 +32,7 @@ import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.TreeMap; +import java.util.function.BiFunction; import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -799,6 +800,7 @@ public abstract class AbstractCamelCatalog { // build at first according to syntax (use a tree map as we want the uri options sorted) Map copy = new TreeMap<>(properties); + Matcher syntaxMatcher = COMPONENT_SYNTAX_PARSER.matcher(originalSyntax); while (syntaxMatcher.find()) { syntax += syntaxMatcher.group(1); @@ -821,6 +823,23 @@ public abstract class AbstractCamelCatalog { sb.append(syntax); if (!copy.isEmpty()) { +// wrap secret values with RAW to avoid breaking URI encoding in case of encoded values +copy.replaceAll((key, val) -> { +if (val == null) { +return val; +} +BaseOptionModel option = rows.get(key); +if (option == null) { +return val; +} + +if (option.isSecret() && !val.startsWith("#") && !val.startsWith("RAW(")) { +return "RAW(" + val + ")"; +} + +return val; +}); + boolean hasQuestionMark = sb.toString().contains("?"); // the last option may already contain a ? char, if so we should use & instead of ? sb.append(hasQuestionMark ? ampersand : '?'); @@ -905,8 +924,28 @@ public abstract class AbstractCamelCatalog { range++; } - if (!copy.isEmpty()) { +// wrap secret values with RAW to avoid breaking URI encoding in case of encoded values +copy.replaceAll(new BiFunction() { +@Override +public String apply(String key, String val) { + +if (val == null) { +return val; +} +BaseOptionModel option = rows.get(key); +if (option == null) { +return val; +} + +if (option.isSecret() && !val.startsWith("#") && !val.startsWith("RAW(")) { +return "RAW(" + val + ")"; +} + +return val; +} +}); + // the last option may already contain a ? char, if so we should use & instead of ? sb.append(hasQuestionmark ? ampersand : '?'); String query = URISupport.cre
[camel] branch master updated (62739be -> 69b2d49)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel.git. from 62739be Deploy gh action: No need for 3.4.x branch new 24a6e27 CAMEL-15664: Automatically wrap secret properites with RAW when computing the URI new 69b2d49 CAMEL-15664: Automatically wrap secret properites with RAW when computing the URI (regen) The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../activemq/ActiveMQEndpointUriFactory.java | 209 +++--- .../component/ahc/ws/WsEndpointUriFactory.java | 54 ++-- .../camel/component/ahc/AhcEndpointUriFactory.java | 44 +-- .../component/amqp/AMQPEndpointUriFactory.java | 209 +++--- .../component/apns/ApnsEndpointUriFactory.java | 60 ++-- .../arangodb/ArangoDbEndpointUriFactory.java | 41 ++- .../camel/component/as2/AS2EndpointUriFactory.java | 101 --- .../asterisk/AsteriskEndpointUriFactory.java | 37 ++- .../component/atmos/AtmosEndpointUriFactory.java | 47 ++-- .../websocket/WebsocketEndpointUriFactory.java | 70 ++--- .../component/atom/AtomEndpointUriFactory.java | 72 ++--- .../client/map/AtomixMapEndpointUriFactory.java| 54 ++-- .../AtomixMessagingEndpointUriFactory.java | 56 ++-- .../multimap/AtomixMultiMapEndpointUriFactory.java | 48 ++-- .../queue/AtomixQueueEndpointUriFactory.java | 50 ++-- .../client/set/AtomixSetEndpointUriFactory.java| 52 ++-- .../value/AtomixValueEndpointUriFactory.java | 52 ++-- .../component/avro/AvroEndpointUriFactory.java | 44 +-- .../component/aws/cw/CwEndpointUriFactory.java | 47 ++-- .../component/aws/ddb/DdbEndpointUriFactory.java | 51 ++-- .../aws/ddbstream/DdbStreamEndpointUriFactory.java | 81 +++--- .../component/aws/ec2/EC2EndpointUriFactory.java | 41 ++- .../component/aws/ecs/ECSEndpointUriFactory.java | 41 ++- .../component/aws/eks/EKSEndpointUriFactory.java | 41 ++- .../component/aws/iam/IAMEndpointUriFactory.java | 41 ++- .../KinesisFirehoseEndpointUriFactory.java | 39 ++- .../aws/kinesis/KinesisEndpointUriFactory.java | 87 +++--- .../component/aws/kms/KMSEndpointUriFactory.java | 41 ++- .../aws/lambda/LambdaEndpointUriFactory.java | 41 ++- .../component/aws/mq/MQEndpointUriFactory.java | 41 ++- .../component/aws/msk/MSKEndpointUriFactory.java | 41 ++- .../component/aws/s3/S3EndpointUriFactory.java | 135 - .../component/aws/sdb/SdbEndpointUriFactory.java | 40 +-- .../component/aws/ses/SesEndpointUriFactory.java | 47 ++-- .../component/aws/sns/SnsEndpointUriFactory.java | 59 ++-- .../component/aws/sqs/SqsEndpointUriFactory.java | 136 - .../component/aws/swf/SWFEndpointUriFactory.java | 81 +++--- .../aws/translate/TranslateEndpointUriFactory.java | 47 ++-- .../aws2/athena/Athena2EndpointUriFactory.java | 77 +++--- .../component/aws2/cw/Cw2EndpointUriFactory.java | 49 ++-- .../component/aws2/ddb/Ddb2EndpointUriFactory.java | 53 ++-- .../ddbstream/Ddb2StreamEndpointUriFactory.java| 83 +++--- .../aws2/ec2/AWS2EC2EndpointUriFactory.java| 45 +-- .../component/aws2/ecs/ECS2EndpointUriFactory.java | 45 +-- .../component/aws2/eks/EKS2EndpointUriFactory.java | 45 +-- .../eventbridge/EventbridgeEndpointUriFactory.java | 47 ++-- .../component/aws2/iam/IAM2EndpointUriFactory.java | 45 +-- .../KinesisFirehose2EndpointUriFactory.java| 43 +-- .../aws2/kinesis/Kinesis2EndpointUriFactory.java | 89 +++--- .../component/aws2/kms/KMS2EndpointUriFactory.java | 45 +-- .../aws2/lambda/Lambda2EndpointUriFactory.java | 45 +-- .../component/aws2/mq/MQ2EndpointUriFactory.java | 45 +-- .../component/aws2/msk/MSK2EndpointUriFactory.java | 45 +-- .../aws2/s3/AWS2S3EndpointUriFactory.java | 141 +- .../component/aws2/ses/Ses2EndpointUriFactory.java | 49 ++-- .../component/aws2/sns/Sns2EndpointUriFactory.java | 59 ++-- .../component/aws2/sqs/Sqs2EndpointUriFactory.java | 138 +- .../component/aws2/sts/STS2EndpointUriFactory.java | 45 +-- .../translate/Translate2EndpointUriFactory.java| 51 ++-- .../eventhubs/EventHubsEndpointUriFactory.java | 67 +++-- .../azure/storage/blob/BlobEndpointUriFactory.java | 78 +++--- .../storage/queue/QueueEndpointUriFactory.java | 54 ++-- .../azure/blob/BlobServiceEndpointUriFactory.java | 65 +++-- .../queue/QueueServiceEndpointUriFactory.java | 47 ++-- .../validator/BeanValidatorEndpointUriFactory.java | 34 ++- .../component/bean/BeanEndpointUriFactory.java | 28 +- .../beanclass/ClassEndpointUriFactory.java |
[camel-kafka-connector] branch master updated: github action: add trigger on workflow_dispatch
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git The following commit(s) were added to refs/heads/master by this push: new 6d2e697 github action: add trigger on workflow_dispatch 6d2e697 is described below commit 6d2e697a70d1a5605811b5be009d089f912ad382 Author: Luca Burgazzoli AuthorDate: Sun Oct 11 15:14:38 2020 + github action: add trigger on workflow_dispatch --- .github/workflows/asf-snapshots-deploy.yml| 1 + .github/workflows/automatic-changelog-update.yml | 1 + .github/workflows/automatic-sync-camel-master.yml | 1 + .github/workflows/rebase-master-onto-camel-master.yml | 1 + 4 files changed, 4 insertions(+) diff --git a/.github/workflows/asf-snapshots-deploy.yml b/.github/workflows/asf-snapshots-deploy.yml index c301e21..d3e4560 100644 --- a/.github/workflows/asf-snapshots-deploy.yml +++ b/.github/workflows/asf-snapshots-deploy.yml @@ -23,6 +23,7 @@ on: schedule: # Run at 1 during night - cron: '0 1 * * *' + workflow_dispatch: jobs: build: diff --git a/.github/workflows/automatic-changelog-update.yml b/.github/workflows/automatic-changelog-update.yml index 91b5873..db35e77 100644 --- a/.github/workflows/automatic-changelog-update.yml +++ b/.github/workflows/automatic-changelog-update.yml @@ -21,6 +21,7 @@ on: schedule: # Run at 3 during night - cron: '0 3 * * *' + workflow_dispatch: jobs: generate_changelog: diff --git a/.github/workflows/automatic-sync-camel-master.yml b/.github/workflows/automatic-sync-camel-master.yml index 27e0b5f..3e4737e 100644 --- a/.github/workflows/automatic-sync-camel-master.yml +++ b/.github/workflows/automatic-sync-camel-master.yml @@ -24,6 +24,7 @@ on: schedule: # Run at 2 AM every day - cron: '0 2 * * *' + workflow_dispatch: jobs: build: name: Sync Camel Kafka Connector camel-master Branch diff --git a/.github/workflows/rebase-master-onto-camel-master.yml b/.github/workflows/rebase-master-onto-camel-master.yml index ec5d351..5d8906b 100644 --- a/.github/workflows/rebase-master-onto-camel-master.yml +++ b/.github/workflows/rebase-master-onto-camel-master.yml @@ -24,6 +24,7 @@ on: schedule: # Run every day at midnight - cron: '0 0 * * *' + workflow_dispatch: jobs: build:
[camel-kafka-connector] branch master updated: build: execute ci-build for pr/push to the camel-master branch
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git The following commit(s) were added to refs/heads/master by this push: new 1073095 build: execute ci-build for pr/push to the camel-master branch 1073095 is described below commit 1073095af0db4f08878e68aa7ed43c7d62df312a Author: Luca Burgazzoli AuthorDate: Fri Oct 9 09:37:14 2020 +0200 build: execute ci-build for pr/push to the camel-master branch --- .github/workflows/ci-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 34aa062..20a406d 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -24,9 +24,11 @@ on: push: branches: - master + - camel-master pull_request: branches: - master + - camel-master jobs: build: runs-on: ubuntu-latest
[camel-kafka-connector] branch master updated: core: simplify kafka headers to camel exchange mapping
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git The following commit(s) were added to refs/heads/master by this push: new 3b315a3 core: simplify kafka headers to camel exchange mapping 3b315a3 is described below commit 3b315a3e4c4e2270460376a422fb094c9f1fde40 Author: Luca Burgazzoli AuthorDate: Thu Oct 8 19:27:03 2020 +0200 core: simplify kafka headers to camel exchange mapping --- .../apache/camel/kafkaconnector/CamelSinkTask.java | 86 -- 1 file changed, 13 insertions(+), 73 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java index 63e139c..25d94f1 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java @@ -18,9 +18,6 @@ package org.apache.camel.kafkaconnector; import java.util.Collection; import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Objects; @@ -36,8 +33,6 @@ import org.apache.camel.support.DefaultExchange; import org.apache.commons.lang3.StringUtils; import org.apache.kafka.connect.data.Decimal; import org.apache.kafka.connect.data.Schema; -import org.apache.kafka.connect.data.SchemaBuilder; -import org.apache.kafka.connect.data.Timestamp; import org.apache.kafka.connect.errors.ConnectException; import org.apache.kafka.connect.header.Header; import org.apache.kafka.connect.sink.SinkRecord; @@ -130,18 +125,18 @@ public class CamelSinkTask extends SinkTask { public void put(Collection sinkRecords) { for (SinkRecord record : sinkRecords) { TaskHelper.logRecordContent(LOG, record, config); -Map headers = new HashMap<>(); + Exchange exchange = new DefaultExchange(producer.getCamelContext()); -headers.put(KAFKA_RECORD_KEY_HEADER, record.key()); +exchange.getMessage().setBody(record.value()); +exchange.getMessage().setHeader(KAFKA_RECORD_KEY_HEADER, record.key()); + for (Header header : record.headers()) { if (header.key().startsWith(HEADER_CAMEL_PREFIX)) { -addHeader(headers, header); +mapHeader(header, HEADER_CAMEL_PREFIX, exchange.getMessage().getHeaders()); } else if (header.key().startsWith(PROPERTY_CAMEL_PREFIX)) { -addProperty(exchange, header); +mapHeader(header, PROPERTY_CAMEL_PREFIX, exchange.getProperties()); } } -exchange.getMessage().setHeaders(headers); -exchange.getMessage().setBody(record.value()); LOG.debug("Sending exchange {} to {}", exchange.getExchangeId(), LOCAL_URL); producer.send(localEndpoint, exchange); @@ -172,69 +167,14 @@ public class CamelSinkTask extends SinkTask { } } -private void addHeader(Map map, Header singleHeader) { -String camelHeaderKey = StringUtils.removeStart(singleHeader.key(), HEADER_CAMEL_PREFIX); -Schema schema = singleHeader.schema(); - -if (schema.type().equals(Timestamp.SCHEMA.type()) && Objects.equals(schema.name(), Timestamp.SCHEMA.name())) { -map.put(camelHeaderKey, (Date)singleHeader.value()); -} else if (schema.type().getName().equals(Schema.STRING_SCHEMA.type().getName())) { -map.put(camelHeaderKey, (String)singleHeader.value()); -} else if (schema.type().getName().equalsIgnoreCase(Schema.BOOLEAN_SCHEMA.type().getName())) { -map.put(camelHeaderKey, (Boolean)singleHeader.value()); -} else if (schema.type().getName().equalsIgnoreCase(Schema.INT32_SCHEMA.type().getName())) { -map.put(camelHeaderKey, singleHeader.value()); -} else if (schema.type().getName().equalsIgnoreCase(Schema.BYTES_SCHEMA.type().getName())) { -if (Decimal.class.getCanonicalName().equals(schema.name())) { -map.put(camelHeaderKey, Decimal.toLogical(schema, (byte[])singleHeader.value())); -} else { -map.put(camelHeaderKey, (byte[])singleHeader.value()); -} -} else if (schema.type().getName().equalsIgnoreCase(Schema.FLOAT32_SCHEMA.type().getName())) { -map.put(camelHeaderKey, (float)singleHeader.value()); -} else if (schema.type().getName().equalsIgnoreCase(Schema.FLOAT64_SCHEMA.type().getName())) { -map.put(camelHeaderKey, (double)singleHeader.value()); -} else if (schema.type().getName().equalsIgnoreCase(Schema.INT16_SCHEMA.type().getName())) { -map.put(camelHeaderKey, (short)singleHeader.valu
[camel-k-runtime] branch master updated: fix: Update loggers after configuration
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new a8196eb fix: Update loggers after configuration a8196eb is described below commit a8196ebab97151dca4fe25b2fc40ef5d2dc1c571 Author: Christoph Deppisch AuthorDate: Thu Oct 8 19:41:09 2020 +0200 fix: Update loggers after configuration Logger configuration needs to be updated so changes come into effect --- .../apache/camel/k/main/ApplicationSupport.java| 2 ++ .../camel/k/main/ApplicationSupportTest.java | 42 ++ .../src/test/resources/logger.properties | 18 ++ 3 files changed, 62 insertions(+) diff --git a/camel-k-main/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/ApplicationSupport.java b/camel-k-main/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/ApplicationSupport.java index a45703c..288521f 100644 --- a/camel-k-main/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/ApplicationSupport.java +++ b/camel-k-main/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/ApplicationSupport.java @@ -49,5 +49,7 @@ public final class ApplicationSupport { ctx.getConfiguration().addLogger(logger, config); } ); + +ctx.updateLoggers(); } } diff --git a/camel-k-main/camel-k-runtime-main/src/test/java/org/apache/camel/k/main/ApplicationSupportTest.java b/camel-k-main/camel-k-runtime-main/src/test/java/org/apache/camel/k/main/ApplicationSupportTest.java new file mode 100644 index 000..25c5aa0 --- /dev/null +++ b/camel-k-main/camel-k-runtime-main/src/test/java/org/apache/camel/k/main/ApplicationSupportTest.java @@ -0,0 +1,42 @@ +/* + * 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.main; + +import org.apache.camel.k.Constants; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.slf4j.LoggerFactory; + +class ApplicationSupportTest { + +@Test +void configureLogging() { +System.setProperty(Constants.PROPERTY_CAMEL_K_CONF, "src/test/resources/logger.properties"); + +try { + Assertions.assertFalse(LoggerFactory.getLogger("org.foo").isDebugEnabled()); + Assertions.assertTrue(LoggerFactory.getLogger("org.bar").isInfoEnabled()); + +ApplicationSupport.configureLogging(); + + Assertions.assertTrue(LoggerFactory.getLogger("org.foo").isDebugEnabled()); + Assertions.assertFalse(LoggerFactory.getLogger("org.bar").isInfoEnabled()); +} finally { +System.getProperties().remove(Constants.PROPERTY_CAMEL_K_CONF); +} +} +} diff --git a/camel-k-main/camel-k-runtime-main/src/test/resources/logger.properties b/camel-k-main/camel-k-runtime-main/src/test/resources/logger.properties new file mode 100644 index 000..acb9346 --- /dev/null +++ b/camel-k-main/camel-k-runtime-main/src/test/resources/logger.properties @@ -0,0 +1,18 @@ +## --- +## 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. +## --- +logging.level.org.foo=DEBUG +logging.level.org.bar=WARN
[camel-kafka-connector] branch master updated: source: better handling of headers of type Data #544
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git The following commit(s) were added to refs/heads/master by this push: new 7fd48c1 source: better handling of headers of type Data #544 7fd48c1 is described below commit 7fd48c150172fa9419fe33dde560254bb35845cc Author: Luca Burgazzoli AuthorDate: Thu Oct 8 16:51:06 2020 +0200 source: better handling of headers of type Data #544 --- .../camel/kafkaconnector/CamelConnectorUtils.java | 49 ++ .../apache/camel/kafkaconnector/CamelSinkTask.java | 13 +- .../camel/kafkaconnector/CamelSourceTask.java | 9 +--- .../camel/kafkaconnector/CamelSinkTaskTest.java| 32 ++ .../camel/kafkaconnector/CamelSourceTaskTest.java | 30 + 5 files changed, 123 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelConnectorUtils.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelConnectorUtils.java new file mode 100644 index 000..fa6a3e5 --- /dev/null +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelConnectorUtils.java @@ -0,0 +1,49 @@ +/* + * 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.kafkaconnector; + +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; + +public final class CamelConnectorUtils { +public static final TimeZone UTC = TimeZone.getTimeZone("UTC"); + +private CamelConnectorUtils() { +} + +public static Date truncateDate(Date value) { +Calendar calendar = Calendar.getInstance(CamelConnectorUtils.UTC); +calendar.setTime(value); +calendar.set(Calendar.YEAR, 0); +calendar.set(Calendar.MONTH, 0); +calendar.set(Calendar.DAY_OF_MONTH, 0); + +return calendar.getTime(); +} + +public static Date truncateTime(Date value) { +Calendar calendar = Calendar.getInstance(CamelConnectorUtils.UTC); +calendar.setTime(value); +calendar.set(Calendar.HOUR_OF_DAY, 0); +calendar.set(Calendar.MINUTE, 0); +calendar.set(Calendar.SECOND, 0); +calendar.set(Calendar.MILLISECOND, 0); + +return calendar.getTime(); +} +} diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java index 51cfe88..63e139c 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java @@ -18,9 +18,11 @@ package org.apache.camel.kafkaconnector; import java.util.Collection; import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; @@ -35,6 +37,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.kafka.connect.data.Decimal; import org.apache.kafka.connect.data.Schema; import org.apache.kafka.connect.data.SchemaBuilder; +import org.apache.kafka.connect.data.Timestamp; import org.apache.kafka.connect.errors.ConnectException; import org.apache.kafka.connect.header.Header; import org.apache.kafka.connect.sink.SinkRecord; @@ -172,7 +175,10 @@ public class CamelSinkTask extends SinkTask { private void addHeader(Map map, Header singleHeader) { String camelHeaderKey = StringUtils.removeStart(singleHeader.key(), HEADER_CAMEL_PREFIX); Schema schema = singleHeader.schema(); -if (schema.type().getName().equals(Schema.STRING_SCHEMA.type().getName())) { + +if (schema.type().equals(Timestamp.SCHEMA.type()) && Objects.equals(schema.name(), Timestamp.SCHEMA.name())) { +map.put(camelHeaderKey, (Date)singleHeader.value()); +} else if (schema.type().getName().equals(Schema.STRING_SCHEMA.type().getName())) { map.put(camelHeaderKey, (String)singleHeader.value()); } else if (schema.type().getName().equalsIgnoreCas
[camel-kafka-connector] branch master updated: core: add support for aggreation on source sinks
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git The following commit(s) were added to refs/heads/master by this push: new a0c1c60 core: add support for aggreation on source sinks a0c1c60 is described below commit a0c1c6015fe05ce9ab473d826401990811591dd1 Author: Luca Burgazzoli AuthorDate: Thu Oct 8 11:03:09 2020 +0200 core: add support for aggreation on source sinks --- core/pom.xml | 5 ++ .../camel/kafkaconnector/CamelConnectorConfig.java | 49 + .../kafkaconnector/CamelSinkConnectorConfig.java | 21 +- .../apache/camel/kafkaconnector/CamelSinkTask.java | 4 +- .../kafkaconnector/CamelSourceConnectorConfig.java | 8 +- .../camel/kafkaconnector/CamelSourceTask.java | 6 +- .../utils/CamelKafkaConnectMain.java | 3 +- .../camel/kafkaconnector/CamelSinkTaskTest.java| 10 +-- .../camel/kafkaconnector/CamelSourceTaskTest.java | 85 ++ .../utils/StringJoinerAggregator.java | 54 ++ 10 files changed, 215 insertions(+), 30 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index fe05166..61454c1 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -141,6 +141,11 @@ camel-aws2-sqs test + +org.assertj +assertj-core +test + diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelConnectorConfig.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelConnectorConfig.java new file mode 100644 index 000..fd62052 --- /dev/null +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelConnectorConfig.java @@ -0,0 +1,49 @@ +/* + * 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.kafkaconnector; + +import java.util.Map; + +import org.apache.kafka.common.config.AbstractConfig; +import org.apache.kafka.common.config.ConfigDef; + +public abstract class CamelConnectorConfig extends AbstractConfig { +public static final String CAMEL_CONNECTOR_AGGREGATE_DEFAULT = null; +public static final String CAMEL_CONNECTOR_AGGREGATE_NAME = "aggregate"; +public static final String CAMEL_CONNECTOR_AGGREGATE_CONF = "camel.beans." + CAMEL_CONNECTOR_AGGREGATE_NAME; +public static final String CAMEL_CONNECTOR_AGGREGATE_DOC = "A reference to an aggregate bean, in the form of #class:"; + +public static final Integer CAMEL_CONNECTOR_AGGREGATE_SIZE_DEFAULT = 10; +public static final String CAMEL_CONNECTOR_AGGREGATE_SIZE_CONF = "camel.beans.aggregation.size"; +public static final String CAMEL_CONNECTOR_AGGREGATE_SIZE_DOC = "The size of the aggregation, to be used in combination with camel.beans.aggregate"; + +public static final Long CAMEL_CONNECTOR_AGGREGATE_TIMEOUT_DEFAULT = 500L; +public static final String CAMEL_CONNECTOR_AGGREGATE_TIMEOUT_CONF = "camel.beans.aggregation.timeout"; +public static final String CAMEL_CONNECTOR_AGGREGATE_TIMEOUT_DOC = "The timeout of the aggregation, to be used in combination with camel.beans.aggregate"; + +protected CamelConnectorConfig(ConfigDef definition, Map originals, Map configProviderProps, boolean doLog) { +super(definition, originals, configProviderProps, doLog); +} + +protected CamelConnectorConfig(ConfigDef definition, Map originals) { +super(definition, originals); +} + +protected CamelConnectorConfig(ConfigDef definition, Map originals, boolean doLog) { +super(definition, originals, doLog); +} +} diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkConnectorConfig.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkConnectorConfig.java index 9b4b2df..980aad1 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkConnectorConfig.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkConnectorConfig.java @@ -19,12 +19,11 @@ package org.apache.cam
[camel-kafka-connector] branch master updated (7f46db0 -> 8dde130)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git. from 7f46db0 Catalog: Rename the json file to reflect the id and connectors.properties content - regeneration new e5184d8 [core] refactor camel main new e6049ee [core] cleanup CamelSourceTask new be4ad31 [core] cleanup CamelSinkTask new 8dde130 [core] cleanup TaskHelper The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/camel/kafkaconnector/CamelSinkTask.java | 35 ++--- .../camel/kafkaconnector/CamelSourceTask.java | 43 +++--- .../utils/CamelKafkaConnectMain.java | 129 .../kafkaconnector/utils/CamelMainSupport.java | 165 - .../camel/kafkaconnector/utils/TaskHelper.java | 6 +- .../camel/kafkaconnector/CamelSinkTaskTest.java| 38 ++--- .../camel/kafkaconnector/CamelSourceTaskTest.java | 18 +-- .../camel/kafkaconnector/DataFormatTest.java | 31 ++-- .../kafkaconnector/PropertiesNameFormatsTest.java | 4 +- 9 files changed, 211 insertions(+), 258 deletions(-) delete mode 100644 core/src/main/java/org/apache/camel/kafkaconnector/utils/CamelMainSupport.java
[camel-kafka-connector] 01/04: [core] refactor camel main
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit e5184d8f610bda5a3db886d03e93d239c172587f Author: Luca Burgazzoli AuthorDate: Wed Oct 7 15:57:57 2020 +0200 [core] refactor camel main --- .../apache/camel/kafkaconnector/CamelSinkTask.java | 25 ++-- .../camel/kafkaconnector/CamelSourceTask.java | 28 ++-- .../utils/CamelKafkaConnectMain.java | 129 .../kafkaconnector/utils/CamelMainSupport.java | 165 - .../camel/kafkaconnector/CamelSinkTaskTest.java| 38 ++--- .../camel/kafkaconnector/CamelSourceTaskTest.java | 18 +-- .../camel/kafkaconnector/DataFormatTest.java | 31 ++-- .../kafkaconnector/PropertiesNameFormatsTest.java | 4 +- 8 files changed, 199 insertions(+), 239 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java index c6242cb..c39a4f4 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java @@ -20,7 +20,6 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -29,8 +28,7 @@ import org.apache.camel.Exchange; import org.apache.camel.ExtendedCamelContext; import org.apache.camel.ProducerTemplate; import org.apache.camel.impl.DefaultCamelContext; -import org.apache.camel.kafkaconnector.utils.CamelKafkaConnectDataformat; -import org.apache.camel.kafkaconnector.utils.CamelMainSupport; +import org.apache.camel.kafkaconnector.utils.CamelKafkaConnectMain; import org.apache.camel.kafkaconnector.utils.TaskHelper; import org.apache.camel.support.DefaultExchange; import org.apache.commons.lang3.StringUtils; @@ -57,7 +55,7 @@ public class CamelSinkTask extends SinkTask { private static final String LOCAL_URL = "direct:start"; -private CamelMainSupport cms; +private CamelKafkaConnectMain cms; private ProducerTemplate producer; private CamelSinkConnectorConfig config; @@ -76,13 +74,6 @@ public class CamelSinkTask extends SinkTask { String remoteUrl = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_URL_CONF); final String marshaller = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_MARSHAL_CONF); final String unmarshaller = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_UNMARSHAL_CONF); -List dataformats = new LinkedList<>(); -if (unmarshaller != null) { -dataformats.add(new CamelKafkaConnectDataformat(unmarshaller, CamelKafkaConnectDataformat.CamelKafkaConnectDataformatKind.UNMARSHALL)); -} -if (marshaller != null) { -dataformats.add(new CamelKafkaConnectDataformat(marshaller, CamelKafkaConnectDataformat.CamelKafkaConnectDataformatKind.MARSHALL)); -} final int size = config.getInt(CamelSinkConnectorConfig.CAMEL_SINK_AGGREGATE_SIZE_CONF); final long timeout = config.getLong(CamelSinkConnectorConfig.CAMEL_SINK_AGGREGATE_TIMEOUT_CONF); @@ -95,9 +86,15 @@ public class CamelSinkTask extends SinkTask { CAMEL_SINK_PATH_PROPERTIES_PREFIX); } -cms = new CamelMainSupport(actualProps, LOCAL_URL, remoteUrl, dataformats, size, timeout, camelContext); +cms = CamelKafkaConnectMain.builder(LOCAL_URL, remoteUrl) +.withProperties(actualProps) +.withUnmarshallDataFormat(unmarshaller) +.withMarshallDataFormat(marshaller) +.withAggregationSize(size) +.withAggregationTimeout(timeout) +.build(camelContext); -producer = cms.createProducerTemplate(); +producer = cms.getProducerTemplate(); cms.start(); LOG.info("CamelSinkTask connector task started"); @@ -229,7 +226,7 @@ public class CamelSinkTask extends SinkTask { } } -public CamelMainSupport getCms() { +CamelKafkaConnectMain getCms() { return cms; } } diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java index e825e49..42d9214 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java @@ -25,18 +25,15 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Date; -import java.util.LinkedList; import java.util.List; impor
[camel-kafka-connector] 04/04: [core] cleanup TaskHelper
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit 8dde130b9737c865c4795bfeb21958572ff3c4d8 Author: Luca Burgazzoli AuthorDate: Wed Oct 7 18:18:34 2020 +0200 [core] cleanup TaskHelper --- .../main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java b/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java index 6fbeb20..78e489d 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java @@ -81,21 +81,21 @@ public final class TaskHelper { .filter(k -> k.startsWith(prefix)) .map(k -> k.replace(prefix, "") + "=" + props.get(k)) .reduce((o1, o2) -> o1 + "&" + o2) -.map(result -> (result == null || result.isEmpty()) ? "" : "?" + result) +.map(result -> result.isEmpty() ? "" : "?" + result) .orElse(""); } public static String createUrlPathFromProperties(Map props, String prefix) { return props.keySet().stream() .filter(k -> k.startsWith(prefix)) -.map(k -> props.get(k)) +.map(props::get) .reduce((p1, p2) -> p1 + ":" + p2) .orElse(""); } public static Map mergeProperties(Map defaultProps, Map loadedProps) { if (loadedProps == null && defaultProps == null) { -return Collections.EMPTY_MAP; +return Collections.emptyMap(); } else if (loadedProps == null) { return new HashMap<>(defaultProps); } else if (defaultProps == null) {
[camel-kafka-connector] 02/04: [core] cleanup CamelSourceTask
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit e6049ee4cbdbdde6d4c7912371eb818a704acb8f Author: Luca Burgazzoli AuthorDate: Wed Oct 7 17:10:10 2020 +0200 [core] cleanup CamelSourceTask --- .../org/apache/camel/kafkaconnector/CamelSourceTask.java | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java index 42d9214..604b9b1 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java @@ -22,7 +22,6 @@ import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.time.Instant; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.List; @@ -58,15 +57,14 @@ public class CamelSourceTask extends SourceTask { private CamelKafkaConnectMain cms; private CamelSourceConnectorConfig config; private PollingConsumer consumer; -private String topic; -private List topics; +private String[] topics; private Long maxBatchPollSize; private Long maxPollDuration; private String camelMessageHeaderKey; @Override public String version() { -return new CamelSourceConnector().version(); +return VersionUtil.getVersion(); } @Override @@ -85,8 +83,7 @@ public class CamelSourceTask extends SourceTask { final String unmarshaller = config.getString(CamelSourceConnectorConfig.CAMEL_SOURCE_UNMARSHAL_CONF); final String marshaller = config.getString(CamelSourceConnectorConfig.CAMEL_SOURCE_MARSHAL_CONF); -topic = config.getString(CamelSourceConnectorConfig.TOPIC_CONF); -topics = Arrays.asList(topic.split(",")); +topics = config.getString(CamelSourceConnectorConfig.TOPIC_CONF).split(","); String localUrl = getLocalUrlWithPollingOptions(config); @@ -205,7 +202,7 @@ public class CamelSourceTask extends SourceTask { } protected Map getDefaultConfig() { -return Collections.EMPTY_MAP; +return Collections.emptyMap(); } protected static String getCamelSourceEndpointConfigPrefix() { @@ -236,9 +233,7 @@ public class CamelSourceTask extends SourceTask { } else if (value instanceof Timestamp) { record.headers().addTimestamp(keyCamelHeader, (Timestamp)value); } else if (value instanceof Date) { -SimpleDateFormat sdf = new SimpleDateFormat("-MM-dd"); -String convertedDate = sdf.format(value); -record.headers().addString(keyCamelHeader, (String)convertedDate); +record.headers().addString(keyCamelHeader, new SimpleDateFormat("-MM-dd").format(value)); } else if (value instanceof BigDecimal) { Schema schema = Decimal.schema(((BigDecimal)value).scale()); record.headers().add(keyCamelHeader, Decimal.fromLogical(schema, (BigDecimal)value), schema);
[camel-kafka-connector] 04/04: [core] cleanup TaskHelper
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit 8dde130b9737c865c4795bfeb21958572ff3c4d8 Author: Luca Burgazzoli AuthorDate: Wed Oct 7 18:18:34 2020 +0200 [core] cleanup TaskHelper --- .../main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java b/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java index 6fbeb20..78e489d 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java @@ -81,21 +81,21 @@ public final class TaskHelper { .filter(k -> k.startsWith(prefix)) .map(k -> k.replace(prefix, "") + "=" + props.get(k)) .reduce((o1, o2) -> o1 + "&" + o2) -.map(result -> (result == null || result.isEmpty()) ? "" : "?" + result) +.map(result -> result.isEmpty() ? "" : "?" + result) .orElse(""); } public static String createUrlPathFromProperties(Map props, String prefix) { return props.keySet().stream() .filter(k -> k.startsWith(prefix)) -.map(k -> props.get(k)) +.map(props::get) .reduce((p1, p2) -> p1 + ":" + p2) .orElse(""); } public static Map mergeProperties(Map defaultProps, Map loadedProps) { if (loadedProps == null && defaultProps == null) { -return Collections.EMPTY_MAP; +return Collections.emptyMap(); } else if (loadedProps == null) { return new HashMap<>(defaultProps); } else if (defaultProps == null) {
[camel-kafka-connector] 02/04: [core] cleanup CamelSourceTask
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit e6049ee4cbdbdde6d4c7912371eb818a704acb8f Author: Luca Burgazzoli AuthorDate: Wed Oct 7 17:10:10 2020 +0200 [core] cleanup CamelSourceTask --- .../org/apache/camel/kafkaconnector/CamelSourceTask.java | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java index 42d9214..604b9b1 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java @@ -22,7 +22,6 @@ import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.time.Instant; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.List; @@ -58,15 +57,14 @@ public class CamelSourceTask extends SourceTask { private CamelKafkaConnectMain cms; private CamelSourceConnectorConfig config; private PollingConsumer consumer; -private String topic; -private List topics; +private String[] topics; private Long maxBatchPollSize; private Long maxPollDuration; private String camelMessageHeaderKey; @Override public String version() { -return new CamelSourceConnector().version(); +return VersionUtil.getVersion(); } @Override @@ -85,8 +83,7 @@ public class CamelSourceTask extends SourceTask { final String unmarshaller = config.getString(CamelSourceConnectorConfig.CAMEL_SOURCE_UNMARSHAL_CONF); final String marshaller = config.getString(CamelSourceConnectorConfig.CAMEL_SOURCE_MARSHAL_CONF); -topic = config.getString(CamelSourceConnectorConfig.TOPIC_CONF); -topics = Arrays.asList(topic.split(",")); +topics = config.getString(CamelSourceConnectorConfig.TOPIC_CONF).split(","); String localUrl = getLocalUrlWithPollingOptions(config); @@ -205,7 +202,7 @@ public class CamelSourceTask extends SourceTask { } protected Map getDefaultConfig() { -return Collections.EMPTY_MAP; +return Collections.emptyMap(); } protected static String getCamelSourceEndpointConfigPrefix() { @@ -236,9 +233,7 @@ public class CamelSourceTask extends SourceTask { } else if (value instanceof Timestamp) { record.headers().addTimestamp(keyCamelHeader, (Timestamp)value); } else if (value instanceof Date) { -SimpleDateFormat sdf = new SimpleDateFormat("-MM-dd"); -String convertedDate = sdf.format(value); -record.headers().addString(keyCamelHeader, (String)convertedDate); +record.headers().addString(keyCamelHeader, new SimpleDateFormat("-MM-dd").format(value)); } else if (value instanceof BigDecimal) { Schema schema = Decimal.schema(((BigDecimal)value).scale()); record.headers().add(keyCamelHeader, Decimal.fromLogical(schema, (BigDecimal)value), schema);
[camel-kafka-connector] 01/04: [core] refactor camel main
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit e5184d8f610bda5a3db886d03e93d239c172587f Author: Luca Burgazzoli AuthorDate: Wed Oct 7 15:57:57 2020 +0200 [core] refactor camel main --- .../apache/camel/kafkaconnector/CamelSinkTask.java | 25 ++-- .../camel/kafkaconnector/CamelSourceTask.java | 28 ++-- .../utils/CamelKafkaConnectMain.java | 129 .../kafkaconnector/utils/CamelMainSupport.java | 165 - .../camel/kafkaconnector/CamelSinkTaskTest.java| 38 ++--- .../camel/kafkaconnector/CamelSourceTaskTest.java | 18 +-- .../camel/kafkaconnector/DataFormatTest.java | 31 ++-- .../kafkaconnector/PropertiesNameFormatsTest.java | 4 +- 8 files changed, 199 insertions(+), 239 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java index c6242cb..c39a4f4 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java @@ -20,7 +20,6 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -29,8 +28,7 @@ import org.apache.camel.Exchange; import org.apache.camel.ExtendedCamelContext; import org.apache.camel.ProducerTemplate; import org.apache.camel.impl.DefaultCamelContext; -import org.apache.camel.kafkaconnector.utils.CamelKafkaConnectDataformat; -import org.apache.camel.kafkaconnector.utils.CamelMainSupport; +import org.apache.camel.kafkaconnector.utils.CamelKafkaConnectMain; import org.apache.camel.kafkaconnector.utils.TaskHelper; import org.apache.camel.support.DefaultExchange; import org.apache.commons.lang3.StringUtils; @@ -57,7 +55,7 @@ public class CamelSinkTask extends SinkTask { private static final String LOCAL_URL = "direct:start"; -private CamelMainSupport cms; +private CamelKafkaConnectMain cms; private ProducerTemplate producer; private CamelSinkConnectorConfig config; @@ -76,13 +74,6 @@ public class CamelSinkTask extends SinkTask { String remoteUrl = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_URL_CONF); final String marshaller = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_MARSHAL_CONF); final String unmarshaller = config.getString(CamelSinkConnectorConfig.CAMEL_SINK_UNMARSHAL_CONF); -List dataformats = new LinkedList<>(); -if (unmarshaller != null) { -dataformats.add(new CamelKafkaConnectDataformat(unmarshaller, CamelKafkaConnectDataformat.CamelKafkaConnectDataformatKind.UNMARSHALL)); -} -if (marshaller != null) { -dataformats.add(new CamelKafkaConnectDataformat(marshaller, CamelKafkaConnectDataformat.CamelKafkaConnectDataformatKind.MARSHALL)); -} final int size = config.getInt(CamelSinkConnectorConfig.CAMEL_SINK_AGGREGATE_SIZE_CONF); final long timeout = config.getLong(CamelSinkConnectorConfig.CAMEL_SINK_AGGREGATE_TIMEOUT_CONF); @@ -95,9 +86,15 @@ public class CamelSinkTask extends SinkTask { CAMEL_SINK_PATH_PROPERTIES_PREFIX); } -cms = new CamelMainSupport(actualProps, LOCAL_URL, remoteUrl, dataformats, size, timeout, camelContext); +cms = CamelKafkaConnectMain.builder(LOCAL_URL, remoteUrl) +.withProperties(actualProps) +.withUnmarshallDataFormat(unmarshaller) +.withMarshallDataFormat(marshaller) +.withAggregationSize(size) +.withAggregationTimeout(timeout) +.build(camelContext); -producer = cms.createProducerTemplate(); +producer = cms.getProducerTemplate(); cms.start(); LOG.info("CamelSinkTask connector task started"); @@ -229,7 +226,7 @@ public class CamelSinkTask extends SinkTask { } } -public CamelMainSupport getCms() { +CamelKafkaConnectMain getCms() { return cms; } } diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java index e825e49..42d9214 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSourceTask.java @@ -25,18 +25,15 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Date; -import java.util.LinkedList; import java.util.List; impor
[camel-kafka-connector] 03/04: [core] cleanup CamelSinkTask
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit be4ad310200b1a5ec775502277988e94a84e499d Author: Luca Burgazzoli AuthorDate: Wed Oct 7 17:48:22 2020 +0200 [core] cleanup CamelSinkTask --- .../java/org/apache/camel/kafkaconnector/CamelSinkTask.java| 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java index c39a4f4..3ac39e6 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java @@ -19,7 +19,6 @@ package org.apache.camel.kafkaconnector; import java.util.Collection; import java.util.Collections; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -61,7 +60,7 @@ public class CamelSinkTask extends SinkTask { @Override public String version() { -return new CamelSinkConnector().version(); +return VersionUtil.getVersion(); } @Override @@ -108,7 +107,7 @@ public class CamelSinkTask extends SinkTask { } protected Map getDefaultConfig() { -return Collections.EMPTY_MAP; +return Collections.emptyMap(); } protected static String getCamelSinkEndpointConfigPrefix() { @@ -123,11 +122,10 @@ public class CamelSinkTask extends SinkTask { public void put(Collection sinkRecords) { for (SinkRecord record : sinkRecords) { TaskHelper.logRecordContent(LOG, record, config); -Map headers = new HashMap(); +Map headers = new HashMap<>(); Exchange exchange = new DefaultExchange(producer.getCamelContext()); headers.put(KAFKA_RECORD_KEY_HEADER, record.key()); -for (Iterator iterator = record.headers().iterator(); iterator.hasNext();) { -Header header = (Header)iterator.next(); +for (Header header : record.headers()) { if (header.key().startsWith(HEADER_CAMEL_PREFIX)) { addHeader(headers, header); } else if (header.key().startsWith(PROPERTY_CAMEL_PREFIX)) {
[camel-kafka-connector] branch master updated (7f46db0 -> 8dde130)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git. from 7f46db0 Catalog: Rename the json file to reflect the id and connectors.properties content - regeneration new e5184d8 [core] refactor camel main new e6049ee [core] cleanup CamelSourceTask new be4ad31 [core] cleanup CamelSinkTask new 8dde130 [core] cleanup TaskHelper The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/camel/kafkaconnector/CamelSinkTask.java | 35 ++--- .../camel/kafkaconnector/CamelSourceTask.java | 43 +++--- .../utils/CamelKafkaConnectMain.java | 129 .../kafkaconnector/utils/CamelMainSupport.java | 165 - .../camel/kafkaconnector/utils/TaskHelper.java | 6 +- .../camel/kafkaconnector/CamelSinkTaskTest.java| 38 ++--- .../camel/kafkaconnector/CamelSourceTaskTest.java | 18 +-- .../camel/kafkaconnector/DataFormatTest.java | 31 ++-- .../kafkaconnector/PropertiesNameFormatsTest.java | 4 +- 9 files changed, 211 insertions(+), 258 deletions(-) delete mode 100644 core/src/main/java/org/apache/camel/kafkaconnector/utils/CamelMainSupport.java
[camel-kafka-connector] 03/04: [core] cleanup CamelSinkTask
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git commit be4ad310200b1a5ec775502277988e94a84e499d Author: Luca Burgazzoli AuthorDate: Wed Oct 7 17:48:22 2020 +0200 [core] cleanup CamelSinkTask --- .../java/org/apache/camel/kafkaconnector/CamelSinkTask.java| 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java index c39a4f4..3ac39e6 100644 --- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java +++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java @@ -19,7 +19,6 @@ package org.apache.camel.kafkaconnector; import java.util.Collection; import java.util.Collections; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -61,7 +60,7 @@ public class CamelSinkTask extends SinkTask { @Override public String version() { -return new CamelSinkConnector().version(); +return VersionUtil.getVersion(); } @Override @@ -108,7 +107,7 @@ public class CamelSinkTask extends SinkTask { } protected Map getDefaultConfig() { -return Collections.EMPTY_MAP; +return Collections.emptyMap(); } protected static String getCamelSinkEndpointConfigPrefix() { @@ -123,11 +122,10 @@ public class CamelSinkTask extends SinkTask { public void put(Collection sinkRecords) { for (SinkRecord record : sinkRecords) { TaskHelper.logRecordContent(LOG, record, config); -Map headers = new HashMap(); +Map headers = new HashMap<>(); Exchange exchange = new DefaultExchange(producer.getCamelContext()); headers.put(KAFKA_RECORD_KEY_HEADER, record.key()); -for (Iterator iterator = record.headers().iterator(); iterator.hasNext();) { -Header header = (Header)iterator.next(); +for (Header header : record.headers()) { if (header.key().startsWith(HEADER_CAMEL_PREFIX)) { addHeader(headers, header); } else if (header.key().startsWith(PROPERTY_CAMEL_PREFIX)) {
[camel-k-runtime] branch master updated: build(deps): bump junit-pioneer from 0.9.2 to 1.0.0
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new f169fef build(deps): bump junit-pioneer from 0.9.2 to 1.0.0 f169fef is described below commit f169fef1fed01f0c23f796ae5370ceec3c3fe66b Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> AuthorDate: Wed Oct 7 19:02:28 2020 + build(deps): bump junit-pioneer from 0.9.2 to 1.0.0 Bumps [junit-pioneer](https://github.com/junit-pioneer/junit-pioneer) from 0.9.2 to 1.0.0. - [Release notes](https://github.com/junit-pioneer/junit-pioneer/releases) - [Changelog](https://github.com/junit-pioneer/junit-pioneer/blob/master/docs/release-notes.md) - [Commits](https://github.com/junit-pioneer/junit-pioneer/compare/v0.9.2...v1.0.0) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 45456a5..c169ec8 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ 2.8.8 3.1.0 1.4.0 -0.9.2 +1.0.0 1.13.0
[camel-kafka-connector] branch master updated: chore(build): split build in multiple steps
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git The following commit(s) were added to refs/heads/master by this push: new 3eb6336 chore(build): split build in multiple steps 3eb6336 is described below commit 3eb63367b2c2bc896e6d0a1c9b0fb7fe4226da01 Author: Luca Burgazzoli AuthorDate: Wed Oct 7 13:01:32 2020 +0200 chore(build): split build in multiple steps --- .github/workflows/asf-snapshots-deploy.yml | 8 +++- .github/workflows/automatic-sync-camel-master.yml | 43 +++--- .github/workflows/master-pr-build.yml | 43 ++ .github/workflows/master-push-build.yml| 41 + .../workflows/rebase-master-onto-camel-master.yml | 38 +-- docs/modules/ROOT/pages/connectors.adoc| 34 - 6 files changed, 182 insertions(+), 25 deletions(-) diff --git a/.github/workflows/asf-snapshots-deploy.yml b/.github/workflows/asf-snapshots-deploy.yml index 1967e83..9eefb8f 100644 --- a/.github/workflows/asf-snapshots-deploy.yml +++ b/.github/workflows/asf-snapshots-deploy.yml @@ -16,6 +16,9 @@ # name: Deploy Camel Kafka Connector Snapshot +env: + MAVEN_ARGS: -V -ntp -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 + on: schedule: # Run at 1 during night @@ -54,6 +57,9 @@ jobs: with: version: '11' - name: Deploy to ASF Snapshots Repository - run: ./mvnw -U -B -e -fae -V -Dnoassembly -Dmaven.compiler.fork=true -Pdeploy -Dmaven.test.skip.exec=true -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 --no-transfer-progress clean deploy --settings .github/asf-deploy-settings.xml + run: ./mvnw ${MAVEN_ARGS} \ +-U -B -e -fae -Dnoassembly -Dmaven.compiler.fork=true -Pdeploy -Dmaven.test.skip.exec=true \ +--settings .github/asf-deploy-settings.xml \ +clean deploy diff --git a/.github/workflows/automatic-sync-camel-master.yml b/.github/workflows/automatic-sync-camel-master.yml index 33b5feb..27e0b5f 100644 --- a/.github/workflows/automatic-sync-camel-master.yml +++ b/.github/workflows/automatic-sync-camel-master.yml @@ -17,6 +17,9 @@ name: Sync Camel Kafka Connector camel-master Branch +env: + MAVEN_ARGS: -V -ntp + on: schedule: # Run at 2 AM every day @@ -47,18 +50,48 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - name: Build Camel Project -run: ./mvnw -V --no-transfer-progress clean install -DskipTests +run: | + ./mvnw ${MAVEN_ARGS} \ +-DskipTests \ +clean install working-directory: ${{ github.workspace }}/camel - name: Checkout camel-kafka-connector project uses: actions/checkout@v2 with: ref: camel-master fetch-depth: 0 - - name: Build Camel-kafka-connector Project + # first command builds the source check module, + - name: build tools +run: | + ./mvnw ${MAVEN_ARGS} \ +-DskipTests \ +-pl :parent \ +-pl :camel-kafka-connector-aggregator \ +-pl :camel-buildtools \ +clean install + # second one source check and install :camel-kafka-connector-generator-maven-plugin + # this is needed to add maven plugin metadata to it, + - name: build connector-generator-plugin +run: | + ./mvnw ${MAVEN_ARGS} \ +-Dcheckstyle.failOnViolation=true \ +-Psourcecheck \ +-DskipTests \ +-pl :camel-kafka-connector-model \ +-pl :camel-kafka-connector-generator-maven-plugin \ +clean install + # third command source check everything else but :camel-kafka-connector-generator-maven-plugin + - name: build and itests run: | - ./mvnw -V --no-transfer-progress -DskipTests --projects org.apache.camel.kafkaconnector:parent,org.apache.camel.kafkaconnector:camel-kafka-connector-aggregator,org.apache.camel.kafkaconnector:camel-buildtools clean install - ./mvnw -V --no-transfer-progress --projects org.apache.camel.kafkaconnector:camel-kafka-connector-model,org.apache.camel.kafkaconnector:camel-kafka-connector-generator-maven-plugin -Dcheckstyle.failOnViolation=true -Psourcecheck -DskipTests clean install - ./mvnw -V -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 --no-transfer-progress --projects '!org.apache.camel.kafkaconnector:camel-kafka-connector-generator-maven-plugin' -Dcheckstyle.failOnViolation=true -Psourcecheck -DskipIntegrationTests=false clean test + ./mvnw ${MAVEN_ARGS} \ +-Dcheckstyle.
[camel-kafka-connector] branch master updated (75ccafa -> 932db48)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git. from 75ccafa [camel-main-support] Use BaseMainSupport instead of Main #499 add 932db48 chore(build): use AdoptOpenJDK to set-up java No new revisions were added by this update. Summary of changes: .github/workflows/asf-snapshots-deploy.yml| 6 +++--- .github/workflows/automatic-sync-camel-master.yml | 6 +++--- .github/workflows/master-pr-build.yml | 6 +++--- .github/workflows/master-push-build.yml | 4 ++-- .github/workflows/rebase-master-onto-camel-master.yml | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-)
[camel-kafka-connector] branch master updated (75ccafa -> 932db48)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git. from 75ccafa [camel-main-support] Use BaseMainSupport instead of Main #499 add 932db48 chore(build): use AdoptOpenJDK to set-up java No new revisions were added by this update. Summary of changes: .github/workflows/asf-snapshots-deploy.yml| 6 +++--- .github/workflows/automatic-sync-camel-master.yml | 6 +++--- .github/workflows/master-pr-build.yml | 6 +++--- .github/workflows/master-push-build.yml | 4 ++-- .github/workflows/rebase-master-onto-camel-master.yml | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-)
[camel-kafka-connector] branch master updated: [camel-main-support] Use BaseMainSupport instead of Main #499
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git The following commit(s) were added to refs/heads/master by this push: new 75ccafa [camel-main-support] Use BaseMainSupport instead of Main #499 75ccafa is described below commit 75ccafa823b4215bf2836b2586940073649537c9 Author: Luca Burgazzoli AuthorDate: Wed Oct 7 11:18:00 2020 +0200 [camel-main-support] Use BaseMainSupport instead of Main #499 --- .../utils/CamelKafkaConnectMain.java | 122 +++ .../kafkaconnector/utils/CamelMainSupport.java | 165 - 2 files changed, 153 insertions(+), 134 deletions(-) diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/utils/CamelKafkaConnectMain.java b/core/src/main/java/org/apache/camel/kafkaconnector/utils/CamelKafkaConnectMain.java new file mode 100644 index 000..46b0822 --- /dev/null +++ b/core/src/main/java/org/apache/camel/kafkaconnector/utils/CamelKafkaConnectMain.java @@ -0,0 +1,122 @@ +/* + * 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.kafkaconnector.utils; + +import org.apache.camel.CamelContext; +import org.apache.camel.ConsumerTemplate; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.main.BaseMainSupport; +import org.apache.camel.main.MainListener; +import org.apache.camel.support.service.ServiceHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CamelKafkaConnectMain extends BaseMainSupport { +public static final String CAMEL_DATAFORMAT_PROPERTIES_PREFIX = "camel.dataformat."; +private static final Logger LOG = LoggerFactory.getLogger(CamelKafkaConnectMain.class); + +protected volatile ConsumerTemplate consumerTemplate; +protected volatile ProducerTemplate producerTemplate; + +public CamelKafkaConnectMain(CamelContext context) { +this.camelContext = context; +} + +@Override +protected void doInit() throws Exception { +super.doInit(); +postProcessCamelContext(camelContext); +} + +@Override +protected void doStart() throws Exception { +LOG.info("Starting Main"); + +for (MainListener listener : listeners) { +listener.beforeStart(this); +} + +super.doStart(); + +getCamelContext().start(); + +for (MainListener listener : listeners) { +listener.afterStart(this); +} + +LOG.info("Main started"); +} + +@Override +protected void doStop() throws Exception { +LOG.info("Stopping Main"); + +ServiceHelper.stopService(consumerTemplate); +consumerTemplate = null; + +ServiceHelper.stopService(producerTemplate); +producerTemplate = null; + +for (MainListener listener : listeners) { +listener.beforeStop(this); +} + +super.doStart(); + +getCamelContext().stop(); + +for (MainListener listener : listeners) { +listener.afterStop(this); +} + +LOG.info("Main stopped"); +} + +@Override +protected ProducerTemplate findOrCreateCamelTemplate() { +throw new UnsupportedOperationException("Should not happen"); +} + +@Override +protected CamelContext createCamelContext() { +throw new UnsupportedOperationException("Should not happen"); +} + +public ProducerTemplate getProducerTemplate() { +if (this.producerTemplate == null) { +synchronized (this) { +if (this.producerTemplate == null) { +this.producerTemplate = getCamelContext().createProducerTemplate(); +} +} +} + +return this.producerTemplate; +} + +public ConsumerTemplate getConsumerTemplate() { +if (this.consumerTemplate == null) { +synchronized (this) { +if (this.consumerTemplate == null) { +this.consumerTemplate = getCamelContext().createConsumerTempla
[camel] branch master updated: CAMEL-15620: Add CBOR s transitive dependency of AWS Kinesis connectors
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/master by this push: new b106a9c CAMEL-15620: Add CBOR s transitive dependency of AWS Kinesis connectors b106a9c is described below commit b106a9c2755f36d44659767ad631ac0482d3f37b Author: Luca Burgazzoli AuthorDate: Fri Oct 2 14:51:11 2020 +0200 CAMEL-15620: Add CBOR s transitive dependency of AWS Kinesis connectors --- components/camel-aws-kinesis/pom.xml | 5 + 1 file changed, 5 insertions(+) diff --git a/components/camel-aws-kinesis/pom.xml b/components/camel-aws-kinesis/pom.xml index f43fa79..c2f2ae3 100644 --- a/components/camel-aws-kinesis/pom.xml +++ b/components/camel-aws-kinesis/pom.xml @@ -45,6 +45,11 @@ aws-java-sdk-kinesis ${aws-java-sdk-version} + +com.fasterxml.jackson.dataformat +jackson-dataformat-cbor +${jackson2-version} +
[camel-k-runtime] branch master updated: knative: cleanup knative environment definition leftovers
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new cf3f9d9 knative: cleanup knative environment definition leftovers cf3f9d9 is described below commit cf3f9d9348f2a5eb19af90108ce69b40cb220491 Author: Luca Burgazzoli AuthorDate: Thu Oct 1 16:00:47 2020 +0200 knative: cleanup knative environment definition leftovers --- .../component/knative/spi/KnativeEnvironment.java | 54 +++-- .../knative/spi/KnativeEnvironmentTest.java| 4 +- .../knative/http/KnativeHttpConsumer.java | 7 --- .../knative/http/KnativeHttpProducer.java | 67 +- .../component/knative/http/KnativeHttpTest.java| 58 --- .../component/knative/KnativeComponentTest.java| 8 +-- 6 files changed, 88 insertions(+), 110 deletions(-) diff --git a/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeEnvironment.java b/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeEnvironment.java index 7e88425..cebc932 100644 --- a/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeEnvironment.java +++ b/components/camel-knative/camel-knative-api/src/main/java/org/apache/camel/component/knative/spi/KnativeEnvironment.java @@ -20,8 +20,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.io.StringReader; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -204,32 +202,6 @@ public class KnativeEnvironment { return this.name; } -public String getHost() { -String urlAsString = getUrl(); -if (urlAsString != null) { -try { -return new URL(urlAsString).getHost(); -} catch (MalformedURLException ignored) { -// ignore -} -} - -return null; -} - -public int getPort() { -String urlAsString = getUrl(); -if (urlAsString != null) { -try { -return new URL(urlAsString).getPort(); -} catch (MalformedURLException ignored) { -// ignored -} -} - -return -1; -} - public Map getMetadata() { return this.meta; } @@ -239,30 +211,13 @@ public class KnativeEnvironment { } public String getPath() { -String urlAsString = getUrl(); -if (urlAsString != null) { -try { -return new URL(urlAsString).getPath(); -} catch (MalformedURLException e) { -throw new RuntimeException(e); -} -} - return getMetadata(Knative.SERVICE_META_PATH); } -public String getPathOrDefault(String path) { -return getMetadata().getOrDefault(Knative.SERVICE_META_PATH, path); -} - public String getEventType() { return getMetadata(Knative.KNATIVE_EVENT_TYPE); } -public int getPortOrDefault(int port) { -return getPort() != -1 ? getPort() : port; -} - public String getUrl() { return this.url != null ? this.url : getMetadata(Knative.SERVICE_META_URL); } @@ -279,5 +234,14 @@ public class KnativeEnvironment { return Objects.equals(type.name(), getMetadata(Knative.KNATIVE_TYPE)) && Objects.equals(name, getName()); } + +@Override +public String toString() { +return "KnativeResource{" + +"name='" + name + '\'' + +", url='" + url + '\'' + +", meta=" + meta + +'}'; +} } } diff --git a/components/camel-knative/camel-knative-api/src/test/java/org/apache/camel/component/knative/spi/KnativeEnvironmentTest.java b/components/camel-knative/camel-knative-api/src/test/java/org/apache/camel/component/knative/spi/KnativeEnvironmentTest.java index 6586964..eb219c7 100644 --- a/components/camel-knative/camel-knative-api/src/test/java/org/apache/camel/component/knative/spi/KnativeEnvironmentTest.java +++ b/components/camel-knative/camel-knative-api/src/test/java/org/apache/camel/component/knative/spi/KnativeEnvironmentTest.java @@ -25,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThat; public class KnativeEnvironmentTest { - @Param
[camel-k-runtime] branch master updated: knative(http): fix request handler exception handling
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new aec7856 knative(http): fix request handler exception handling aec7856 is described below commit aec785608d6a0a436a6dad9301b0e5b281ffbbbc Author: Luca Burgazzoli AuthorDate: Thu Oct 1 13:06:52 2020 +0200 knative(http): fix request handler exception handling --- .../camel/component/knative/http/KnativeHttpConsumer.java | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java b/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java index bb1b932..13c5c42 100644 --- a/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java +++ b/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java @@ -188,6 +188,8 @@ public class KnativeHttpConsumer extends DefaultConsumer { false, result -> { try { +Throwable failure = null; + if (result.succeeded()) { try { HttpServerResponse response = toHttpResponse(request, exchange.getMessage()); @@ -196,10 +198,8 @@ public class KnativeHttpConsumer extends DefaultConsumer { if (request.response().getStatusCode() != 204 && configuration.isReply()) { body = computeResponseBody(exchange.getMessage()); -// set the content type in the response. String contentType = MessageHelper.getContentType(exchange.getMessage()); if (contentType != null) { -// set content-type response.putHeader(Exchange.CONTENT_TYPE, contentType); } } @@ -211,12 +211,15 @@ public class KnativeHttpConsumer extends DefaultConsumer { request.response().end(); } } catch (Exception e) { -getExceptionHandler().handleException(e); +failure = e; } } else if (result.failed()) { -getExceptionHandler().handleException(result.cause()); +failure = result.cause(); +} -routingContext.fail(result.cause()); +if (failure != null) { +getExceptionHandler().handleException(failure); +routingContext.fail(failure); } } finally { doneUoW(exchange);
[camel-k-runtime] 01/02: examples: fix route definition
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit 060d4fe690c5813e5de196abb15ecf05536bbf7a Author: Luca Burgazzoli AuthorDate: Wed Sep 30 23:52:03 2020 +0200 examples: fix route definition --- .../data/routes.yaml | 28 +++--- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/camel-k-runtime-example-quarkus-yaml/data/routes.yaml b/examples/camel-k-runtime-example-quarkus-yaml/data/routes.yaml index 287fd74..8c31c7d 100644 --- a/examples/camel-k-runtime-example-quarkus-yaml/data/routes.yaml +++ b/examples/camel-k-runtime-example-quarkus-yaml/data/routes.yaml @@ -20,22 +20,22 @@ group: "routes" from: uri: "platform-http:/hello" - steps: -- convert-body-to: -type: "java.lang.String" -- to: -uri: "log:info" +steps: + - convert-body-to: + type: "java.lang.String" + - to: + uri: "log:info" - route: id: "flow-2" group: "routes" from: uri: "timer:tick" - parameters: -period: "5000" - steps: -- set-body: -simple: "${exchangeProperty.CamelTimerName} -> ${exchangeProperty.CamelTimerCounter}" -- to: -uri: "log:tick" -- log: -message: "{{message}}" \ No newline at end of file +parameters: + period: "5000" +steps: + - set-body: + simple: "${exchangeProperty.CamelTimerName} -> ${exchangeProperty.CamelTimerCounter}" + - to: + uri: "log:tick" + - log: + message: "{{message}}"
[camel-k-runtime] 02/02: Log runtime version when starting #512
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit de1b959a0c0073e9fc2aff9a3dc97e62d50b1ec9 Author: Luca Burgazzoli AuthorDate: Wed Sep 30 23:52:20 2020 +0200 Log runtime version when starting #512 --- .../apache/camel/k/main/ApplicationRuntime.java| 4 ++ .../k/quarkus/deployment/DeploymentProcessor.java | 2 + .../org/apache/camel/k/quarkus/Application.java| 1 + .../camel/k/quarkus/ApplicationRecorder.java | 5 +++ .../src/main/java/org/apache/camel/k/Runtime.java | 3 +- .../org/apache/camel/k/support/RuntimeSupport.java | 48 ++ 6 files changed, 62 insertions(+), 1 deletion(-) diff --git a/camel-k-main/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/ApplicationRuntime.java b/camel-k-main/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/ApplicationRuntime.java index df01e69..f7a0938 100644 --- a/camel-k-main/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/ApplicationRuntime.java +++ b/camel-k-main/camel-k-runtime-main/src/main/java/org/apache/camel/k/main/ApplicationRuntime.java @@ -30,6 +30,7 @@ import org.apache.camel.RuntimeCamelException; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.k.CompositeClassloader; import org.apache.camel.k.Runtime; +import org.apache.camel.k.support.RuntimeSupport; import org.apache.camel.main.BaseMainSupport; import org.apache.camel.main.MainSupport; import org.apache.camel.main.RoutesCollector; @@ -57,6 +58,7 @@ public final class ApplicationRuntime implements Runtime { this.main = new MainAdapter(); this.main.configure().setXmlRoutes("false"); this.main.configure().setXmlRests("false"); +this.main.configure().setXmlRouteTemplates("false"); this.main.setDefaultPropertyPlaceholderLocation("false"); this.main.setRoutesCollector(new NoRoutesCollector()); this.main.addMainListener(new MainListenerAdapter()); @@ -68,6 +70,7 @@ public final class ApplicationRuntime implements Runtime { } public void run() throws Exception { +LOGGER.info("Apache Camel K Runtime {}", RuntimeSupport.getRuntimeVersion()); this.main.run(); } @@ -119,6 +122,7 @@ public final class ApplicationRuntime implements Runtime { private final class MainListenerAdapter implements org.apache.camel.main.MainListener { @Override public void beforeInitialize(BaseMainSupport main) { +invokeListeners(Phase.Initializing); invokeListeners(Phase.ConfigureProperties); } diff --git a/camel-k-quarkus/camel-k-runtime-quarkus/deployment/src/main/java/org/apache/camel/k/quarkus/deployment/DeploymentProcessor.java b/camel-k-quarkus/camel-k-runtime-quarkus/deployment/src/main/java/org/apache/camel/k/quarkus/deployment/DeploymentProcessor.java index 9beab55..b2a3fd2 100644 --- a/camel-k-quarkus/camel-k-runtime-quarkus/deployment/src/main/java/org/apache/camel/k/quarkus/deployment/DeploymentProcessor.java +++ b/camel-k-quarkus/camel-k-runtime-quarkus/deployment/src/main/java/org/apache/camel/k/quarkus/deployment/DeploymentProcessor.java @@ -30,6 +30,7 @@ import io.quarkus.deployment.annotations.Record; import org.apache.camel.k.Runtime; import org.apache.camel.k.quarkus.ApplicationProducers; import org.apache.camel.k.quarkus.ApplicationRecorder; +import org.apache.camel.k.support.RuntimeSupport; import org.apache.camel.quarkus.core.deployment.spi.CamelRuntimeTaskBuildItem; import org.apache.camel.quarkus.main.deployment.spi.CamelMainBuildItem; import org.apache.camel.quarkus.main.deployment.spi.CamelMainListenerBuildItem; @@ -60,6 +61,7 @@ public class DeploymentProcessor { BeanContainerBuildItem beanContainer) { recorder.publishRuntime(camelMain.getInstance(), beanContainer.getValue()); +recorder.version(RuntimeSupport.getRuntimeVersion()); return new CamelRuntimeTaskBuildItem("camel-k-runtime"); } diff --git a/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/Application.java b/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/Application.java index 0d971f5..20690a4 100644 --- a/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/Application.java +++ b/camel-k-quarkus/camel-k-runtime-quarkus/runtime/src/main/java/org/apache/camel/k/quarkus/Application.java @@ -94,6 +94,7 @@ public final class Application { @Override public void beforeInitialize(BaseMainSupport main) { +invokeListeners(org.apache.camel.k.Runtime.Phase.Initializing); invokeListeners(org.apache.camel.k.Runtime.Phase.ConfigureProperties); } diff --git a/c
[camel-k-runtime] branch master updated (8b9e5d4 -> de1b959)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git. from 8b9e5d4 Updated CHANGELOG.md new 060d4fe examples: fix route definition new de1b959 Log runtime version when starting #512 The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/camel/k/main/ApplicationRuntime.java| 4 ++ .../k/quarkus/deployment/DeploymentProcessor.java | 2 + .../org/apache/camel/k/quarkus/Application.java| 1 + .../camel/k/quarkus/ApplicationRecorder.java | 5 +++ .../src/main/java/org/apache/camel/k/Runtime.java | 3 +- .../org/apache/camel/k/support/RuntimeSupport.java | 48 ++ .../data/routes.yaml | 28 ++--- 7 files changed, 76 insertions(+), 15 deletions(-)
[camel-quarkus] branch master updated: platform-http: handle requests using a thread from the worker pool
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git The following commit(s) were added to refs/heads/master by this push: new 00cd740 platform-http: handle requests using a thread from the worker pool 00cd740 is described below commit 00cd740abcc7e39f16ea21fca682651eebe74518 Author: Luca Burgazzoli AuthorDate: Wed Sep 30 18:22:01 2020 +0200 platform-http: handle requests using a thread from the worker pool --- .../http/runtime/QuarkusPlatformHttpConsumer.java | 261 - 1 file changed, 153 insertions(+), 108 deletions(-) diff --git a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java index 087ed58..cf9fc15 100644 --- a/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java +++ b/extensions/platform-http/runtime/src/main/java/org/apache/camel/quarkus/component/platform/http/runtime/QuarkusPlatformHttpConsumer.java @@ -35,6 +35,7 @@ import java.util.regex.Pattern; import io.vertx.core.Handler; import io.vertx.core.MultiMap; +import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServerRequest; @@ -71,10 +72,10 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer { private final Router router; private final List> handlers; -private Route route; private final String fileNameExtWhitelist; private final UploadAttacher uploadAttacher; private final Pattern PATH_PARAMETER_PATTERN = Pattern.compile("\\{([^/}]+)\\}"); +private Route route; public QuarkusPlatformHttpConsumer(PlatformHttpEndpoint endpoint, Processor processor, Router router, List> handlers, UploadAttacher uploadAttacher) { @@ -86,81 +87,6 @@ public class QuarkusPlatformHttpConsumer extends DefaultConsumer { this.uploadAttacher = uploadAttacher; } -@Override -public PlatformHttpEndpoint getEndpoint() { -return (PlatformHttpEndpoint) super.getEndpoint(); -} - -@Override -protected void doStart() throws Exception { -super.doStart(); - -final PlatformHttpEndpoint endpoint = getEndpoint(); -final String path = endpoint.getPath(); -/* Transform from the Camel path param syntax /path/{key} to vert.x web's /path/:key */ -final String vertxPathParamPath = PATH_PARAMETER_PATTERN.matcher(path).replaceAll(":$1"); -final Route newRoute = router.route(vertxPathParamPath); - -final Set methods = Method.parseList(endpoint.getHttpMethodRestrict()); -if (!methods.equals(Method.getAll())) { -methods.stream().forEach(m -> newRoute.method(HttpMethod.valueOf(m.name(; -} -if (endpoint.getConsumes() != null) { -newRoute.consumes(endpoint.getConsumes()); -} -if (endpoint.getProduces() != null) { -newRoute.produces(endpoint.getProduces()); -} - -handlers.forEach(newRoute::handler); - -newRoute.handler( -ctx -> { -Exchange exchg = null; -try { -final Exchange exchange = exchg = toExchange(ctx); -createUoW(exchange); -getAsyncProcessor().process( -exchange, -doneSync -> writeResponse(ctx, exchange, getEndpoint().getHeaderFilterStrategy())); -} catch (Exception e) { -ctx.fail(e); -getExceptionHandler().handleException("Failed handling platform-http endpoint " + path, exchg, e); -} finally { -if (exchg != null) { -doneUoW(exchg); -} -} -}); - -this.route = newRoute; -} - -@Override -protected void doStop() throws Exception { -if (route != null) { -route.remove(); -route = null; -} -super.doStop(); -} - -@Override -protected void doSuspend() throws Exception { -if (route != null) { -route.disable(); -} -super.doSuspend(); -} - -@Override -protected void doResume() throws Exception { -if (route != null) { -route.enable(); -} -super.doResume(); -} - static Object toHttpResponse(HttpServerResponse response, Message message, HeaderFilterStrate
[camel-k-runtime] branch master updated: knative(http): use async processor to process http requests
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new 92d7ca4 knative(http): use async processor to process http requests 92d7ca4 is described below commit 92d7ca4bd71a15716641b49a5aa50c7dd84251af Author: Luca Burgazzoli AuthorDate: Wed Sep 30 17:16:15 2020 +0200 knative(http): use async processor to process http requests --- .../knative/http/KnativeHttpConsumer.java | 70 ++ 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java b/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java index ecd1dc7..bb1b932 100644 --- a/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java +++ b/components/camel-knative/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpConsumer.java @@ -158,32 +158,36 @@ public class KnativeHttpConsumer extends DefaultConsumer { message.setBody(null); } -try { -createUoW(exchange); - -// We do not know if any of the processing logic of the route is synchronous or not so we -// need to process the request on a thread on the Vert.x worker pool. -// -// As example the following route may block the Vert.x event loop as the camel-http component -// is not async so if the service is scaled-down, the it may take a while to become ready and -// the camel-http component blocks until the service becomes available. -// -// from("knative:event/my.event") -// .to("http://{{env:PROJECT}}.{{env:NAMESPACE}}.svc.cluster.local/service";); -// -router.vertx().executeBlocking( -promise -> { -try { -// no need to use an async processor as the processing happen in -// a dedicated thread ans it won't block the Vert.x event loop -getProcessor().process(exchange); +// We do not know if any of the processing logic of the route is synchronous or not so we +// need to process the request on a thread on the Vert.x worker pool. +// +// As example the following route may block the Vert.x event loop as the camel-http component +// is not async so if the service is scaled-down, the it may take a while to become ready and +// the camel-http component blocks until the service becomes available. +// +// from("knative:event/my.event") +// .to("http://{{env:PROJECT}}.{{env:NAMESPACE}}.svc.cluster.local/service";); +// +router.vertx().executeBlocking( +promise -> { +try { +createUoW(exchange); +} catch (Exception e) { +promise.fail(e); +return; +} + +getAsyncProcessor().process(exchange, c -> { +if (!exchange.isFailed()) { promise.complete(); -} catch (Exception e) { -promise.fail(e); +} else { +promise.fail(exchange.getException()); } -}, -false, -result -> { +}); +}, +false, +result -> { +try { if (result.succeeded()) { try { HttpServerResponse response = toHttpResponse(request, exchange.getMessage()); @@ -212,22 +216,12 @@ public class KnativeHttpConsumer extends DefaultConsumer { } else if (result.failed()) { getExceptionHandler().handleException(result.cause()); -request.response().setStatusCode(500); -request.response().putHeader(Exchange.CONTENT_TYPE, "text/plain"); -request.response().end(result.cause().getMessage()); +routingContext.fail(result.cause()); } - +} finally { doneUoW(exchange); -}); -} catch (Exception e) { -getExceptionHandler().handleException(e); - -request.response().setStatusCode(500); -request.response().putHeader(Exchange.CONTENT_TYPE, "text/plain&quo
[camel] 01/02: camel-platform-http-vertx: handle requests using a thread from the worker pool
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch camel-3.4.x in repository https://gitbox.apache.org/repos/asf/camel.git commit f8027157fcb4bae1891a38c629abc88aea1daa4d Author: Luca Burgazzoli AuthorDate: Wed Sep 30 15:26:03 2020 +0200 camel-platform-http-vertx: handle requests using a thread from the worker pool --- .../http/vertx/VertxPlatformHttpConsumer.java | 101 ++-- .../http/vertx/VertxPlatformHttpSupport.java | 23 ++--- .../http/vertx/VertxPlatformHttpEngineTest.java| 105 - 3 files changed, 182 insertions(+), 47 deletions(-) diff --git a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java index f816ea6..125a4ed 100644 --- a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java +++ b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java @@ -26,6 +26,7 @@ import java.util.regex.Pattern; import io.vertx.core.Handler; import io.vertx.core.MultiMap; +import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpMethod; import io.vertx.ext.web.FileUpload; @@ -63,15 +64,16 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer { private Route route; public VertxPlatformHttpConsumer( -PlatformHttpEndpoint endpoint, -Processor processor, -List> handlers, -UploadAttacher uploadAttacher) { + PlatformHttpEndpoint endpoint, + Processor processor, + List> handlers, + UploadAttacher uploadAttacher) { super(endpoint, processor); this.handlers = handlers; this.uploadAttacher = uploadAttacher; -this.fileNameExtWhitelist = endpoint.getFileNameExtWhitelist() == null ? null : endpoint.getFileNameExtWhitelist().toLowerCase(Locale.US); +this.fileNameExtWhitelist += endpoint.getFileNameExtWhitelist() == null ? null : endpoint.getFileNameExtWhitelist().toLowerCase(Locale.US); } @Override @@ -101,28 +103,11 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer { } newRoute.handler(router.bodyHandler()); -for (Handler handler: handlers) { +for (Handler handler : handlers) { newRoute.handler(handler); } -newRoute.handler( -ctx -> { -Exchange exchg = null; -try { -final Exchange exchange = exchg = toExchange(ctx); -createUoW(exchange); -getAsyncProcessor().process( -exchange, -doneSync -> writeResponse(ctx, exchange, getEndpoint().getHeaderFilterStrategy())); -} catch (Exception e) { -ctx.fail(e); -getExceptionHandler().handleException("Failed handling platform-http endpoint " + endpoint.getPath(), exchg, e); -} finally { -if (exchg != null) { -doneUoW(exchg); -} -} -}); +newRoute.handler(this::handleRequest); this.route = newRoute; } @@ -161,6 +146,67 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer { return PATH_PARAMETER_PATTERN.matcher(path).replaceAll(":$1"); } +private void handleRequest(RoutingContext ctx) { +final Vertx vertx = ctx.vertx(); +final Exchange exchange = toExchange(ctx); + +// +// We do not know if any of the processing logic of the route is synchronous or not so we +// need to process the request on a thread on the Vert.x worker pool. +// +// As example, assuming the platform-http component is configured as the transport provider +// for the rest dsl, then the following code may result in a blocking operation that could +// block Vert.x event-loop for too long if the target service takes long to respond, as +// example in case the service is a knative service scaled to zero that could take some time +// to be come available: +// +// rest("/results") +// .get("/{id}") +// .route() +// .removeHeaders("*", "CamelHttpPath") +// .to("rest:get:?bridgeEndpoint=true"); +// +
[camel] branch camel-3.4.x updated (926640b -> 2c70250)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch camel-3.4.x in repository https://gitbox.apache.org/repos/asf/camel.git. from 926640b Add XML schema references for release 3.4.4 new f802715 camel-platform-http-vertx: handle requests using a thread from the worker pool new 2c70250 camel-platform-http-vertx: reformat The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../services/org/apache/camel/other.properties | 2 +- .../generated/resources/platform-http-vertx.json | 2 +- .../http/vertx/VertxPlatformHttpConsumer.java | 86 + .../http/vertx/VertxPlatformHttpSupport.java | 23 ++--- .../http/vertx/VertxPlatformHttpEngineTest.java| 105 - 5 files changed, 176 insertions(+), 42 deletions(-)
[camel] 02/02: camel-platform-http-vertx: reformat
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch camel-3.4.x in repository https://gitbox.apache.org/repos/asf/camel.git commit 2c70250efd1e25cc8f96f528ba50b9fd701687fc Author: Luca Burgazzoli AuthorDate: Wed Sep 30 17:52:51 2020 +0200 camel-platform-http-vertx: reformat --- .../services/org/apache/camel/other.properties | 2 +- .../generated/resources/platform-http-vertx.json | 2 +- .../http/vertx/VertxPlatformHttpConsumer.java | 81 +++--- 3 files changed, 42 insertions(+), 43 deletions(-) diff --git a/components/camel-platform-http-vertx/src/generated/resources/META-INF/services/org/apache/camel/other.properties b/components/camel-platform-http-vertx/src/generated/resources/META-INF/services/org/apache/camel/other.properties index 64045fc..7829961 100644 --- a/components/camel-platform-http-vertx/src/generated/resources/META-INF/services/org/apache/camel/other.properties +++ b/components/camel-platform-http-vertx/src/generated/resources/META-INF/services/org/apache/camel/other.properties @@ -2,6 +2,6 @@ name=platform-http-vertx groupId=org.apache.camel artifactId=camel-platform-http-vertx -version=3.4.4-SNAPSHOT +version=3.4.5-SNAPSHOT projectName=Camel :: Platform HTTP :: Vert.x projectDescription=Implementation of the Platform HTTP Engine based on Vert.x Web diff --git a/components/camel-platform-http-vertx/src/generated/resources/platform-http-vertx.json b/components/camel-platform-http-vertx/src/generated/resources/platform-http-vertx.json index 45d67f7..f41dbe9 100644 --- a/components/camel-platform-http-vertx/src/generated/resources/platform-http-vertx.json +++ b/components/camel-platform-http-vertx/src/generated/resources/platform-http-vertx.json @@ -10,6 +10,6 @@ "supportLevel": "Stable", "groupId": "org.apache.camel", "artifactId": "camel-platform-http-vertx", -"version": "3.4.4-SNAPSHOT" +"version": "3.4.5-SNAPSHOT" } } diff --git a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java index 125a4ed..fe37c13 100644 --- a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java +++ b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java @@ -64,16 +64,15 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer { private Route route; public VertxPlatformHttpConsumer( - PlatformHttpEndpoint endpoint, - Processor processor, - List> handlers, - UploadAttacher uploadAttacher) { +PlatformHttpEndpoint endpoint, +Processor processor, +List> handlers, +UploadAttacher uploadAttacher) { super(endpoint, processor); this.handlers = handlers; this.uploadAttacher = uploadAttacher; -this.fileNameExtWhitelist -= endpoint.getFileNameExtWhitelist() == null ? null : endpoint.getFileNameExtWhitelist().toLowerCase(Locale.US); +this.fileNameExtWhitelist = endpoint.getFileNameExtWhitelist() == null ? null : endpoint.getFileNameExtWhitelist().toLowerCase(Locale.US); } @Override @@ -167,44 +166,44 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer { // .to("rest:get:?bridgeEndpoint=true"); // vertx.executeBlocking( -promise -> { -try { -createUoW(exchange); -} catch (Exception e) { -promise.fail(e); -return; -} +promise -> { +try { +createUoW(exchange); +} catch (Exception e) { +promise.fail(e); +return; +} -getAsyncProcessor().process(exchange, c -> { -if (!exchange.isFailed()) { -promise.complete(); -} else { -promise.fail(exchange.getException()); -} -}); -}, -false, -result -> { -try { -if (result.succeeded()) { -try { -writeResponse(ctx, exchange, getEndpoint().getHeaderFilterStrategy
[camel] 01/02: camel-platform-http-vertx: handle requests using a thread from the worker pool
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch camel-3.4.x in repository https://gitbox.apache.org/repos/asf/camel.git commit f8027157fcb4bae1891a38c629abc88aea1daa4d Author: Luca Burgazzoli AuthorDate: Wed Sep 30 15:26:03 2020 +0200 camel-platform-http-vertx: handle requests using a thread from the worker pool --- .../http/vertx/VertxPlatformHttpConsumer.java | 101 ++-- .../http/vertx/VertxPlatformHttpSupport.java | 23 ++--- .../http/vertx/VertxPlatformHttpEngineTest.java| 105 - 3 files changed, 182 insertions(+), 47 deletions(-) diff --git a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java index f816ea6..125a4ed 100644 --- a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java +++ b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java @@ -26,6 +26,7 @@ import java.util.regex.Pattern; import io.vertx.core.Handler; import io.vertx.core.MultiMap; +import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpMethod; import io.vertx.ext.web.FileUpload; @@ -63,15 +64,16 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer { private Route route; public VertxPlatformHttpConsumer( -PlatformHttpEndpoint endpoint, -Processor processor, -List> handlers, -UploadAttacher uploadAttacher) { + PlatformHttpEndpoint endpoint, + Processor processor, + List> handlers, + UploadAttacher uploadAttacher) { super(endpoint, processor); this.handlers = handlers; this.uploadAttacher = uploadAttacher; -this.fileNameExtWhitelist = endpoint.getFileNameExtWhitelist() == null ? null : endpoint.getFileNameExtWhitelist().toLowerCase(Locale.US); +this.fileNameExtWhitelist += endpoint.getFileNameExtWhitelist() == null ? null : endpoint.getFileNameExtWhitelist().toLowerCase(Locale.US); } @Override @@ -101,28 +103,11 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer { } newRoute.handler(router.bodyHandler()); -for (Handler handler: handlers) { +for (Handler handler : handlers) { newRoute.handler(handler); } -newRoute.handler( -ctx -> { -Exchange exchg = null; -try { -final Exchange exchange = exchg = toExchange(ctx); -createUoW(exchange); -getAsyncProcessor().process( -exchange, -doneSync -> writeResponse(ctx, exchange, getEndpoint().getHeaderFilterStrategy())); -} catch (Exception e) { -ctx.fail(e); -getExceptionHandler().handleException("Failed handling platform-http endpoint " + endpoint.getPath(), exchg, e); -} finally { -if (exchg != null) { -doneUoW(exchg); -} -} -}); +newRoute.handler(this::handleRequest); this.route = newRoute; } @@ -161,6 +146,67 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer { return PATH_PARAMETER_PATTERN.matcher(path).replaceAll(":$1"); } +private void handleRequest(RoutingContext ctx) { +final Vertx vertx = ctx.vertx(); +final Exchange exchange = toExchange(ctx); + +// +// We do not know if any of the processing logic of the route is synchronous or not so we +// need to process the request on a thread on the Vert.x worker pool. +// +// As example, assuming the platform-http component is configured as the transport provider +// for the rest dsl, then the following code may result in a blocking operation that could +// block Vert.x event-loop for too long if the target service takes long to respond, as +// example in case the service is a knative service scaled to zero that could take some time +// to be come available: +// +// rest("/results") +// .get("/{id}") +// .route() +// .removeHeaders("*", "CamelHttpPath") +// .to("rest:get:?bridgeEndpoint=true"); +// +
[camel] branch camel-3.4.x updated (926640b -> 2c70250)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch camel-3.4.x in repository https://gitbox.apache.org/repos/asf/camel.git. from 926640b Add XML schema references for release 3.4.4 new f802715 camel-platform-http-vertx: handle requests using a thread from the worker pool new 2c70250 camel-platform-http-vertx: reformat The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../services/org/apache/camel/other.properties | 2 +- .../generated/resources/platform-http-vertx.json | 2 +- .../http/vertx/VertxPlatformHttpConsumer.java | 86 + .../http/vertx/VertxPlatformHttpSupport.java | 23 ++--- .../http/vertx/VertxPlatformHttpEngineTest.java| 105 - 5 files changed, 176 insertions(+), 42 deletions(-)
[camel] 02/02: camel-platform-http-vertx: reformat
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch camel-3.4.x in repository https://gitbox.apache.org/repos/asf/camel.git commit 2c70250efd1e25cc8f96f528ba50b9fd701687fc Author: Luca Burgazzoli AuthorDate: Wed Sep 30 17:52:51 2020 +0200 camel-platform-http-vertx: reformat --- .../services/org/apache/camel/other.properties | 2 +- .../generated/resources/platform-http-vertx.json | 2 +- .../http/vertx/VertxPlatformHttpConsumer.java | 81 +++--- 3 files changed, 42 insertions(+), 43 deletions(-) diff --git a/components/camel-platform-http-vertx/src/generated/resources/META-INF/services/org/apache/camel/other.properties b/components/camel-platform-http-vertx/src/generated/resources/META-INF/services/org/apache/camel/other.properties index 64045fc..7829961 100644 --- a/components/camel-platform-http-vertx/src/generated/resources/META-INF/services/org/apache/camel/other.properties +++ b/components/camel-platform-http-vertx/src/generated/resources/META-INF/services/org/apache/camel/other.properties @@ -2,6 +2,6 @@ name=platform-http-vertx groupId=org.apache.camel artifactId=camel-platform-http-vertx -version=3.4.4-SNAPSHOT +version=3.4.5-SNAPSHOT projectName=Camel :: Platform HTTP :: Vert.x projectDescription=Implementation of the Platform HTTP Engine based on Vert.x Web diff --git a/components/camel-platform-http-vertx/src/generated/resources/platform-http-vertx.json b/components/camel-platform-http-vertx/src/generated/resources/platform-http-vertx.json index 45d67f7..f41dbe9 100644 --- a/components/camel-platform-http-vertx/src/generated/resources/platform-http-vertx.json +++ b/components/camel-platform-http-vertx/src/generated/resources/platform-http-vertx.json @@ -10,6 +10,6 @@ "supportLevel": "Stable", "groupId": "org.apache.camel", "artifactId": "camel-platform-http-vertx", -"version": "3.4.4-SNAPSHOT" +"version": "3.4.5-SNAPSHOT" } } diff --git a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java index 125a4ed..fe37c13 100644 --- a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java +++ b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java @@ -64,16 +64,15 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer { private Route route; public VertxPlatformHttpConsumer( - PlatformHttpEndpoint endpoint, - Processor processor, - List> handlers, - UploadAttacher uploadAttacher) { +PlatformHttpEndpoint endpoint, +Processor processor, +List> handlers, +UploadAttacher uploadAttacher) { super(endpoint, processor); this.handlers = handlers; this.uploadAttacher = uploadAttacher; -this.fileNameExtWhitelist -= endpoint.getFileNameExtWhitelist() == null ? null : endpoint.getFileNameExtWhitelist().toLowerCase(Locale.US); +this.fileNameExtWhitelist = endpoint.getFileNameExtWhitelist() == null ? null : endpoint.getFileNameExtWhitelist().toLowerCase(Locale.US); } @Override @@ -167,44 +166,44 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer { // .to("rest:get:?bridgeEndpoint=true"); // vertx.executeBlocking( -promise -> { -try { -createUoW(exchange); -} catch (Exception e) { -promise.fail(e); -return; -} +promise -> { +try { +createUoW(exchange); +} catch (Exception e) { +promise.fail(e); +return; +} -getAsyncProcessor().process(exchange, c -> { -if (!exchange.isFailed()) { -promise.complete(); -} else { -promise.fail(exchange.getException()); -} -}); -}, -false, -result -> { -try { -if (result.succeeded()) { -try { -writeResponse(ctx, exchange, getEndpoint().getHeaderFilterStrategy
[camel] branch master updated: camel-platform-http-vertx: handle requests using a thread from the worker pool
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/master by this push: new 57fb955 camel-platform-http-vertx: handle requests using a thread from the worker pool 57fb955 is described below commit 57fb9554c7eeb54d6d707f038fc1febf8cab9cb8 Author: Luca Burgazzoli AuthorDate: Wed Sep 30 15:26:03 2020 +0200 camel-platform-http-vertx: handle requests using a thread from the worker pool --- .../http/vertx/VertxPlatformHttpConsumer.java | 82 .../http/vertx/VertxPlatformHttpSupport.java | 23 ++--- .../http/vertx/VertxPlatformHttpEngineTest.java| 105 - 3 files changed, 171 insertions(+), 39 deletions(-) diff --git a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java index 8c0942d7..125a4ed 100644 --- a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java +++ b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java @@ -26,6 +26,7 @@ import java.util.regex.Pattern; import io.vertx.core.Handler; import io.vertx.core.MultiMap; +import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpMethod; import io.vertx.ext.web.FileUpload; @@ -106,25 +107,7 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer { newRoute.handler(handler); } -newRoute.handler( -ctx -> { -Exchange exchg = null; -try { -final Exchange exchange = exchg = toExchange(ctx); -createUoW(exchange); -getAsyncProcessor().process( -exchange, -doneSync -> writeResponse(ctx, exchange, getEndpoint().getHeaderFilterStrategy())); -} catch (Exception e) { -ctx.fail(e); -getExceptionHandler().handleException("Failed handling platform-http endpoint " + endpoint.getPath(), -exchg, e); -} finally { -if (exchg != null) { -doneUoW(exchg); -} -} -}); +newRoute.handler(this::handleRequest); this.route = newRoute; } @@ -163,6 +146,67 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer { return PATH_PARAMETER_PATTERN.matcher(path).replaceAll(":$1"); } +private void handleRequest(RoutingContext ctx) { +final Vertx vertx = ctx.vertx(); +final Exchange exchange = toExchange(ctx); + +// +// We do not know if any of the processing logic of the route is synchronous or not so we +// need to process the request on a thread on the Vert.x worker pool. +// +// As example, assuming the platform-http component is configured as the transport provider +// for the rest dsl, then the following code may result in a blocking operation that could +// block Vert.x event-loop for too long if the target service takes long to respond, as +// example in case the service is a knative service scaled to zero that could take some time +// to be come available: +// +// rest("/results") +// .get("/{id}") +// .route() +// .removeHeaders("*", "CamelHttpPath") +// .to("rest:get:?bridgeEndpoint=true"); +// +vertx.executeBlocking( +promise -> { +try { +createUoW(exchange); +} catch (Exception e) { +promise.fail(e); +return; +} + +getAsyncProcessor().process(exchange, c -> { +if (!exchange.isFailed()) { +promise.complete(); +} else { +promise.fail(exchange.getException()); +} +}); +}, +false, +result -> { +try { +if (result.succeeded()) { +try { +writeResponse(ctx, exchange, getEnd
[camel-k-runtime] 03/03: kamelet source/sink component #490
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit 979288ecc735e8613a39ca5d627d2f288fb68c2f Author: Luca Burgazzoli AuthorDate: Mon Sep 28 20:59:58 2020 +0200 kamelet source/sink component #490 --- .../src/main/resources/application.properties | 2 +- .../src/test/resources/routes/set-body.yaml| 2 +- .../src/test/resources/routes/to-upper.yaml| 2 +- .../apache/camel/component/kamelet/kamelet.json| 2 +- .../apache/camel/component/kamelet/Kamelet.java| 97 - .../camel/component/kamelet/KameletComponent.java | 154 +++-- .../camel/component/kamelet/KameletEndpoint.java | 7 +- .../camel/component/kamelet/KameletProducer.java | 2 +- .../src/test/resources/log4j2-test.xml | 2 + 9 files changed, 151 insertions(+), 119 deletions(-) diff --git a/camel-k-quarkus/camel-k-quarkus-itests/camel-k-quarkus-itests-kamelet/src/main/resources/application.properties b/camel-k-quarkus/camel-k-quarkus-itests/camel-k-quarkus-itests-kamelet/src/main/resources/application.properties index 3ce5493..5b8f41a 100644 --- a/camel-k-quarkus/camel-k-quarkus-itests/camel-k-quarkus-itests-kamelet/src/main/resources/application.properties +++ b/camel-k-quarkus/camel-k-quarkus-itests/camel-k-quarkus-itests-kamelet/src/main/resources/application.properties @@ -18,6 +18,6 @@ # # Quarkus # -quarkus.log.console.enable = false +quarkus.log.console.enable = true quarkus.banner.enabled = false diff --git a/camel-k-quarkus/camel-k-quarkus-itests/camel-k-quarkus-itests-kamelet/src/test/resources/routes/set-body.yaml b/camel-k-quarkus/camel-k-quarkus-itests/camel-k-quarkus-itests-kamelet/src/test/resources/routes/set-body.yaml index 55347e9..c311da1 100644 --- a/camel-k-quarkus/camel-k-quarkus-itests/camel-k-quarkus-itests-kamelet/src/test/resources/routes/set-body.yaml +++ b/camel-k-quarkus/camel-k-quarkus-itests/camel-k-quarkus-itests-kamelet/src/test/resources/routes/set-body.yaml @@ -16,7 +16,7 @@ # - from: -uri: "direct:{{routeId}}" +uri: "kamelet:source" steps: - set-body: constant: "{{bodyValue}}" \ No newline at end of file diff --git a/camel-k-quarkus/camel-k-quarkus-itests/camel-k-quarkus-itests-kamelet/src/test/resources/routes/to-upper.yaml b/camel-k-quarkus/camel-k-quarkus-itests/camel-k-quarkus-itests-kamelet/src/test/resources/routes/to-upper.yaml index 74105f1..ba51838 100644 --- a/camel-k-quarkus/camel-k-quarkus-itests/camel-k-quarkus-itests-kamelet/src/test/resources/routes/to-upper.yaml +++ b/camel-k-quarkus/camel-k-quarkus-itests/camel-k-quarkus-itests-kamelet/src/test/resources/routes/to-upper.yaml @@ -16,7 +16,7 @@ # - from: -uri: "direct:{{routeId}}" +uri: "kamelet:source" steps: - set-body: constant: "{{message}}" diff --git a/components/camel-kamelet/src/generated/resources/org/apache/camel/component/kamelet/kamelet.json b/components/camel-kamelet/src/generated/resources/org/apache/camel/component/kamelet/kamelet.json index a66f1ca..4dd132f 100644 --- a/components/camel-kamelet/src/generated/resources/org/apache/camel/component/kamelet/kamelet.json +++ b/components/camel-kamelet/src/generated/resources/org/apache/camel/component/kamelet/kamelet.json @@ -6,7 +6,7 @@ "description": "The Kamelet Component provides support for interacting with Knative", "deprecated": false, "firstVersion": "3.5.0", -"label": "camel-k", +"label": "core", "javaType": "org.apache.camel.component.kamelet.KameletComponent", "supportLevel": "Preview", "groupId": "org.apache.camel.k", diff --git a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java index 689c1ed..14ecc43 100644 --- a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java +++ b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java @@ -17,19 +17,32 @@ package org.apache.camel.component.kamelet; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import java.util.Properties; +import java.util.StringJoiner; import java.util.function.Predicate; import org.apache.camel.CamelContext; +import org.apache.camel.model.FromDefinition; +import org.apache.camel.model.ModelCamelContext; +import org.apache.camel.model.RouteDefinition; +import org.apache.camel.model.RouteTemplateDefinition; +import org.apache.camel.model.RouteTemplateParameterDefinition
[camel-k-runtime] branch master updated (14210d1 -> 979288e)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git. from 14210d1 Updated CHANGELOG.md new 4dede2a kamelet source/sink component #490 new cb2b893 Make kamelet:sink and kamelet:source work with workaround here (need to find nicer solution in camel-core) new 979288e kamelet source/sink component #490 The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../src/main/resources/application.properties | 2 +- .../src/test/resources/routes/set-body.yaml| 2 +- .../src/test/resources/routes/to-upper.yaml| 2 +- components/camel-kamelet/pom.xml | 9 +- .../kamelet/KameletComponentConfigurer.java| 6 + .../kamelet/KameletEndpointConfigurer.java | 11 ++ .../apache/camel/component/kamelet/kamelet.json| 7 +- .../apache/camel/component/kamelet/Kamelet.java| 115 ++-- .../camel/component/kamelet/KameletComponent.java | 192 + .../camel/component/kamelet/KameletConsumer.java | 74 .../camel/component/kamelet/KameletEndpoint.java | 159 + .../camel/component/kamelet/KameletProducer.java | 70 .../camel/component/kamelet/KameletBasicTest.java | 4 +- .../component/kamelet/KameletPropertiesTest.java | 2 +- .../camel/component/kamelet/KameletRouteTest.java | 23 +-- .../component/kamelet/KameletValidationTest.java | 2 +- 16 files changed, 519 insertions(+), 161 deletions(-) create mode 100644 components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletConsumer.java create mode 100644 components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletProducer.java
[camel-k-runtime] 02/03: Make kamelet:sink and kamelet:source work with workaround here (need to find nicer solution in camel-core)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit cb2b8934fbb7226e40c2ae965c84d9b768edc178 Author: Claus Ibsen AuthorDate: Mon Sep 28 18:17:18 2020 +0200 Make kamelet:sink and kamelet:source work with workaround here (need to find nicer solution in camel-core) --- .../kamelet/KameletComponentConfigurer.java| 6 ++ .../kamelet/KameletEndpointConfigurer.java | 11 +++ .../apache/camel/component/kamelet/kamelet.json| 5 + .../camel/component/kamelet/KameletComponent.java | 101 - .../camel/component/kamelet/KameletEndpoint.java | 3 + 5 files changed, 124 insertions(+), 2 deletions(-) diff --git a/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletComponentConfigurer.java b/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletComponentConfigurer.java index a0a384d..7c3717a 100644 --- a/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletComponentConfigurer.java +++ b/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletComponentConfigurer.java @@ -21,10 +21,12 @@ public class KameletComponentConfigurer extends PropertyConfigurerSupport implem switch (ignoreCase ? name.toLowerCase() : name) { case "basicpropertybinding": case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true; +case "block": target.setBlock(property(camelContext, boolean.class, value)); return true; case "bridgeerrorhandler": case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true; case "lazystartproducer": case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; +case "timeout": target.setTimeout(property(camelContext, long.class, value)); return true; default: return false; } } @@ -33,8 +35,10 @@ public class KameletComponentConfigurer extends PropertyConfigurerSupport implem public Map getAllOptions(Object target) { Map answer = new CaseInsensitiveMap(); answer.put("basicPropertyBinding", boolean.class); +answer.put("block", boolean.class); answer.put("bridgeErrorHandler", boolean.class); answer.put("lazyStartProducer", boolean.class); +answer.put("timeout", long.class); return answer; } @@ -44,10 +48,12 @@ public class KameletComponentConfigurer extends PropertyConfigurerSupport implem switch (ignoreCase ? name.toLowerCase() : name) { case "basicpropertybinding": case "basicPropertyBinding": return target.isBasicPropertyBinding(); +case "block": return target.isBlock(); case "bridgeerrorhandler": case "bridgeErrorHandler": return target.isBridgeErrorHandler(); case "lazystartproducer": case "lazyStartProducer": return target.isLazyStartProducer(); +case "timeout": return target.getTimeout(); default: return null; } } diff --git a/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletEndpointConfigurer.java b/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletEndpointConfigurer.java index bb99f63..6869355 100644 --- a/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletEndpointConfigurer.java +++ b/components/camel-kamelet/src/generated/java/org/apache/camel/component/kamelet/KameletEndpointConfigurer.java @@ -21,15 +21,19 @@ public class KameletEndpointConfigurer extends PropertyConfigurerSupport impleme switch (ignoreCase ? name.toLowerCase() : name) { case "basicpropertybinding": case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true; +case "block": target.setBlock(property(camelContext, boolean.class, value)); return true; case "bridgeerrorhandler": case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true; case "exceptionhandler": case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true; case "exchangepattern": case "exchangePattern": target.set
[camel-k-runtime] 01/03: kamelet source/sink component #490
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git commit 4dede2ab1d61551b675b6bde82dae236511ac07e Author: Luca Burgazzoli AuthorDate: Mon Sep 28 11:56:22 2020 +0200 kamelet source/sink component #490 --- components/camel-kamelet/pom.xml | 9 +- .../apache/camel/component/kamelet/Kamelet.java| 32 ++--- .../camel/component/kamelet/KameletComponent.java | 143 ++- .../camel/component/kamelet/KameletConsumer.java | 74 ++ .../camel/component/kamelet/KameletEndpoint.java | 157 - .../camel/component/kamelet/KameletProducer.java | 70 + .../camel/component/kamelet/KameletBasicTest.java | 4 +- .../component/kamelet/KameletPropertiesTest.java | 2 +- .../camel/component/kamelet/KameletRouteTest.java | 23 +-- .../component/kamelet/KameletValidationTest.java | 2 +- .../src/test/resources/log4j2-test.xml | 2 - 11 files changed, 361 insertions(+), 157 deletions(-) diff --git a/components/camel-kamelet/pom.xml b/components/camel-kamelet/pom.xml index 21232ac..426c1f7 100644 --- a/components/camel-kamelet/pom.xml +++ b/components/camel-kamelet/pom.xml @@ -40,10 +40,6 @@ org.apache.camel camel-core-engine - -org.apache.camel -camel-direct - @@ -78,6 +74,11 @@ org.apache.camel +camel-direct +test + + +org.apache.camel camel-test-junit5 test diff --git a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java index d9ac81b..689c1ed 100644 --- a/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java +++ b/components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/Kamelet.java @@ -17,24 +17,19 @@ package org.apache.camel.component.kamelet; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Properties; import java.util.function.Predicate; import org.apache.camel.CamelContext; -import org.apache.camel.model.ModelCamelContext; -import org.apache.camel.model.RouteDefinition; import org.apache.camel.spi.PropertiesComponent; import org.apache.camel.util.StringHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public final class Kamelet { public static final String PROPERTIES_PREFIX = "camel.kamelet."; public static final String SCHEME = "kamelet"; - -private static final Logger LOGGER = LoggerFactory.getLogger(Kamelet.class); +public static final String SOURCE_ID = "source"; +public static final String SINK_ID = "sink"; private Kamelet() { } @@ -43,20 +38,11 @@ public final class Kamelet { return item -> item.startsWith(prefix); } -public static void createRouteForEndpoint(KameletEndpoint endpoint) throws Exception { -LOGGER.debug("Creating route from template {}", endpoint.getTemplateId()); - -ModelCamelContext context = endpoint.getCamelContext().adapt(ModelCamelContext.class); -String id = context.addRouteFromTemplate(endpoint.getRouteId(), endpoint.getTemplateId(), endpoint.getKameletProperties()); -RouteDefinition def = context.getRouteDefinition(id); -if (!def.isPrepared()) { -context.startRouteDefinitions(List.of(def)); +public static String extractTemplateId(CamelContext context, String remaining) { +if (SOURCE_ID.equals(remaining) || SINK_ID.equals(remaining)) { +return context.resolvePropertyPlaceholders("{{templateId}}"); } -LOGGER.debug("Route {} created from template {}", id, endpoint.getTemplateId()); -} - -public static String extractTemplateId(CamelContext context, String remaining) { String answer = StringHelper.before(remaining, "/"); if (answer == null) { answer = remaining; @@ -65,7 +51,11 @@ public final class Kamelet { return answer; } -public static String extractRouteId(CamelContext context, String remaining) { +public static String extractRouteId(CamelContext context, String remaining) { +if (SOURCE_ID.equals(remaining) || SINK_ID.equals(remaining)) { +return context.resolvePropertyPlaceholders("{{routeId}}"); +} + String answer = StringHelper.after(remaining, "/"); if (answer == null) { answer = extractTemplateId(context, remaining) + "-" + context.getUuidGenerator().generateUuid(); @@ -74,7 +64,7
[camel-k-runtime] branch master updated: build(deps): bump groovy-version from 3.0.5 to 3.0.6
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new 856b9b9 build(deps): bump groovy-version from 3.0.5 to 3.0.6 856b9b9 is described below commit 856b9b9106a0b564d6c615b2a7a95c7e6b05c898 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> AuthorDate: Tue Sep 29 19:01:43 2020 + build(deps): bump groovy-version from 3.0.5 to 3.0.6 Bumps `groovy-version` from 3.0.5 to 3.0.6. Updates `groovy` from 3.0.5 to 3.0.6 - [Release notes](https://github.com/apache/groovy/releases) - [Commits](https://github.com/apache/groovy/commits) Updates `groovy-xml` from 3.0.5 to 3.0.6 - [Release notes](https://github.com/apache/groovy/releases) - [Commits](https://github.com/apache/groovy/commits) Updates `groovy-json` from 3.0.5 to 3.0.6 - [Release notes](https://github.com/apache/groovy/releases) - [Commits](https://github.com/apache/groovy/commits) Updates `groovy-yaml` from 3.0.5 to 3.0.6 - [Release notes](https://github.com/apache/groovy/releases) - [Commits](https://github.com/apache/groovy/commits) Updates `groovy-test` from 3.0.5 to 3.0.6 - [Release notes](https://github.com/apache/groovy/releases) - [Commits](https://github.com/apache/groovy/commits) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9b26cc6..45456a5 100644 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ 0.9.13 -3.0.5 +3.0.6 1.4.10 2.0-M3-groovy-3.0 2.3.1
[camel-k-runtime] branch master updated (012d255 -> 38405d3)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git. from 012d255 build(deps): bump junit-pioneer from 0.9.0 to 0.9.1 add 38405d3 build(deps): bump junit-pioneer from 0.9.1 to 0.9.2 No new revisions were added by this update. Summary of changes: pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[camel] branch master updated: CAMEL-15590: route templates: add an hook to further customize the RouteDefinition computed out of a template
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/master by this push: new 5029d32 CAMEL-15590: route templates: add an hook to further customize the RouteDefinition computed out of a template 5029d32 is described below commit 5029d32302fbd5e8d2688b82b0dc66637633ef62 Author: Luca Burgazzoli AuthorDate: Tue Sep 29 11:30:19 2020 +0200 CAMEL-15590: route templates: add an hook to further customize the RouteDefinition computed out of a template --- .../org/apache/camel/impl/DefaultCamelContext.java | 6 +- .../java/org/apache/camel/impl/DefaultModel.java | 65 +++--- .../camel/impl/lw/LightweightCamelContext.java | 5 + .../main/java/org/apache/camel/model/Model.java| 9 ++ .../camel/model/RouteTemplateDefinition.java | 5 + .../camel/builder/RouteTemplateConverterTest.java | 136 + 6 files changed, 205 insertions(+), 21 deletions(-) diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultCamelContext.java index c4ead09..b6d16d9 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultCamelContext.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultCamelContext.java @@ -183,6 +183,11 @@ public class DefaultCamelContext extends SimpleCamelContext implements ModelCame } @Override +public void addRouteTemplateDefinitionConverter(String templateIdPattern, RouteTemplateDefinition.Converter converter) { +model.addRouteTemplateDefinitionConverter(templateIdPattern, converter); +} + +@Override public String addRouteFromTemplate(String routeId, String routeTemplateId, Map parameters) throws Exception { return model.addRouteFromTemplate(routeId, routeTemplateId, parameters); @@ -487,5 +492,4 @@ public class DefaultCamelContext extends SimpleCamelContext implements ModelCame ? new TransformerKey(def.getScheme()) : new TransformerKey(new DataType(def.getFromType()), new DataType(def.getToType())); } - } diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java index bdaf469..f545d28 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java @@ -46,6 +46,7 @@ import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition; import org.apache.camel.model.rest.RestDefinition; import org.apache.camel.model.transformer.TransformerDefinition; import org.apache.camel.model.validator.ValidatorDefinition; +import org.apache.camel.util.AntPathMatcher; public class DefaultModel implements Model { @@ -55,6 +56,7 @@ public class DefaultModel implements Model { private final List routeDefinitions = new ArrayList<>(); private final List routeTemplateDefinitions = new ArrayList<>(); private final List restDefinitions = new ArrayList<>(); +private final Map routeTemplateConverters = new ConcurrentHashMap<>(); private Map dataFormats = new HashMap<>(); private List transformers = new ArrayList<>(); private List validators = new ArrayList<>(); @@ -68,6 +70,15 @@ public class DefaultModel implements Model { this.camelContext = camelContext; } +protected static T lookup(CamelContext context, String ref, Class type) { +try { +return context.getRegistry().lookupByNameAndType(ref, type); +} catch (Exception e) { +// need to ignore not same type and return it as null +return null; +} +} + public CamelContext getCamelContext() { return camelContext; } @@ -194,6 +205,11 @@ public class DefaultModel implements Model { } @Override +public void addRouteTemplateDefinitionConverter(String templateIdPattern, RouteTemplateDefinition.Converter converter) { +routeTemplateConverters.put(templateIdPattern, converter); +} + +@Override public String addRouteFromTemplate(final String routeId, final String routeTemplateId, final Map parameters) throws Exception { RouteTemplateDefinition target = null; @@ -208,7 +224,7 @@ public class DefaultModel implements Model { } StringJoiner templatesBuilder = new StringJoiner(", "); -final Map prop = new HashMap(); +final Map prop = new HashMap<>(); // include default values first from the template (and validate that we have inputs for all required parameters) if (
[camel] branch master updated: CAMEL-15590: route templates: add an hook to further customize the RouteDefinition computed out of a template
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/master by this push: new 5029d32 CAMEL-15590: route templates: add an hook to further customize the RouteDefinition computed out of a template 5029d32 is described below commit 5029d32302fbd5e8d2688b82b0dc66637633ef62 Author: Luca Burgazzoli AuthorDate: Tue Sep 29 11:30:19 2020 +0200 CAMEL-15590: route templates: add an hook to further customize the RouteDefinition computed out of a template --- .../org/apache/camel/impl/DefaultCamelContext.java | 6 +- .../java/org/apache/camel/impl/DefaultModel.java | 65 +++--- .../camel/impl/lw/LightweightCamelContext.java | 5 + .../main/java/org/apache/camel/model/Model.java| 9 ++ .../camel/model/RouteTemplateDefinition.java | 5 + .../camel/builder/RouteTemplateConverterTest.java | 136 + 6 files changed, 205 insertions(+), 21 deletions(-) diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultCamelContext.java index c4ead09..b6d16d9 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultCamelContext.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultCamelContext.java @@ -183,6 +183,11 @@ public class DefaultCamelContext extends SimpleCamelContext implements ModelCame } @Override +public void addRouteTemplateDefinitionConverter(String templateIdPattern, RouteTemplateDefinition.Converter converter) { +model.addRouteTemplateDefinitionConverter(templateIdPattern, converter); +} + +@Override public String addRouteFromTemplate(String routeId, String routeTemplateId, Map parameters) throws Exception { return model.addRouteFromTemplate(routeId, routeTemplateId, parameters); @@ -487,5 +492,4 @@ public class DefaultCamelContext extends SimpleCamelContext implements ModelCame ? new TransformerKey(def.getScheme()) : new TransformerKey(new DataType(def.getFromType()), new DataType(def.getToType())); } - } diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java index bdaf469..f545d28 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/DefaultModel.java @@ -46,6 +46,7 @@ import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition; import org.apache.camel.model.rest.RestDefinition; import org.apache.camel.model.transformer.TransformerDefinition; import org.apache.camel.model.validator.ValidatorDefinition; +import org.apache.camel.util.AntPathMatcher; public class DefaultModel implements Model { @@ -55,6 +56,7 @@ public class DefaultModel implements Model { private final List routeDefinitions = new ArrayList<>(); private final List routeTemplateDefinitions = new ArrayList<>(); private final List restDefinitions = new ArrayList<>(); +private final Map routeTemplateConverters = new ConcurrentHashMap<>(); private Map dataFormats = new HashMap<>(); private List transformers = new ArrayList<>(); private List validators = new ArrayList<>(); @@ -68,6 +70,15 @@ public class DefaultModel implements Model { this.camelContext = camelContext; } +protected static T lookup(CamelContext context, String ref, Class type) { +try { +return context.getRegistry().lookupByNameAndType(ref, type); +} catch (Exception e) { +// need to ignore not same type and return it as null +return null; +} +} + public CamelContext getCamelContext() { return camelContext; } @@ -194,6 +205,11 @@ public class DefaultModel implements Model { } @Override +public void addRouteTemplateDefinitionConverter(String templateIdPattern, RouteTemplateDefinition.Converter converter) { +routeTemplateConverters.put(templateIdPattern, converter); +} + +@Override public String addRouteFromTemplate(final String routeId, final String routeTemplateId, final Map parameters) throws Exception { RouteTemplateDefinition target = null; @@ -208,7 +224,7 @@ public class DefaultModel implements Model { } StringJoiner templatesBuilder = new StringJoiner(", "); -final Map prop = new HashMap(); +final Map prop = new HashMap<>(); // include default values first from the template (and validate that we have inputs for all required parameters) if (
[camel-k-runtime] branch master updated (924a91c -> 012d255)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git. from 924a91c Updated CHANGELOG.md add 012d255 build(deps): bump junit-pioneer from 0.9.0 to 0.9.1 No new revisions were added by this update. Summary of changes: pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[camel] branch master updated: camel-telegram: fix wrong documentation
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/master by this push: new 831d607 camel-telegram: fix wrong documentation 831d607 is described below commit 831d6072051269cbb69f49985f3e16531d797615 Author: Luca Burgazzoli AuthorDate: Mon Sep 28 10:47:06 2020 +0200 camel-telegram: fix wrong documentation --- .../camel/catalog/docs/telegram-component.adoc | 32 +++--- .../src/main/docs/telegram-component.adoc | 32 +++--- .../modules/ROOT/pages/telegram-component.adoc | 32 +++--- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/telegram-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/telegram-component.adoc index 91ce86b..244c993 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/telegram-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/telegram-component.adoc @@ -47,7 +47,7 @@ for this component: [source,text] -telegram:type/authorizationToken[?options] +telegram:type[?options] You can append query options to the URI in the following format, @@ -175,7 +175,7 @@ in Java DSL [source,java] - -from("direct:start").to("telegram:bots/123456789:insertYourAuthorizationTokenHere"); +from("direct:start").to("telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere"); - or in Spring XML @@ -184,7 +184,7 @@ or in Spring XML - - + - @@ -226,7 +226,7 @@ In Java DSL [source,java] - -from("telegram:bots/123456789:insertYourAuthorizationTokenHere") +from("telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere") .bean(ProcessorBean.class) - @@ -235,7 +235,7 @@ or in Spring XML [source,xml] - - + @@ -281,9 +281,9 @@ The following is a basic configuration of the chat-bot in Java DSL [source,java] - -from("telegram:bots/123456789:insertYourAuthorizationTokenHere") +from("telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere") .bean(ChatBotLogic.class) -.to("telegram:bots/123456789:insertYourAuthorizationTokenHere"); +.to("telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere"); - or in Spring XML @@ -291,9 +291,9 @@ or in Spring XML [source,xml] - - + - + @@ -331,7 +331,7 @@ First, add the bot to the chat where you want to push messages, then run a route [source,java] - -from("telegram:bots/123456789:insertYourAuthorizationTokenHere") +from("telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere") .to("log:INFO?showHeaders=true"); - @@ -344,7 +344,7 @@ Once you get the chat ID, you can use the following sample route to push message - from("timer:tick") .setBody().constant("Hello") -to("telegram:bots/123456789:insertYourAuthorizationTokenHere?chatId=123456") +to("telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere?chatId=123456") - Note that the corresponding URI parameter is simply `chatId`. @@ -355,7 +355,7 @@ You can customize the user keyboard instead of asking him to write an option. `O [source,java] - -from("telegram:bots/123456789:insertYourAuthorizationTokenHere") +from("telegram:bots?authorizationToken=123456789:insertYourAuthorizationTokenHere") .process(exchange -> { OutgoingTextMessage msg = new OutgoingTextMessage(); @@ -382,14 +382,14 @@ from("telegram:bots/123456789:insertYourAuthorizationTokenHere") exchange.getIn().setBody(msg); }) -.to("telegram:bots/1234
[camel-k-runtime] branch master updated: yaml dsl: add documentation for endpoint-dsl support #484
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new 59c1a10 yaml dsl: add documentation for endpoint-dsl support #484 59c1a10 is described below commit 59c1a10ed0aa9f4412d03cd63f89de6cccaa9c87 Author: Luca Burgazzoli AuthorDate: Mon Sep 28 09:57:07 2020 +0200 yaml dsl: add documentation for endpoint-dsl support #484 --- docs/modules/languages/pages/yaml.adoc | 51 ++ 1 file changed, 51 insertions(+) diff --git a/docs/modules/languages/pages/yaml.adoc b/docs/modules/languages/pages/yaml.adoc index c94e563..65af468 100644 --- a/docs/modules/languages/pages/yaml.adoc +++ b/docs/modules/languages/pages/yaml.adoc @@ -112,6 +112,57 @@ set-body: In case you want to use the data-format's default settings, you need to place an empty block as data format parameters, like `json: {}` +== Defining endpoints + +To define an endpoint with the YAML dsl you have three options: + +. Using a classic Camel URI: ++ +[source,yaml] + +- from: +uri: "timer:tick?period=1s" +steps: + - to: + uri: "telegram:bots?authorizationToken=XXX" + +. Using URI and parameters: ++ +[source,yaml] + +- from: +uri: "timer://tick" +parameters: + period: "1s" +steps: + - to: + uri: "telegram:bots" + parameters: +authorizationToken: "XXX" + +. Using the YAML implementation of the https://camel.apache.org/manual/latest/Endpoint-dsl.html[Endpoint DSL]: ++ +[source,yaml] + +- from: +timer: + name: "tick" + period: "1s" +steps: + - telegram: + type: "bots" + authorizationToken: "XXX" + + +[WARNING] + +Support for the Endpoint DSL with YAML is experimental and subject to changes. + +[NOTE] + +Support for Endpoint DSL auto completion https://github.com/apache/camel-k-runtime/issues/485[is not yet available]. + + == Defining beans In addition to the general support for creating beans provided by https://camel.apache.org/components/latest/others/main.html#_specifying_custom_beans[Camel Main], the YAML DSL provide a convenient syntax to define and configure them:
[camel-k] branch master updated (7dcf39b -> 43e59c5)
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git. from 7dcf39b Updated CHANGELOG.md new abe76da docs: add section describing secret ref in properties files new 43e59c5 docs: include apply command for secret ref example The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../ROOT/pages/configuration/configmap-secret.adoc | 41 ++ 1 file changed, 41 insertions(+)
[camel-k] 01/02: docs: add section describing secret ref in properties files
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git commit abe76dab72338613535c079a3e1ce0bbc0034e05 Author: Evan Shortiss AuthorDate: Sat Sep 26 12:35:54 2020 +0100 docs: add section describing secret ref in properties files --- .../ROOT/pages/configuration/configmap-secret.adoc | 40 ++ 1 file changed, 40 insertions(+) diff --git a/docs/modules/ROOT/pages/configuration/configmap-secret.adoc b/docs/modules/ROOT/pages/configuration/configmap-secret.adoc index 1be9f30..6ed5ec6 100644 --- a/docs/modules/ROOT/pages/configuration/configmap-secret.adoc +++ b/docs/modules/ROOT/pages/configuration/configmap-secret.adoc @@ -77,3 +77,43 @@ You can now run the integration with the following command to reference the _Sec ``` kamel run --secret=my-secret props.groovy ``` + +== Reference a Secret in Properties + +Suppose you have an existing _Secret_ that contains sensitive information that your integration requires. You might want to reference the values from this _Secret_ in your configuration properties. + +For example, a _Secret_ named *secret-message*: + +[source,yaml] +.secret-message.yaml + +apiVersion: v1 +kind: Secret +metadata: + name: secret-message +data: + MESSAGE: SGVsbG8gV29ybGQK +type: Opaque + + +You can reference this _Secret_ in configuration properties using the `{{secret:secret-name/key-name}}` syntax. + +For example, the following configuration stored in a _ConfigMap_ references the example _Secret_ defined previously: + +[source,yaml] +.my-config.yaml + +apiVersion: v1 +kind: ConfigMap +metadata: + name: my-config +data: + application.properties: | +my.message=={{secret:secret-message/MESSAGE}} + + +You can now run the integration with the following command to include necessary the _Secret_ and _ConfigMap_: + +``` +kamel run --secret=secret-message --configmap=my-config props.groovy +``` \ No newline at end of file
[camel-k] 02/02: docs: include apply command for secret ref example
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git commit 43e59c5f76cd88dfddd1494039a5f8c3d0508ec9 Author: Evan Shortiss AuthorDate: Sat Sep 26 12:57:29 2020 +0100 docs: include apply command for secret ref example --- docs/modules/ROOT/pages/configuration/configmap-secret.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/modules/ROOT/pages/configuration/configmap-secret.adoc b/docs/modules/ROOT/pages/configuration/configmap-secret.adoc index 6ed5ec6..fabc9af 100644 --- a/docs/modules/ROOT/pages/configuration/configmap-secret.adoc +++ b/docs/modules/ROOT/pages/configuration/configmap-secret.adoc @@ -112,8 +112,9 @@ data: my.message=={{secret:secret-message/MESSAGE}} -You can now run the integration with the following command to include necessary the _Secret_ and _ConfigMap_: +You can now run the integration with the following commands to include necessary the _Secret_ and _ConfigMap_: ``` +kubectl apply -f my-config.yaml -f secret-message.yaml kamel run --secret=secret-message --configmap=my-config props.groovy ``` \ No newline at end of file
[camel-k-runtime] branch master updated: build: enable transfer logging for deploy task
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new f34aaf1 build: enable transfer logging for deploy task f34aaf1 is described below commit f34aaf177bd83c073f6aec073f7d12169a693dc6 Author: Luca Burgazzoli AuthorDate: Fri Sep 25 23:07:17 2020 +0200 build: enable transfer logging for deploy task --- .github/workflows/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 1fc3352..e2aa863 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -128,7 +128,7 @@ jobs: with: version: '11' - name: Deploy to ASF Snapshots Repository - run: ./mvnw -V -ntp clean deploy -DskipTests -DskipITs --settings .github/asf-deploy-settings.xml + run: ./mvnw -V clean deploy -DskipTests -DskipITs --settings .github/asf-deploy-settings.xml # # JS build disabled as fails for OOM
[camel-k-runtime] branch master updated: build: fix retrieval of nexus credentials
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new e57d695 build: fix retrieval of nexus credentials e57d695 is described below commit e57d6958ec0a00c540aadc3a995f88c16b22808e Author: Luca Burgazzoli AuthorDate: Fri Sep 25 22:20:05 2020 +0200 build: fix retrieval of nexus credentials --- .github/workflows/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 7be28b6..1fc3352 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -120,7 +120,7 @@ jobs: if: github.ref == 'refs/heads/master' env: NEXUS_DEPLOY_USERNAME: ${{ secrets.NEXUS_USER }} - NEXUS_DEPLOY_PASSWORD: ${{ secrets.NEXUS_PWD }} + NEXUS_DEPLOY_PASSWORD: ${{ secrets.NEXUS_PW }} steps: - uses: actions/checkout@v2 - name: Set up JDK 11
[camel-k-runtime] branch master updated: build: deploy to ASF snapshots from GitHub Actions
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new 932416b build: deploy to ASF snapshots from GitHub Actions 932416b is described below commit 932416bfaf84786f6b27949ce253cc75e25fca7c Author: Luca Burgazzoli AuthorDate: Fri Sep 25 18:24:32 2020 +0200 build: deploy to ASF snapshots from GitHub Actions --- .github/asf-deploy-settings.xml | 34 + .github/workflows/ci-build.yml | 48 ++--- 2 files changed, 50 insertions(+), 32 deletions(-) diff --git a/.github/asf-deploy-settings.xml b/.github/asf-deploy-settings.xml new file mode 100644 index 000..b8da75d --- /dev/null +++ b/.github/asf-deploy-settings.xml @@ -0,0 +1,34 @@ + + +http://maven.apache.org/SETTINGS/1.0.0"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation=" +http://maven.apache.org/SETTINGS/1.0.0 +http://maven.apache.org/xsd/settings-1.0.0.xsd";> + + + + apache.snapshots.https + ${env.NEXUS_DEPLOY_USERNAME} + ${env.NEXUS_DEPLOY_PASSWORD} + + + + \ No newline at end of file diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index a63863a..7be28b6 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -46,39 +46,8 @@ jobs: uses: AdoptOpenJDK/install-jdk@v1 with: version: '11' -- name: Build camel (master) - if: contains( github.event.pull_request.labels.*.name, 'depends-on/camel/master') - run: | -git clone --depth 1 --branch master https://github.com/apache/camel.git \ - && cd camel \ - && echo "Current Camel commit:" $(git rev-parse HEAD) \ - && ./mvnw -V -B -ntp clean install \ --Dfastinstall -git clone --depth 1 --branch camel-master https://github.com/apache/camel-quarkus.git \ - && cd camel-quarkus \ - && echo "Current Camel Quarkus commit:" $(git rev-parse HEAD) \ - && ./mvnw -V -B -ntp clean install \ --Dformatter.skip \ --Dimpsort.skip \ --Denforce=false \ --Dcamel-quarkus.update-extension-doc-page.skip \ --DskipTests \ --DskipITs -- name: Build camel-quarkus (master) - if: contains( github.event.pull_request.labels.*.name, 'depends-on/quarkus/master') - run: | -git clone --depth 1 --branch master https://github.com/apache/camel-quarkus.git \ - && cd camel-quarkus \ - && echo "Current Camel Quarkus commit:" $(git rev-parse HEAD) \ - && ./mvnw -V -B -ntp clean install \ --Dformatter.skip \ --Dimpsort.skip \ --Denforce=false \ --Dcamel-quarkus.update-extension-doc-page.skip \ --DskipTests \ --DskipITs - name: Build camel-k-runtime - run: ./mvnw -V -B -ntp clean install + run: ./mvnw -V -ntp clean install - name: Tar Maven Repo shell: bash run: tar -czf maven-repo-${{ github.run_id }}-${{ github.run_number }}.tgz -C ~ .m2/repository @@ -145,6 +114,21 @@ jobs: -Dnative-image.xmx=6g \ -Ddocker \ -pl ${{ matrix.native-image-project }} + deploy: +runs-on: ubuntu-latest +needs: build-native +if: github.ref == 'refs/heads/master' +env: + NEXUS_DEPLOY_USERNAME: ${{ secrets.NEXUS_USER }} + NEXUS_DEPLOY_PASSWORD: ${{ secrets.NEXUS_PWD }} +steps: +- uses: actions/checkout@v2 +- name: Set up JDK 11 + uses: AdoptOpenJDK/install-jdk@v1 + with: +version: '11' +- name: Deploy to ASF Snapshots Repository + run: ./mvnw -V -ntp clean deploy -DskipTests -DskipITs --settings .github/asf-deploy-settings.xml # # JS build disabled as fails for OOM
[camel-k-runtime] branch master updated: knative: refactor knative environment definition #453
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git The following commit(s) were added to refs/heads/master by this push: new 474cff0 knative: refactor knative environment definition #453 474cff0 is described below commit 474cff09f990d44ba503dc906acd5f8b31872e09 Author: Luca Burgazzoli AuthorDate: Wed Sep 23 12:49:06 2020 +0200 knative: refactor knative environment definition #453 --- .../java/org/apache/camel/k/main/RuntimeTest.java | 2 +- .../knative/deployment/DeploymentProcessor.java| 2 +- .../KnativeSinkBindingContextCustomizer.java | 2 +- .../KnativeSinkBindingCustomizerTest.java | 4 +- .../knative/KnativeSourceRoutesLoaderTest.java | 2 +- components/camel-knative/camel-knative-api/pom.xml | 4 - .../component/knative/spi/KnativeEnvironment.java | 100 +++-- .../component/knative/spi/KnativeTransport.java| 4 +- .../knative/spi/KnativeEnvironmentTest.java| 19 ++-- .../camel-knative/camel-knative-http/pom.xml | 4 - .../knative/http/KnativeHttpConsumer.java | 4 +- .../knative/http/KnativeHttpProducer.java | 24 ++--- .../component/knative/http/KnativeHttpSupport.java | 2 +- .../knative/http/KnativeHttpTransport.java | 4 +- .../component/knative/http/KnativeHttpTest.java| 74 ++- .../knative/http/KnativeHttpTestSupport.java | 4 +- .../http/assertions/HttpServerRequestAssert.java | 2 - .../knative/test/KnativeEnvironmentSupport.java| 38 .../camel/component/knative/KnativeEndpoint.java | 23 +++-- .../knative/ce/AbstractCloudEventProcessor.java| 4 +- .../component/knative/ce/CloudEventProcessor.java | 4 +- .../component/knative/ce/CloudEventProcessors.java | 4 +- .../component/knative/KnativeComponentTest.java| 22 +++-- .../component/knative/KnativeTransportNoop.java| 4 +- .../src/test/resources/environment.json| 11 +-- .../{environment.json => environment_classic.json} | 9 +- 26 files changed, 176 insertions(+), 200 deletions(-) diff --git a/camel-k-main/camel-k-runtime-main/src/test/java/org/apache/camel/k/main/RuntimeTest.java b/camel-k-main/camel-k-runtime-main/src/test/java/org/apache/camel/k/main/RuntimeTest.java index bbb649a..4e275c3 100644 --- a/camel-k-main/camel-k-runtime-main/src/test/java/org/apache/camel/k/main/RuntimeTest.java +++ b/camel-k-main/camel-k-runtime-main/src/test/java/org/apache/camel/k/main/RuntimeTest.java @@ -167,7 +167,7 @@ public class RuntimeTest { public void testLoadJavaSourceWrap() throws Exception { KnativeComponent component = new KnativeComponent(); component.setEnvironment(KnativeEnvironment.on( -KnativeEnvironmentSupport.endpoint(Knative.EndpointKind.sink, "sink", "localhost", AvailablePortFinder.getNextAvailable()) +KnativeEnvironmentSupport.endpoint(Knative.EndpointKind.sink, "sink", "http://localhost:"; + AvailablePortFinder.getNextAvailable()) )); PlatformHttpServiceContextCustomizer phsc = new PlatformHttpServiceContextCustomizer(); diff --git a/camel-k-quarkus/camel-k-quarkus-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/DeploymentProcessor.java b/camel-k-quarkus/camel-k-quarkus-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/DeploymentProcessor.java index a17d85d..877e5b0 100644 --- a/camel-k-quarkus/camel-k-quarkus-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/DeploymentProcessor.java +++ b/camel-k-quarkus/camel-k-quarkus-knative/deployment/src/main/java/org/apache/camel/k/quarkus/knative/deployment/DeploymentProcessor.java @@ -46,7 +46,7 @@ public class DeploymentProcessor { List reflectiveClasses() { return List.of( new ReflectiveClassBuildItem(true, false, KnativeEnvironment.class), -new ReflectiveClassBuildItem(true, false, KnativeEnvironment.KnativeServiceDefinition.class) +new ReflectiveClassBuildItem(true, false, KnativeEnvironment.KnativeResource.class) ); } diff --git a/camel-k-runtime-knative/src/main/java/org/apache/camel/k/knative/customizer/KnativeSinkBindingContextCustomizer.java b/camel-k-runtime-knative/src/main/java/org/apache/camel/k/knative/customizer/KnativeSinkBindingContextCustomizer.java index 5ef35ca..f409956 100644 --- a/camel-k-runtime-knative/src/main/java/org/apache/camel/k/knative/customizer/KnativeSinkBindingContextCustomizer.java +++ b/camel-k-runtime-knative/src/main/java/org/apache/camel/k/knative/customizer/KnativeSinkBindingContextCustomizer.java @@ -51,7 +51,7 @@ public class KnativeSinkBindingContextCustomizer implements ContextCustomizer { }); } -
[camel] branch master updated: CAMEL-15526: Camel-AWS2-S3: Consume Gzip file from S3 not working
This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/master by this push: new 6241a5c CAMEL-15526: Camel-AWS2-S3: Consume Gzip file from S3 not working 6241a5c is described below commit 6241a5cbe548b1ca855f91a3741acf06184a947e Author: Luca Burgazzoli AuthorDate: Fri Sep 25 15:59:51 2020 +0200 CAMEL-15526: Camel-AWS2-S3: Consume Gzip file from S3 not working --- components/camel-aws2-s3/pom.xml | 5 ++ .../camel/component/aws2/s3/AWS2S3Endpoint.java| 24 +- .../localstack/S3GzipOperationLocalstackTest.java | 85 ++ 3 files changed, 94 insertions(+), 20 deletions(-) diff --git a/components/camel-aws2-s3/pom.xml b/components/camel-aws2-s3/pom.xml index 81d292b..500d556 100644 --- a/components/camel-aws2-s3/pom.xml +++ b/components/camel-aws2-s3/pom.xml @@ -67,6 +67,11 @@ camel-testcontainers-junit5 test + +org.apache.camel +camel-zip-deflater +test + diff --git a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java index 7212715..c9e3b9c 100644 --- a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java +++ b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Endpoint.java @@ -16,12 +16,7 @@ */ package org.apache.camel.component.aws2.s3; -import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; import org.apache.camel.Category; import org.apache.camel.Component; @@ -32,6 +27,7 @@ import org.apache.camel.ExtendedExchange; import org.apache.camel.Message; import org.apache.camel.Processor; import org.apache.camel.Producer; +import org.apache.camel.RuntimeCamelException; import org.apache.camel.component.aws2.s3.client.AWS2S3ClientFactory; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; @@ -50,6 +46,7 @@ import software.amazon.awssdk.services.s3.model.CreateBucketRequest; import software.amazon.awssdk.services.s3.model.GetObjectResponse; import software.amazon.awssdk.services.s3.model.ListObjectsRequest; import software.amazon.awssdk.services.s3.model.PutBucketPolicyRequest; +import software.amazon.awssdk.utils.IoUtils; /** * Store and retrieve objects from AWS S3 Storage Service using AWS SDK version 2.x. @@ -173,10 +170,9 @@ public class AWS2S3Endpoint extends ScheduledPollEndpoint { if (configuration.isIncludeBody()) { try { -message.setBody(readInputStream(s3Object)); +message.setBody(IoUtils.toByteArray(s3Object)); } catch (IOException e) { -// TODO Auto-generated catch block -e.printStackTrace(); +throw new RuntimeCamelException(e); } } else { message.setBody(null); @@ -258,16 +254,4 @@ public class AWS2S3Endpoint extends ScheduledPollEndpoint { public void setMaxConnections(int maxConnections) { this.maxConnections = maxConnections; } - -private String readInputStream(ResponseInputStream s3Object) throws IOException { -StringBuilder textBuilder = new StringBuilder(); -try (Reader reader -= new BufferedReader(new InputStreamReader(s3Object, Charset.forName(StandardCharsets.UTF_8.name() { -int c = 0; -while ((c = reader.read()) != -1) { -textBuilder.append((char) c); -} -} -return textBuilder.toString(); -} } diff --git a/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/S3GzipOperationLocalstackTest.java b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/S3GzipOperationLocalstackTest.java new file mode 100644 index 000..f35de30 --- /dev/null +++ b/components/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/localstack/S3GzipOperationLocalstackTest.java @@ -0,0 +1,85 @@ +/* + * 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 ag