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 2021/01/26 11:55:58 UTC
[camel-k-runtime] 01/02: Catalog contains duplicate entry for same
schema (cron) #592
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 1a1aa5901ce54bddc74ced7aaf615d1c0a7af435
Author: Luca Burgazzoli <lb...@gmail.com>
AuthorDate: Tue Jan 26 11:35:38 2021 +0100
Catalog contains duplicate entry for same schema (cron) #592
---
support/camel-k-maven-plugin/pom.xml | 5 +++
.../src/it/generate-catalog/verify.groovy | 24 +++++++++++++++
.../maven/processors/CatalogProcessor3x.java | 36 ++++++++--------------
3 files changed, 42 insertions(+), 23 deletions(-)
diff --git a/support/camel-k-maven-plugin/pom.xml b/support/camel-k-maven-plugin/pom.xml
index 1ec0adf..821aecb 100644
--- a/support/camel-k-maven-plugin/pom.xml
+++ b/support/camel-k-maven-plugin/pom.xml
@@ -251,6 +251,11 @@
<artifactId>groovy-xml</artifactId>
<version>${groovy-version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ <version>${commons-collections4-version}</version>
+ </dependency>
</dependencies>
</plugin>
</plugins>
diff --git a/support/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy b/support/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy
index 5ca2797..77a6f83 100644
--- a/support/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy
+++ b/support/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy
@@ -46,6 +46,30 @@ new File(basedir, "catalog.yaml").withReader {
assert catalog.metadata.labels['camel.apache.org/runtime.version'] == runtimeVersion
+ catalog.spec.artifacts['camel-k-master'].with {
+ schemes == null
+ }
+ catalog.spec.artifacts['camel-k-cron'].with {
+ schemes == null
+ }
+ catalog.spec.artifacts['camel-k-webhook'].with {
+ schemes == null
+ }
+
+ def diff = org.apache.commons.collections4.CollectionUtils.disjunction(
+ catalog.spec.artifacts.values()
+ .findAll { it.schemes != null }
+ .collect { it.schemes.collect { it.id } }
+ .flatten(),
+ catalog.spec.artifacts.values()
+ .findAll { it.schemes != null }
+ .collect { it.schemes.collect { it.id } }
+ .flatten()
+ .unique()
+ )
+
+ assert diff.size() == 0 : "Duplicated schemes: ${diff}"
+
catalog.spec.artifacts['camel-k-knative'].with {
assert dependencies == null
assert requiredCapabilities == null
diff --git a/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java b/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java
index bb239a2..d01549c 100644
--- a/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java
+++ b/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java
@@ -115,14 +115,24 @@ public class CatalogProcessor3x implements CatalogProcessor {
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
.artifactId("camel-k-cron")
- .addScheme(new CamelScheme.Builder()
- .id("cron")
- .build())
.build()
);
specBuilder.putArtifact(
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
+ .artifactId("camel-k-webhook")
+ .build()
+ );
+ specBuilder.putArtifact(
+ new CamelArtifact.Builder()
+ .groupId("org.apache.camel.k")
+ .artifactId("camel-k-master")
+ .build()
+ );
+
+ specBuilder.putArtifact(
+ new CamelArtifact.Builder()
+ .groupId("org.apache.camel.k")
.artifactId("camel-k-kamelet")
.addScheme(new CamelScheme.Builder()
.id("kamelet")
@@ -149,26 +159,6 @@ public class CatalogProcessor3x implements CatalogProcessor {
specBuilder.putArtifact(
new CamelArtifact.Builder()
.groupId("org.apache.camel.k")
- .artifactId("camel-k-master")
- .addScheme(new CamelScheme.Builder()
- .id("master")
- .build())
- .build()
- );
- specBuilder.putArtifact(
- new CamelArtifact.Builder()
- .groupId("org.apache.camel.k")
- .artifactId("camel-k-webhook")
- .addScheme(new CamelScheme.Builder()
- .id("webhook")
- .http(true)
- .passive(true)
- .build())
- .build()
- );
- specBuilder.putArtifact(
- new CamelArtifact.Builder()
- .groupId("org.apache.camel.k")
.artifactId("camel-k-kamelet-reify")
.addScheme(new CamelScheme.Builder()
.id("kamelet-reify")