You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/05/03 13:14:08 UTC
[camel-kamelets] 01/01: Validate the parameters in a Kamelet by looking at catalog
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch fix-889-2
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
commit 2067220a6f2f44490ec761d259099d8fb402838c
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue May 3 15:11:25 2022 +0200
Validate the parameters in a Kamelet by looking at catalog
---
library/camel-kamelets-catalog/pom.xml | 12 ++++++++++++
.../apache/camel/kamelets/catalog/KameletsCatalogTest.java | 7 +++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/library/camel-kamelets-catalog/pom.xml b/library/camel-kamelets-catalog/pom.xml
index 0bb8816f..b7f18cea 100644
--- a/library/camel-kamelets-catalog/pom.xml
+++ b/library/camel-kamelets-catalog/pom.xml
@@ -19,6 +19,18 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>11</source>
+ <target>11</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
<parent>
<groupId>org.apache.camel.kamelets</groupId>
diff --git a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
index 7db7c4f2..affbe6e2 100644
--- a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
+++ b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
@@ -31,8 +31,10 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
public class KameletsCatalogTest {
@@ -131,6 +133,8 @@ public class KameletsCatalogTest {
@Test
void testOptionsParams() throws Exception {
+ String[] bannedDeps = {"mvn:", "camel:gson", "camel:core", "camel:kamelet", "github:apache.camel-kamelets:camel-kamelets-utils:main-SNAPSHOT"};
+ List<String> bannedDepsList = Arrays.asList(bannedDeps);
DefaultCamelCatalog cc = new DefaultCamelCatalog();
List<String> names = catalog.getKameletsName();
for (String name:
@@ -139,8 +143,7 @@ public class KameletsCatalogTest {
Map<String,Object> f = (Map) kd.get("from");
Map<String,Object> p = (Map) f.get("parameters");
List<String> deps = catalog.getKameletDependencies(name).stream()
- .filter(d -> !d.contains("mvn:") && !d.contains("camel:gson") && !d.contains("camel:core") && !d.contains("camel:kamelet") && !d.contains("github:apache.camel-kamelets:camel-kamelets-utils:main-SNAPSHOT"))
- .collect(Collectors.toList());
+ .filter(Predicate.not(bannedDepsList::contains)).collect(Collectors.toList());
String cleanName;
if (!deps.isEmpty()) {
if (deps.get(0).equals("camel:jackson") && deps.size() > 1) {