This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
The following commit(s) were added to refs/heads/main by this push:
new c90bba11 fix: use map instead of set
c90bba11 is described below
commit c90bba11447bdb7ddc17378d997d46dd2db41bcb
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Wed Mar 20 16:20:36 2024 +0100
fix: use map instead of set
---
.../camel/k/catalog/model/CamelCapability.java | 25 +++-------
.../src/it/generate-catalog/verify.groovy | 54 ++++++++--------------
.../camel/k/tooling/maven/GenerateCatalogMojo.java | 6 +--
3 files changed, 28 insertions(+), 57 deletions(-)
diff --git
a/support/camel-k-catalog-model/src/main/java/org/apache/camel/k/catalog/model/CamelCapability.java
b/support/camel-k-catalog-model/src/main/java/org/apache/camel/k/catalog/model/CamelCapability.java
index ed933ece..769e48db 100644
---
a/support/camel-k-catalog-model/src/main/java/org/apache/camel/k/catalog/model/CamelCapability.java
+++
b/support/camel-k-catalog-model/src/main/java/org/apache/camel/k/catalog/model/CamelCapability.java
@@ -18,6 +18,7 @@ package org.apache.camel.k.catalog.model;
import java.util.Collections;
import java.util.Optional;
+import java.util.SortedMap;
import java.util.SortedSet;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@@ -39,22 +40,22 @@ public interface CamelCapability {
@Value.Auxiliary
@Value.Default
@Value.NaturalOrder
- default SortedSet<Property> getRuntimeProperties() {
- return Collections.emptySortedSet();
+ default SortedMap<String, String> getRuntimeProperties() {
+ return Collections.emptySortedMap();
}
@Value.Auxiliary
@Value.Default
@Value.NaturalOrder
- default SortedSet<Property> getBuildTimeProperties() {
- return Collections.emptySortedSet();
+ default SortedMap<String, String> getBuildTimeProperties() {
+ return Collections.emptySortedMap();
}
@Value.Auxiliary
@Value.Default
@Value.NaturalOrder
- default SortedSet<Property> getMetadata() {
- return Collections.emptySortedSet();
+ default SortedMap<String, String> getMetadata() {
+ return Collections.emptySortedMap();
}
static CamelCapability forArtifact(String groupId, String artifactId) {
@@ -73,17 +74,5 @@ public interface CamelCapability {
return super.addDependencies(Artifact.from(groupId,
artifactId, classifier.get()));
}
}
-
- public Builder addRuntimeProperty(String key, String value) {
- return super.addRuntimeProperty(Property.from(key, value));
- }
-
- public Builder addBuildTimeProperty(String key, String value) {
- return super.addBuildTimeProperty(Property.from(key, value));
- }
-
- public Builder addMetadata(String key, String value) {
- return super.addMetadata(Property.from(key, value));
- }
}
}
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 749acec1..5568b822 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
@@ -49,46 +49,28 @@ new File(basedir, "catalog.yaml").withReader {
assert catalog.spec.runtime.capabilities['master'].dependencies[0].groupId
== 'org.apache.camel.k'
assert
catalog.spec.runtime.capabilities['master'].dependencies[0].artifactId ==
'camel-k-master'
// Logging properties
- assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties[0].key == 'color'
- assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties[0].value ==
'quarkus.console.color'
- assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties[1].key ==
'format'
- assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties[1].value ==
'quarkus.log.console.format'
- assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties[2].key == 'json'
- assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties[2].value ==
'quarkus.log.console.json'
- assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties[3].key ==
'jsonPrettyPrint'
- assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties[3].value ==
'quarkus.log.console.json.pretty-print'
- assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties[4].key == 'level'
- assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties[4].value ==
'quarkus.log.level'
+ assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties.color ==
'quarkus.console.color'
+ assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties.format ==
'quarkus.log.console.format'
+ assert catalog.spec.runtime.capabilities['logging'].runtimeProperties.json
== 'quarkus.log.console.json'
+ assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties.jsonPrettyPrint
== 'quarkus.log.console.json.pretty-print'
+ assert
catalog.spec.runtime.capabilities['logging'].runtimeProperties.level ==
'quarkus.log.level'
// Master properties
- assert
catalog.spec.runtime.capabilities['master'].runtimeProperties[0].key ==
'labelKeyFormat'
- assert
catalog.spec.runtime.capabilities['master'].runtimeProperties[0].value ==
'quarkus.camel.cluster.kubernetes.labels.\"%s\"'
- assert
catalog.spec.runtime.capabilities['master'].runtimeProperties[1].key ==
'resourceName'
- assert
catalog.spec.runtime.capabilities['master'].runtimeProperties[1].value ==
'quarkus.camel.cluster.kubernetes.resource-name'
- assert
catalog.spec.runtime.capabilities['master'].runtimeProperties[2].key ==
'resourceType'
- assert
catalog.spec.runtime.capabilities['master'].runtimeProperties[2].value ==
'quarkus.camel.cluster.kubernetes.resource-type'
- assert
catalog.spec.runtime.capabilities['master'].buildTimeProperties[0].key ==
'enabled'
- assert
catalog.spec.runtime.capabilities['master'].buildTimeProperties[0].value ==
'quarkus.camel.cluster.kubernetes.enabled'
+ assert
catalog.spec.runtime.capabilities['master'].runtimeProperties.labelKeyFormat ==
'quarkus.camel.cluster.kubernetes.labels.\"%s\"'
+ assert
catalog.spec.runtime.capabilities['master'].runtimeProperties.resourceName ==
'quarkus.camel.cluster.kubernetes.resource-name'
+ assert
catalog.spec.runtime.capabilities['master'].runtimeProperties.resourceType ==
'quarkus.camel.cluster.kubernetes.resource-type'
+ assert
catalog.spec.runtime.capabilities['master'].buildTimeProperties.enabled ==
'quarkus.camel.cluster.kubernetes.enabled'
// Telemetry properties
- assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties[0].key ==
'endpoint'
- assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties[0].value ==
'quarkus.opentelemetry.tracer.exporter.otlp.endpoint'
- assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties[1].key ==
'sampler'
- assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties[1].value ==
'quarkus.opentelemetry.tracer.sampler'
- assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties[2].key ==
'samplerParentBased'
- assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties[2].value ==
'quarkus.opentelemetry.tracer.sampler.parent-based'
- assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties[3].key ==
'samplerRatio'
- assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties[3].value ==
'quarkus.opentelemetry.tracer.sampler.ratio'
- assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties[4].key ==
'serviceName'
- assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties[4].value ==
'quarkus.opentelemetry.tracer.resource-attributes'
+ assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties.endpoint ==
'quarkus.opentelemetry.tracer.exporter.otlp.endpoint'
+ assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties.sampler ==
'quarkus.opentelemetry.tracer.sampler'
+ assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties.samplerParentBased
== 'quarkus.opentelemetry.tracer.sampler.parent-based'
+ assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties.samplerRatio
== 'quarkus.opentelemetry.tracer.sampler.ratio'
+ assert
catalog.spec.runtime.capabilities['telemetry'].runtimeProperties.serviceName ==
'quarkus.opentelemetry.tracer.resource-attributes'
// Service Binding properties
- assert
catalog.spec.runtime.capabilities['service-binding'].runtimeProperties[0].key
== 'enabled'
- assert
catalog.spec.runtime.capabilities['service-binding'].runtimeProperties[0].value
== 'quarkus.kubernetes-service-binding.enabled'
+ assert
catalog.spec.runtime.capabilities['service-binding'].runtimeProperties.enabled
== 'quarkus.kubernetes-service-binding.enabled'
// Health properties
- assert catalog.spec.runtime.capabilities['health'].metadata[0].key ==
'defaultLivenessProbePath'
- assert catalog.spec.runtime.capabilities['health'].metadata[0].value ==
'/q/health/live'
- assert catalog.spec.runtime.capabilities['health'].metadata[1].key ==
'defaultReadinessProbePath'
- assert catalog.spec.runtime.capabilities['health'].metadata[1].value ==
'/q/health/ready'
- assert catalog.spec.runtime.capabilities['health'].metadata[2].key ==
'defaultStartupProbePath'
- assert catalog.spec.runtime.capabilities['health'].metadata[2].value ==
'/q/health/started'
+ assert
catalog.spec.runtime.capabilities['health'].metadata.defaultLivenessProbePath
== '/q/health/live'
+ assert
catalog.spec.runtime.capabilities['health'].metadata.defaultReadinessProbePath
== '/q/health/ready'
+ assert
catalog.spec.runtime.capabilities['health'].metadata.defaultStartupProbePath ==
'/q/health/started'
assert catalog.spec.loaders['groovy'].groupId == 'org.apache.camel.quarkus'
assert catalog.spec.loaders['groovy'].artifactId ==
'camel-quarkus-groovy-dsl'
diff --git
a/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java
b/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java
index 2e76316c..973535d2 100644
---
a/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java
+++
b/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java
@@ -585,13 +585,13 @@ public class GenerateCatalogMojo extends AbstractMojo {
if (capabilitiesExclusionList != null &&
!capabilitiesExclusionList.contains(name)) {
CamelCapability.Builder capBuilder = new CamelCapability.Builder();
runtimeProperties.forEach(property -> {
- capBuilder.addRuntimeProperty(property.getKey(),
property.getValue());
+ capBuilder.putRuntimeProperty(property.getKey(),
property.getValue());
});
buildTimeProperties.forEach(property -> {
- capBuilder.addBuildTimeProperty(property.getKey(),
property.getValue());
+ capBuilder.putBuildTimeProperty(property.getKey(),
property.getValue());
});
metadataProperties.forEach(property -> {
- capBuilder.addMetadata(property.getKey(), property.getValue());
+ capBuilder.putMetadata(property.getKey(), property.getValue());
});
artifacts.forEach(artifact -> {
capBuilder.addDependency(artifact.getGroupId(),
artifact.getArtifactId(), artifact.getClassifier());