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/03/24 16:16:18 UTC
[camel-k-runtime] 04/07: Review dependencies
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 abdb7ab033338db59275a648f0c296b579434800
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Fri Mar 20 18:24:13 2020 +0100
Review dependencies
---
camel-k-loader-groovy/pom.xml | 59 ++++--------
camel-k-loader-java/pom.xml | 38 +++-----
.../camel/k/loader/java/JavaSourceLoader.java | 9 +-
camel-k-loader-js/pom.xml | 44 +++------
.../camel/k/loader/js/JavaScriptSourceLoader.java | 6 +-
camel-k-loader-kotlin/pom.xml | 48 +++-------
camel-k-loader-xml/pom.xml | 32 ++-----
camel-k-loader-yaml/camel-k-loader-yaml/pom.xml | 58 +-----------
.../camel/k/loader/yaml/YamlSourceLoader.java | 6 ++
.../camel/k/loader/yaml/DefinitionsTest.groovy | 21 ++---
.../apache/camel/k/loader/yaml/TestSupport.groovy | 3 +-
camel-k-main/camel-k-runtime-health/pom.xml | 55 +-----------
.../camel/k/health/HealthCustomizerTest.java | 2 +-
camel-k-main/camel-k-runtime-main/pom.xml | 34 ++++---
.../js/quarkus/deployment/ExtensionTest.java | 5 +-
.../xml/quarkus/deployment/ExtensionTest.java | 5 +-
.../yaml/quarkus/deployment/ExtensionTest.java | 5 +-
camel-k-runtime-core/pom.xml | 46 +---------
.../src/main/java/org/apache/camel/k/Sources.java | 18 ++--
.../apache/camel/k/support/PropertiesSupport.java | 5 +-
.../org/apache/camel/k/support/StringSupport.java | 69 ++++++++++++++
camel-k-runtime-cron/pom.xml | 55 ++----------
camel-k-runtime-http/pom.xml | 56 +-----------
.../k/http/PlatformHttpServiceCustomizerTest.java | 2 +-
camel-k-runtime-knative/pom.xml | 59 ++----------
.../knative/KnativeSourceRoutesLoaderTest.java | 7 +-
camel-k-runtime-master/pom.xml | 50 ++---------
camel-k-runtime-webhook/pom.xml | 67 +++-----------
.../camel/k/webhook/DummyWebhookComponent.java | 9 ++
.../org/apache/camel/k/webhook/WebhookTest.java | 48 +++++-----
.../src/test/resources/webhook.js | 3 +-
camel-knative/camel-knative-http/pom.xml | 69 +-------------
.../component/knative/http/KnativeHttpTest.java | 2 +-
camel-knative/camel-knative/pom.xml | 89 +-----------------
.../camel/component/knative/KnativeProducer.java | 7 +-
.../component/knative/ce/CloudEventProcessors.java | 5 +-
pom.xml | 87 +++++++++++++++++-
tooling/camel-k-maven-plugin/pom.xml | 6 --
.../camel/k/tooling/maven/GenerateRestXML.java | 10 +--
.../camel-k-test}/pom.xml | 100 ++++++---------------
.../apache/camel/k/test/AvailablePortFinder.java | 84 +++++++++++++++++
tooling/pom.xml | 1 +
42 files changed, 478 insertions(+), 906 deletions(-)
diff --git a/camel-k-loader-groovy/pom.xml b/camel-k-loader-groovy/pom.xml
index de5c0f3..42b52b7 100644
--- a/camel-k-loader-groovy/pom.xml
+++ b/camel-k-loader-groovy/pom.xml
@@ -57,7 +57,6 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
- <version>${groovy.version}</version>
</dependency>
<dependency>
@@ -71,11 +70,24 @@
<scope>provided</scope>
</dependency>
- <!-- ******************************* -->
- <!-- test deps :: camel -->
- <!-- ******************************* -->
+ <!-- ****************************** -->
+ <!-- -->
+ <!-- TESTS -->
+ <!-- -->
+ <!-- ****************************** -->
<dependency>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-main</artifactId>
<scope>test</scope>
@@ -111,27 +123,6 @@
<scope>test</scope>
</dependency>
- <!-- ******************************* -->
- <!-- test deps :: misc -->
- <!-- ******************************* -->
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-dbcp2</artifactId>
- <version>${commons-dbcp2.version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- ******************************* -->
- <!-- test deps -->
- <!-- ******************************* -->
-
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-test</artifactId>
- <version>${groovy.version}</version>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
@@ -150,24 +141,12 @@
</dependency>
<dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-dbcp2</artifactId>
+ <version>${commons-dbcp2.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/camel-k-loader-java/pom.xml b/camel-k-loader-java/pom.xml
index 304b90f..0302e8c 100644
--- a/camel-k-loader-java/pom.xml
+++ b/camel-k-loader-java/pom.xml
@@ -57,6 +57,18 @@
<scope>provided</scope>
</dependency>
+ <!-- ****************************** -->
+ <!-- -->
+ <!-- TESTS -->
+ <!-- -->
+ <!-- ****************************** -->
+
+ <dependency>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-main</artifactId>
@@ -97,32 +109,6 @@
<artifactId>camel-direct</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/camel-k-loader-java/src/main/java/org/apache/camel/k/loader/java/JavaSourceLoader.java b/camel-k-loader-java/src/main/java/org/apache/camel/k/loader/java/JavaSourceLoader.java
index bdecfe5..42009ae 100644
--- a/camel-k-loader-java/src/main/java/org/apache/camel/k/loader/java/JavaSourceLoader.java
+++ b/camel-k-loader-java/src/main/java/org/apache/camel/k/loader/java/JavaSourceLoader.java
@@ -17,7 +17,6 @@
package org.apache.camel.k.loader.java;
import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
@@ -27,8 +26,8 @@ import org.apache.camel.k.Runtime;
import org.apache.camel.k.Source;
import org.apache.camel.k.SourceLoader;
import org.apache.camel.k.annotation.Loader;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.camel.k.support.StringSupport;
+import org.apache.camel.util.IOHelper;
import org.joor.Reflect;
@Loader(value = "java")
@@ -43,7 +42,7 @@ public class JavaSourceLoader implements SourceLoader {
@Override
public Result load(Runtime runtime, Source source) throws Exception {
try (InputStream is = source.resolveAsInputStream(runtime.getCamelContext())) {
- final String content = IOUtils.toString(is, StandardCharsets.UTF_8);
+ final String content = IOHelper.loadText(is);
final String name = determineQualifiedName(source, content);
final Reflect compiled = Reflect.compile(name, content);
final Object instance = compiled.create().get();
@@ -53,7 +52,7 @@ public class JavaSourceLoader implements SourceLoader {
}
private static String determineQualifiedName(Source source, String content) {
- String name = StringUtils.removeEnd(source.getName(), ".java");
+ String name = StringSupport.substringBefore(source.getName(), ".java");
Matcher matcher = PACKAGE_PATTERN.matcher(content);
if (matcher.find()) {
diff --git a/camel-k-loader-js/pom.xml b/camel-k-loader-js/pom.xml
index fcf2e83..04daef8 100644
--- a/camel-k-loader-js/pom.xml
+++ b/camel-k-loader-js/pom.xml
@@ -57,9 +57,17 @@
<scope>provided</scope>
</dependency>
- <!-- ******************************* -->
- <!-- test deps :: camel -->
- <!-- ******************************* -->
+ <!-- ****************************** -->
+ <!-- -->
+ <!-- TESTS -->
+ <!-- -->
+ <!-- ****************************** -->
+
+ <dependency>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
@@ -101,36 +109,6 @@
<artifactId>camel-mock</artifactId>
<scope>test</scope>
</dependency>
-
- <!-- ******************************* -->
- <!-- test deps -->
- <!-- ******************************* -->
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/JavaScriptSourceLoader.java b/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/JavaScriptSourceLoader.java
index d99d065..92ad3ae 100644
--- a/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/JavaScriptSourceLoader.java
+++ b/camel-k-loader-js/src/main/java/org/apache/camel/k/loader/js/JavaScriptSourceLoader.java
@@ -17,7 +17,6 @@
package org.apache.camel.k.loader.js;
import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
@@ -30,7 +29,7 @@ import org.apache.camel.k.SourceLoader;
import org.apache.camel.k.annotation.Loader;
import org.apache.camel.k.loader.js.dsl.IntegrationConfiguration;
import org.apache.camel.support.LifecycleStrategySupport;
-import org.apache.commons.io.IOUtils;
+import org.apache.camel.util.IOHelper;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Value;
@@ -56,7 +55,8 @@ public class JavaScriptSourceLoader implements SourceLoader {
// configure bindings
bindings.putMember("__dsl", new IntegrationConfiguration(this));
- final String script = IOUtils.toString(is, StandardCharsets.UTF_8);
+
+ final String script = IOHelper.loadText(is);
final String wrappedScript = "with (__dsl) { " + script + " }";
context.eval(LANGUAGE_ID, wrappedScript);
diff --git a/camel-k-loader-kotlin/pom.xml b/camel-k-loader-kotlin/pom.xml
index eb911f7..f79338f 100644
--- a/camel-k-loader-kotlin/pom.xml
+++ b/camel-k-loader-kotlin/pom.xml
@@ -77,9 +77,17 @@
<scope>provided</scope>
</dependency>
- <!-- ******************************* -->
- <!-- test deps :: camel -->
- <!-- ******************************* -->
+ <!-- ****************************** -->
+ <!-- -->
+ <!-- TESTS -->
+ <!-- -->
+ <!-- ****************************** -->
+
+ <dependency>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
@@ -117,46 +125,12 @@
<scope>test</scope>
</dependency>
- <!-- ******************************* -->
- <!-- test deps :: misc -->
- <!-- ******************************* -->
-
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>${commons-dbcp2.version}</version>
<scope>test</scope>
</dependency>
-
- <!-- ******************************* -->
- <!-- test deps -->
- <!-- ******************************* -->
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/camel-k-loader-xml/pom.xml b/camel-k-loader-xml/pom.xml
index 1bf42e4..496b2be 100644
--- a/camel-k-loader-xml/pom.xml
+++ b/camel-k-loader-xml/pom.xml
@@ -73,6 +73,12 @@
<!-- ****************************** -->
<dependency>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-undertow</artifactId>
<scope>test</scope>
@@ -102,32 +108,6 @@
<artifactId>camel-direct</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
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 fd1c30e..5f12848 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/pom.xml
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/pom.xml
@@ -45,11 +45,6 @@
</dependency>
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
- </dependency>
-
- <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
@@ -76,13 +71,14 @@
<!-- ****************************** -->
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-mock</artifactId>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
+ <artifactId>camel-mock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -102,13 +98,6 @@
</dependency>
<dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-test</artifactId>
- <version>${groovy.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock.version}</version>
@@ -124,33 +113,6 @@
</exclusion>
</exclusions>
</dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
@@ -185,18 +147,6 @@
</goals>
</execution>
</executions>
- <dependencies>
- <dependency>
- <groupId>com.squareup</groupId>
- <artifactId>javapoet</artifactId>
- <version>${javapoet.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-text</artifactId>
- <version>${commons-text.version}</version>
- </dependency>
- </dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/main/java/org/apache/camel/k/loader/yaml/YamlSourceLoader.java b/camel-k-loader-yaml/camel-k-loader-yaml/src/main/java/org/apache/camel/k/loader/yaml/YamlSourceLoader.java
index 5409cd6..1448b70 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/src/main/java/org/apache/camel/k/loader/yaml/YamlSourceLoader.java
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/main/java/org/apache/camel/k/loader/yaml/YamlSourceLoader.java
@@ -16,7 +16,9 @@
*/
package org.apache.camel.k.loader.yaml;
+import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -90,6 +92,10 @@ public class YamlSourceLoader implements SourceLoader {
return mapper;
}
+ final RouteBuilder builder(String content) {
+ return builder(new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)));
+ }
+
final RouteBuilder builder(InputStream is) {
return new RouteBuilder() {
@Override
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/DefinitionsTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/DefinitionsTest.groovy
index 0fe243d..f34daba 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/DefinitionsTest.groovy
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/DefinitionsTest.groovy
@@ -23,9 +23,6 @@ import org.apache.camel.model.SplitDefinition
import org.apache.camel.model.ToDefinition
import org.apache.camel.model.language.SimpleExpression
import org.apache.camel.model.language.TokenizerExpression
-import org.apache.commons.io.IOUtils
-
-import java.nio.charset.StandardCharsets
class DefinitionsTest extends TestSupport {
@@ -43,9 +40,8 @@ class DefinitionsTest extends TestSupport {
'''.stripMargin('|')
def camelContext = new DefaultCamelContext()
- def istream = IOUtils.toInputStream(content, StandardCharsets.UTF_8)
when:
- camelContext.addRoutes(new YamlSourceLoader().builder(istream))
+ camelContext.addRoutes(new YamlSourceLoader().builder(content))
then:
camelContext.routeDefinitions[0].id == 'my-route-id'
camelContext.routeDefinitions[0].group == 'my-route-group'
@@ -82,9 +78,8 @@ class DefinitionsTest extends TestSupport {
'''.stripMargin('|')
def camelContext = new DefaultCamelContext()
- def istream = IOUtils.toInputStream(content, StandardCharsets.UTF_8)
when:
- camelContext.addRoutes(new YamlSourceLoader().builder(istream))
+ camelContext.addRoutes(new YamlSourceLoader().builder(content))
then:
camelContext.routeDefinitions[0].input.endpointUri == 'direct:start'
@@ -128,9 +123,8 @@ class DefinitionsTest extends TestSupport {
'''.stripMargin('|')
def camelContext = new DefaultCamelContext()
- def istream = IOUtils.toInputStream(content, StandardCharsets.UTF_8)
when:
- camelContext.addRoutes(new YamlSourceLoader().builder(istream))
+ camelContext.addRoutes(new YamlSourceLoader().builder(content))
then:
camelContext.routeDefinitions[0].input.endpointUri == 'direct:start'
camelContext.routeDefinitions[0].outputs.size() == 2
@@ -167,9 +161,8 @@ class DefinitionsTest extends TestSupport {
'''.stripMargin('|')
def camelContext = new DefaultCamelContext()
- def istream = IOUtils.toInputStream(content, StandardCharsets.UTF_8)
when:
- camelContext.addRoutes(new YamlSourceLoader().builder(istream))
+ camelContext.addRoutes(new YamlSourceLoader().builder(content))
then:
camelContext.routeDefinitions[0].input.endpointUri == 'direct:start'
camelContext.routeDefinitions[0].outputs.size() == 1
@@ -202,9 +195,8 @@ class DefinitionsTest extends TestSupport {
'''.stripMargin('|')
def camelContext = new DefaultCamelContext()
- def istream = IOUtils.toInputStream(content, StandardCharsets.UTF_8)
when:
- camelContext.addRoutes(new YamlSourceLoader().builder(istream))
+ camelContext.addRoutes(new YamlSourceLoader().builder(content))
then:
camelContext.routeDefinitions[0].input.endpointUri == 'direct:start'
camelContext.routeDefinitions[0].outputs.size() == 2
@@ -241,9 +233,8 @@ class DefinitionsTest extends TestSupport {
'''.stripMargin('|')
def camelContext = new DefaultCamelContext()
- def istream = IOUtils.toInputStream(content, StandardCharsets.UTF_8)
when:
- camelContext.addRoutes(new YamlSourceLoader().builder(istream))
+ camelContext.addRoutes(new YamlSourceLoader().builder(content))
then:
camelContext.routeDefinitions[0].input.endpointUri == 'direct:start'
camelContext.routeDefinitions[0].outputs.size() == 1
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/TestSupport.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/TestSupport.groovy
index fea7a41..1b1c4d1 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/TestSupport.groovy
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/TestSupport.groovy
@@ -22,7 +22,6 @@ import org.apache.camel.CamelContext
import org.apache.camel.component.mock.MockEndpoint
import org.apache.camel.impl.DefaultCamelContext
import org.apache.camel.k.loader.yaml.parser.StepParser
-import org.apache.commons.io.IOUtils
import spock.lang.Specification
import java.nio.charset.StandardCharsets
@@ -48,7 +47,7 @@ class TestSupport extends Specification {
static CamelContext startContext(String content, Map<String, Object> beans) {
return startContext(
- IOUtils.toInputStream(content.stripMargin(), StandardCharsets.UTF_8),
+ new ByteArrayInputStream(content.stripMargin().getBytes(StandardCharsets.UTF_8)),
beans
)
}
diff --git a/camel-k-main/camel-k-runtime-health/pom.xml b/camel-k-main/camel-k-runtime-health/pom.xml
index 07624b3..2edea97 100644
--- a/camel-k-main/camel-k-runtime-health/pom.xml
+++ b/camel-k-main/camel-k-runtime-health/pom.xml
@@ -61,8 +61,8 @@
<!-- ****************************** -->
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -75,57 +75,6 @@
<artifactId>camel-mock</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.rest-assured</groupId>
- <artifactId>rest-assured</artifactId>
- <version>${rest-assured.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-jcl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/camel-k-main/camel-k-runtime-health/src/test/java/org/apache/camel/k/health/HealthCustomizerTest.java b/camel-k-main/camel-k-runtime-health/src/test/java/org/apache/camel/k/health/HealthCustomizerTest.java
index caf512e..a2fb9ab 100644
--- a/camel-k-main/camel-k-runtime-health/src/test/java/org/apache/camel/k/health/HealthCustomizerTest.java
+++ b/camel-k-main/camel-k-runtime-health/src/test/java/org/apache/camel/k/health/HealthCustomizerTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.k.Runtime;
import org.apache.camel.k.http.PlatformHttpServiceContextCustomizer;
-import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.k.test.AvailablePortFinder;
import org.apache.camel.util.ObjectHelper;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
diff --git a/camel-k-main/camel-k-runtime-main/pom.xml b/camel-k-main/camel-k-runtime-main/pom.xml
index d981b3b..369d308 100644
--- a/camel-k-main/camel-k-runtime-main/pom.xml
+++ b/camel-k-main/camel-k-runtime-main/pom.xml
@@ -72,6 +72,22 @@
<!-- ****************************** -->
<dependency>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-undertow</artifactId>
<scope>test</scope>
@@ -122,24 +138,14 @@
<artifactId>camel-k-loader-java</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
<dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-loader-groovy</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-loader-kotlin</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/camel-k-quarkus/camel-k-quarkus-loader-js/it/src/test/java/org/apache/camel/k/loader/js/quarkus/deployment/ExtensionTest.java b/camel-k-quarkus/camel-k-quarkus-loader-js/it/src/test/java/org/apache/camel/k/loader/js/quarkus/deployment/ExtensionTest.java
index 543da3e..391e23f 100644
--- a/camel-k-quarkus/camel-k-quarkus-loader-js/it/src/test/java/org/apache/camel/k/loader/js/quarkus/deployment/ExtensionTest.java
+++ b/camel-k-quarkus/camel-k-quarkus-loader-js/it/src/test/java/org/apache/camel/k/loader/js/quarkus/deployment/ExtensionTest.java
@@ -18,14 +18,13 @@ package org.apache.camel.k.loader.js.quarkus.deployment;
import java.io.IOException;
import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
import javax.ws.rs.core.MediaType;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.path.json.JsonPath;
-import org.apache.commons.io.IOUtils;
+import org.apache.camel.util.IOHelper;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
@@ -37,7 +36,7 @@ public class ExtensionTest {
String code;
try (InputStream is = ExtensionTest.class.getResourceAsStream("/routes.js")) {
- code = IOUtils.toString(is, StandardCharsets.UTF_8);
+ code = IOHelper.loadText(is);
}
JsonPath p = RestAssured.given()
diff --git a/camel-k-quarkus/camel-k-quarkus-loader-xml/it/src/test/java/org/apache/camel/k/loader/xml/quarkus/deployment/ExtensionTest.java b/camel-k-quarkus/camel-k-quarkus-loader-xml/it/src/test/java/org/apache/camel/k/loader/xml/quarkus/deployment/ExtensionTest.java
index 8ee235b..b3ab341 100644
--- a/camel-k-quarkus/camel-k-quarkus-loader-xml/it/src/test/java/org/apache/camel/k/loader/xml/quarkus/deployment/ExtensionTest.java
+++ b/camel-k-quarkus/camel-k-quarkus-loader-xml/it/src/test/java/org/apache/camel/k/loader/xml/quarkus/deployment/ExtensionTest.java
@@ -18,14 +18,13 @@ package org.apache.camel.k.loader.xml.quarkus.deployment;
import java.io.IOException;
import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
import javax.ws.rs.core.MediaType;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.path.json.JsonPath;
-import org.apache.commons.io.IOUtils;
+import org.apache.camel.util.IOHelper;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
@@ -37,7 +36,7 @@ public class ExtensionTest {
String code;
try (InputStream is = ExtensionTest.class.getResourceAsStream("/routes.xml")) {
- code = IOUtils.toString(is, StandardCharsets.UTF_8);
+ code = IOHelper.loadText(is);
}
JsonPath p = RestAssured.given()
diff --git a/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/src/test/java/org/apache/camel/k/loader/yaml/quarkus/deployment/ExtensionTest.java b/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/src/test/java/org/apache/camel/k/loader/yaml/quarkus/deployment/ExtensionTest.java
index 963a023..46692d2 100644
--- a/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/src/test/java/org/apache/camel/k/loader/yaml/quarkus/deployment/ExtensionTest.java
+++ b/camel-k-quarkus/camel-k-quarkus-loader-yaml/it/src/test/java/org/apache/camel/k/loader/yaml/quarkus/deployment/ExtensionTest.java
@@ -18,14 +18,13 @@ package org.apache.camel.k.loader.yaml.quarkus.deployment;
import java.io.IOException;
import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
import javax.ws.rs.core.MediaType;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.path.json.JsonPath;
-import org.apache.commons.io.IOUtils;
+import org.apache.camel.util.IOHelper;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
@@ -37,7 +36,7 @@ public class ExtensionTest {
String code;
try (InputStream is = ExtensionTest.class.getResourceAsStream("/routes.yaml")) {
- code = IOUtils.toString(is, StandardCharsets.UTF_8);
+ code = IOHelper.loadText(is);
}
JsonPath p = RestAssured.given()
diff --git a/camel-k-runtime-core/pom.xml b/camel-k-runtime-core/pom.xml
index 46968f6..97aaa00 100644
--- a/camel-k-runtime-core/pom.xml
+++ b/camel-k-runtime-core/pom.xml
@@ -36,27 +36,10 @@
<!-- ****************************** -->
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
-
- <dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${commons-lang.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>${commons-io.version}</version>
- </dependency>
-
<!-- ****************************** -->
<!-- -->
<!-- TESTS -->
@@ -64,36 +47,11 @@
<!-- ****************************** -->
<dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Sources.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Sources.java
index 9a9054d..976d652 100644
--- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Sources.java
+++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Sources.java
@@ -29,11 +29,11 @@ import java.util.UUID;
import java.util.zip.GZIPInputStream;
import org.apache.camel.CamelContext;
+import org.apache.camel.k.support.StringSupport;
import org.apache.camel.spi.ClassResolver;
import org.apache.camel.support.ResourceHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.URISupport;
-import org.apache.commons.lang3.StringUtils;
public final class Sources {
private Sources() {
@@ -117,13 +117,13 @@ public final class Sources {
private final boolean compressed;
private URI(String uri) throws Exception {
- final String location = StringUtils.substringBefore(uri, "?");
+ final String location = StringSupport.substringBefore(uri, "?");
if (!location.startsWith(Constants.SCHEME_PREFIX_CLASSPATH) && !location.startsWith(Constants.SCHEME_PREFIX_FILE)) {
throw new IllegalArgumentException("No valid resource format, expected scheme:path, found " + uri);
}
- final String query = StringUtils.substringAfter(uri, "?");
+ final String query = StringSupport.substringAfter(uri, "?");
final Map<String, Object> params = URISupport.parseQuery(query);
final String languageName = (String) params.get("language");
final String compression = (String) params.get("compression");
@@ -132,8 +132,8 @@ public final class Sources {
String language = languageName;
if (ObjectHelper.isEmpty(language)) {
- language = StringUtils.substringAfterLast(location, ":");
- language = StringUtils.substringAfterLast(language, ".");
+ language = StringSupport.substringAfterLast(location, ":");
+ language = StringSupport.substringAfterLast(language, ".");
}
if (ObjectHelper.isEmpty(language)) {
throw new IllegalArgumentException("Unknown language " + language);
@@ -141,11 +141,11 @@ public final class Sources {
String name = (String) params.get("name");
if (name == null) {
- name = StringUtils.substringAfter(location, ":");
- name = StringUtils.substringBeforeLast(name, ".");
+ name = StringSupport.substringAfter(location, ":");
+ name = StringSupport.substringBeforeLast(name, ".");
if (name.contains("/")) {
- name = StringUtils.substringAfterLast(name, "/");
+ name = StringSupport.substringAfterLast(name, "/");
}
}
@@ -154,7 +154,7 @@ public final class Sources {
this.language = language;
this.loader = loader;
this.interceptors = interceptors != null ? Arrays.asList(interceptors.split(",", -1)) : Collections.emptyList();
- this.compressed = Boolean.valueOf(compression);
+ this.compressed = Boolean.parseBoolean(compression);
}
@Override
diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java
index 1459819..096ca68 100644
--- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java
+++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java
@@ -37,7 +37,6 @@ import org.apache.camel.k.Constants;
import org.apache.camel.spi.PropertiesComponent;
import org.apache.camel.support.PropertyBindingSupport;
import org.apache.camel.util.ObjectHelper;
-import org.apache.commons.io.FilenameUtils;
public final class PropertiesSupport {
private PropertiesSupport() {
@@ -127,9 +126,7 @@ public final class PropertiesSupport {
Objects.requireNonNull(attrs);
final String path = file.toFile().getAbsolutePath();
- final String ext = FilenameUtils.getExtension(path);
-
- if (Objects.equals("properties", ext)) {
+ if (path.endsWith(".properties")) {
locations.add(path);
}
diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/StringSupport.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/StringSupport.java
new file mode 100644
index 0000000..1ecaf2b
--- /dev/null
+++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/StringSupport.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.k.support;
+
+import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.StringHelper;
+
+public final class StringSupport {
+ private StringSupport() {
+ }
+
+ public static String substringBefore(final String str, final String separator) {
+ if (ObjectHelper.isEmpty(str) || separator == null) {
+ return str;
+ }
+ if (separator.isEmpty()) {
+ return "";
+ }
+ final int pos = str.indexOf(separator);
+ if (pos == -1) {
+ return str;
+ }
+ return str.substring(0, pos);
+ }
+
+ public static String substringAfter(final String str, final String separator) {
+ String answer = StringHelper.after(str, separator);
+ return answer != null ? answer : "";
+ }
+
+ public static String substringAfterLast(final String str, final String separator) {
+ if (ObjectHelper.isEmpty(str)) {
+ return str;
+ }
+ if (ObjectHelper.isEmpty(separator)) {
+ return "";
+ }
+ final int pos = str.lastIndexOf(separator);
+ if (pos == -1 || pos == str.length() - separator.length()) {
+ return "";
+ }
+ return str.substring(pos + separator.length());
+ }
+
+ public static String substringBeforeLast(final String str, final String separator) {
+ if (ObjectHelper.isEmpty(str) || ObjectHelper.isEmpty(separator)) {
+ return str;
+ }
+ final int pos = str.lastIndexOf(separator);
+ if (pos == -1) {
+ return str;
+ }
+ return str.substring(0, pos);
+ }
+}
diff --git a/camel-k-runtime-cron/pom.xml b/camel-k-runtime-cron/pom.xml
index f352a12..7ba8429 100644
--- a/camel-k-runtime-cron/pom.xml
+++ b/camel-k-runtime-cron/pom.xml
@@ -66,25 +66,11 @@
<!-- ****************************** -->
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-log</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-main</artifactId>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-loader-js</artifactId>
@@ -97,40 +83,13 @@
</dependency>
<dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>${log4j2.version}</version>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-log</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-mock</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/camel-k-runtime-http/pom.xml b/camel-k-runtime-http/pom.xml
index aabec84..dff4e07 100644
--- a/camel-k-runtime-http/pom.xml
+++ b/camel-k-runtime-http/pom.xml
@@ -62,60 +62,8 @@
<!-- ****************************** -->
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>io.rest-assured</groupId>
- <artifactId>rest-assured</artifactId>
- <version>${rest-assured.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-jcl</artifactId>
- <version>${log4j2.version}</version>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/camel-k-runtime-http/src/test/java/org/apache/camel/k/http/PlatformHttpServiceCustomizerTest.java b/camel-k-runtime-http/src/test/java/org/apache/camel/k/http/PlatformHttpServiceCustomizerTest.java
index 61435ac..6864b1b 100644
--- a/camel-k-runtime-http/src/test/java/org/apache/camel/k/http/PlatformHttpServiceCustomizerTest.java
+++ b/camel-k-runtime-http/src/test/java/org/apache/camel/k/http/PlatformHttpServiceCustomizerTest.java
@@ -25,7 +25,7 @@ import org.apache.camel.component.platform.http.PlatformHttpConstants;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.k.Runtime;
import org.apache.camel.k.http.engine.RuntimePlatformHttpEngine;
-import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.k.test.AvailablePortFinder;
import org.apache.camel.util.ObjectHelper;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
diff --git a/camel-k-runtime-knative/pom.xml b/camel-k-runtime-knative/pom.xml
index 97204a0..d93b7a7 100644
--- a/camel-k-runtime-knative/pom.xml
+++ b/camel-k-runtime-knative/pom.xml
@@ -44,11 +44,6 @@
</dependency>
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-apt</artifactId>
<optional>true</optional>
@@ -67,6 +62,12 @@
<dependency>
<groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-loader-xml</artifactId>
<scope>test</scope>
</dependency>
@@ -93,11 +94,6 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-direct</artifactId>
<scope>test</scope>
</dependency>
@@ -121,49 +117,6 @@
<artifactId>camel-cloud</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy</artifactId>
- <version>${groovy.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/camel-k-runtime-knative/src/test/java/org/apache/camel/k/loader/knative/KnativeSourceRoutesLoaderTest.java b/camel-k-runtime-knative/src/test/java/org/apache/camel/k/loader/knative/KnativeSourceRoutesLoaderTest.java
index e977e70..6039a09 100644
--- a/camel-k-runtime-knative/src/test/java/org/apache/camel/k/loader/knative/KnativeSourceRoutesLoaderTest.java
+++ b/camel-k-runtime-knative/src/test/java/org/apache/camel/k/loader/knative/KnativeSourceRoutesLoaderTest.java
@@ -38,9 +38,9 @@ import org.apache.camel.k.Sources;
import org.apache.camel.k.http.PlatformHttpServiceContextCustomizer;
import org.apache.camel.k.listener.RoutesConfigurer;
import org.apache.camel.k.loader.java.JavaSourceLoader;
+import org.apache.camel.k.test.AvailablePortFinder;
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.RouteDefinition;
-import org.apache.camel.test.AvailablePortFinder;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
@@ -70,7 +70,6 @@ public class KnativeSourceRoutesLoaderTest {
LOGGER.info("uri: {}", uri);
final int port = AvailablePortFinder.getNextAvailable();
- final int platformHttpPort = AvailablePortFinder.getNextAvailable();
final String data = UUID.randomUUID().toString();
KnativeComponent component = new KnativeComponent();
@@ -175,15 +174,13 @@ public class KnativeSourceRoutesLoaderTest {
static class TestRuntime implements Runtime {
private final CamelContext camelContext;
private final List<RoutesBuilder> builders;
- private final int platformHttpPort;
public TestRuntime() {
this.camelContext = new DefaultCamelContext();
this.builders = new ArrayList<>();
- this.platformHttpPort = AvailablePortFinder.getNextAvailable();
PlatformHttpServiceContextCustomizer httpService = new PlatformHttpServiceContextCustomizer();
- httpService.setBindPort(platformHttpPort);
+ httpService.setBindPort(AvailablePortFinder.getNextAvailable());
httpService.apply(this.camelContext);
}
diff --git a/camel-k-runtime-master/pom.xml b/camel-k-runtime-master/pom.xml
index 479fe51..d48f74c 100644
--- a/camel-k-runtime-master/pom.xml
+++ b/camel-k-runtime-master/pom.xml
@@ -55,18 +55,8 @@
<!-- ****************************** -->
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-master</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-main</artifactId>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -74,42 +64,14 @@
<artifactId>camel-k-runtime-main</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
<dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>${log4j2.version}</version>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-master</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-main</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/camel-k-runtime-webhook/pom.xml b/camel-k-runtime-webhook/pom.xml
index 614388c..7d277a5 100644
--- a/camel-k-runtime-webhook/pom.xml
+++ b/camel-k-runtime-webhook/pom.xml
@@ -55,38 +55,8 @@
<!-- ****************************** -->
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-endpointdsl</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-log</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-timer</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-undertow</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-rest</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-main</artifactId>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -101,40 +71,23 @@
</dependency>
<dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-rest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-undertow</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>${log4j2.version}</version>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-log</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-timer</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/camel-k-runtime-webhook/src/test/java/org/apache/camel/k/webhook/DummyWebhookComponent.java b/camel-k-runtime-webhook/src/test/java/org/apache/camel/k/webhook/DummyWebhookComponent.java
index dafb48b..979b959 100644
--- a/camel-k-runtime-webhook/src/test/java/org/apache/camel/k/webhook/DummyWebhookComponent.java
+++ b/camel-k-runtime-webhook/src/test/java/org/apache/camel/k/webhook/DummyWebhookComponent.java
@@ -36,6 +36,15 @@ public class DummyWebhookComponent extends DefaultComponent {
private final Runnable onUnregister;
+ public DummyWebhookComponent() {
+ this(
+ () -> {
+ },
+ () -> {
+ }
+ );
+ }
+
public DummyWebhookComponent(Runnable onRegister, Runnable onUnregister) {
this.onRegister = onRegister;
this.onUnregister = onUnregister;
diff --git a/camel-k-runtime-webhook/src/test/java/org/apache/camel/k/webhook/WebhookTest.java b/camel-k-runtime-webhook/src/test/java/org/apache/camel/k/webhook/WebhookTest.java
index ab4c53f..e6c1338 100644
--- a/camel-k-runtime-webhook/src/test/java/org/apache/camel/k/webhook/WebhookTest.java
+++ b/camel-k-runtime-webhook/src/test/java/org/apache/camel/k/webhook/WebhookTest.java
@@ -51,8 +51,8 @@ public class WebhookTest {
@BeforeEach
public void setUp() {
this.runtime = new ApplicationRuntime();
- runtime.addListener(RoutesConfigurer.forRoutes("classpath:webhook.js"));
- runtime.addListener(new ContextConfigurer());
+ this.runtime.addListener(RoutesConfigurer.forRoutes("classpath:webhook.js"));
+ this.runtime.addListener(new ContextConfigurer());
}
@ParameterizedTest
@@ -68,15 +68,18 @@ public class WebhookTest {
Map<WebhookAction, AtomicInteger> registerCounters = new HashMap<>();
Arrays.stream(WebhookAction.values()).forEach(v -> registerCounters.put(v, new AtomicInteger()));
- DummyWebhookComponent dummy = new DummyWebhookComponent(() -> {
- registerCounters.get(WebhookAction.REGISTER).incrementAndGet();
- operation.countDown();
- }, () -> {
- registerCounters.get(WebhookAction.UNREGISTER).incrementAndGet();
- operation.countDown();
- }
+ runtime.getCamelContext().addComponent(
+ "dummy",
+ new DummyWebhookComponent(
+ () -> {
+ registerCounters.get(WebhookAction.REGISTER).incrementAndGet();
+ operation.countDown();
+ },
+ () -> {
+ registerCounters.get(WebhookAction.UNREGISTER).incrementAndGet();
+ operation.countDown();
+ })
);
- runtime.getCamelContext().addComponent("dummy", dummy);
AtomicBoolean routeStarted = new AtomicBoolean();
runtime.getCamelContext().addRoutePolicyFactory(new RoutePolicyFactory() {
@@ -127,12 +130,17 @@ public class WebhookTest {
properties.setProperty("customizer.webhook.action", action.name());
runtime.setProperties(properties);
- DummyWebhookComponent dummy = new DummyWebhookComponent(() -> {
- throw new RuntimeException("dummy error");
- }, () -> {
- throw new RuntimeException("dummy error");
- });
- runtime.getCamelContext().addComponent("dummy", dummy);
+ runtime.getCamelContext().addComponent(
+ "dummy",
+ new DummyWebhookComponent(
+ () -> {
+ throw new RuntimeException("dummy error");
+ },
+ () -> {
+ throw new RuntimeException("dummy error");
+ })
+ );
+
Assertions.assertThrows(FailedToCreateRouteException.class, runtime::run);
}
@@ -143,10 +151,10 @@ public class WebhookTest {
properties.setProperty("customizer.webhook.action", WebhookAction.REGISTER.name());
runtime.setProperties(properties);
- DummyWebhookComponent dummy = new DummyWebhookComponent(() -> {
- }, () -> {
- });
- runtime.getCamelContext().addComponent("dummy", dummy);
+ runtime.getCamelContext().addComponent(
+ "dummy",
+ new DummyWebhookComponent());
+
Assertions.assertThrows(FailedToCreateRouteException.class, runtime::run);
}
diff --git a/camel-k-runtime-webhook/src/test/resources/webhook.js b/camel-k-runtime-webhook/src/test/resources/webhook.js
index ef57ca4..da42d97 100644
--- a/camel-k-runtime-webhook/src/test/resources/webhook.js
+++ b/camel-k-runtime-webhook/src/test/resources/webhook.js
@@ -18,4 +18,5 @@
from('webhook:dummy')
.to('log:info')
-from('timer:tick').to('log:info')
+from('timer:tick')
+ .to('log:info')
diff --git a/camel-knative/camel-knative-http/pom.xml b/camel-knative/camel-knative-http/pom.xml
index 731bcfa..59b1daa 100644
--- a/camel-knative/camel-knative-http/pom.xml
+++ b/camel-knative/camel-knative-http/pom.xml
@@ -60,12 +60,6 @@
<version>${vertx.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-collections4</artifactId>
- <version>${commons-collections4.version}</version>
- </dependency>
-
<!-- ****************************** -->
<!-- -->
<!-- TESTS -->
@@ -74,19 +68,12 @@
<dependency>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-knative</artifactId>
+ <artifactId>camel-k-test</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-knative</artifactId>
<scope>test</scope>
</dependency>
@@ -115,56 +102,6 @@
<artifactId>camel-http</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-bean</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.rest-assured</groupId>
- <artifactId>rest-assured</artifactId>
- <version>${rest-assured.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
diff --git a/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java b/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java
index 405356d..f615c3c 100644
--- a/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java
+++ b/camel-knative/camel-knative-http/src/test/java/org/apache/camel/component/knative/http/KnativeHttpTest.java
@@ -47,7 +47,7 @@ import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.http.base.HttpOperationFailedException;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.k.http.PlatformHttpServiceContextCustomizer;
-import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.k.test.AvailablePortFinder;
import org.apache.camel.util.ObjectHelper;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
diff --git a/camel-knative/camel-knative/pom.xml b/camel-knative/camel-knative/pom.xml
index 3659244..798c168 100644
--- a/camel-knative/camel-knative/pom.xml
+++ b/camel-knative/camel-knative/pom.xml
@@ -63,17 +63,6 @@
<artifactId>jackson-datatype-jdk8</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-collections4</artifactId>
- <version>${commons-collections4.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${commons-lang.version}</version>
- </dependency>
-
<!-- ****************************** -->
<!-- -->
<!-- TESTS -->
@@ -81,82 +70,8 @@
<!-- ****************************** -->
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-http</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-file</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-direct</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-mock</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-log</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-undertow</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
<scope>test</scope>
</dependency>
diff --git a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeProducer.java b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeProducer.java
index f503a8e..0b7a54f 100644
--- a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeProducer.java
+++ b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeProducer.java
@@ -28,7 +28,6 @@ import org.apache.camel.processor.Pipeline;
import org.apache.camel.support.AsyncProcessorConverterHelper;
import org.apache.camel.support.DefaultAsyncProducer;
import org.apache.camel.support.service.ServiceHelper;
-import org.apache.commons.collections4.CollectionUtils;
public class KnativeProducer extends DefaultAsyncProducer {
final AsyncProcessor processor;
@@ -37,9 +36,11 @@ public class KnativeProducer extends DefaultAsyncProducer {
super(endpoint);
List<Processor> elements = new ArrayList<>(1 + processors.length);
+ elements.add(processor);
- CollectionUtils.addAll(elements, processor);
- CollectionUtils.addAll(elements, processors);
+ for (Processor p : processors) {
+ elements.add(p);
+ }
Processor pipeline = Pipeline.newInstance(endpoint.getCamelContext(), elements);
diff --git a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/ce/CloudEventProcessors.java b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/ce/CloudEventProcessors.java
index 2d5f499..04ea3df 100644
--- a/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/ce/CloudEventProcessors.java
+++ b/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/ce/CloudEventProcessors.java
@@ -26,7 +26,6 @@ import org.apache.camel.component.knative.KnativeEndpoint;
import org.apache.camel.component.knative.spi.CloudEvent;
import org.apache.camel.component.knative.spi.CloudEvents;
import org.apache.camel.component.knative.spi.KnativeEnvironment;
-import org.apache.commons.lang3.StringUtils;
import static org.apache.camel.util.ObjectHelper.ifNotEmpty;
@@ -84,7 +83,7 @@ public enum CloudEventProcessors implements CloudEventProcessor {
// Map every remaining field as it is (extensions).
//
content.forEach((key, val) -> {
- message.setHeader(StringUtils.lowerCase(key), val);
+ message.setHeader(key.toLowerCase(), val);
});
}
@@ -115,7 +114,7 @@ public enum CloudEventProcessors implements CloudEventProcessor {
// Map every remaining field as it is (extensions).
//
content.forEach((key, val) -> {
- message.setHeader(StringUtils.lowerCase(key), val);
+ message.setHeader(key.toLowerCase(), val);
});
}
});
diff --git a/pom.xml b/pom.xml
index 912b8a4..290d041 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,9 +40,7 @@
<catalog.version>${camel.version}</catalog.version>
<junit.version>5.6.1</junit.version>
<joor.version>0.9.12</joor.version>
- <commons-io.version>2.6</commons-io.version>
<commons-lang.version>3.9</commons-lang.version>
- <commons-collections4.version>4.4</commons-collections4.version>
<commons-text.version>1.8</commons-text.version>
<commons-dbcp2.version>2.7.0</commons-dbcp2.version>
<assertj.version>3.15.0</assertj.version>
@@ -57,13 +55,11 @@
<jaxb-core.version>2.3.0.1</jaxb-core.version>
<immutables.version>2.8.3</immutables.version>
<semver4j.version>3.1.0</semver4j.version>
- <undertow.version>1.4.26.Final</undertow.version>
<vertx.version>3.8.5</vertx.version>
<graalvm.version>19.3.1</graalvm.version>
<quarkus.version>1.3.0.Final</quarkus.version>
<jandex.version>2.1.3.Final</jandex.version>
<javapoet.version>1.11.1</javapoet.version>
- <auto-service.version>1.0-rc6</auto-service.version>
<rest-assured.version>4.3.0</rest-assured.version>
<gmavenplus-plugin.version>1.7.1</gmavenplus-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
@@ -195,6 +191,13 @@
<groupId>org.jboss.jandex</groupId>
<artifactId>jandex-maven-plugin</artifactId>
<version>${jandex-maven-plugin.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jandex</artifactId>
+ <version>${jandex.version}</version>
+ </dependency>
+ </dependencies>
</plugin>
</plugins>
</pluginManagement>
@@ -283,6 +286,11 @@
<artifactId>camel-k-apt</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.k</groupId>
+ <artifactId>camel-k-test</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!-- components -->
<dependency>
@@ -468,6 +476,77 @@
<artifactId>svm</artifactId>
<version>${graalvm.version}</version>
</dependency>
+
+ <!-- misc -->
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <version>${rest-assured.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ <version>${groovy.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-xml</artifactId>
+ <version>${groovy.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-json</artifactId>
+ <version>${groovy.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-yaml</artifactId>
+ <version>${groovy.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-test</artifactId>
+ <version>${groovy.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>${log4j2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <version>${log4j2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-jcl</artifactId>
+ <version>${log4j2.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-params</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>${assertj.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
diff --git a/tooling/camel-k-maven-plugin/pom.xml b/tooling/camel-k-maven-plugin/pom.xml
index f011d1c..7d9f5d6 100644
--- a/tooling/camel-k-maven-plugin/pom.xml
+++ b/tooling/camel-k-maven-plugin/pom.xml
@@ -124,12 +124,6 @@
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-collections4</artifactId>
- <version>${commons-collections4.version}</version>
- </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateRestXML.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateRestXML.java
index ea40a60..67d6bae 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateRestXML.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateRestXML.java
@@ -32,7 +32,6 @@ import io.apicurio.datamodels.openapi.models.OasDocument;
import org.apache.camel.CamelContext;
import org.apache.camel.generator.openapi.RestDslXmlGenerator;
import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.commons.io.FilenameUtils;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
@@ -70,7 +69,10 @@ class GenerateRestXML extends AbstractMojo {
}
try {
- JsonFactory factory = FilenameUtils.isExtension(inputFile, YAML_EXTENSIONS) ? new YAMLFactory() : null;
+ JsonFactory factory = null;
+ if (inputFile.endsWith(".yaml") || inputFile.endsWith(".yml")) {
+ factory = new YAMLFactory();
+ }
ObjectMapper mapper = new ObjectMapper(factory);
mapper.findAndRegisterModules();
@@ -80,10 +82,6 @@ class GenerateRestXML extends AbstractMojo {
JsonNode node = mapper.readTree(fis);
OasDocument document = (OasDocument) Library.readDocument(node);
- if (document == null) {
- throw new MojoExecutionException("Unable to read the OpenAPI file: " + inputFile);
- }
-
final Writer writer;
if (outputFile != null) {
diff --git a/camel-k-runtime-http/pom.xml b/tooling/camel-k-test/pom.xml
similarity index 53%
copy from camel-k-runtime-http/pom.xml
copy to tooling/camel-k-test/pom.xml
index aabec84..5d238be 100644
--- a/camel-k-runtime-http/pom.xml
+++ b/tooling/camel-k-test/pom.xml
@@ -20,121 +20,77 @@
<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/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-runtime-parent</artifactId>
+ <artifactId>camel-k-tooling</artifactId>
<version>1.2.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>camel-k-runtime-http</artifactId>
+ <artifactId>camel-k-test</artifactId>
<dependencies>
-
- <!-- ****************************** -->
- <!-- -->
- <!-- RUNTIME -->
- <!-- -->
- <!-- ****************************** -->
-
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-platform-http</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-runtime-core</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-params</artifactId>
</dependency>
<dependency>
- <groupId>io.vertx</groupId>
- <artifactId>vertx-web</artifactId>
- <version>${vertx.version}</version>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
</dependency>
- <!-- ****************************** -->
- <!-- -->
- <!-- TESTS -->
- <!-- -->
- <!-- ****************************** -->
-
<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy</artifactId>
</dependency>
<dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-xml</artifactId>
</dependency>
<dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-json</artifactId>
</dependency>
-
<dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj.version}</version>
- <scope>test</scope>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-yaml</artifactId>
</dependency>
-
<dependency>
- <groupId>io.rest-assured</groupId>
- <artifactId>rest-assured</artifactId>
- <version>${rest-assured.version}</version>
- <scope>test</scope>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-test</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
- <version>${log4j2.version}</version>
- <scope>test</scope>
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.jandex</groupId>
- <artifactId>jandex-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>make-index</id>
- <goals>
- <goal>jandex</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
</project>
diff --git a/tooling/camel-k-test/src/main/java/org/apache/camel/k/test/AvailablePortFinder.java b/tooling/camel-k-test/src/main/java/org/apache/camel/k/test/AvailablePortFinder.java
new file mode 100644
index 0000000..5504b78
--- /dev/null
+++ b/tooling/camel-k-test/src/main/java/org/apache/camel/k/test/AvailablePortFinder.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.k.test;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Function;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Finds currently available server ports.
+ */
+public final class AvailablePortFinder {
+ private static final Logger LOGGER = LoggerFactory.getLogger(AvailablePortFinder.class);
+
+ /**
+ * Creates a new instance.
+ */
+ private AvailablePortFinder() {
+ // Do nothing
+ }
+
+ /**
+ * Gets the next available port.
+ *
+ * @throws IllegalStateException if there are no ports available
+ * @return the available port
+ */
+ public static int getNextAvailable() {
+ try (ServerSocket ss = new ServerSocket()) {
+ ss.setReuseAddress(true);
+ ss.bind(new InetSocketAddress((InetAddress) null, 0), 1);
+
+ int port = ss.getLocalPort();
+
+ LOGGER.info("getNextAvailable() -> {}", port);
+
+ return port;
+ } catch (IOException e) {
+ throw new IllegalStateException("Cannot find free port", e);
+ }
+ }
+
+ /**
+ * Reserve a list of random and not in use network ports and place them in Map.
+ */
+ public static Map<String, Integer> reserveNetworkPorts(String... names) {
+ return reserveNetworkPorts(Function.identity(), names);
+ }
+
+ /**
+ * Reserve a list of random and not in use network ports and place them in Map.
+ */
+ public static <T> Map<String, T> reserveNetworkPorts(Function<Integer, T> converter, String... names) {
+ Map<String, T> reservedPorts = new HashMap<>();
+
+ for (String name : names) {
+ reservedPorts.put(name, converter.apply(getNextAvailable()));
+ }
+
+ return reservedPorts;
+ }
+}
+
diff --git a/tooling/pom.xml b/tooling/pom.xml
index 214f7ab..0996895 100644
--- a/tooling/pom.xml
+++ b/tooling/pom.xml
@@ -32,6 +32,7 @@
<module>camel-k-annotations</module>
<module>camel-k-apt</module>
<module>camel-k-maven-plugin</module>
+ <module>camel-k-test</module>
</modules>
</project>