From c38b9b6bb3da82af6cef22a400567f91fe9b825c Mon Sep 17 00:00:00 2001 From: Luca Burgazzoli Date: Thu, 5 Nov 2020 17:28:35 +0100 Subject: [PATCH] Switch to Quarkus as runtime #359 (fix catalog generation) --- .../src/it/generate-catalog/verify.groovy | 14 ++++-- .../k/tooling/maven/GenerateCatalogMojo.java | 6 +-- .../maven/processors/CatalogProcessor3x.java | 49 +++++-------------- .../processors/CatalogProcessor3Test.java | 2 +- 4 files changed, 26 insertions(+), 45 deletions(-) diff --git a/tooling/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy b/tooling/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy index 8daeaef81..55919b1c4 100644 --- a/tooling/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy +++ b/tooling/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy @@ -25,8 +25,12 @@ new File(basedir, "catalog.yaml").withReader { assert catalog.spec.runtime.metadata['camel-quarkus.version'] == camelQuarkusVersion + assert catalog.spec.runtime.dependencies.any { + it.groupId == 'org.apache.camel.k' && it.artifactId == 'camel-k-runtime' + } + assert catalog.spec.runtime.capabilities['cron'].dependencies[0].groupId == 'org.apache.camel.k' - assert catalog.spec.runtime.capabilities['cron'].dependencies[0].artifactId == 'camel-k-quarkus-cron' + assert catalog.spec.runtime.capabilities['cron'].dependencies[0].artifactId == 'camel-k-cron' assert catalog.spec.runtime.capabilities['health'].dependencies[0].groupId == 'org.apache.camel.quarkus' assert catalog.spec.runtime.capabilities['health'].dependencies[0].artifactId == 'camel-quarkus-microprofile-health' assert catalog.spec.runtime.capabilities['rest'].dependencies.any { it.groupId == 'org.apache.camel.quarkus' && it.artifactId == 'camel-quarkus-rest' } @@ -38,17 +42,17 @@ new File(basedir, "catalog.yaml").withReader { assert catalog.spec.runtime.capabilities['tracing'].dependencies[0].groupId == 'org.apache.camel.quarkus' assert catalog.spec.runtime.capabilities['tracing'].dependencies[0].artifactId == 'camel-quarkus-opentracing' assert catalog.spec.runtime.capabilities['master'].dependencies[0].groupId == 'org.apache.camel.k' - assert catalog.spec.runtime.capabilities['master'].dependencies[0].artifactId == 'camel-k-quarkus-master' + assert catalog.spec.runtime.capabilities['master'].dependencies[0].artifactId == 'camel-k-master' assert catalog.metadata.labels['camel.apache.org/runtime.version'] == runtimeVersion - catalog.spec.artifacts['camel-k-quarkus-knative'].with { + catalog.spec.artifacts['camel-k-knative'].with { assert dependencies == null assert schemes.size() == 1 assert schemes[0].id == 'knative' } - catalog.spec.artifacts['camel-k-quarkus-kamelet'].with { + catalog.spec.artifacts['camel-k-kamelet'].with { assert dependencies == null assert schemes.size() == 1 assert schemes[0].id == 'kamelet' @@ -56,7 +60,7 @@ new File(basedir, "catalog.yaml").withReader { assert schemes[0].http == false } - catalog.spec.artifacts['camel-k-quarkus-wrap'].with { + catalog.spec.artifacts['camel-k-wrap'].with { assert dependencies == null assert schemes.size() == 1 assert schemes[0].id == 'wrap' diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java index 53467142a..8654ebf81 100644 --- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java +++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java @@ -112,11 +112,11 @@ public void execute() throws MojoExecutionException, MojoFailureException { version -> runtimeSpec.putMetadata("camel-quarkus.version", version)); runtimeSpec.applicationClass("io.quarkus.runner.GeneratedMain"); - runtimeSpec.addDependency("org.apache.camel.k", "camel-k-runtime-quarkus"); + runtimeSpec.addDependency("org.apache.camel.k", "camel-k-runtime"); runtimeSpec.putCapability( "cron", CamelCapability.forArtifact( - "org.apache.camel.k", "camel-k-quarkus-cron")); + "org.apache.camel.k", "camel-k-cron")); runtimeSpec.putCapability( "health", CamelCapability.forArtifact( @@ -142,7 +142,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { runtimeSpec.putCapability( "master", CamelCapability.forArtifact( - "org.apache.camel.k", "camel-k-quarkus-master")); + "org.apache.camel.k", "camel-k-master")); CamelCatalogSpec.Builder catalogSpec = new CamelCatalogSpec.Builder() .runtime(runtimeSpec.build()); diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java index 1e5f51dd6..03364e9c5 100644 --- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java +++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java @@ -112,7 +112,7 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec specBuilder.putArtifact( new CamelArtifact.Builder() .groupId("org.apache.camel.k") - .artifactId("camel-k-quarkus-cron") + .artifactId("camel-k-cron") .addScheme(new CamelScheme.Builder() .id("cron") .http(true) @@ -122,7 +122,7 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec specBuilder.putArtifact( new CamelArtifact.Builder() .groupId("org.apache.camel.k") - .artifactId("camel-k-quarkus-kamelet") + .artifactId("camel-k-kamelet") .addScheme(new CamelScheme.Builder() .id("kamelet") .http(false) @@ -133,7 +133,7 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec specBuilder.putArtifact( new CamelArtifact.Builder() .groupId("org.apache.camel.k") - .artifactId("camel-k-quarkus-knative") + .artifactId("camel-k-knative") .addScheme(new CamelScheme.Builder() .id("knative") .http(true) @@ -143,7 +143,7 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec specBuilder.putArtifact( new CamelArtifact.Builder() .groupId("org.apache.camel.k") - .artifactId("camel-k-quarkus-webhook") + .artifactId("camel-k-webhook") .addScheme(new CamelScheme.Builder() .id("wrap") .build()) @@ -152,7 +152,7 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec specBuilder.putArtifact( new CamelArtifact.Builder() .groupId("org.apache.camel.k") - .artifactId("camel-k-quarkus-master") + .artifactId("camel-k-master") .addScheme(new CamelScheme.Builder() .id("master") .build()) @@ -161,7 +161,7 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec specBuilder.putArtifact( new CamelArtifact.Builder() .groupId("org.apache.camel.k") - .artifactId("camel-k-quarkus-webhook") + .artifactId("camel-k-webhook") .addScheme(new CamelScheme.Builder() .id("webhook") .http(true) @@ -172,76 +172,53 @@ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec specBuilder.putArtifact( new CamelArtifact.Builder() .groupId("org.apache.camel.k") - .artifactId("camel-k-quarkus-wrap") + .artifactId("camel-k-wrap") .addScheme(new CamelScheme.Builder() .id("wrap") .build()) .build() ); - - specBuilder.putArtifact( - new CamelArtifact.Builder() - .groupId("org.apache.camel.k") - .artifactId("camel-k-runtime-knative") - .addDependencies( - MavenArtifact.from("org.apache.camel.k", "camel-k-quarkus-knative")) - .build() - ); - - specBuilder.putArtifact( - new CamelArtifact.Builder() - .groupId("org.apache.camel.k") - .artifactId("camel-k-runtime-quarkus") - .build() - ); - - specBuilder.putArtifact( - new CamelArtifact.Builder() - .groupId("org.apache.camel.k") - .artifactId("camel-k-quarkus-core") - .build() - ); } private static void processLoaders(CamelCatalogSpec.Builder specBuilder) { specBuilder.putLoader( "yaml", - CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-yaml") + CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-yaml") .addLanguage("yaml") .putMetadata("native", "true") .build() ); specBuilder.putLoader( "groovy", - CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-groovy") + CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-groovy") .addLanguage("groovy") .putMetadata("native", "false") .build() ); specBuilder.putLoader( "kts", - CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-kotlin") + CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-kotlin") .addLanguage("kts") .putMetadata("native", "false") .build() ); specBuilder.putLoader( "js", - CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-js") + CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-js") .addLanguage("js") .putMetadata("native", "true") .build() ); specBuilder.putLoader( "xml", - CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-xml") + CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-xml") .addLanguage("xml") .putMetadata("native", "true") .build() ); specBuilder.putLoader( "java", - CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-java") + CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-java") .addLanguage("java") .putMetadata("native", "false") .build() diff --git a/tooling/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3Test.java b/tooling/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3Test.java index e3e83f4b7..6f539eb71 100644 --- a/tooling/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3Test.java +++ b/tooling/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3Test.java @@ -79,7 +79,7 @@ public void testArtifactsEnrichment() { CamelCatalogSpec spec = builder.build(); Map artifactMap = spec.getArtifacts(); - assertThat(artifactMap).containsKey("camel-k-quarkus-knative"); + assertThat(artifactMap).containsKey("camel-k-knative"); assertThat(artifactMap.get("camel-http")).satisfies(a -> { assertThat(a.getDependencies()).anyMatch( d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-file")