You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2020/02/03 11:17:56 UTC
[camel-k-runtime] 01/02: remove support for multiple camel versions
#229
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 567c8cba586e6691304c010551f4ecf5a8ea3184
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Wed Jan 29 14:21:14 2020 +0100
remove support for multiple camel versions #229
---
camel-k-loader-groovy/pom.xml | 9 +-
camel-k-loader-java/pom.xml | 6 +-
camel-k-loader-js/pom.xml | 7 +-
camel-k-loader-knative/pom.xml | 5 +-
camel-k-loader-kotlin/pom.xml | 6 +-
camel-k-loader-xml/pom.xml | 5 +-
.../camel-k-loader-yaml-common/pom.xml | 5 +-
camel-k-loader-yaml/camel-k-loader-yaml/pom.xml | 5 +-
camel-k-runtime-core/pom.xml | 1 -
camel-k-runtime-cron/pom.xml | 1 -
camel-k-runtime-health/pom.xml | 1 -
camel-k-runtime-knative/pom.xml | 2 +-
camel-k-runtime-main/pom.xml | 2 -
camel-k-runtime-servlet/pom.xml | 2 -
camel-k-runtime-webhook/pom.xml | 1 -
camel-knative/camel-knative-api/pom.xml | 2 -
camel-knative/camel-knative-http/pom.xml | 2 -
camel-knative/camel-knative/pom.xml | 2 -
examples/camel-k-runtime-example-health/pom.xml | 28 +-
examples/camel-k-runtime-example-knative/pom.xml | 35 +-
.../camel-k-runtime-example-quarkus-yaml/pom.xml | 5 -
examples/camel-k-runtime-example-servlet/pom.xml | 21 -
examples/camel-k-runtime-example-yaml/pom.xml | 31 +-
tooling/camel-k-maven-plugin/pom.xml | 9 +-
.../pom.xml | 13 +-
.../verify.groovy | 10 +-
.../pom.xml | 13 +-
.../generate-catalog-quarkus/verify.groovy} | 21 +-
.../camel/k/tooling/maven/GenerateCatalogMojo.java | 237 ++++-------
.../camel/k/tooling/maven/model/Artifact.java | 53 +--
.../camel/k/tooling/maven/model/CamelArtifact.java | 187 ++-------
.../CamelCatalogSpec.java => CamelLoader.java} | 42 +-
.../camel/k/tooling/maven/model/CamelScheme.java | 60 +--
.../maven/model/CatalogComponentDefinition.java | 29 +-
.../maven/model/CatalogDataFormatDefinition.java | 29 +-
.../{Artifact.java => CatalogDefinition.java} | 23 +-
.../maven/model/CatalogLanguageDefinition.java | 29 +-
.../k/tooling/maven/model/CatalogProcessor.java | 5 +-
...rkusRuntimeProvider.java => MavenArtifact.java} | 32 +-
.../tooling/maven/model/crd/CamelCatalogSpec.java | 27 +-
.../{CamelCatalogSpec.java => RuntimeSpec.java} | 31 +-
.../maven/processors/CatalogProcessor3x.java | 440 +++++++++++----------
.../maven/processors/CatalogProcessor3Test.java | 75 ++--
43 files changed, 557 insertions(+), 992 deletions(-)
diff --git a/camel-k-loader-groovy/pom.xml b/camel-k-loader-groovy/pom.xml
index 118ed2f..c9d6052 100644
--- a/camel-k-loader-groovy/pom.xml
+++ b/camel-k-loader-groovy/pom.xml
@@ -35,17 +35,14 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-log</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-endpointdsl</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
@@ -56,24 +53,22 @@
<artifactId>*</artifactId>
</exclusion>
</exclusions>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>${groovy.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-apt</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-annotations</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<!-- ******************************* -->
diff --git a/camel-k-loader-java/pom.xml b/camel-k-loader-java/pom.xml
index 1538901..f063665 100644
--- a/camel-k-loader-java/pom.xml
+++ b/camel-k-loader-java/pom.xml
@@ -35,12 +35,10 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-endpointdsl</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
@@ -51,12 +49,12 @@
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-apt</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-annotations</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<dependency>
diff --git a/camel-k-loader-js/pom.xml b/camel-k-loader-js/pom.xml
index 27498e3..1f65fd9 100644
--- a/camel-k-loader-js/pom.xml
+++ b/camel-k-loader-js/pom.xml
@@ -35,13 +35,12 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-endpointdsl</artifactId>
- <scope>provided</scope>
</dependency>
+
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
@@ -50,12 +49,12 @@
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-apt</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-annotations</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<!-- ******************************* -->
diff --git a/camel-k-loader-knative/pom.xml b/camel-k-loader-knative/pom.xml
index d01149d..425e0b7 100644
--- a/camel-k-loader-knative/pom.xml
+++ b/camel-k-loader-knative/pom.xml
@@ -35,18 +35,17 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-apt</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-annotations</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<!-- ****************************** -->
diff --git a/camel-k-loader-kotlin/pom.xml b/camel-k-loader-kotlin/pom.xml
index 9295b34..161bb92 100644
--- a/camel-k-loader-kotlin/pom.xml
+++ b/camel-k-loader-kotlin/pom.xml
@@ -35,17 +35,15 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-endpointdsl</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-log</artifactId>
- <scope>provided</scope>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
@@ -76,7 +74,7 @@
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-annotations</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<!-- ******************************* -->
diff --git a/camel-k-loader-xml/pom.xml b/camel-k-loader-xml/pom.xml
index 4a285bc..7000537 100644
--- a/camel-k-loader-xml/pom.xml
+++ b/camel-k-loader-xml/pom.xml
@@ -43,18 +43,17 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-apt</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-annotations</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<!-- ****************************** -->
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/pom.xml b/camel-k-loader-yaml/camel-k-loader-yaml-common/pom.xml
index b1d1112..76f78eb 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml-common/pom.xml
+++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/pom.xml
@@ -43,7 +43,6 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
@@ -58,12 +57,12 @@
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-apt</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-annotations</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
</dependencies>
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 20dd73b..da9f7eb 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/pom.xml
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/pom.xml
@@ -47,7 +47,6 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
@@ -62,12 +61,12 @@
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-apt</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-annotations</artifactId>
- <optional>true</optional>
+ <scope>provided</scope>
</dependency>
<!-- ****************************** -->
diff --git a/camel-k-runtime-core/pom.xml b/camel-k-runtime-core/pom.xml
index 8331607..f4e1333 100644
--- a/camel-k-runtime-core/pom.xml
+++ b/camel-k-runtime-core/pom.xml
@@ -44,7 +44,6 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
diff --git a/camel-k-runtime-cron/pom.xml b/camel-k-runtime-cron/pom.xml
index 5ee94b7..9158098 100644
--- a/camel-k-runtime-cron/pom.xml
+++ b/camel-k-runtime-cron/pom.xml
@@ -38,7 +38,6 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/camel-k-runtime-health/pom.xml b/camel-k-runtime-health/pom.xml
index 8386621..3eb0e2d 100644
--- a/camel-k-runtime-health/pom.xml
+++ b/camel-k-runtime-health/pom.xml
@@ -38,7 +38,6 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
diff --git a/camel-k-runtime-knative/pom.xml b/camel-k-runtime-knative/pom.xml
index 5ea6be0..843bb05 100644
--- a/camel-k-runtime-knative/pom.xml
+++ b/camel-k-runtime-knative/pom.xml
@@ -36,6 +36,7 @@
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-knative-http</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-loader-yaml</artifactId>
@@ -50,7 +51,6 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<!-- ****************************** -->
diff --git a/camel-k-runtime-main/pom.xml b/camel-k-runtime-main/pom.xml
index c37af82..456d2b8 100644
--- a/camel-k-runtime-main/pom.xml
+++ b/camel-k-runtime-main/pom.xml
@@ -43,12 +43,10 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-main</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
diff --git a/camel-k-runtime-servlet/pom.xml b/camel-k-runtime-servlet/pom.xml
index 43c95bb..948297d 100644
--- a/camel-k-runtime-servlet/pom.xml
+++ b/camel-k-runtime-servlet/pom.xml
@@ -38,12 +38,10 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-servlet</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
diff --git a/camel-k-runtime-webhook/pom.xml b/camel-k-runtime-webhook/pom.xml
index 42e151d..86f04e2 100644
--- a/camel-k-runtime-webhook/pom.xml
+++ b/camel-k-runtime-webhook/pom.xml
@@ -38,7 +38,6 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/camel-knative/camel-knative-api/pom.xml b/camel-knative/camel-knative-api/pom.xml
index d36f40a..b8261e3 100644
--- a/camel-knative/camel-knative-api/pom.xml
+++ b/camel-knative/camel-knative-api/pom.xml
@@ -44,12 +44,10 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cloud</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
diff --git a/camel-knative/camel-knative-http/pom.xml b/camel-knative/camel-knative-http/pom.xml
index a200c8d..c3c51f2 100644
--- a/camel-knative/camel-knative-http/pom.xml
+++ b/camel-knative/camel-knative-http/pom.xml
@@ -44,12 +44,10 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cloud</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
diff --git a/camel-knative/camel-knative/pom.xml b/camel-knative/camel-knative/pom.xml
index af22d8d..6db1cb9 100644
--- a/camel-knative/camel-knative/pom.xml
+++ b/camel-knative/camel-knative/pom.xml
@@ -44,12 +44,10 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cloud</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
diff --git a/examples/camel-k-runtime-example-health/pom.xml b/examples/camel-k-runtime-example-health/pom.xml
index 5e40bf5..83c34cb 100644
--- a/examples/camel-k-runtime-example-health/pom.xml
+++ b/examples/camel-k-runtime-example-health/pom.xml
@@ -28,29 +28,6 @@
<artifactId>camel-k-runtime-example-health</artifactId>
<dependencies>
-
- <!-- ****************************** -->
- <!-- -->
- <!-- RUNTIME -->
- <!-- -->
- <!-- ****************************** -->
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-main</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-log</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-servlet</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-runtime-main</artifactId>
@@ -68,9 +45,8 @@
<artifactId>camel-k-runtime-health</artifactId>
</dependency>
<dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy</artifactId>
- <version>${groovy.version}</version>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-log</artifactId>
</dependency>
</dependencies>
diff --git a/examples/camel-k-runtime-example-knative/pom.xml b/examples/camel-k-runtime-example-knative/pom.xml
index 3db3270..5c4e99d 100644
--- a/examples/camel-k-runtime-example-knative/pom.xml
+++ b/examples/camel-k-runtime-example-knative/pom.xml
@@ -28,33 +28,6 @@
<artifactId><![CDATA[camel-k-runtime-example-knative]]></artifactId>
<dependencies>
-
- <!-- ****************************** -->
- <!-- -->
- <!-- RUNTIME -->
- <!-- -->
- <!-- ****************************** -->
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-main</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-log</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-jackson</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-cloud</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-runtime-main</artifactId>
@@ -67,6 +40,14 @@
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-loader-yaml</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-log</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jackson</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git a/examples/camel-k-runtime-example-quarkus-yaml/pom.xml b/examples/camel-k-runtime-example-quarkus-yaml/pom.xml
index 94b4184..75aba80 100644
--- a/examples/camel-k-runtime-example-quarkus-yaml/pom.xml
+++ b/examples/camel-k-runtime-example-quarkus-yaml/pom.xml
@@ -67,11 +67,6 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-timer</artifactId>
</dependency>
-
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-netty</artifactId>
- </dependency>
</dependencies>
<build>
diff --git a/examples/camel-k-runtime-example-servlet/pom.xml b/examples/camel-k-runtime-example-servlet/pom.xml
index 0ae914a..20e1acd 100644
--- a/examples/camel-k-runtime-example-servlet/pom.xml
+++ b/examples/camel-k-runtime-example-servlet/pom.xml
@@ -36,22 +36,6 @@
<!-- ****************************** -->
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-main</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-log</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-servlet</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-runtime-main</artifactId>
</dependency>
@@ -63,11 +47,6 @@
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-runtime-servlet</artifactId>
</dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy</artifactId>
- <version>${groovy.version}</version>
- </dependency>
</dependencies>
<build>
diff --git a/examples/camel-k-runtime-example-yaml/pom.xml b/examples/camel-k-runtime-example-yaml/pom.xml
index fb981be..bc88486 100644
--- a/examples/camel-k-runtime-example-yaml/pom.xml
+++ b/examples/camel-k-runtime-example-yaml/pom.xml
@@ -28,20 +28,17 @@
<artifactId>camel-k-runtime-example-yaml</artifactId>
<dependencies>
-
- <!-- ****************************** -->
- <!-- -->
- <!-- RUNTIME -->
- <!-- -->
- <!-- ****************************** -->
-
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-runtime-main</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-main</artifactId>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-runtime-servlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-loader-yaml</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
@@ -59,18 +56,6 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-runtime-main</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-runtime-servlet</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-loader-yaml</artifactId>
- </dependency>
</dependencies>
<build>
diff --git a/tooling/camel-k-maven-plugin/pom.xml b/tooling/camel-k-maven-plugin/pom.xml
index d4a3918..8566834 100644
--- a/tooling/camel-k-maven-plugin/pom.xml
+++ b/tooling/camel-k-maven-plugin/pom.xml
@@ -84,23 +84,26 @@
</exclusion>
</exclusions>
</dependency>
+
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-swagger-rest-dsl-generator</artifactId>
<version>${camel.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-catalog</artifactId>
<version>${camel.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-catalog-quarkus</artifactId>
<version>${camel-quarkus.version}</version>
- <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core</artifactId>
+ <version>${camel-quarkus.version}</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
diff --git a/tooling/camel-k-maven-plugin/src/it/generate-catalog/pom.xml b/tooling/camel-k-maven-plugin/src/it/generate-catalog-main/pom.xml
similarity index 89%
copy from tooling/camel-k-maven-plugin/src/it/generate-catalog/pom.xml
copy to tooling/camel-k-maven-plugin/src/it/generate-catalog-main/pom.xml
index 7dbd032..bbdc7ba 100644
--- a/tooling/camel-k-maven-plugin/src/it/generate-catalog/pom.xml
+++ b/tooling/camel-k-maven-plugin/src/it/generate-catalog-main/pom.xml
@@ -29,8 +29,10 @@
<properties>
<catalog.path>${project.basedir}</catalog.path>
- <camel.version>3.0.0-RC3</camel.version>
- <runtime.version>1.0.5</runtime.version>
+ <catalog.runtime>main</catalog.runtime>
+ <catalog.file>catalog.yaml</catalog.file>
+
+ <runtime.version>1.0.11-SNAPSHOT</runtime.version>
</properties>
<build>
@@ -47,13 +49,6 @@
</goals>
</execution>
</executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-catalog</artifactId>
- <version>${camel.version}</version>
- </dependency>
- </dependencies>
</plugin>
</plugins>
</build>
diff --git a/tooling/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy b/tooling/camel-k-maven-plugin/src/it/generate-catalog-main/verify.groovy
similarity index 72%
rename from tooling/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy
rename to tooling/camel-k-maven-plugin/src/it/generate-catalog-main/verify.groovy
index 00d99b1..7ca710b 100644
--- a/tooling/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy
+++ b/tooling/camel-k-maven-plugin/src/it/generate-catalog-main/verify.groovy
@@ -14,13 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-def catalogVersion = '3.0.0-RC3'
-def runtimeVersion = '1.0.5'
+def runtimeVersion = '1.0.11-SNAPSHOT'
-def source = new File(basedir, "camel-catalog-${catalogVersion}-${runtimeVersion}.yaml")
+def source = new File(basedir, "catalog.yaml")
def catalog = new org.yaml.snakeyaml.Yaml().load(new FileInputStream(source))
-assert catalog.spec.version == catalogVersion
-assert catalog.spec.runtimeVersion == runtimeVersion
-assert catalog.metadata.labels['camel.apache.org/catalog.version'] == catalogVersion
+assert catalog.spec.runtime.version == runtimeVersion
+assert catalog.spec.runtime.applicationClass == 'org.apache.camel.k.main.Application'
assert catalog.metadata.labels['camel.apache.org/runtime.version'] == runtimeVersion
\ No newline at end of file
diff --git a/tooling/camel-k-maven-plugin/src/it/generate-catalog/pom.xml b/tooling/camel-k-maven-plugin/src/it/generate-catalog-quarkus/pom.xml
similarity index 89%
rename from tooling/camel-k-maven-plugin/src/it/generate-catalog/pom.xml
rename to tooling/camel-k-maven-plugin/src/it/generate-catalog-quarkus/pom.xml
index 7dbd032..63e6f77 100644
--- a/tooling/camel-k-maven-plugin/src/it/generate-catalog/pom.xml
+++ b/tooling/camel-k-maven-plugin/src/it/generate-catalog-quarkus/pom.xml
@@ -29,8 +29,10 @@
<properties>
<catalog.path>${project.basedir}</catalog.path>
- <camel.version>3.0.0-RC3</camel.version>
- <runtime.version>1.0.5</runtime.version>
+ <catalog.runtime>quarkus</catalog.runtime>
+ <catalog.file>catalog.yaml</catalog.file>
+
+ <runtime.version>1.0.11-SNAPSHOT</runtime.version>
</properties>
<build>
@@ -47,13 +49,6 @@
</goals>
</execution>
</executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-catalog</artifactId>
- <version>${camel.version}</version>
- </dependency>
- </dependencies>
</plugin>
</plugins>
</build>
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/RuntimeProvider.java b/tooling/camel-k-maven-plugin/src/it/generate-catalog-quarkus/verify.groovy
similarity index 61%
rename from tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/RuntimeProvider.java
rename to tooling/camel-k-maven-plugin/src/it/generate-catalog-quarkus/verify.groovy
index 1920229..a2f8d2d 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/RuntimeProvider.java
+++ b/tooling/camel-k-maven-plugin/src/it/generate-catalog-quarkus/verify.groovy
@@ -14,20 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.k.tooling.maven.model.crd;
+def runtimeVersion = '1.0.11-SNAPSHOT'
-import java.util.Optional;
+def source = new File(basedir, "catalog.yaml")
+def catalog = new org.yaml.snakeyaml.Yaml().load(new FileInputStream(source))
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import org.immutables.value.Value;
-
-@Value.Immutable
-@JsonDeserialize(builder = RuntimeProvider.Builder.class)
-@JsonPropertyOrder({ "quarkus" })
-public interface RuntimeProvider {
- Optional<QuarkusRuntimeProvider> getQuarkus();
-
- class Builder extends ImmutableRuntimeProvider.Builder {
- }
-}
+assert catalog.spec.runtime.version == runtimeVersion
+assert catalog.spec.runtime.applicationClass == 'io.quarkus.runner.GeneratedMain'
+assert catalog.metadata.labels['camel.apache.org/runtime.version'] == runtimeVersion
\ No newline at end of file
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 39a452c..cd62f2e 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
@@ -24,13 +24,9 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Comparator;
-import java.util.Map;
-import java.util.Objects;
import java.util.Properties;
import java.util.ServiceLoader;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.regex.Pattern;
+import java.util.function.Consumer;
import java.util.stream.StreamSupport;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -39,18 +35,15 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import org.apache.camel.catalog.DefaultCamelCatalog;
-import org.apache.camel.k.tooling.maven.model.CamelArtifact;
-import org.apache.camel.k.tooling.maven.model.CatalogComponentDefinition;
-import org.apache.camel.k.tooling.maven.model.CatalogDataFormatDefinition;
-import org.apache.camel.k.tooling.maven.model.CatalogLanguageDefinition;
+import org.apache.camel.catalog.DefaultRuntimeProvider;
+import org.apache.camel.catalog.quarkus.QuarkusRuntimeProvider;
+import org.apache.camel.impl.engine.AbstractCamelContext;
import org.apache.camel.k.tooling.maven.model.CatalogProcessor;
-import org.apache.camel.k.tooling.maven.model.CatalogSupport;
import org.apache.camel.k.tooling.maven.model.crd.CamelCatalog;
import org.apache.camel.k.tooling.maven.model.crd.CamelCatalogSpec;
-import org.apache.camel.k.tooling.maven.model.crd.QuarkusRuntimeProvider;
-import org.apache.camel.k.tooling.maven.model.crd.RuntimeProvider;
+import org.apache.camel.k.tooling.maven.model.crd.RuntimeSpec;
import org.apache.camel.k.tooling.maven.model.k8s.ObjectMeta;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.camel.quarkus.core.FastCamelContext;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -74,10 +67,10 @@ public class GenerateCatalogMojo extends AbstractMojo {
@Parameter(property = "catalog.path", defaultValue = "${project.build.directory}")
private String outputPath;
- @Parameter(property = "catalog.file", defaultValue = "camel-catalog-${camel.version}-${runtime.version}.yaml")
+ @Parameter(property = "catalog.file", defaultValue = "camel-catalog-${runtime.version}.yaml")
private String outputFile;
- @Parameter(property = "catalog.runtime", defaultValue = "")
+ @Parameter(property = "catalog.runtime", defaultValue = "main")
private String runtime;
// ********************
@@ -100,48 +93,79 @@ public class GenerateCatalogMojo extends AbstractMojo {
throw new MojoExecutionException("Exception while generating camel catalog", e);
}
- final SortedMap<String, CamelArtifact> artifacts = new TreeMap<>();
final org.apache.camel.catalog.CamelCatalog catalog = new DefaultCamelCatalog();
- if (runtime == null) {
- runtime = "";
- }
- switch (runtime) {
- case "quarkus":
- catalog.setRuntimeProvider(new org.apache.camel.catalog.quarkus.QuarkusRuntimeProvider());
- break;
- case "":
- break;
- default:
- throw new IllegalArgumentException("catalog.runtime parameter value [" + runtime + "] is not supported!");
- }
+ final String runtimeVersion = getVersion(getClass(), "/META-INF/maven/org.apache.camel.k/camel-k-maven-plugin/pom.properties");
+ final String catalogName = String.format("camel-catalog-%s-%s", runtimeVersion.toLowerCase(), runtime);
try {
- processComponents(catalog, artifacts);
- processLanguages(catalog, artifacts);
- processDataFormats(catalog, artifacts);
-
ServiceLoader<CatalogProcessor> processors = ServiceLoader.load(CatalogProcessor.class);
Comparator<CatalogProcessor> comparator = Comparator.comparingInt(CatalogProcessor::getOrder);
- //
- // post process catalog
- //
+ RuntimeSpec.Builder runtimeSpec = new RuntimeSpec.Builder()
+ .version(runtimeVersion)
+ .provider(runtime);
+
+ getVersion(
+ AbstractCamelContext.class,
+ "org.apache.camel", "camel-base",
+ version -> runtimeSpec.putMetadata("camel.version", version));
+ getVersion(
+ FastCamelContext.class,
+ "io.quarkus", "quarkus-core",
+ version -> runtimeSpec.putMetadata("quarkus.version", version));
+ getVersion(
+ QuarkusRuntimeProvider.class,
+ "org.apache.camel.quarkus", "camel-catalog-quarkus",
+ version -> runtimeSpec.putMetadata("camel-quarkus.version", version));
+
+ switch (runtime) {
+ case "main":
+ catalog.setRuntimeProvider(new DefaultRuntimeProvider());
+ runtimeSpec.applicationClass("org.apache.camel.k.main.Application");
+ runtimeSpec.addDependency("org.apache.camel.k", "camel-k-runtime-main");
+ break;
+ case "quarkus":
+ catalog.setRuntimeProvider(new QuarkusRuntimeProvider());
+ runtimeSpec.applicationClass("io.quarkus.runner.GeneratedMain");
+ runtimeSpec.addDependency("org.apache.camel.k", "camel-k-runtime-quarkus");
+ break;
+ default:
+ throw new IllegalArgumentException("catalog.runtime parameter value [" + runtime + "] is not supported!");
+ }
+
+ CamelCatalogSpec.Builder catalogSpec = new CamelCatalogSpec.Builder()
+ .runtime(runtimeSpec.build());
+
StreamSupport.stream(processors.spliterator(), false).sorted(comparator).filter(p -> p.accepts(catalog)).forEach(p -> {
getLog().info("Executing processor: " + p.getClass().getName());
- p.process(project, catalog, artifacts);
+ p.process(project, catalog, catalogSpec);
});
+ ObjectMeta.Builder metadata = new ObjectMeta.Builder()
+ .name(catalogName)
+ .putLabels("app", "camel-k")
+ .putLabels("camel.apache.org/catalog.version", catalog.getCatalogVersion())
+ .putLabels("camel.apache.org/catalog.loader.version", catalog.getLoadedVersion())
+ .putLabels("camel.apache.org/runtime.version", runtimeVersion)
+ .putLabels("camel.apache.org/runtime.provider", runtime);
+
+ CamelCatalog cr = new CamelCatalog.Builder()
+ .metadata(metadata.build())
+ .spec(catalogSpec.build())
+ .build();
+
//
// apiVersion: camel.apache.org/v1
// kind: CamelCatalog
// metadata:
- // name: catalog-x.y.z-a.b.c
+ // name: catalog-x.y.z-main
// labels:
// app: "camel-k"
// camel.apache.org/catalog.version: x.y.x
// camel.apache.org/catalog.loader.version: x.y.z
// camel.apache.org/runtime.version: x.y.x
+ // camel.apache.org/runtime.provider: main
// spec:
// version:
// runtimeVersion:
@@ -149,50 +173,6 @@ public class GenerateCatalogMojo extends AbstractMojo {
// artifacts:
//
try (Writer writer = Files.newBufferedWriter(output, StandardCharsets.UTF_8)) {
- String catalogName;
- if ("quarkus".equals(runtime)) {
- catalogName = String.format("camel-catalog-%s-%s-%s",
- runtime,
- getVersionFor("/META-INF/maven/org.apache.camel.quarkus/camel-catalog-quarkus/pom.properties").toLowerCase(),
- getRuntimeVersion().toLowerCase()
- );
- } else {
- catalogName = String.format("camel-catalog-%s-%s",
- catalog.getCatalogVersion().toLowerCase(),
- getRuntimeVersion().toLowerCase()
- );
- }
-
- ObjectMeta.Builder labels = new ObjectMeta.Builder()
- .name(catalogName)
- .putLabels("app", "camel-k")
- .putLabels("camel.apache.org/catalog.version", catalog.getCatalogVersion())
- .putLabels("camel.apache.org/catalog.loader.version", catalog.getLoadedVersion())
- .putLabels("camel.apache.org/runtime.version", getRuntimeVersion());
- if (!"".equals(runtime)) {
- labels.putLabels("camel.apache.org/runtime.provider", runtime);
- }
-
- CamelCatalogSpec.Builder catalogSpec = new CamelCatalogSpec.Builder()
- .version(catalog.getCatalogVersion())
- .runtimeVersion(getRuntimeVersion())
- .artifacts(artifacts);
-
- if ("quarkus".equals(runtime)) {
- String camelQuarkusVersion = getVersionFor("/META-INF/maven/org.apache.camel.quarkus/camel-catalog-quarkus/pom.properties");
- String quarkusVersion = getVersionFor("/META-INF/maven/io.quarkus/quarkus-core/pom.properties");
- catalogSpec.runtimeProvider(new RuntimeProvider.Builder()
- .quarkus(new QuarkusRuntimeProvider.Builder()
- .camelQuarkusVersion(camelQuarkusVersion)
- .quarkusVersion(quarkusVersion)
- .build())
- .build());
- }
-
- CamelCatalog cr = new CamelCatalog.Builder()
- .metadata(labels.build())
- .spec(catalogSpec.build())
- .build();
YAMLFactory factory = new YAMLFactory()
.configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true)
@@ -200,7 +180,6 @@ public class GenerateCatalogMojo extends AbstractMojo {
.configure(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID, false)
.configure(YAMLGenerator.Feature.WRITE_DOC_START_MARKER, false);
-
// write license header
writer.write(
GenerateSupport.getResourceAsString("/catalog-license.txt")
@@ -220,95 +199,29 @@ public class GenerateCatalogMojo extends AbstractMojo {
}
}
- private void processComponents(org.apache.camel.catalog.CamelCatalog catalog, Map<String, CamelArtifact> 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) -> {
- if (artifact == null) {
- artifact = new CamelArtifact();
- artifact.setGroupId(definition.getGroupId());
- artifact.setArtifactId(definition.getArtifactId());
-
- Objects.requireNonNull(artifact.getGroupId());
- Objects.requireNonNull(artifact.getArtifactId());
- }
-
- definition.getSchemes()
- .map(StringUtils::trimToNull)
- .filter(Objects::nonNull)
- .forEach(artifact::createScheme);
-
- artifact.addJavaType(definition.getJavaType());
-
- return artifact;
- });
- }
- }
-
- private void processLanguages(org.apache.camel.catalog.CamelCatalog catalog, Map<String, CamelArtifact> artifacts) {
- for (String name : catalog.findLanguageNames()) {
- String json = catalog.languageJSonSchema(name);
- CatalogLanguageDefinition definition = CatalogSupport.unmarshallLanguage(json);
-
- artifacts.compute(definition.getArtifactId(), (key, artifact) -> {
- if (artifact == null) {
- artifact = new CamelArtifact();
- artifact.setGroupId(definition.getGroupId());
- artifact.setArtifactId(definition.getArtifactId());
-
- Objects.requireNonNull(artifact.getGroupId());
- Objects.requireNonNull(artifact.getArtifactId());
- }
-
- artifact.addLanguage(definition.getName());
- artifact.addJavaType(definition.getJavaType());
-
- return artifact;
- });
- }
+ private static void getVersion(Class<?> clazz, String path, Consumer<String> consumer) {
+ consumer.accept(getVersion(clazz, path));
}
- private void processDataFormats(org.apache.camel.catalog.CamelCatalog catalog, Map<String, CamelArtifact> artifacts) {
- for (String name : catalog.findDataFormatNames()) {
- String json = catalog.dataFormatJSonSchema(name);
- CatalogDataFormatDefinition definition = CatalogSupport.unmarshallDataFormat(json);
-
- artifacts.compute(definition.getArtifactId(), (key, artifact) -> {
- if (artifact == null) {
- artifact = new CamelArtifact();
- artifact.setGroupId(definition.getGroupId());
- artifact.setArtifactId(definition.getArtifactId());
-
- Objects.requireNonNull(artifact.getGroupId());
- Objects.requireNonNull(artifact.getArtifactId());
- }
-
- artifact.addDataformats(definition.getName());
- artifact.addJavaType(definition.getJavaType());
-
- return artifact;
- });
- }
+ private static void getVersion(Class<?> clazz, String groupId, String artifactId, Consumer<String> consumer) {
+ getVersion(
+ clazz,
+ String.format("/META-INF/maven/%s/%s/pom.properties", groupId, artifactId),
+ consumer);
}
- private String getRuntimeVersion() {
- return getVersionFor("/META-INF/maven/org.apache.camel.k/camel-k-maven-plugin/pom.properties");
+ private static synchronized String getVersion(Class<?> clazz, String groupId, String artifactId) {
+ return getVersion(
+ clazz,
+ String.format("/META-INF/maven/%s/%s/pom.properties", groupId, artifactId));
}
- private synchronized String getVersionFor(String path) {
+ private static synchronized String getVersion(Class<?> clazz, String path) {
String version = null;
// try to load from maven properties first
try {
- InputStream is = getClass().getResourceAsStream(path);
+ InputStream is = clazz.getResourceAsStream(path);
if (is != null) {
Properties p = new Properties();
@@ -321,7 +234,7 @@ public class GenerateCatalogMojo extends AbstractMojo {
// fallback to using Java API
if (version == null) {
- Package aPackage = getClass().getPackage();
+ Package aPackage = clazz.getPackage();
if (aPackage != null) {
version = aPackage.getImplementationVersion();
if (version == null) {
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/Artifact.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/Artifact.java
index 86ce6eb..d378ab0 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/Artifact.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/Artifact.java
@@ -16,53 +16,10 @@
*/
package org.apache.camel.k.tooling.maven.model;
-import java.util.Objects;
+import java.util.Optional;
-public class Artifact {
- private String groupId;
- private String artifactId;
- private String version;
-
- public String getGroupId() {
- return groupId;
- }
-
- public void setGroupId(String groupId) {
- this.groupId = groupId;
- }
-
- public String getArtifactId() {
- return artifactId;
- }
-
- public void setArtifactId(String artifactId) {
- this.artifactId = artifactId;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Artifact artifact = (Artifact) o;
-
- return Objects.equals(groupId, artifact.groupId)
- && Objects.equals(artifactId, artifact.artifactId);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(groupId, artifactId);
- }
+public interface Artifact {
+ String getGroupId();;
+ String getArtifactId();
+ Optional<String> getVersion();
}
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelArtifact.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelArtifact.java
index 7c2b16f..d031919 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelArtifact.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelArtifact.java
@@ -16,171 +16,54 @@
*/
package org.apache.camel.k.tooling.maven.model;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.Collections;
+import java.util.Set;
-public class CamelArtifact extends Artifact {
- private List<CamelScheme> schemes;
- private List<String> languages;
- private List<String> dataformats;
- private List<Artifact> dependencies;
- private List<Artifact> exclusions;
- private List<String> javaTypes;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.immutables.value.Value;
- public CamelArtifact() {
- this.schemes = new ArrayList<>();
- this.languages = new ArrayList<>();
- this.dataformats = new ArrayList<>();
- this.dependencies = new ArrayList<>();
- this.exclusions = new ArrayList<>();
- this.javaTypes = new ArrayList<>();
+@Value.Immutable
+@Value.Style(depluralize = true)
+@JsonDeserialize(builder = CamelArtifact.Builder.class)
+@JsonPropertyOrder({"groupId", "artifactId", "version"})
+public interface CamelArtifact extends Artifact {
+ @Value.Auxiliary
+ @Value.Default
+ default Set<CamelScheme> getSchemes() {
+ return Collections.emptySet();
}
- public void setSchemes(List<CamelScheme> schemes) {
- this.schemes = schemes;
+ @Value.Auxiliary
+ @Value.Default
+ default Set<String> getLanguages() {
+ return Collections.emptySet();
}
- public void addScheme(CamelScheme scheme) {
- if (!this.schemes.contains(scheme)) {
- this.schemes.add(scheme);
- }
+ @Value.Auxiliary
+ @Value.Default
+ default Set<String> getDataformats() {
+ return Collections.emptySet();
}
- public List<String> getLanguages() {
- return languages;
+ @Value.Auxiliary
+ @Value.Default
+ default Set<Artifact> getDependencies() {
+ return Collections.emptySet();
}
- public void setLanguages(List<String> languages) {
- this.languages = languages;
+ @Value.Auxiliary
+ @Value.Default
+ default Set<Artifact> getExclusions() {
+ return Collections.emptySet();
}
- public void addLanguage(String language) {
- if (!this.languages.contains(language)) {
- this.languages.add(language);
- }
+ @Value.Auxiliary
+ @Value.Default
+ default Set<String> getJavaTypes() {
+ return Collections.emptySet();
}
- public List<String> getDataformats() {
- return dataformats;
- }
-
- public void setDataformats(List<String> dataformats) {
- this.dataformats = dataformats;
- }
-
- public void addDataformats(String dataformat) {
- if (!this.dataformats.contains(dataformat)) {
- this.dataformats.add(dataformat);
- }
- }
-
- public List<CamelScheme> getSchemes() {
- return schemes;
- }
-
- public Optional<CamelScheme> getScheme(String id) {
- return schemes.stream().filter(s -> Objects.equals(s.getId(), id)).findFirst();
- }
-
- public CamelScheme createScheme(String id) {
- for (CamelScheme scheme: schemes) {
- if (scheme.getId().equals(id)) {
- return scheme;
- }
- }
-
-
- CamelScheme answer = new CamelScheme();
- answer.setId(id);
-
- schemes.add(answer);
-
- return answer;
- }
-
- public List<Artifact> getDependencies() {
- return dependencies;
- }
-
- public void setDependencies(List<Artifact> dependencies) {
- this.dependencies = dependencies;
- }
-
- public void addDependency(Artifact dependency) {
- if (!this.dependencies.contains(dependency)) {
- this.dependencies.add(dependency);
- }
- }
-
- public void addDependency(String groupId, String artifactId) {
- Artifact artifact = new Artifact();
- artifact.setGroupId(groupId);
- artifact.setArtifactId(artifactId);
-
- addDependency(artifact);
- }
-
- public void addDependency(String groupId, String artifactId, String version) {
- Artifact artifact = new Artifact();
- artifact.setGroupId(groupId);
- artifact.setArtifactId(artifactId);
- artifact.setVersion(version);
-
- addDependency(artifact);
- }
-
- public List<Artifact> getExclusions() {
- return exclusions;
- }
-
- public void setExclusions(List<Artifact> exclusions) {
- this.exclusions = exclusions;
- }
-
- public void addExclusion(Artifact exclusion) {
- if (!this.exclusions.contains(exclusion)) {
- this.exclusions.add(exclusion);
- }
- }
-
- public void addExclusion(String groupId, String artifactId) {
- Artifact artifact = new Artifact();
- artifact.setGroupId(groupId);
- artifact.setArtifactId(artifactId);
-
- addExclusion(artifact);
- }
-
- public List<String> getJavaTypes() {
- return javaTypes;
- }
-
- public void setJavaTypes(List<String> javaTypes) {
- this.javaTypes = javaTypes;
- }
-
- public void addJavaType(String javaType) {
- if (!this.javaTypes.contains(javaType)) {
- this.javaTypes.add(javaType);
- }
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- CamelArtifact artifact = (CamelArtifact) o;
- return Objects.equals(getArtifactId(), artifact.getArtifactId());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getArtifactId());
+ class Builder extends ImmutableCamelArtifact.Builder {
}
}
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/CamelCatalogSpec.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelLoader.java
similarity index 50%
copy from tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/CamelCatalogSpec.java
copy to tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelLoader.java
index f41d2e7..b051ddb 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/CamelCatalogSpec.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelLoader.java
@@ -14,31 +14,47 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.k.tooling.maven.model.crd;
+package org.apache.camel.k.tooling.maven.model;
import java.util.Collections;
-import java.util.Optional;
-import java.util.SortedMap;
+import java.util.Map;
+import java.util.Set;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import org.apache.camel.k.tooling.maven.model.CamelArtifact;
import org.immutables.value.Value;
@Value.Immutable
-@JsonDeserialize(builder = CamelCatalogSpec.Builder.class)
-@JsonPropertyOrder({ "version", "runtimeVersion", "runtimeProvider", "artifacts" })
-public interface CamelCatalogSpec {
- String getVersion();
- String getRuntimeVersion();
+@Value.Style(depluralize = true)
+@JsonDeserialize(builder = CamelLoader.Builder.class)
+@JsonPropertyOrder({"groupId", "artifactId", "version"})
+public interface CamelLoader extends Artifact {
+ @Value.Auxiliary
+ @Value.Default
+ default Set<String> getLanguages() {
+ return Collections.emptySet();
+ }
- Optional<RuntimeProvider> getRuntimeProvider();
+ @Value.Auxiliary
+ @Value.Default
+ default Set<Artifact> getDependencies() {
+ return Collections.emptySet();
+ }
+ @Value.Auxiliary
@Value.Default
- default SortedMap<String, CamelArtifact> getArtifacts() {
- return Collections.emptySortedMap();
+ default Map<String, String> getMetadata() {
+ return Collections.emptyMap();
+ }
+
+ static Builder fromArtifact(String groupId, String artifactId) {
+ return new Builder().groupId(groupId).artifactId(artifactId);
}
- class Builder extends ImmutableCamelCatalogSpec.Builder {
+ class Builder extends ImmutableCamelLoader.Builder {
+ public Builder addDependency(String groupId, String artifactId) {
+ addDependencies(MavenArtifact.from(groupId, artifactId));
+ return this;
+ }
}
}
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelScheme.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelScheme.java
index 51c0227..6edcb8a 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelScheme.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CamelScheme.java
@@ -16,56 +16,26 @@
*/
package org.apache.camel.k.tooling.maven.model;
-import java.util.Objects;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.immutables.value.Value;
-public class CamelScheme {
- private String id;
- private boolean http;
- private boolean passive;
+@Value.Immutable
+@JsonDeserialize(builder = CamelScheme.Builder.class)
+public interface CamelScheme {
+ String getId();
- public CamelScheme() {
+ @Value.Auxiliary
+ @Value.Default
+ default boolean http() {
+ return false;
}
- public String getId() {
- return id;
+ @Value.Auxiliary
+ @Value.Default
+ default boolean passive() {
+ return false;
}
- public void setId(String id) {
- this.id = id;
- }
-
- public boolean isHttp() {
- return http;
- }
-
- public void setHttp(boolean http) {
- this.http = http;
- }
-
- public boolean isPassive() {
- return passive;
- }
-
- public void setPassive(boolean passive) {
- this.passive = passive;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- CamelScheme scheme = (CamelScheme) o;
- return isHttp() == scheme.isHttp()
- && isPassive() == scheme.isPassive()
- && Objects.equals(getId(), scheme.getId());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getId(), isHttp(), isPassive());
+ class Builder extends ImmutableCamelScheme.Builder {
}
}
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogComponentDefinition.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogComponentDefinition.java
index 7cb6566..929f772 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogComponentDefinition.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogComponentDefinition.java
@@ -24,11 +24,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.StringUtils;
@JsonIgnoreProperties(ignoreUnknown = true)
-public final class CatalogComponentDefinition {
+public final class CatalogComponentDefinition extends CatalogDefinition {
private String scheme;
- private String groupId;
- private String artifactId;
- private String version;
private String alternativeSchemes;
private String javaType;
@@ -49,30 +46,6 @@ public final class CatalogComponentDefinition {
this.scheme = scheme;
}
- public String getGroupId() {
- return groupId;
- }
-
- public void setGroupId(String groupId) {
- this.groupId = groupId;
- }
-
- public String getArtifactId() {
- return artifactId;
- }
-
- public void setArtifactId(String artifactId) {
- this.artifactId = artifactId;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
public String getAlternativeSchemes() {
return alternativeSchemes;
}
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogDataFormatDefinition.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogDataFormatDefinition.java
index 01b43cd..1ade47c 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogDataFormatDefinition.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogDataFormatDefinition.java
@@ -21,11 +21,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
-public final class CatalogDataFormatDefinition {
+public final class CatalogDataFormatDefinition extends CatalogDefinition {
private String name;
- private String groupId;
- private String artifactId;
- private String version;
private String javaType;
public String getName() {
@@ -36,30 +33,6 @@ public final class CatalogDataFormatDefinition {
this.name = name;
}
- public String getGroupId() {
- return groupId;
- }
-
- public void setGroupId(String groupId) {
- this.groupId = groupId;
- }
-
- public String getArtifactId() {
- return artifactId;
- }
-
- public void setArtifactId(String artifactId) {
- this.artifactId = artifactId;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
public String getJavaType() {
return javaType;
}
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/Artifact.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogDefinition.java
similarity index 72%
copy from tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/Artifact.java
copy to tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogDefinition.java
index 86ce6eb..a423894 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/Artifact.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogDefinition.java
@@ -16,9 +16,7 @@
*/
package org.apache.camel.k.tooling.maven.model;
-import java.util.Objects;
-
-public class Artifact {
+public class CatalogDefinition {
private String groupId;
private String artifactId;
private String version;
@@ -46,23 +44,4 @@ public class Artifact {
public void setVersion(String version) {
this.version = version;
}
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Artifact artifact = (Artifact) o;
-
- return Objects.equals(groupId, artifact.groupId)
- && Objects.equals(artifactId, artifact.artifactId);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(groupId, artifactId);
- }
}
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogLanguageDefinition.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogLanguageDefinition.java
index 7c9134b..d2d0f20 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogLanguageDefinition.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogLanguageDefinition.java
@@ -21,11 +21,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
-public final class CatalogLanguageDefinition {
+public final class CatalogLanguageDefinition extends CatalogDefinition {
private String name;
- private String groupId;
- private String artifactId;
- private String version;
private String javaType;
public String getName() {
@@ -36,30 +33,6 @@ public final class CatalogLanguageDefinition {
this.name = name;
}
- public String getGroupId() {
- return groupId;
- }
-
- public void setGroupId(String groupId) {
- this.groupId = groupId;
- }
-
- public String getArtifactId() {
- return artifactId;
- }
-
- public void setArtifactId(String artifactId) {
- this.artifactId = artifactId;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
public String getJavaType() {
return javaType;
}
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogProcessor.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogProcessor.java
index 95ceb31..999aa99 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogProcessor.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/CatalogProcessor.java
@@ -16,9 +16,8 @@
*/
package org.apache.camel.k.tooling.maven.model;
-import java.util.Map;
-
import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.k.tooling.maven.model.crd.CamelCatalogSpec;
import org.apache.maven.project.MavenProject;
public interface CatalogProcessor {
@@ -34,7 +33,7 @@ public interface CatalogProcessor {
boolean accepts(CamelCatalog catalog);
- void process(MavenProject project, CamelCatalog catalog, Map<String, CamelArtifact> artifacts);
+ void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec.Builder specBuilder);
default int getOrder() {
return LOWEST;
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/QuarkusRuntimeProvider.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/MavenArtifact.java
similarity index 56%
rename from tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/QuarkusRuntimeProvider.java
rename to tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/MavenArtifact.java
index 6858f3c..b864ce1 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/QuarkusRuntimeProvider.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/MavenArtifact.java
@@ -14,19 +14,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.k.tooling.maven.model.crd;
+package org.apache.camel.k.tooling.maven.model;
+
+import java.util.Optional;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.immutables.value.Value;
@Value.Immutable
-@JsonDeserialize(builder = QuarkusRuntimeProvider.Builder.class)
-@JsonPropertyOrder({ "camelQuarkusVersion", "quarkusVersion" })
-public interface QuarkusRuntimeProvider {
- String getCamelQuarkusVersion();
- String getQuarkusVersion();
+@JsonDeserialize(builder = MavenArtifact.Builder.class)
+@JsonPropertyOrder({"groupId", "artifactId", "version"})
+public interface MavenArtifact extends Artifact {
+ static MavenArtifact from(String groupId, String artifactId) {
+ return new MavenArtifact() {
+ @Override
+ public String getGroupId() {
+ return groupId;
+ }
+
+ @Override
+ public String getArtifactId() {
+ return artifactId;
+ }
+
+ @Override
+ public Optional<String> getVersion() {
+ return Optional.empty();
+ }
+ };
+ }
- class Builder extends ImmutableQuarkusRuntimeProvider.Builder {
+ class Builder extends ImmutableMavenArtifact.Builder {
}
}
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/CamelCatalogSpec.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/CamelCatalogSpec.java
index f41d2e7..f096056 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/CamelCatalogSpec.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/CamelCatalogSpec.java
@@ -17,28 +17,39 @@
package org.apache.camel.k.tooling.maven.model.crd;
import java.util.Collections;
-import java.util.Optional;
-import java.util.SortedMap;
+import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.apache.camel.k.tooling.maven.model.CamelArtifact;
+import org.apache.camel.k.tooling.maven.model.CamelLoader;
import org.immutables.value.Value;
@Value.Immutable
+@Value.Style(depluralize = true)
@JsonDeserialize(builder = CamelCatalogSpec.Builder.class)
-@JsonPropertyOrder({ "version", "runtimeVersion", "runtimeProvider", "artifacts" })
+@JsonPropertyOrder({ "runtime", "artifacts" })
public interface CamelCatalogSpec {
- String getVersion();
- String getRuntimeVersion();
+ RuntimeSpec getRuntime();
- Optional<RuntimeProvider> getRuntimeProvider();
+ @Value.Default
+ default Map<String, CamelArtifact> getArtifacts() {
+ return Collections.emptyMap();
+ }
@Value.Default
- default SortedMap<String, CamelArtifact> getArtifacts() {
- return Collections.emptySortedMap();
+ default Map<String, CamelLoader> getLoaders() {
+ return Collections.emptyMap();
}
class Builder extends ImmutableCamelCatalogSpec.Builder {
+ public Builder putArtifact(CamelArtifact artifact) {
+ putArtifact(artifact.getArtifactId(), artifact);
+ return this;
+ }
+ public Builder putArtifact(String groupId, String artifactId) {
+ putArtifact(new CamelArtifact.Builder().groupId(groupId).artifactId(artifactId).build());
+ return this;
+ }
}
}
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/CamelCatalogSpec.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/RuntimeSpec.java
similarity index 58%
copy from tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/CamelCatalogSpec.java
copy to tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/RuntimeSpec.java
index f41d2e7..ee1b3f7 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/CamelCatalogSpec.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/model/crd/RuntimeSpec.java
@@ -17,28 +17,37 @@
package org.apache.camel.k.tooling.maven.model.crd;
import java.util.Collections;
-import java.util.Optional;
-import java.util.SortedMap;
+import java.util.Map;
+import java.util.Set;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import org.apache.camel.k.tooling.maven.model.CamelArtifact;
+import org.apache.camel.k.tooling.maven.model.MavenArtifact;
import org.immutables.value.Value;
@Value.Immutable
-@JsonDeserialize(builder = CamelCatalogSpec.Builder.class)
-@JsonPropertyOrder({ "version", "runtimeVersion", "runtimeProvider", "artifacts" })
-public interface CamelCatalogSpec {
+@Value.Style(depluralize = true)
+@JsonDeserialize(builder = RuntimeSpec.Builder.class)
+@JsonPropertyOrder({ "version", "runtimeVersion", "artifacts" })
+public interface RuntimeSpec {
String getVersion();
- String getRuntimeVersion();
+ String getProvider();
+ String getApplicationClass();
- Optional<RuntimeProvider> getRuntimeProvider();
+ @Value.Default
+ default Map<String, String> getMetadata() {
+ return Collections.emptyMap();
+ }
@Value.Default
- default SortedMap<String, CamelArtifact> getArtifacts() {
- return Collections.emptySortedMap();
+ default Set<MavenArtifact> getDependencies() {
+ return Collections.emptySet();
}
- class Builder extends ImmutableCamelCatalogSpec.Builder {
+ class Builder extends ImmutableRuntimeSpec.Builder {
+ public Builder addDependency(String groupId, String artifactId) {
+ addDependencies(MavenArtifact.from(groupId, artifactId));
+ return this;
+ }
}
}
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 3d26b5d..0fe6453 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
@@ -17,13 +17,26 @@
package org.apache.camel.k.tooling.maven.processors;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import com.vdurmont.semver4j.Semver;
import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.catalog.quarkus.QuarkusRuntimeProvider;
import org.apache.camel.k.tooling.maven.model.CamelArtifact;
+import org.apache.camel.k.tooling.maven.model.CamelLoader;
+import org.apache.camel.k.tooling.maven.model.CamelScheme;
+import org.apache.camel.k.tooling.maven.model.CatalogComponentDefinition;
+import org.apache.camel.k.tooling.maven.model.CatalogDataFormatDefinition;
+import org.apache.camel.k.tooling.maven.model.CatalogDefinition;
+import org.apache.camel.k.tooling.maven.model.CatalogLanguageDefinition;
import org.apache.camel.k.tooling.maven.model.CatalogProcessor;
+import org.apache.camel.k.tooling.maven.model.CatalogSupport;
+import org.apache.camel.k.tooling.maven.model.MavenArtifact;
+import org.apache.camel.k.tooling.maven.model.crd.CamelCatalogSpec;
+import org.apache.commons.lang3.StringUtils;
import org.apache.maven.project.MavenProject;
public class CatalogProcessor3x implements CatalogProcessor {
@@ -79,220 +92,251 @@ public class CatalogProcessor3x implements CatalogProcessor {
}
@Override
- public void process(MavenProject project, CamelCatalog catalog, Map<String, CamelArtifact> artifacts) {
-
- // ************************
- //
- // camel-k-runtime-main
- //
- // ************************
-
- {
- CamelArtifact artifact = new CamelArtifact();
- artifact.setGroupId("org.apache.camel.k");
- artifact.setArtifactId("camel-k-runtime-main");
- artifact.addDependency("org.apache.camel", "camel-core-engine");
- artifact.addDependency("org.apache.camel", "camel-main");
-
- artifacts.put(artifact.getArtifactId(), artifact);
- }
-
- // ************************
- //
- // camel-k-loader-groovy
- //
- // ************************
-
- {
- CamelArtifact artifact = new CamelArtifact();
- artifact.setGroupId("org.apache.camel.k");
- artifact.setArtifactId("camel-k-loader-groovy");
- artifact.addDependency("org.apache.camel", "camel-endpointdsl");
- artifact.addDependency("org.apache.camel", "camel-groovy");
-
- artifacts.put(artifact.getArtifactId(), artifact);
- }
-
- // ************************
- //
- // camel-k-loader-kotlin
- //
- // ************************
-
- {
- CamelArtifact artifact = new CamelArtifact();
- artifact.setGroupId("org.apache.camel.k");
- artifact.setArtifactId("camel-k-loader-kotlin");
- artifact.addDependency("org.apache.camel", "camel-endpointdsl");
-
- artifacts.put(artifact.getArtifactId(), artifact);
- }
-
- // ************************
- //
- // camel-k-loader-js
- //
- // ************************
-
- {
- CamelArtifact artifact = new CamelArtifact();
- artifact.setGroupId("org.apache.camel.k");
- artifact.setArtifactId("camel-k-loader-js");
- artifact.addDependency("org.apache.camel", "camel-endpointdsl");
-
- artifacts.put(artifact.getArtifactId(), artifact);
- }
-
- // ************************
- //
- // camel-k-loader-xml
- //
- // ************************
-
- {
- CamelArtifact artifact = new CamelArtifact();
- artifact.setGroupId("org.apache.camel.k");
- artifact.setArtifactId("camel-k-loader-xml");
-
- artifacts.put(artifact.getArtifactId(), artifact);
- }
-
- // ************************
- //
- // camel-k-loader-java
- //
- // ************************
-
- {
- CamelArtifact artifact = new CamelArtifact();
- artifact.setGroupId("org.apache.camel.k");
- artifact.setArtifactId("camel-k-loader-java");
- artifact.addDependency("org.apache.camel", "camel-endpointdsl");
-
- artifacts.put(artifact.getArtifactId(), artifact);
- }
-
- // ************************
- //
- // camel-k-loader-knative
- //
- // ************************
-
- {
- CamelArtifact artifact = new CamelArtifact();
- artifact.setGroupId("org.apache.camel.k");
- artifact.setArtifactId("camel-k-loader-knative");
-
- artifacts.put(artifact.getArtifactId(), artifact);
- }
-
- // ************************
- //
- // camel-knative
- //
- // ************************
+ public void process(MavenProject project, CamelCatalog catalog, CamelCatalogSpec.Builder specBuilder) {
+ Map<String, CamelArtifact> artifacts = new HashMap<>();
+
+ processComponents(catalog, artifacts);
+ processLanguages(catalog, artifacts);
+ processDataFormats(catalog, artifacts);
+ processLoaders(catalog, specBuilder);
+
+ artifacts.computeIfPresent("camel-http",
+ (key, artifact) -> new CamelArtifact.Builder()
+ .from(artifact)
+ .addDependencies(MavenArtifact.from("org.apache.camel", "camel-file"))
+ .build()
+ );
+
+ specBuilder.putAllArtifacts(artifacts);
+
+ specBuilder.putArtifact("org.apache.camel.k", "camel-k-loader-yaml");
+ specBuilder.putArtifact("org.apache.camel.k", "camel-k-loader-groovy");
+ specBuilder.putArtifact("org.apache.camel.k", "camel-k-loader-kotlin");
+ specBuilder.putArtifact("org.apache.camel.k", "camel-k-loader-js");
+ specBuilder.putArtifact("org.apache.camel.k", "camel-k-loader-xml");
+ specBuilder.putArtifact("org.apache.camel.k", "camel-k-loader-java");
+ specBuilder.putArtifact("org.apache.camel.k", "camel-k-loader-knative");
+
+ specBuilder.putArtifact(
+ new CamelArtifact.Builder()
+ .groupId("org.apache.camel.k")
+ .artifactId("camel-k-runtime-main")
+ .build()
+ );
+ specBuilder.putArtifact(
+ new CamelArtifact.Builder()
+ .groupId("org.apache.camel.k")
+ .artifactId("camel-k-runtime-health")
+ .build()
+ );
+ specBuilder.putArtifact(
+ new CamelArtifact.Builder()
+ .groupId("org.apache.camel.k")
+ .artifactId("camel-k-runtime-servlet")
+ .build()
+ );
+ specBuilder.putArtifact(
+ new CamelArtifact.Builder()
+ .groupId("org.apache.camel.k")
+ .artifactId("camel-k-runtime-webhook")
+ .build()
+ );
+ specBuilder.putArtifact(
+ new CamelArtifact.Builder()
+ .groupId("org.apache.camel.k")
+ .artifactId("camel-k-runtime-cron")
+ .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-loader-yaml"))
+ .addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-k-loader-knative"))
+ .addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative-api"))
+ .addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative"))
+ .addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative-http"))
+ .build()
+ );
+
+ specBuilder.putArtifact(
+ new CamelArtifact.Builder()
+ .groupId("org.apache.camel.k")
+ .artifactId("camel-knative")
+ .addScheme(new CamelScheme.Builder()
+ .id("knative")
+ .http(true)
+ .build())
+ .addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative-api"))
+ .addDependencies(MavenArtifact.from("org.apache.camel.k", "camel-knative-http"))
+ .build()
+ );
+ }
- {
- CamelArtifact artifact = new CamelArtifact();
- artifact.setGroupId("org.apache.camel.k");
- artifact.setArtifactId("camel-knative");
- artifact.createScheme("knative").setHttp(true);
- artifact.addDependency("org.apache.camel", "camel-cloud");
- artifact.addDependency("org.apache.camel.k", "camel-knative-api");
- artifact.addDependency("org.apache.camel.k", "camel-knative-http");
+ private static void processLoaders(CamelCatalog catalog, CamelCatalogSpec.Builder specBuilder) {
+ if (catalog.getRuntimeProvider() instanceof QuarkusRuntimeProvider) {
+ specBuilder.putLoader(
+ "yaml",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-yaml")
+ .addLanguage("yaml")
+ .putMetadata("native", "true")
+ .build()
+ );
+ specBuilder.putLoader(
+ "groovy",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-groovy")
+ .addLanguage("groovy")
+ .putMetadata("native", "false")
+ .build()
+ );
+ specBuilder.putLoader(
+ "kts",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-kotlin")
+ .addLanguage("kts")
+ .putMetadata("native", "false")
+ .build()
+ );
+ specBuilder.putLoader(
+ "js",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-js")
+ .addLanguage("js")
+ .putMetadata("native", "true")
+ .build()
+ );
+ specBuilder.putLoader(
+ "xml",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-xml")
+ .addLanguage("xml")
+ .putMetadata("native", "true")
+ .build()
+ );
+ specBuilder.putLoader(
+ "java",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-java")
+ .addLanguage("java")
+ .putMetadata("native", "false")
+ .build()
+ );
+ specBuilder.putLoader(
+ "knative-source",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-quarkus-loader-knative")
+ .addDependency("org.apache.camel.k", "camel-k-quarkus-knative")
+ .putMetadata("native", "true")
+ .build()
+ );
+ } else {
+ specBuilder.putLoader(
+ "yaml",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-yaml")
+ .addLanguage("yaml")
+ .build()
+ );
+ specBuilder.putLoader(
+ "groovy",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-groovy")
+ .addLanguage("groovy")
+ .build()
+ );
+ specBuilder.putLoader(
+ "kts",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-kotlin")
+ .addLanguage("kts")
+ .build()
+ );
+ specBuilder.putLoader(
+ "js",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-js")
+ .addLanguage("js")
+ .build()
+ );
+ specBuilder.putLoader(
+ "xml",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-xml")
+ .addLanguage("xml")
+ .build()
+ );
+ specBuilder.putLoader(
+ "java",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-java")
+ .addLanguage("java")
+ .build()
+ );
+ specBuilder.putLoader(
+ "knative-source",
+ CamelLoader.fromArtifact("org.apache.camel.k", "camel-k-loader-knative")
+ .addDependency("org.apache.camel.k", "camel-k-runtime-knative")
+ .build()
+ );
- artifacts.put(artifact.getArtifactId(), artifact);
}
-
- // ************************
- //
- // camel-k-runtime-health
- //
- // ************************
-
- {
- CamelArtifact artifact = new CamelArtifact();
- artifact.setGroupId("org.apache.camel.k");
- artifact.setArtifactId("camel-k-runtime-health");
- artifact.addDependency("org.apache.camel", "camel-servlet");
- artifact.addDependency("org.apache.camel.k", "camel-k-runtime-servlet");
-
-
- artifacts.put(artifact.getArtifactId(), artifact);
+ }
+ private static void processComponents(org.apache.camel.catalog.CamelCatalog catalog, Map<String, CamelArtifact> artifacts) {
+ for (String name : catalog.findComponentNames()) {
+ String json = catalog.componentJSonSchema(name);
+ CatalogComponentDefinition definition = CatalogSupport.unmarshallComponent(json);
+
+ artifacts.compute(definition.getArtifactId(), (key, artifact) -> {
+ CamelArtifact.Builder builder = artifactBuilder(artifact, definition);
+ builder.addJavaType(definition.getJavaType());
+
+ definition.getSchemes().map(StringUtils::trimToNull).filter(Objects::nonNull).forEach(scheme -> {
+ builder.addScheme(
+ new CamelScheme.Builder()
+ .id(scheme)
+ .http(KNOWN_HTTP_URIS.contains(scheme))
+ .passive(KNOWN_PASSIVE_URIS.contains(scheme))
+ .build());
+ });
+
+ return builder.build();
+ });
}
+ }
- // ************************
- //
- // camel-k-runtime-servlet
- //
- // ************************
+ private static void processLanguages(org.apache.camel.catalog.CamelCatalog catalog, Map<String, CamelArtifact> artifacts) {
+ for (String name : catalog.findLanguageNames()) {
+ String json = catalog.languageJSonSchema(name);
+ CatalogLanguageDefinition definition = CatalogSupport.unmarshallLanguage(json);
- {
- CamelArtifact artifact = new CamelArtifact();
- artifact.setGroupId("org.apache.camel.k");
- artifact.setArtifactId("camel-k-runtime-servlet");
- artifact.addDependency("org.apache.camel", "camel-servlet");
+ artifacts.compute(definition.getArtifactId(), (key, artifact) -> {
+ CamelArtifact.Builder builder = artifactBuilder(artifact, definition);
+ builder.addLanguage(definition.getName());
+ builder.addJavaType(definition.getJavaType());
- artifacts.put(artifact.getArtifactId(), artifact);
+ return builder.build();
+ });
}
+ }
- // ************************
- //
- // camel-k-runtime-webhook
- //
- // ************************
+ private static void processDataFormats(org.apache.camel.catalog.CamelCatalog catalog, Map<String, CamelArtifact> artifacts) {
+ for (String name : catalog.findDataFormatNames()) {
+ String json = catalog.dataFormatJSonSchema(name);
+ CatalogDataFormatDefinition definition = CatalogSupport.unmarshallDataFormat(json);
- {
- CamelArtifact artifact = new CamelArtifact();
- artifact.setGroupId("org.apache.camel.k");
- artifact.setArtifactId("camel-k-runtime-webhook");
- artifact.addDependency("org.apache.camel", "camel-webhook");
+ artifacts.compute(definition.getArtifactId(), (key, artifact) -> {
+ CamelArtifact.Builder builder = artifactBuilder(artifact, definition);
+ builder.addDataformat(definition.getName());
+ builder.addJavaType(definition.getJavaType());
- artifacts.put(artifact.getArtifactId(), artifact);
+ return builder.build();
+ });
}
+ }
- // ************************
- //
- // camel-k-runtime-knative
- //
- // ************************
-
- {
- CamelArtifact artifact = new CamelArtifact();
- artifact.setGroupId("org.apache.camel.k");
- artifact.setArtifactId("camel-k-runtime-knative");
- artifact.addDependency("org.apache.camel", "camel-cloud");
- artifact.addDependency("org.apache.camel.k", "camel-k-loader-yaml");
- artifact.addDependency("org.apache.camel.k", "camel-k-loader-knative");
- artifact.addDependency("org.apache.camel.k", "camel-knative-api");
- artifact.addDependency("org.apache.camel.k", "camel-knative");
- artifact.addDependency("org.apache.camel.k", "camel-knative-http");
-
- artifacts.put(artifact.getArtifactId(), artifact);
- }
+ private static CamelArtifact.Builder artifactBuilder(CamelArtifact artifact, CatalogDefinition definition) {
+ CamelArtifact.Builder builder = new CamelArtifact.Builder();
- // ************************
- //
- //
- //
- // ************************
+ if (artifact != null) {
+ builder.from(artifact);
+ } else {
+ Objects.requireNonNull(definition.getGroupId());
+ Objects.requireNonNull(definition.getArtifactId());
- for (String scheme: KNOWN_HTTP_URIS) {
- artifacts.values().forEach(artifact -> artifact.getScheme(scheme).ifPresent(s -> s.setHttp(true)));
+ builder.groupId(definition.getGroupId());
+ builder.artifactId(definition.getArtifactId());
}
- for (String scheme: KNOWN_PASSIVE_URIS) {
- artifacts.values().forEach(artifact -> artifact.getScheme(scheme).ifPresent(s -> s.setPassive(true)));
- }
-
- // ************************
- //
- //
- //
- // ************************
- artifacts.computeIfPresent("camel-http", (key, artifact) -> {
- artifact.addDependency("org.apache.camel", "camel-file");
- return artifact;
- });
+ return builder;
}
}
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 6f581bb..18e9388 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
@@ -16,13 +16,14 @@
*/
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.Artifact;
import org.apache.camel.k.tooling.maven.model.CamelArtifact;
import org.apache.camel.k.tooling.maven.model.CatalogProcessor;
+import org.apache.camel.k.tooling.maven.model.crd.CamelCatalogSpec;
+import org.apache.camel.k.tooling.maven.model.crd.RuntimeSpec;
import org.apache.maven.project.MavenProject;
import org.junit.jupiter.api.Test;
@@ -31,29 +32,23 @@ import static org.assertj.core.api.Assertions.assertThat;
public class CatalogProcessor3Test extends AbstractCatalogProcessorTest {
@Test
public void testAcceptHyphen() {
- CatalogProcessor3x cp3 = new CatalogProcessor3x();
-
CamelCatalog catalog = versionCamelCatalog("3.0.0.acme-123456");
- assertThat(cp3.accepts(catalog)).isTrue();
+ assertThat(new CatalogProcessor3x().accepts(catalog)).isTrue();
}
@Test
public void testAcceptEqualToLower() {
- CatalogProcessor3x cp3 = new CatalogProcessor3x();
-
CamelCatalog catalog = versionCamelCatalog("3.0.0");
- assertThat(cp3.accepts(catalog)).isTrue();
+ assertThat(new CatalogProcessor3x().accepts(catalog)).isTrue();
}
@Test
public void testAcceptLessThanLower() {
- CatalogProcessor3x cp3 = new CatalogProcessor3x();
-
CamelCatalog catalog = versionCamelCatalog("2.17.0");
- assertThat(cp3.accepts(catalog)).isFalse();
+ assertThat(new CatalogProcessor3x().accepts(catalog)).isFalse();
}
@Test
@@ -62,46 +57,33 @@ public class CatalogProcessor3Test extends AbstractCatalogProcessorTest {
CamelCatalog catalog = versionCamelCatalog("4.0.0");
- assertThat(cp3.accepts(catalog)).isFalse();
+ assertThat(new CatalogProcessor3x().accepts(catalog)).isFalse();
}
@Test
public void testAcceptMoreThanHigher() {
- CatalogProcessor3x cp3 = new CatalogProcessor3x();
-
CamelCatalog catalog = versionCamelCatalog("5.0.0");
- assertThat(cp3.accepts(catalog)).isFalse();
+ assertThat(new CatalogProcessor3x().accepts(catalog)).isFalse();
}
@Test
public void testArtifactsEnrichment() {
CatalogProcessor processor = new CatalogProcessor3x();
CamelCatalog catalog = versionCamelCatalog("3.0.0");
- Map<String, CamelArtifact> artifactMap = new HashMap<>();
- artifactMap.put("camel-http", new CamelArtifact());
+
+ RuntimeSpec runtime = new RuntimeSpec.Builder().version("1.0.0").provider("main").applicationClass("unknown").build();
+ CamelCatalogSpec.Builder builder = new CamelCatalogSpec.Builder().runtime(runtime);
assertThat(processor.accepts(catalog)).isTrue();
- processor.process(new MavenProject(), catalog, artifactMap);
+ processor.process(new MavenProject(), catalog, builder);
- assertThat(artifactMap.get("camel-k-runtime-health")).satisfies(a -> {
- assertThat(a.getDependencies()).anyMatch(
- d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-servlet")
- );
- assertThat(a.getDependencies()).anyMatch(
- d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-k-runtime-servlet")
- );
- });
- 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-k-runtime-webhook")).satisfies(a -> {
- assertThat(a.getDependencies()).anyMatch(
- d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-webhook")
- );
- });
+ CamelCatalogSpec spec = builder.build();
+ Map<String, CamelArtifact> artifactMap = spec.getArtifacts();
+
+ assertThat(artifactMap).containsKeys("camel-k-runtime-health");
+ assertThat(artifactMap).containsKeys("camel-k-runtime-servlet");
+ assertThat(artifactMap).containsKeys("camel-k-runtime-webhook");
assertThat(artifactMap.get("camel-k-runtime-knative")).satisfies(a -> {
assertThat(a.getDependencies()).anyMatch(
@@ -116,15 +98,6 @@ public class CatalogProcessor3Test extends AbstractCatalogProcessorTest {
assertThat(a.getDependencies()).anyMatch(
d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-k-loader-yaml")
);
- assertThat(a.getDependencies()).anyMatch(
- d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-cloud")
- );
- });
-
- assertThat(artifactMap.get("camel-knative")).satisfies(a -> {
- assertThat(a.getDependencies()).anyMatch(
- d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-cloud")
- );
});
assertThat(artifactMap.get("camel-http")).satisfies(a -> {
@@ -138,17 +111,21 @@ public class CatalogProcessor3Test extends AbstractCatalogProcessorTest {
public void testArtifactsDoNotContainVersion() {
CatalogProcessor processor = new CatalogProcessor3x();
CamelCatalog catalog = versionCamelCatalog("3.0.0");
- Map<String, CamelArtifact> artifactMap = new HashMap<>();
- artifactMap.put("camel-http", new CamelArtifact());
+
+ RuntimeSpec runtime = new RuntimeSpec.Builder().version("1.0.0").provider("main").applicationClass("unknown").build();
+ CamelCatalogSpec.Builder builder = new CamelCatalogSpec.Builder().runtime(runtime);
assertThat(processor.accepts(catalog)).isTrue();
- processor.process(new MavenProject(), catalog, artifactMap);
+ processor.process(new MavenProject(), catalog, builder);
+
+ CamelCatalogSpec spec = builder.build();
+ Map<String, CamelArtifact> artifactMap = spec.getArtifacts();
for (Map.Entry<String, CamelArtifact> artifact: artifactMap.entrySet()) {
- assertThat(artifact.getValue().getVersion()).isNull();
+ assertThat(artifact.getValue().getVersion()).isNotPresent();
for (Artifact dependency: artifact.getValue().getDependencies()) {
- assertThat(dependency.getVersion()).isNull();
+ assertThat(dependency.getVersion()).isNotPresent();
}
}
}