From 58d17c67a33eb459145dc0bf9e0f83253ff828c7 Mon Sep 17 00:00:00 2001 From: lburgazzoli Date: Wed, 22 May 2019 16:13:41 +0200 Subject: [PATCH] servlet: update catalog and bom --- .../processors/CatalogProcessor_2_x.java | 15 ++++++ .../processors/CatalogProcessor_3_x.java | 15 ++++++ .../processors/CataloProcessor2Test.java | 47 +++++++++++++++++++ .../processors/CataloProcessor3Test.java | 47 +++++++++++++++++++ camel-k-runtime-bom/pom.xml | 5 ++ 5 files changed, 129 insertions(+) diff --git a/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor_2_x.java b/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor_2_x.java index ee684ac97..82102954f 100644 --- a/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor_2_x.java +++ b/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor_2_x.java @@ -173,6 +173,21 @@ public void process(MavenProject project, CamelCatalog catalog, Map artifactMap = new HashMap<>(); + + assertThat(processor.accepts(catalog)).isTrue(); + processor.process(new MavenProject(), catalog, artifactMap); + + + 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") + ); + assertThat(a.getDependencies()).anyMatch( + d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-k-adapter-camel-2") + ); + }); + assertThat(artifactMap.get("camel-k-runtime-groovy")).satisfies(a -> { + assertThat(a.getDependencies()).anyMatch( + d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-groovy") + ); + }); + assertThat(artifactMap.get("camel-k-runtime-health")).satisfies(a -> { + assertThat(a.getDependencies()).anyMatch( + d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-netty4-http") + ); + }); + assertThat(artifactMap.get("camel-k-runtime-servlet")).satisfies(a -> { + assertThat(a.getDependencies()).anyMatch( + d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-servlet") + ); + }); + + assertThat(artifactMap.get("camel-knative")).satisfies(a -> { + assertThat(a.getDependencies()).anyMatch( + d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-netty4-http") + ); + }); + } } diff --git a/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CataloProcessor3Test.java b/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CataloProcessor3Test.java index 97d33c5aa..fd4bb9ca9 100644 --- a/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CataloProcessor3Test.java +++ b/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CataloProcessor3Test.java @@ -17,7 +17,13 @@ package org.apache.camel.k.tooling.maven.processors; +import java.util.HashMap; +import java.util.Map; + import org.apache.camel.catalog.CamelCatalog; +import org.apache.camel.k.tooling.maven.model.CamelArtifact; +import org.apache.camel.k.tooling.maven.model.CatalogProcessor; +import org.apache.maven.project.MavenProject; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -68,4 +74,45 @@ public void testAcceptMoreThanHigher(){ assertThat(cp3.accepts(catalog)).isFalse(); } + + @Test + public void testArtifactsEnrichment(){ + CatalogProcessor processor = new CatalogProcessor_3_x(); + CamelCatalog catalog = versionCamelCatalog("3.0.0"); + Map artifactMap = new HashMap<>(); + + assertThat(processor.accepts(catalog)).isTrue(); + processor.process(new MavenProject(), catalog, artifactMap); + + + 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") + ); + assertThat(a.getDependencies()).anyMatch( + d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-k-adapter-camel-3") + ); + }); + assertThat(artifactMap.get("camel-k-runtime-groovy")).satisfies(a -> { + assertThat(a.getDependencies()).anyMatch( + d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-groovy") + ); + }); + assertThat(artifactMap.get("camel-k-runtime-health")).satisfies(a -> { + assertThat(a.getDependencies()).anyMatch( + d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-netty4-http") + ); + }); + assertThat(artifactMap.get("camel-k-runtime-servlet")).satisfies(a -> { + assertThat(a.getDependencies()).anyMatch( + d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-servlet") + ); + }); + + assertThat(artifactMap.get("camel-knative")).satisfies(a -> { + assertThat(a.getDependencies()).anyMatch( + d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-netty4-http") + ); + }); + } } diff --git a/camel-k-runtime-bom/pom.xml b/camel-k-runtime-bom/pom.xml index c123fd674..402ec0324 100644 --- a/camel-k-runtime-bom/pom.xml +++ b/camel-k-runtime-bom/pom.xml @@ -125,6 +125,11 @@ camel-k-runtime-health ${project.version} + + org.apache.camel.k + camel-k-runtime-servlet + ${project.version} + org.apache.camel.k camel-knative