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 88be1e1 Support camel 3.0.0 M3 #79 88be1e1 is described below commit 88be1e1754488d3701cb4e46de93a4bc9998257f Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Mon Jun 10 13:43:39 2019 +0200 Support camel 3.0.0 M3 #79 --- camel-k-runtime-core/pom.xml | 5 + .../main/java/org/apache/camel/k/Constants.java | 1 - .../src/main/java/org/apache/camel/k/Runtime.java | 2 +- .../src/main/java/org/apache/camel/k/Source.java | 3 +- .../customizer/StreamCachingContextCustomizer.java | 139 --------------------- .../apache/camel/k/listener/ContextConfigurer.java | 17 +-- .../k/listener/ContextLifecycleConfigurer.java | 48 ------- .../apache/camel/k/support/PropertiesSupport.java | 41 ++---- .../org/apache/camel/k/support/RuntimeSupport.java | 49 ++------ .../org/apache/camel/k/support/URIResolver.java | 35 +----- .../services/org.apache.camel.k.Runtime$Listener | 1 - .../org/apache/camel/k/customizer/streamcaching | 18 --- .../org/apache/camel/k/support/NameCustomizer.java | 2 +- .../apache/camel/k/support/RuntimeSupportTest.java | 47 ++----- .../StreamCachingContextCustomizerTest.java | 75 ----------- .../org/apache/camel/k/jvm/ApplicationRuntime.java | 16 +-- .../org/apache/camel/k/jvm/PropertiesTest.java | 81 ++++++------ .../java/org/apache/camel/k/jvm/RuntimeTest.java | 7 +- .../org/apache/camel/k/yaml/YamlFlowLoader.java | 3 +- pom.xml | 2 +- 20 files changed, 96 insertions(+), 496 deletions(-) diff --git a/camel-k-runtime-core/pom.xml b/camel-k-runtime-core/pom.xml index 3bd6d19..33e82fd 100644 --- a/camel-k-runtime-core/pom.xml +++ b/camel-k-runtime-core/pom.xml @@ -53,6 +53,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-base</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-properties</artifactId> <scope>provided</scope> </dependency> diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Constants.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Constants.java index b528317..e9ba9e4 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Constants.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Constants.java @@ -31,7 +31,6 @@ public final class Constants { public static final String SCHEME_CLASSPATH = "classpath:"; public static final String SCHEME_FILE = "file:"; - public static final String SCHEME_ENV = "env:"; public static final String LOGGING_LEVEL_PREFIX = "logging.level."; public static final String ROUTES_LOADER_RESOURCE_PATH = "META-INF/services/org/apache/camel/k/loader/"; public static final String CONTEXT_CUSTOMIZER_RESOURCE_PATH = "META-INF/services/org/apache/camel/k/customizer/"; diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java index eedb7ea..456f50e 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java @@ -34,7 +34,7 @@ public interface Runtime extends HasCamelContext { default void setProperties(Properties properties) { PropertiesComponent pc = new PropertiesComponent(); - pc.setInitialProperties(properties); + pc.setOverrideProperties(properties); getRegistry().bind("properties", pc); } diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Source.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Source.java index ccedd65..5b903f3 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Source.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Source.java @@ -64,8 +64,7 @@ public class Source { final String location = StringUtils.substringBefore(uri, "?"); if (!location.startsWith(Constants.SCHEME_CLASSPATH) && - !location.startsWith(Constants.SCHEME_FILE) && - !location.startsWith(Constants.SCHEME_ENV)) { + !location.startsWith(Constants.SCHEME_FILE)) { throw new IllegalArgumentException("No valid resource format, expected scheme:path, found " + uri); } diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/customizer/StreamCachingContextCustomizer.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/customizer/StreamCachingContextCustomizer.java deleted file mode 100644 index e674eb2..0000000 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/customizer/StreamCachingContextCustomizer.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.k.customizer; - -import org.apache.camel.CamelContext; -import org.apache.camel.k.ContextCustomizer; -import org.apache.camel.spi.StreamCachingStrategy; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class StreamCachingContextCustomizer implements ContextCustomizer { - private static final Logger LOGGER = LoggerFactory.getLogger(StreamCachingContextCustomizer.class); - - private boolean enabled; - private boolean anySpoolRules; - private int bufferSize; - private boolean removeSpoolDirectoryWhenStopping; - private String spoolChiper; - private String spoolDirectory; - private long spoolThreshold; - private String spoolUsedHeapMemoryLimit; - private int spoolUsedHeapMemoryThreshold; - - public int getBufferSize() { - return bufferSize; - } - - public void setBufferSize(int bufferSize) { - this.bufferSize = bufferSize; - } - - public String getSpoolChiper() { - return spoolChiper; - } - - public void setSpoolChiper(String spoolChiper) { - this.spoolChiper = spoolChiper; - } - - public String getSpoolDirectory() { - return spoolDirectory; - } - - public void setSpoolDirectory(String spoolDirectory) { - this.spoolDirectory = spoolDirectory; - } - - public long getSpoolThreshold() { - return spoolThreshold; - } - - public void setSpoolThreshold(long spoolThreshold) { - this.spoolThreshold = spoolThreshold; - } - - public String getSpoolUsedHeapMemoryLimit() { - return spoolUsedHeapMemoryLimit; - } - - public void setSpoolUsedHeapMemoryLimit(String spoolUsedHeapMemoryLimit) { - this.spoolUsedHeapMemoryLimit = spoolUsedHeapMemoryLimit; - } - - public int getSpoolUsedHeapMemoryThreshold() { - return spoolUsedHeapMemoryThreshold; - } - - public void setSpoolUsedHeapMemoryThreshold(int spoolUsedHeapMemoryThreshold) { - this.spoolUsedHeapMemoryThreshold = spoolUsedHeapMemoryThreshold; - } - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public boolean isAnySpoolRules() { - return anySpoolRules; - } - - public void setAnySpoolRules(boolean anySpoolRules) { - this.anySpoolRules = anySpoolRules; - } - - public boolean isRemoveSpoolDirectoryWhenStopping() { - return removeSpoolDirectoryWhenStopping; - } - - public void setRemoveSpoolDirectoryWhenStopping(boolean removeSpoolDirectoryWhenStopping) { - this.removeSpoolDirectoryWhenStopping = removeSpoolDirectoryWhenStopping; - } - - @Override - public void apply(CamelContext camelContext) { - camelContext.setStreamCaching(isEnabled()); - camelContext.getStreamCachingStrategy().setAnySpoolRules(isAnySpoolRules()); - camelContext.getStreamCachingStrategy().setBufferSize(getBufferSize()); - camelContext.getStreamCachingStrategy().setRemoveSpoolDirectoryWhenStopping(isRemoveSpoolDirectoryWhenStopping()); - camelContext.getStreamCachingStrategy().setSpoolChiper(getSpoolChiper()); - if (getSpoolDirectory() != null) { - camelContext.getStreamCachingStrategy().setSpoolDirectory(getSpoolDirectory()); - } - if (getSpoolThreshold() != 0) { - camelContext.getStreamCachingStrategy().setSpoolThreshold(getSpoolThreshold()); - } - if (getSpoolUsedHeapMemoryLimit() != null) { - StreamCachingStrategy.SpoolUsedHeapMemoryLimit limit; - if ("Committed".equalsIgnoreCase(getSpoolUsedHeapMemoryLimit())) { - limit = StreamCachingStrategy.SpoolUsedHeapMemoryLimit.Committed; - } else if ("Max".equalsIgnoreCase(getSpoolUsedHeapMemoryLimit())) { - limit = StreamCachingStrategy.SpoolUsedHeapMemoryLimit.Max; - } else { - throw new IllegalArgumentException("Invalid option " + getSpoolUsedHeapMemoryLimit() + " must either be Committed or Max"); - } - camelContext.getStreamCachingStrategy().setSpoolUsedHeapMemoryLimit(limit); - } - if (getSpoolUsedHeapMemoryThreshold() != 0) { - camelContext.getStreamCachingStrategy().setSpoolUsedHeapMemoryThreshold(getSpoolUsedHeapMemoryThreshold()); - } - LOGGER.info("Configured camel context through CamelContextCustomizer.class"); - } -} diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextConfigurer.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextConfigurer.java index 867d673..c742592 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextConfigurer.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextConfigurer.java @@ -17,7 +17,6 @@ package org.apache.camel.k.listener; import org.apache.camel.k.Runtime; -import org.apache.camel.k.support.PropertiesSupport; import org.apache.camel.k.support.RuntimeSupport; public class ContextConfigurer extends AbstractPhaseListener { @@ -28,25 +27,11 @@ public class ContextConfigurer extends AbstractPhaseListener { @Override protected void accept(Runtime runtime) { // - // Configure the camel context using properties in the form: - // - // camel.context.${name} = ${value} - // - PropertiesSupport.bindProperties(runtime.getCamelContext(), runtime.getCamelContext(), "camel.context."); - - // - // Configure the camel rest definition using properties in the form: - // - // camel.rest.${name} = ${value} - // - RuntimeSupport.configureRest(runtime.getCamelContext()); - - // // Programmatically configure the camel context. // // This is useful to configure services such as the ClusterService, // RouteController, etc // - RuntimeSupport.configureContext(runtime.getCamelContext()); + RuntimeSupport.configureContextCustomizers(runtime.getCamelContext()); } } diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextLifecycleConfigurer.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextLifecycleConfigurer.java deleted file mode 100644 index 789d467..0000000 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextLifecycleConfigurer.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.k.listener; - -import org.apache.camel.Component; -import org.apache.camel.k.Runtime; -import org.apache.camel.k.support.PropertiesSupport; -import org.apache.camel.support.LifecycleStrategySupport; - -public class ContextLifecycleConfigurer extends AbstractPhaseListener { - public ContextLifecycleConfigurer() { - super(Runtime.Phase.ConfigureContext); - } - - @Override - protected void accept(Runtime runtime) { - // - // Configure components upon creation - // - runtime.getCamelContext().addLifecycleStrategy(new LifecycleStrategySupport() { - @SuppressWarnings("unchecked") - @Override - public void onComponentAdd(String name, Component component) { - // The prefix that identifies component properties is the - // same one used by camel-spring-boot to configure components - // using starters: - // - // camel.component.${scheme}.${name} = ${value} - // - PropertiesSupport.bindProperties(runtime.getCamelContext(), component, "camel.component." + name + "."); - } - }); - } -} diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java index 1b3c363..f6f18fd 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java @@ -28,13 +28,11 @@ import java.nio.file.attribute.BasicFileAttributes; import java.util.Objects; import java.util.Properties; import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.BiConsumer; -import java.util.function.Predicate; import org.apache.camel.CamelContext; import org.apache.camel.component.properties.PropertiesComponent; import org.apache.camel.k.Constants; -import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.support.PropertyBindingSupport; import org.apache.camel.util.ObjectHelper; import org.apache.commons.io.FilenameUtils; @@ -42,31 +40,18 @@ public final class PropertiesSupport { private PropertiesSupport() { } - public static void forEachProperty(CamelContext context, Predicate<String> nameFilter, BiConsumer<String, Object> consumer) { - final PropertiesComponent component = context.getComponent("properties", PropertiesComponent.class); - final Properties properties = component.getInitialProperties(); - - if (properties != null) { - for (String name: properties.stringPropertyNames()) { - if (nameFilter.test(name)) { - consumer.accept(name, properties.get(name)); - } - } - } - } - public static int bindProperties(CamelContext context, Object target, String prefix) { final PropertiesComponent component = context.getComponent("properties", PropertiesComponent.class); - final Properties properties = component.getInitialProperties(); + final Properties properties = component.loadProperties(); if (properties == null) { return 0; } - return bindProperties(properties, target, prefix); + return bindProperties(context, properties, target, prefix); } - public static int bindProperties(Properties properties, Object target, String prefix) { + public static int bindProperties(CamelContext context, Properties properties, Object target, String prefix) { final AtomicInteger count = new AtomicInteger(); properties.entrySet().stream() @@ -78,7 +63,7 @@ public final class PropertiesSupport { final Object val = entry.getValue(); try { - if (IntrospectionSupport.setProperty(target, key, val)) { + if (PropertyBindingSupport.bindProperty(context, target, key, val)) { count.incrementAndGet(); } } catch (Exception ex) { @@ -102,18 +87,10 @@ public final class PropertiesSupport { // Main location if (ObjectHelper.isNotEmpty(conf)) { - if (conf.startsWith(Constants.SCHEME_ENV)) { - try (Reader reader = URIResolver.resolveEnv(conf)) { - properties.load(reader); - } catch (IOException e) { - throw new RuntimeException(e); - } - } else { - try (Reader reader = Files.newBufferedReader(Paths.get(conf))) { - properties.load(reader); - } catch (IOException e) { - throw new RuntimeException(e); - } + try (Reader reader = Files.newBufferedReader(Paths.get(conf))) { + properties.load(reader); + } catch (IOException e) { + throw new RuntimeException(e); } } diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RuntimeSupport.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RuntimeSupport.java index c6f4ec6..d745ec9 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RuntimeSupport.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RuntimeSupport.java @@ -17,7 +17,6 @@ package org.apache.camel.k.support; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; @@ -28,6 +27,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.camel.CamelContext; +import org.apache.camel.ExtendedCamelContext; import org.apache.camel.NoFactoryAvailableException; import org.apache.camel.component.properties.PropertiesComponent; import org.apache.camel.k.Constants; @@ -35,7 +35,6 @@ import org.apache.camel.k.ContextCustomizer; import org.apache.camel.k.RoutesLoader; import org.apache.camel.k.Source; import org.apache.camel.spi.FactoryFinder; -import org.apache.camel.spi.RestConfiguration; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +46,13 @@ public final class RuntimeSupport { private RuntimeSupport() { } - public static List<ContextCustomizer> configureContext(CamelContext context) { + // ********************************* + // + // Helpers - Customizers + // + // ********************************* + + public static List<ContextCustomizer> configureContextCustomizers(CamelContext context) { List<ContextCustomizer> appliedCustomizers = new ArrayList<>(); Map<String, ContextCustomizer> customizers = lookupCustomizers(context); @@ -65,43 +70,11 @@ public final class RuntimeSupport { return appliedCustomizers; } - @SuppressWarnings("unchecked") - public static void configureRest(CamelContext context) { - RestConfiguration configuration = new RestConfiguration(); - configuration.setComponentProperties(new HashMap<>()); - configuration.setEndpointProperties(new HashMap<>()); - - PropertiesSupport.forEachProperty( - context, - name -> name.startsWith(Constants.PROPERTY_PREFIX_REST_COMPONENT_PROPERTY), - (k, v) -> configuration.getComponentProperties().put(k.substring(Constants.PROPERTY_PREFIX_REST_COMPONENT_PROPERTY.length()), v) - ); - PropertiesSupport.forEachProperty( - context, - name -> name.startsWith(Constants.PROPERTY_PREFIX_REST_ENDPOINT_PROPERTY), - (k, v) -> configuration.getEndpointProperties().put(k.substring(Constants.PROPERTY_PREFIX_REST_ENDPOINT_PROPERTY.length()), v) - ); - - if (PropertiesSupport.bindProperties(context, configuration, "camel.rest.") > 0) { - // - // Set the rest configuration if only if at least one - // rest parameter has been set. - // - context.setRestConfiguration(configuration); - } - } - - // ********************************* - // - // Helpers - Customizers - // - // ********************************* - public static Map<String, ContextCustomizer> lookupCustomizers(CamelContext context) { Map<String, ContextCustomizer> customizers = new ConcurrentHashMap<>(); PropertiesComponent component = context.getComponent("properties", PropertiesComponent.class); - Properties properties = component.getInitialProperties(); + Properties properties = component.loadProperties(); if (properties != null) { // @@ -142,7 +115,7 @@ public final class RuntimeSupport { ContextCustomizer customizer = context.getRegistry().lookupByNameAndType(customizerId, ContextCustomizer.class); if (customizer == null) { try { - customizer = (ContextCustomizer) context.getFactoryFinder(Constants.CONTEXT_CUSTOMIZER_RESOURCE_PATH).newInstance(customizerId); + customizer = (ContextCustomizer) context.adapt(ExtendedCamelContext.class).getFactoryFinder(Constants.CONTEXT_CUSTOMIZER_RESOURCE_PATH).newInstance(customizerId); } catch (NoFactoryAvailableException e) { throw new RuntimeException(e); } @@ -191,7 +164,7 @@ public final class RuntimeSupport { final RoutesLoader loader; try { - finder = context.getFactoryFinder(Constants.ROUTES_LOADER_RESOURCE_PATH); + finder = context.adapt(ExtendedCamelContext.class).getFactoryFinder(Constants.ROUTES_LOADER_RESOURCE_PATH); loader = (RoutesLoader)finder.newInstance(source.getLanguage()); } catch (NoFactoryAvailableException e) { throw new IllegalArgumentException("Unable to find loader for: " + source, e); diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/URIResolver.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/URIResolver.java index 7f92c6b..89a9d80 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/URIResolver.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/URIResolver.java @@ -16,18 +16,14 @@ */ package org.apache.camel.k.support; -import java.io.ByteArrayInputStream; import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; import java.util.Base64; import java.util.zip.GZIPInputStream; import org.apache.camel.CamelContext; -import org.apache.camel.k.Constants; import org.apache.camel.k.Source; +import org.apache.camel.spi.ClassResolver; import org.apache.camel.support.ResourceHelper; -import org.apache.camel.util.StringHelper; public class URIResolver { @@ -37,30 +33,11 @@ public class URIResolver { throw new IllegalArgumentException("Cannot resolve null URI"); } - final InputStream is; + final ClassResolver cr = ctx.getClassResolver(); + final InputStream is = ResourceHelper.resolveResourceAsInputStream(cr, source.getLocation()); - if (source.getLocation().startsWith(Constants.SCHEME_ENV)) { - final String envvar = StringHelper.after(source.getLocation(), ":"); - final String content = System.getenv(envvar); - - // Using platform encoding on purpose - is = new ByteArrayInputStream(content.getBytes()); - } else { - is = ResourceHelper.resolveResourceAsInputStream(ctx.getClassResolver(), source.getLocation()); - } - - return source.isCompressed() ? new GZIPInputStream(Base64.getDecoder().wrap(is)) : is; + return source.isCompressed() + ? new GZIPInputStream(Base64.getDecoder().wrap(is)) + : is; } - - public static Reader resolveEnv(String uri) { - if (!uri.startsWith(Constants.SCHEME_ENV)) { - throw new IllegalArgumentException("The provided content is not env: " + uri); - } - - final String envvar = StringHelper.after(uri, ":"); - final String content = System.getenv(envvar); - - return new StringReader(content); - } - } diff --git a/camel-k-runtime-core/src/main/resources/META-INF/services/org.apache.camel.k.Runtime$Listener b/camel-k-runtime-core/src/main/resources/META-INF/services/org.apache.camel.k.Runtime$Listener index 75acf2b..c544dab 100644 --- a/camel-k-runtime-core/src/main/resources/META-INF/services/org.apache.camel.k.Runtime$Listener +++ b/camel-k-runtime-core/src/main/resources/META-INF/services/org.apache.camel.k.Runtime$Listener @@ -16,6 +16,5 @@ # org.apache.camel.k.listener.ContextConfigurer -org.apache.camel.k.listener.ContextLifecycleConfigurer org.apache.camel.k.listener.RoutesConfigurer org.apache.camel.k.listener.RoutesDumper diff --git a/camel-k-runtime-core/src/main/resources/META-INF/services/org/apache/camel/k/customizer/streamcaching b/camel-k-runtime-core/src/main/resources/META-INF/services/org/apache/camel/k/customizer/streamcaching deleted file mode 100644 index 816e498..0000000 --- a/camel-k-runtime-core/src/main/resources/META-INF/services/org/apache/camel/k/customizer/streamcaching +++ /dev/null @@ -1,18 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -class=org.apache.camel.k.customizer.StreamCachingContextCustomizer diff --git a/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/NameCustomizer.java b/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/NameCustomizer.java index ef9bede..2c37555 100644 --- a/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/NameCustomizer.java +++ b/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/NameCustomizer.java @@ -18,7 +18,7 @@ package org.apache.camel.k.support; import org.apache.camel.CamelContext; import org.apache.camel.Ordered; -import org.apache.camel.impl.ExplicitCamelContextNameStrategy; +import org.apache.camel.impl.engine.ExplicitCamelContextNameStrategy; import org.apache.camel.k.ContextCustomizer; import org.apache.camel.model.ModelCamelContext; diff --git a/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/RuntimeSupportTest.java b/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/RuntimeSupportTest.java index e4fde91..82ccf93 100644 --- a/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/RuntimeSupportTest.java +++ b/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/RuntimeSupportTest.java @@ -16,6 +16,8 @@ */ package org.apache.camel.k.support; +import static org.assertj.core.api.Assertions.assertThat; + import java.util.List; import java.util.Properties; @@ -23,14 +25,11 @@ import org.apache.camel.CamelContext; import org.apache.camel.Ordered; import org.apache.camel.component.properties.PropertiesComponent; import org.apache.camel.impl.DefaultCamelContext; -import org.apache.camel.impl.ExplicitCamelContextNameStrategy; +import org.apache.camel.impl.engine.ExplicitCamelContextNameStrategy; import org.apache.camel.k.Constants; import org.apache.camel.k.ContextCustomizer; -import org.apache.camel.spi.RestConfiguration; import org.junit.jupiter.api.Test; -import static org.assertj.core.api.Assertions.assertThat; - public class RuntimeSupportTest { @Test @@ -42,7 +41,7 @@ public class RuntimeSupportTest { NameCustomizer customizer = new NameCustomizer("from-registry"); context.getRegistry().bind("name", customizer); - List<ContextCustomizer> customizers = RuntimeSupport.configureContext(context); + List<ContextCustomizer> customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(context.getName()).isNotEqualTo("from-registry"); assertThat(context.getName()).isNotEqualTo("default"); assertThat(customizers).hasSize(0); @@ -51,7 +50,7 @@ public class RuntimeSupportTest { properties.setProperty("customizer.name.enabled", "true"); pc.setInitialProperties(properties); - customizers = RuntimeSupport.configureContext(context); + customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(context.getName()).isEqualTo("from-registry"); assertThat(customizers).hasSize(1); } @@ -65,7 +64,7 @@ public class RuntimeSupportTest { NameCustomizer customizer = new NameCustomizer("from-registry"); context.getRegistry().bind("name", customizer); - List<ContextCustomizer> customizers = RuntimeSupport.configureContext(context); + List<ContextCustomizer> customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(context.getName()).isNotEqualTo("from-registry"); assertThat(context.getName()).isNotEqualTo("default"); assertThat(customizers).hasSize(0); @@ -74,7 +73,7 @@ public class RuntimeSupportTest { properties.setProperty(Constants.PROPERTY_CAMEL_K_CUSTOMIZER, "name"); pc.setInitialProperties(properties); - customizers = RuntimeSupport.configureContext(context); + customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(context.getName()).isEqualTo("from-registry"); assertThat(customizers).hasSize(1); } @@ -86,7 +85,7 @@ public class RuntimeSupportTest { context.addComponent("properties", pc); context.getRegistry().bind("converters", (ContextCustomizer) (camelContext) -> camelContext.setLoadTypeConverters(false)); - List<ContextCustomizer> customizers = RuntimeSupport.configureContext(context); + List<ContextCustomizer> customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(context.getName()).isNotEqualTo("from-registry"); assertThat(context.getName()).isNotEqualTo("default"); assertThat(context.isLoadTypeConverters()).isTrue(); @@ -96,14 +95,14 @@ public class RuntimeSupportTest { properties.setProperty("customizer.name.enabled", "true"); pc.setInitialProperties(properties); - customizers = RuntimeSupport.configureContext(context); + customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(context.getName()).isEqualTo("default"); assertThat(customizers).hasSize(1); properties.setProperty("customizer.converters.enabled", "true"); pc.setInitialProperties(properties); - customizers = RuntimeSupport.configureContext(context); + customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(context.getName()).isEqualTo("default"); assertThat(context.isLoadTypeConverters()).isFalse(); assertThat(customizers).hasSize(2); @@ -150,32 +149,8 @@ public class RuntimeSupportTest { properties.setProperty("customizer.c3.enabled", "true"); pc.setInitialProperties(properties); - List<ContextCustomizer> customizers = RuntimeSupport.configureContext(context); + List<ContextCustomizer> customizers = RuntimeSupport.configureContextCustomizers(context); assertThat(customizers).hasSize(3); assertThat(context.getName()).isEqualTo("camel-c2-c3-c1"); } - - @Test - public void testCustomizeRestConfiguration() { - Properties properties = new Properties(); - properties.setProperty("camel.rest.component", "servlet"); - properties.setProperty("camel.rest.contextPath", "/mypath"); - properties.setProperty(Constants.PROPERTY_PREFIX_REST_COMPONENT_PROPERTY + "servletName", "MyCamelServlet"); - properties.setProperty(Constants.PROPERTY_PREFIX_REST_ENDPOINT_PROPERTY + "headerFilterStrategy", "myHeaderStrategy"); - - PropertiesComponent pc = new PropertiesComponent(); - pc.setInitialProperties(properties); - - CamelContext context = new DefaultCamelContext(); - context.addComponent("properties", pc); - - - RuntimeSupport.configureRest(context); - - RestConfiguration configuration = context.getRestConfiguration(); - assertThat(configuration).hasFieldOrPropertyWithValue("component", "servlet"); - assertThat(configuration).hasFieldOrPropertyWithValue("contextPath", "/mypath"); - assertThat(configuration.getComponentProperties()).containsEntry("servletName", "MyCamelServlet"); - assertThat(configuration.getEndpointProperties()).containsEntry("headerFilterStrategy", "myHeaderStrategy"); - } } diff --git a/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/StreamCachingContextCustomizerTest.java b/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/StreamCachingContextCustomizerTest.java deleted file mode 100644 index b36f6dc..0000000 --- a/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/StreamCachingContextCustomizerTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.k.support; - -import org.apache.camel.CamelContext; -import org.apache.camel.impl.DefaultCamelContext; -import org.apache.camel.k.customizer.StreamCachingContextCustomizer; -import org.apache.camel.spi.StreamCachingStrategy; -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -public class StreamCachingContextCustomizerTest { - - @Test - public void testClasspathHandler() { - StreamCachingContextCustomizer scccc = new StreamCachingContextCustomizer(); - - scccc.setAnySpoolRules(true); - scccc.setBufferSize(9); - scccc.setEnabled(true); - scccc.setRemoveSpoolDirectoryWhenStopping(true); - scccc.setSpoolChiper("sha"); - scccc.setSpoolDirectory("./xxx"); - scccc.setSpoolThreshold(9); - scccc.setSpoolUsedHeapMemoryLimit("Committed"); - scccc.setSpoolUsedHeapMemoryThreshold(9); - - CamelContext context = new DefaultCamelContext(); - scccc.apply(context); - - assertThat(context.getStreamCachingStrategy().isAnySpoolRules()).isTrue(); - assertThat(context.getStreamCachingStrategy().getBufferSize()).isEqualTo(9); - assertThat(context.isStreamCaching()).isTrue(); - assertThat(context.getStreamCachingStrategy().isRemoveSpoolDirectoryWhenStopping()).isTrue(); - assertThat(context.getStreamCachingStrategy().getSpoolChiper()).isEqualTo("sha"); - assertThat(context.getStreamCachingStrategy().getSpoolDirectory()).isNull(); - assertThat(context.getStreamCachingStrategy().getSpoolThreshold()).isEqualTo(9L); - assertThat(context.getStreamCachingStrategy().getSpoolUsedHeapMemoryLimit()).isEqualTo(StreamCachingStrategy.SpoolUsedHeapMemoryLimit.Committed); - assertThat(context.getStreamCachingStrategy().getSpoolUsedHeapMemoryThreshold()).isEqualTo(9); - - scccc.setSpoolUsedHeapMemoryLimit("Max"); - - scccc.apply(context); - assertThat(context.getStreamCachingStrategy().getSpoolUsedHeapMemoryLimit()).isEqualTo(StreamCachingStrategy.SpoolUsedHeapMemoryLimit.Max); - } - - @Test - public void testUnsupportedStreamCachingSpoolUsedHeapMemoryLimit() { - StreamCachingContextCustomizer scccc = new StreamCachingContextCustomizer(); - - scccc.setSpoolUsedHeapMemoryLimit("Unsupported"); - - CamelContext context = new DefaultCamelContext(); - - IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> scccc.apply(context)); - - assertThat(exception.getMessage()).isEqualTo("Invalid option Unsupported must either be Committed or Max"); - } -} diff --git a/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/ApplicationRuntime.java b/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/ApplicationRuntime.java index d94d671..a916801 100644 --- a/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/ApplicationRuntime.java +++ b/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/ApplicationRuntime.java @@ -18,10 +18,10 @@ package org.apache.camel.k.jvm; import java.util.Comparator; import java.util.LinkedHashSet; +import java.util.Properties; import java.util.Set; import org.apache.camel.CamelContext; -import org.apache.camel.ProducerTemplate; import org.apache.camel.RuntimeCamelException; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.k.Runtime; @@ -48,12 +48,8 @@ public final class ApplicationRuntime implements Runtime { this.main = new Main() { @Override - protected ProducerTemplate findOrCreateCamelTemplate() { - return context.createProducerTemplate(); - } - @Override protected CamelContext createCamelContext() { - return context; + return ApplicationRuntime.this.context; } }; @@ -62,7 +58,7 @@ public final class ApplicationRuntime implements Runtime { @Override public CamelContext getCamelContext() { - return context; + return this.context; } public void run() throws Exception { @@ -73,6 +69,11 @@ public final class ApplicationRuntime implements Runtime { this.main.stop(); } + @Override + public void setProperties(Properties properties) { + this.main.setOverrideProperties(properties); + } + public void addListeners(Iterable<Runtime.Listener> listeners) { listeners.forEach(this::addListener); } @@ -145,3 +146,4 @@ public final class ApplicationRuntime implements Runtime { } } } + diff --git a/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/PropertiesTest.java b/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/PropertiesTest.java index 8cb416c..8eed460 100644 --- a/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/PropertiesTest.java +++ b/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/PropertiesTest.java @@ -16,6 +16,8 @@ */ package org.apache.camel.k.jvm; +import static org.assertj.core.api.Assertions.assertThat; + import java.util.Properties; import java.util.concurrent.ThreadLocalRandom; @@ -24,12 +26,9 @@ import org.apache.camel.component.seda.SedaComponent; import org.apache.camel.k.ContextCustomizer; import org.apache.camel.k.Runtime; import org.apache.camel.k.listener.ContextConfigurer; -import org.apache.camel.k.listener.ContextLifecycleConfigurer; import org.apache.camel.k.support.PropertiesSupport; import org.junit.jupiter.api.Test; -import static org.assertj.core.api.Assertions.assertThat; - public class PropertiesTest { @Test @@ -39,7 +38,6 @@ public class PropertiesTest { ApplicationRuntime runtime = new ApplicationRuntime(); runtime.setProperties(properties); runtime.addListener(new ContextConfigurer()); - runtime.addListener(new ContextLifecycleConfigurer()); runtime.addListener(Runtime.Phase.Started, r -> { CamelContext context = r.getCamelContext(); assertThat(context.resolvePropertyPlaceholders("{{root.key}}")).isEqualTo("root.value"); @@ -60,7 +58,6 @@ public class PropertiesTest { ApplicationRuntime runtime = new ApplicationRuntime(); runtime.setProperties(System.getProperties()); runtime.addListener(new ContextConfigurer()); - runtime.addListener(new ContextLifecycleConfigurer()); runtime.addListener(Runtime.Phase.Started, r -> { CamelContext context = r.getCamelContext(); String value = context.resolvePropertyPlaceholders("{{my.property}}"); @@ -80,63 +77,58 @@ public class PropertiesTest { int queueSize1 = ThreadLocalRandom.current().nextInt(10, 100); int queueSize2 = ThreadLocalRandom.current().nextInt(10, 100); - System.setProperty("camel.component.seda.queueSize", Integer.toString(queueSize1)); - System.setProperty("camel.component.my-seda.queueSize", Integer.toString(queueSize2)); + Properties properties = new Properties(); + properties.setProperty("camel.component.seda.queueSize", Integer.toString(queueSize1)); + properties.setProperty("camel.component.my-seda.queueSize", Integer.toString(queueSize2)); - try { - ApplicationRuntime runtime = new ApplicationRuntime(); - runtime.setProperties(System.getProperties()); - runtime.getRegistry().bind("my-seda", new SedaComponent()); - runtime.addListener(new ContextConfigurer()); - runtime.addListener(new ContextLifecycleConfigurer()); - runtime.addListener(Runtime.Phase.Started, r -> { - CamelContext context = r.getCamelContext(); - assertThat(context.getComponent("seda", true)).hasFieldOrPropertyWithValue("queueSize", queueSize1); - assertThat(context.getComponent("my-seda", true)).hasFieldOrPropertyWithValue("queueSize", queueSize2); - runtime.stop(); - }); + ApplicationRuntime runtime = new ApplicationRuntime(); + runtime.setProperties(properties); + runtime.getRegistry().bind("my-seda", new SedaComponent()); + runtime.addListener(new ContextConfigurer()); + runtime.addListener(Runtime.Phase.Started, r -> { + CamelContext context = r.getCamelContext(); + assertThat(context.getComponent("seda", true)).hasFieldOrPropertyWithValue("queueSize", queueSize1); + assertThat(context.getComponent("my-seda", true)).hasFieldOrPropertyWithValue("queueSize", queueSize2); + runtime.stop(); + }); - runtime.run(); - } finally { - System.getProperties().remove("camel.component.seda.queueSize"); - System.getProperties().remove("camel.component.my-seda.queueSize"); - } + runtime.run(); } @Test public void testContextConfiguration() throws Exception { - System.setProperty("camel.context.messageHistory", "false"); - System.setProperty("camel.context.loadTypeConverters", "false"); + Properties properties = new Properties(); + properties.setProperty("camel.context.message-history", "false"); + properties.setProperty("camel.context.load-type-converters", "false"); + properties.setProperty("camel.context.stream-caching-strategy.spool-threshold", "100"); + properties.setProperty("camel.context.rest-configuration.component", "servlet"); + properties.setProperty("camel.context.rest-configuration.context-path", "/my/path"); - try { - ApplicationRuntime runtime = new ApplicationRuntime(); - runtime.setProperties(System.getProperties()); - runtime.addListener(new ContextConfigurer()); - runtime.addListener(new ContextLifecycleConfigurer()); - runtime.addListener(Runtime.Phase.Started, r -> { - CamelContext context = r.getCamelContext(); - assertThat(context.isMessageHistory()).isFalse(); - assertThat(context.isLoadTypeConverters()).isFalse(); - runtime.stop(); - }); + ApplicationRuntime runtime = new ApplicationRuntime(); + runtime.setProperties(properties); + runtime.addListener(new ContextConfigurer()); + runtime.addListener(Runtime.Phase.Started, r -> { + CamelContext context = r.getCamelContext(); + assertThat(context.isMessageHistory()).isFalse(); + assertThat(context.isLoadTypeConverters()).isFalse(); + assertThat(context.getStreamCachingStrategy().getSpoolThreshold()).isEqualTo(100); + assertThat(context.getRestConfiguration().getComponent()).isEqualTo("servlet"); + assertThat(context.getRestConfiguration().getContextPath()).isEqualTo("/my/path"); + runtime.stop(); + }); - runtime.run(); - } finally { - System.getProperties().remove("camel.context.messageHistory"); - System.getProperties().remove("camel.context.loadTypeConverters"); - } + runtime.run(); } @Test public void testContextCustomizerFromProperty() throws Exception { Properties properties = new Properties(); properties.setProperty("customizer.test.enabled", "true"); - properties.setProperty("customizer.test.messageHistory", "false"); + properties.setProperty("customizer.test.message-history", "false"); ApplicationRuntime runtime = new ApplicationRuntime(); runtime.setProperties(properties); runtime.addListener(new ContextConfigurer()); - runtime.addListener(new ContextLifecycleConfigurer()); runtime.addListener(Runtime.Phase.Started, r -> { CamelContext context = r.getCamelContext(); assertThat(context.isMessageHistory()).isFalse(); @@ -155,7 +147,6 @@ public class PropertiesTest { ApplicationRuntime runtime = new ApplicationRuntime(); runtime.setProperties(properties); runtime.addListener(new ContextConfigurer()); - runtime.addListener(new ContextLifecycleConfigurer()); runtime.getRegistry().bind("c1", (ContextCustomizer) camelContext -> { camelContext.setMessageHistory(false); camelContext.setLoadTypeConverters(false); diff --git a/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RuntimeTest.java b/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RuntimeTest.java index 09c4a0a..85dc42e 100644 --- a/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RuntimeTest.java +++ b/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RuntimeTest.java @@ -16,20 +16,19 @@ */ package org.apache.camel.k.jvm; +import static org.assertj.core.api.Java6Assertions.assertThat; + import java.util.List; import org.apache.camel.CamelContext; import org.apache.camel.Route; import org.apache.camel.k.Runtime; import org.apache.camel.k.listener.ContextConfigurer; -import org.apache.camel.k.listener.ContextLifecycleConfigurer; import org.apache.camel.k.listener.RoutesConfigurer; import org.apache.camel.model.ModelCamelContext; import org.apache.camel.util.ObjectHelper; import org.junit.jupiter.api.Test; -import static org.assertj.core.api.Java6Assertions.assertThat; - public class RuntimeTest { @Test @@ -38,7 +37,6 @@ public class RuntimeTest { try { runtime.addListener(new ContextConfigurer()); - runtime.addListener(new ContextLifecycleConfigurer()); runtime.addListener(RoutesConfigurer.forRoutes("classpath:r1.js", "classpath:r2.mytype?language=js")); runtime.addListener(Runtime.Phase.Started, r -> { CamelContext context = r.getCamelContext(); @@ -63,7 +61,6 @@ public class RuntimeTest { ApplicationRuntime runtime = new ApplicationRuntime(); try { runtime.addListener(new ContextConfigurer()); - runtime.addListener(new ContextLifecycleConfigurer()); runtime.addListener(RoutesConfigurer.forRoutes("classpath:routes.xml", "classpath:rests.xml")); runtime.addListener(Runtime.Phase.Started, r -> { CamelContext context = r.getCamelContext(); diff --git a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/YamlFlowLoader.java b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/YamlFlowLoader.java index bba8a14..7cbdd47 100644 --- a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/YamlFlowLoader.java +++ b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/YamlFlowLoader.java @@ -27,6 +27,7 @@ import com.fasterxml.jackson.databind.jsontype.NamedType; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; import org.apache.camel.CamelContext; +import org.apache.camel.ExtendedCamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.k.RoutesLoader; import org.apache.camel.k.Source; @@ -69,7 +70,7 @@ public class YamlFlowLoader implements RoutesLoader { for (Flow flow: mapper.readValue(is, Flow[].class)) { final List<Step> steps = flow.getSteps(); final int size = steps.size(); - final FactoryFinder finder = getContext().getFactoryFinder(Step.RESOURCE_PATH); + final FactoryFinder finder = getContext().adapt(ExtendedCamelContext.class).getFactoryFinder(Step.RESOURCE_PATH); ProcessorDefinition<?> definition = null; diff --git a/pom.xml b/pom.xml index 99ec175..d9fa301 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> - <camel.version>3.0.0-M2</camel.version> + <camel.version>3.0.0-M3</camel.version> <catalog.version>${camel.version}</catalog.version> <junit.version>4.12</junit.version> <junit-jupiter.version>5.4.2</junit-jupiter.version>