diff --git a/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java b/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java index dd802e5f9..5980901e3 100644 --- a/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java +++ b/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java @@ -17,7 +17,6 @@ package org.apache.camel.k.tooling.maven; import java.io.IOException; -import java.io.InputStream; import java.io.Writer; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -29,6 +28,7 @@ import java.util.ServiceLoader; import java.util.SortedMap; import java.util.TreeMap; +import java.util.regex.Pattern; import java.util.stream.StreamSupport; import com.fasterxml.jackson.annotation.JsonInclude; @@ -54,7 +54,6 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; -import org.apache.maven.shared.utils.io.IOUtil; @Mojo( name = "generate-catalog", @@ -167,6 +166,12 @@ public void execute() throws MojoExecutionException, MojoFailureException { private void processComponents(org.apache.camel.catalog.CamelCatalog catalog, Map artifacts) { for (String name : catalog.findComponentNames()) { String json = catalog.componentJSonSchema(name); + + if ("rest-swagger".equalsIgnoreCase(name)) { + // TODO: workaround for https://issues.apache.org/jira/browse/CAMEL-13588 + json = json.replaceAll(Pattern.quote("\\h"), "h"); + } + CatalogComponentDefinition definition = CatalogSupport.unmarshallComponent(json); artifacts.compute(definition.getArtifactId(), (key, artifact) -> { diff --git a/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java b/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java index 8d21e7f4a..881d0f88b 100644 --- a/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java +++ b/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java @@ -93,7 +93,9 @@ public void process(MavenProject project, CamelCatalog catalog, Map artifact.getScheme(scheme).ifPresent(s -> s.setPassive(true))); } + + // ************************ + // + // + // + // ************************ + + artifacts.computeIfPresent("camel-http4", (key, artifact) -> { + artifact.addDependency("org.apache.camel", "camel-file"); + return artifact; + }); } } diff --git a/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3Test.java b/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3Test.java index 88b3b8cf2..295e8e21f 100644 --- a/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3Test.java +++ b/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3Test.java @@ -78,6 +78,7 @@ public void testArtifactsEnrichment() { CatalogProcessor processor = new CatalogProcessor3x(); CamelCatalog catalog = versionCamelCatalog("3.0.0"); Map artifactMap = new HashMap<>(); + artifactMap.put("camel-http4", new CamelArtifact()); assertThat(processor.accepts(catalog)).isTrue(); processor.process(new MavenProject(), catalog, artifactMap); @@ -85,7 +86,10 @@ public void testArtifactsEnrichment() { assertThat(artifactMap.get("camel-k-runtime-jvm")).satisfies(a -> { assertThat(a.getDependencies()).anyMatch( - d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-core") + d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-core-engine") + ); + assertThat(a.getDependencies()).anyMatch( + d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-properties") ); }); assertThat(artifactMap.get("camel-k-runtime-groovy")).satisfies(a -> { @@ -126,5 +130,11 @@ public void testArtifactsEnrichment() { d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-netty4-http") ); }); + + assertThat(artifactMap.get("camel-http4")).satisfies(a -> { + assertThat(a.getDependencies()).anyMatch( + d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-file") + ); + }); } } diff --git a/camel-k-runtime-core/pom.xml b/camel-k-runtime-core/pom.xml index 56cfd57ad..9d04a587d 100644 --- a/camel-k-runtime-core/pom.xml +++ b/camel-k-runtime-core/pom.xml @@ -43,17 +43,7 @@ org.apache.camel - camel-api - provided - - - org.apache.camel - camel-core - provided - - - org.apache.camel - camel-base + camel-core-engine provided 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 2bd59ca33..81ecf28b0 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 @@ -25,9 +25,10 @@ import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; import java.util.Properties; -import java.util.concurrent.atomic.AtomicInteger; import org.apache.camel.CamelContext; import org.apache.camel.component.properties.PropertiesComponent; @@ -40,38 +41,20 @@ public final class PropertiesSupport { private PropertiesSupport() { } - public static int bindProperties(CamelContext context, Object target, String prefix) { + public static boolean bindProperties(CamelContext context, Object target, String prefix) { final PropertiesComponent component = context.getComponent("properties", PropertiesComponent.class); final Properties properties = component.loadProperties(); if (properties == null) { - return 0; + return false; } - return bindProperties(context, properties, target, prefix); - } - - public static int bindProperties(CamelContext context, Properties properties, Object target, String prefix) { - final AtomicInteger count = new AtomicInteger(); - - properties.entrySet().stream() - .filter(entry -> entry.getKey() instanceof String) - .filter(entry -> entry.getValue() != null) - .filter(entry -> ((String)entry.getKey()).startsWith(prefix)) - .forEach(entry -> { - final String key = ((String)entry.getKey()).substring(prefix.length()); - final Object val = entry.getValue(); - - try { - if (PropertyBindingSupport.bindProperty(context, target, key, val)) { - count.incrementAndGet(); - } - } catch (Exception ex) { - throw new RuntimeException(ex); - } - }); + Map props = new HashMap<>(); + for (String key : properties.stringPropertyNames()) { + props.put(key, properties.get(key)); + } - return count.get(); + return PropertyBindingSupport.bindProperties(context, target, props, prefix); } public static Properties loadProperties() { diff --git a/camel-k-runtime-examples/camel-k-runtime-example-health/pom.xml b/camel-k-runtime-examples/camel-k-runtime-example-health/pom.xml index cbb4273a2..ab15e199e 100644 --- a/camel-k-runtime-examples/camel-k-runtime-example-health/pom.xml +++ b/camel-k-runtime-examples/camel-k-runtime-example-health/pom.xml @@ -37,7 +37,7 @@ org.apache.camel - camel-core + camel-core-engine org.apache.camel diff --git a/camel-k-runtime-examples/camel-k-runtime-example-servlet/pom.xml b/camel-k-runtime-examples/camel-k-runtime-example-servlet/pom.xml index a3cff980c..07a80500e 100644 --- a/camel-k-runtime-examples/camel-k-runtime-example-servlet/pom.xml +++ b/camel-k-runtime-examples/camel-k-runtime-example-servlet/pom.xml @@ -37,7 +37,7 @@ org.apache.camel - camel-core + camel-core-engine org.apache.camel diff --git a/camel-k-runtime-examples/camel-k-runtime-example-yaml/pom.xml b/camel-k-runtime-examples/camel-k-runtime-example-yaml/pom.xml index 34e801be7..398a9788e 100644 --- a/camel-k-runtime-examples/camel-k-runtime-example-yaml/pom.xml +++ b/camel-k-runtime-examples/camel-k-runtime-example-yaml/pom.xml @@ -37,7 +37,7 @@ org.apache.camel - camel-core + camel-core-engine org.apache.camel diff --git a/camel-k-runtime-groovy/pom.xml b/camel-k-runtime-groovy/pom.xml index ae993ede0..7b4182527 100644 --- a/camel-k-runtime-groovy/pom.xml +++ b/camel-k-runtime-groovy/pom.xml @@ -35,17 +35,18 @@ org.apache.camel - camel-api + camel-core-engine provided org.apache.camel - camel-core + camel-main provided - org.apache.camel.k - camel-k-runtime-core + org.apache.camel + camel-log + provided @@ -73,6 +74,26 @@ + + org.apache.camel + camel-timer + test + + + org.apache.camel + camel-seda + test + + + org.apache.camel + camel-rest + test + + + org.apache.camel + camel-direct + test + org.apache.camel camel-properties diff --git a/camel-k-runtime-health/pom.xml b/camel-k-runtime-health/pom.xml index f9af59b59..0888876af 100644 --- a/camel-k-runtime-health/pom.xml +++ b/camel-k-runtime-health/pom.xml @@ -37,7 +37,7 @@ org.apache.camel - camel-core + camel-core-engine provided diff --git a/camel-k-runtime-jvm/pom.xml b/camel-k-runtime-jvm/pom.xml index 48f0b2488..4c5caab70 100644 --- a/camel-k-runtime-jvm/pom.xml +++ b/camel-k-runtime-jvm/pom.xml @@ -42,7 +42,12 @@ org.apache.camel - camel-core + camel-core-engine + provided + + + org.apache.camel + camel-main provided @@ -78,6 +83,31 @@ camel-undertow test + + org.apache.camel + camel-timer + test + + + org.apache.camel + camel-seda + test + + + org.apache.camel + camel-log + test + + + org.apache.camel + camel-rest + test + + + org.apache.camel + camel-direct + test + org.apache.camel camel-properties diff --git a/camel-k-runtime-knative/pom.xml b/camel-k-runtime-knative/pom.xml index bd0b0c2d1..febd9349c 100644 --- a/camel-k-runtime-knative/pom.xml +++ b/camel-k-runtime-knative/pom.xml @@ -44,7 +44,7 @@ org.apache.camel - camel-core + camel-core-engine provided diff --git a/camel-k-runtime-kotlin/pom.xml b/camel-k-runtime-kotlin/pom.xml index 560b093ec..63bd714e4 100644 --- a/camel-k-runtime-kotlin/pom.xml +++ b/camel-k-runtime-kotlin/pom.xml @@ -35,7 +35,17 @@ org.apache.camel - camel-core + camel-core-engine + provided + + + org.apache.camel + camel-main + provided + + + org.apache.camel + camel-log provided @@ -66,6 +76,26 @@ + + org.apache.camel + camel-timer + test + + + org.apache.camel + camel-seda + test + + + org.apache.camel + camel-rest + test + + + org.apache.camel + camel-direct + test + org.apache.camel camel-properties diff --git a/camel-k-runtime-servlet/pom.xml b/camel-k-runtime-servlet/pom.xml index 90b37fb4e..3e9c69fae 100644 --- a/camel-k-runtime-servlet/pom.xml +++ b/camel-k-runtime-servlet/pom.xml @@ -37,7 +37,7 @@ org.apache.camel - camel-core + camel-core-engine provided diff --git a/camel-k-runtime-yaml/pom.xml b/camel-k-runtime-yaml/pom.xml index c4251e6bc..9f05f32d4 100644 --- a/camel-k-runtime-yaml/pom.xml +++ b/camel-k-runtime-yaml/pom.xml @@ -42,7 +42,8 @@ org.apache.camel - camel-core + camel-core-engine + provided @@ -67,11 +68,31 @@ camel-properties test + + org.apache.camel + camel-mock + test + org.apache.camel camel-test test + + org.apache.camel + camel-direct + test + + + org.apache.camel + camel-log + test + + + org.apache.camel + camel-bean + test + org.codehaus.groovy diff --git a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/parser/SetHeaderStepParser.java b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/parser/SetHeaderStepParser.java index 7c2f88e69..cf769b344 100644 --- a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/parser/SetHeaderStepParser.java +++ b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/parser/SetHeaderStepParser.java @@ -16,7 +16,6 @@ */ package org.apache.camel.k.yaml.parser; -import com.fasterxml.jackson.annotation.JsonAlias; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.SetHeaderDefinition; @@ -31,11 +30,6 @@ public ProcessorDefinition toProcessor(Context context) { } public static final class Definition extends SetHeaderDefinition implements HasExpression { - @JsonAlias("name") - @Override - public void setHeaderName(String headerName) { - super.setHeaderName(headerName); - } } } diff --git a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/parser/SetPropertyStepParser.java b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/parser/SetPropertyStepParser.java index 4ea2b8716..484a280f1 100644 --- a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/parser/SetPropertyStepParser.java +++ b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/parser/SetPropertyStepParser.java @@ -16,7 +16,6 @@ */ package org.apache.camel.k.yaml.parser; -import com.fasterxml.jackson.annotation.JsonAlias; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.SetPropertyDefinition; @@ -31,11 +30,6 @@ public ProcessorDefinition toProcessor(Context context) { } public static final class Definition extends SetPropertyDefinition implements HasExpression { - @JsonAlias("name") - @Override - public void setPropertyName(String propertyName) { - super.setPropertyName(propertyName); - } } } diff --git a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/parser/StepParserSupport.java b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/parser/StepParserSupport.java index c6d5f0cd5..3a0bf6728 100644 --- a/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/parser/StepParserSupport.java +++ b/camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/parser/StepParserSupport.java @@ -22,6 +22,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.k.yaml.model.Step; +import org.apache.camel.model.OutputNode; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.support.IntrospectionSupport; import org.apache.camel.support.PropertyBindingSupport; @@ -83,7 +84,7 @@ public static ProcessorDefinition convertSteps(ProcessorStepParser.Context co current.addOutput(child); - if (child.isOutputSupported() && child.getOutputs().isEmpty()) { + if (child instanceof OutputNode && child.getOutputs().isEmpty()) { current = child; } } diff --git a/camel-k-runtime-yaml/src/test/groovy/org/apache/camel/k/yaml/parser/SetHeaderTest.groovy b/camel-k-runtime-yaml/src/test/groovy/org/apache/camel/k/yaml/parser/SetHeaderTest.groovy index 74b94f38d..5d4e597dc 100644 --- a/camel-k-runtime-yaml/src/test/groovy/org/apache/camel/k/yaml/parser/SetHeaderTest.groovy +++ b/camel-k-runtime-yaml/src/test/groovy/org/apache/camel/k/yaml/parser/SetHeaderTest.groovy @@ -31,7 +31,7 @@ class SetHeaderTest extends TestSupport { def processor = new SetHeaderStepParser().toProcessor(stepContext) then: with(processor, SetHeaderDefinition) { - headerName == 'test' + name == 'test' expression.language == 'simple' expression.expression == '${body}' } @@ -48,7 +48,7 @@ class SetHeaderTest extends TestSupport { def processor = new SetHeaderStepParser().toProcessor(stepContext) then: with(processor, SetHeaderDefinition) { - headerName == 'test' + name == 'test' expression.language == 'simple' expression.expression == '${body}' } diff --git a/camel-k-runtime-yaml/src/test/groovy/org/apache/camel/k/yaml/parser/SetPropertyTest.groovy b/camel-k-runtime-yaml/src/test/groovy/org/apache/camel/k/yaml/parser/SetPropertyTest.groovy index 04fa79e51..31a528651 100644 --- a/camel-k-runtime-yaml/src/test/groovy/org/apache/camel/k/yaml/parser/SetPropertyTest.groovy +++ b/camel-k-runtime-yaml/src/test/groovy/org/apache/camel/k/yaml/parser/SetPropertyTest.groovy @@ -30,11 +30,11 @@ class SetPropertyTest extends TestSupport { when: def processor = new SetPropertyStepParser().toProcessor(stepContext) then: - def p = processor as SetPropertyDefinition - - p.propertyName == 'test' - p.expression.language == 'simple' - p.expression.expression == '${body}' + with(processor, SetPropertyDefinition) { + name == 'test' + expression.language == 'simple' + expression.expression == '${body}' + } } def "definition with expression block"() { @@ -48,7 +48,7 @@ class SetPropertyTest extends TestSupport { def processor = new SetPropertyStepParser().toProcessor(stepContext) then: with(processor, SetPropertyDefinition) { - propertyName == 'test' + name == 'test' expression.language == 'simple' expression.expression == '${body}' } diff --git a/camel-knative-http/pom.xml b/camel-knative-http/pom.xml index b341ee410..ebdbd71a9 100644 --- a/camel-knative-http/pom.xml +++ b/camel-knative-http/pom.xml @@ -43,7 +43,7 @@ org.apache.camel - camel-core + camel-core-engine provided diff --git a/camel-knative/pom.xml b/camel-knative/pom.xml index 5f3b0f4b9..a9178a34d 100644 --- a/camel-knative/pom.xml +++ b/camel-knative/pom.xml @@ -48,7 +48,7 @@ org.apache.camel - camel-core + camel-core-engine provided @@ -112,7 +112,26 @@ camel-http4 test - + + org.apache.camel + camel-file + test + + + org.apache.camel + camel-direct + test + + + org.apache.camel + camel-mock + test + + + org.apache.camel + camel-log + test + org.apache.camel camel-properties diff --git a/pom.xml b/pom.xml index 38bc52c72..00984530d 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ UTF-8 1.8 1.8 - 3.0.0-M3 + 3.0.0-M4 ${camel.version} 5.5.0 0.9.12