diff --git a/tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/services/kafkaconnect/KafkaConnectRunner.java b/tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/services/kafkaconnect/KafkaConnectRunner.java index d5affd0386..ff1c267859 100644 --- a/tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/services/kafkaconnect/KafkaConnectRunner.java +++ b/tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/services/kafkaconnect/KafkaConnectRunner.java @@ -37,13 +37,13 @@ import org.apache.kafka.connect.runtime.Worker; import org.apache.kafka.connect.runtime.WorkerInfo; import org.apache.kafka.connect.runtime.isolation.Plugins; +import org.apache.kafka.connect.runtime.rest.RestClient; import org.apache.kafka.connect.runtime.rest.RestServer; import org.apache.kafka.connect.runtime.rest.entities.ConnectorInfo; import org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo; import org.apache.kafka.connect.runtime.standalone.StandaloneConfig; import org.apache.kafka.connect.runtime.standalone.StandaloneHerder; import org.apache.kafka.connect.storage.FileOffsetBackingStore; -import org.apache.kafka.connect.util.ConnectUtils; import org.apache.kafka.connect.util.FutureCallback; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -127,10 +127,11 @@ private void init() { Plugins plugins = new Plugins(standAloneProperties); StandaloneConfig config = new StandaloneConfig(standAloneProperties); - String kafkaClusterId = ConnectUtils.lookupKafkaClusterId(config); + String kafkaClusterId = config.kafkaClusterId(); AllConnectorClientConfigOverridePolicy allConnectorClientConfigOverridePolicy = new AllConnectorClientConfigOverridePolicy(); - RestServer rest = new RestServer(config); + RestClient restClient = new RestClient(config); + RestServer rest = new RestServer(config, restClient); rest.initializeServer(); /* diff --git a/tests/itests-cxf/pom.xml b/tests/itests-cxf/pom.xml index d420ec9f11..009e76f44b 100644 --- a/tests/itests-cxf/pom.xml +++ b/tests/itests-cxf/pom.xml @@ -60,38 +60,16 @@ org.apache.camel camel-cxf-rest - + org.apache.cxf - cxf-rt-transports-http-jetty + cxf-rt-transports-http-undertow ${cxf-version} - test - - - org.eclipse.jetty - jetty-server - - - org.eclipse.jetty - jetty-util - - - org.eclipse.jetty - jetty-io - - - org.eclipse.jetty - jetty-security - - - org.eclipse.jetty - jetty-continuation - - - org.eclipse.jetty - jetty-http - - + + + jakarta.servlet + jakarta.servlet-api + 5.0.0 org.apache.cxf @@ -105,5 +83,11 @@ commons-io + + javax.annotation + javax.annotation-api + 1.3.2 + + diff --git a/tests/itests-cxf/src/test/java/org/apache/camel/kafkaconnector/cxf/sink/SinkJaxWsServiceConfigurator.java b/tests/itests-cxf/src/test/java/org/apache/camel/kafkaconnector/cxf/sink/SinkJaxWsServiceConfigurator.java index 7cd2ce6528..45c71fb158 100644 --- a/tests/itests-cxf/src/test/java/org/apache/camel/kafkaconnector/cxf/sink/SinkJaxWsServiceConfigurator.java +++ b/tests/itests-cxf/src/test/java/org/apache/camel/kafkaconnector/cxf/sink/SinkJaxWsServiceConfigurator.java @@ -17,7 +17,6 @@ package org.apache.camel.kafkaconnector.cxf.sink; import jakarta.xml.ws.Endpoint; - import org.apache.camel.kafkaconnector.cxf.services.JaxWsServiceConfigurator; import org.apache.cxf.jaxws.EndpointImpl; diff --git a/tests/itests-cxfrs/pom.xml b/tests/itests-cxfrs/pom.xml index e466638249..6fd612a9d7 100644 --- a/tests/itests-cxfrs/pom.xml +++ b/tests/itests-cxfrs/pom.xml @@ -54,44 +54,24 @@ org.apache.camel - camel-cxf-soap + camel-cxf-rest + - org.apache.camel - camel-cxf-rest + javax.annotation + javax.annotation-api + 1.3.2 - + org.apache.cxf - cxf-rt-transports-http-jetty - test + cxf-rt-transports-http-undertow ${cxf-version} - - - org.eclipse.jetty - jetty-server - - - org.eclipse.jetty - jetty-util - - - org.eclipse.jetty - jetty-io - - - org.eclipse.jetty - jetty-security - - - org.eclipse.jetty - jetty-continuation - - - org.eclipse.jetty - jetty-http - - + + + jakarta.servlet + jakarta.servlet-api + 5.0.0 org.apache.cxf diff --git a/tests/itests-cxfrs/src/test/java/org/apache/camel/kafkaconnector/cxfrs/Customer.java b/tests/itests-cxfrs/src/test/java/org/apache/camel/kafkaconnector/cxfrs/Customer.java index ddc045471c..ca89143d73 100644 --- a/tests/itests-cxfrs/src/test/java/org/apache/camel/kafkaconnector/cxfrs/Customer.java +++ b/tests/itests-cxfrs/src/test/java/org/apache/camel/kafkaconnector/cxfrs/Customer.java @@ -16,8 +16,9 @@ */ package org.apache.camel.kafkaconnector.cxfrs; -import javax.xml.bind.annotation.XmlRootElement; + +import jakarta.xml.bind.annotation.XmlRootElement; import org.apache.camel.util.ObjectHelper; /** diff --git a/tests/itests-cxfrs/src/test/java/org/apache/camel/kafkaconnector/cxfrs/CustomerServiceResource.java b/tests/itests-cxfrs/src/test/java/org/apache/camel/kafkaconnector/cxfrs/CustomerServiceResource.java index ca9111ec43..c0f201b4ac 100644 --- a/tests/itests-cxfrs/src/test/java/org/apache/camel/kafkaconnector/cxfrs/CustomerServiceResource.java +++ b/tests/itests-cxfrs/src/test/java/org/apache/camel/kafkaconnector/cxfrs/CustomerServiceResource.java @@ -16,14 +16,14 @@ */ package org.apache.camel.kafkaconnector.cxfrs; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Response; // START SNIPPET: example @Path("/customerservice/") diff --git a/tests/itests-hdfs/pom.xml b/tests/itests-hdfs/pom.xml index ea12a2b416..ce6a952ffd 100644 --- a/tests/itests-hdfs/pom.xml +++ b/tests/itests-hdfs/pom.xml @@ -73,12 +73,16 @@ javax.ws.rs jsr311-api + + jakarta.activation + jakarta.activation-api + org.apache.camel - camel-test + camel-test-junit5 test @@ -109,6 +113,10 @@ org.eclipse.jetty jetty-util + + jakarta.activation + jakarta.activation-api + diff --git a/tests/itests-hdfs/src/test/java/org/apache/camel/kafkaconnector/hdfs/sink/CamelSinkHDFSITCase.java b/tests/itests-hdfs/src/test/java/org/apache/camel/kafkaconnector/hdfs/sink/CamelSinkHDFSITCase.java index 7784af41ee..cb7634673c 100644 --- a/tests/itests-hdfs/src/test/java/org/apache/camel/kafkaconnector/hdfs/sink/CamelSinkHDFSITCase.java +++ b/tests/itests-hdfs/src/test/java/org/apache/camel/kafkaconnector/hdfs/sink/CamelSinkHDFSITCase.java @@ -25,6 +25,7 @@ import org.apache.camel.kafkaconnector.common.test.CamelSinkTestSupport; import org.apache.camel.kafkaconnector.common.test.StringMessageProducer; import org.apache.camel.kafkaconnector.hdfs.utils.HDFSEasy; +import org.apache.camel.test.AvailablePortFinder; import org.apache.camel.test.infra.common.TestUtils; import org.apache.camel.test.infra.hdfs.v2.services.HDFSService; import org.apache.camel.test.infra.hdfs.v2.services.HDFSServiceFactory; @@ -47,7 +48,7 @@ @TestInstance(TestInstance.Lifecycle.PER_CLASS) public class CamelSinkHDFSITCase extends CamelSinkTestSupport { @RegisterExtension - public static HDFSService hdfsService = HDFSServiceFactory.createSingletonService(); + public static HDFSService hdfsService = HDFSServiceFactory.createSingletonService(AvailablePortFinder.getNextAvailable()); private static final Logger LOG = LoggerFactory.getLogger(CamelSinkHDFSITCase.class); diff --git a/tests/itests-http/pom.xml b/tests/itests-http/pom.xml index 2614ce619c..4d5b9c43d6 100644 --- a/tests/itests-http/pom.xml +++ b/tests/itests-http/pom.xml @@ -41,5 +41,7 @@ org.apache.camel camel-http + + \ No newline at end of file diff --git a/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/CamelSinkHTTPITCase.java b/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/CamelSinkHTTPITCase.java index 79b4b40160..42f77c782a 100644 --- a/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/CamelSinkHTTPITCase.java +++ b/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/CamelSinkHTTPITCase.java @@ -28,8 +28,9 @@ import org.apache.camel.kafkaconnector.common.ConnectorPropertyFactory; import org.apache.camel.kafkaconnector.common.test.CamelSinkTestSupport; import org.apache.camel.kafkaconnector.common.utils.NetworkUtils; -import org.apache.http.impl.bootstrap.HttpServer; -import org.apache.http.impl.bootstrap.ServerBootstrap; +import org.apache.hc.core5.http.impl.bootstrap.HttpServer; +import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap; +import org.apache.hc.core5.io.CloseMode; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -68,7 +69,7 @@ public void setUp() throws IOException { localServer = ServerBootstrap.bootstrap() .setLocalAddress(localhost) .setListenerPort(NetworkUtils.getFreePort()) - .registerHandler("/ckc", validationHandler) + .register("/ckc", validationHandler) .create(); localServer.start(); @@ -79,7 +80,7 @@ public void tearDown() { try { localServer.stop(); } finally { - localServer.shutdown(2, TimeUnit.SECONDS); + localServer.close(CloseMode.IMMEDIATE, org.apache.hc.core5.util.Timeout.ofSeconds(2L)); } } diff --git a/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/HTTPTestValidationHandler.java b/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/HTTPTestValidationHandler.java index c5de4c2cbf..8e9fe92229 100644 --- a/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/HTTPTestValidationHandler.java +++ b/tests/itests-http/src/test/java/org/apache/camel/kafkaconnector/http/sink/HTTPTestValidationHandler.java @@ -27,14 +27,15 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import org.apache.http.HttpEntity; -import org.apache.http.HttpEntityEnclosingRequest; -import org.apache.http.HttpRequest; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.protocol.HttpContext; -import org.apache.http.protocol.HttpRequestHandler; -import org.apache.http.util.EntityUtils; +import org.apache.hc.core5.http.ClassicHttpRequest; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.core5.http.HttpEntity; +import org.apache.hc.core5.http.HttpException; +import org.apache.hc.core5.http.HttpStatus; +import org.apache.hc.core5.http.io.HttpRequestHandler; +import org.apache.hc.core5.http.io.entity.EntityUtils; +import org.apache.hc.core5.http.protocol.HttpContext; + class HTTPTestValidationHandler implements HttpRequestHandler { private final List replies = new ArrayList<>(); @@ -47,37 +48,36 @@ class HTTPTestValidationHandler implements HttpRequestHandler { this.expected = expected; } - - @Override - public void handle(HttpRequest httpRequest, HttpResponse httpResponse, HttpContext httpContext) throws IOException { + public Future> getReplies() throws InterruptedException { lock.lock(); try { - HttpEntity entity = ((HttpEntityEnclosingRequest) httpRequest).getEntity(); - String content = EntityUtils.toString(entity); - - replies.add(content); - if (replies.size() == expected) { - receivedExpectedMessages.signal(); - } + receivedExpectedMessages.await(10, TimeUnit.SECONDS); - httpResponse.setStatusCode(HttpStatus.SC_OK); + List ret = new ArrayList<>(replies); + replies.clear(); + return CompletableFuture.supplyAsync(() -> ret); } finally { lock.unlock(); } + + } - public Future> getReplies() throws InterruptedException { + @Override + public void handle(ClassicHttpRequest classicHttpRequest, ClassicHttpResponse classicHttpResponse, HttpContext httpContext) throws HttpException, IOException { lock.lock(); try { - receivedExpectedMessages.await(10, TimeUnit.SECONDS); + HttpEntity entity = classicHttpRequest.getEntity(); + String content = EntityUtils.toString(entity); - List ret = new ArrayList<>(replies); - replies.clear(); - return CompletableFuture.supplyAsync(() -> ret); + replies.add(content); + if (replies.size() == expected) { + receivedExpectedMessages.signal(); + } + + classicHttpResponse.setCode(HttpStatus.SC_OK); } finally { lock.unlock(); } - - } } diff --git a/tests/itests-https/src/test/java/org/apache/camel/kafkaconnector/https/sink/CamelSinkHTTPSITCase.java b/tests/itests-https/src/test/java/org/apache/camel/kafkaconnector/https/sink/CamelSinkHTTPSITCase.java index 0db13e0b19..89b31250a7 100644 --- a/tests/itests-https/src/test/java/org/apache/camel/kafkaconnector/https/sink/CamelSinkHTTPSITCase.java +++ b/tests/itests-https/src/test/java/org/apache/camel/kafkaconnector/https/sink/CamelSinkHTTPSITCase.java @@ -31,7 +31,7 @@ import org.apache.camel.kafkaconnector.common.ConnectorPropertyFactory; import org.apache.camel.kafkaconnector.common.services.mockweb.MockWebService; import org.apache.camel.kafkaconnector.common.test.CamelSinkTestSupport; -import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; @@ -112,7 +112,7 @@ protected void verifyMessages(CountDownLatch latch) throws InterruptedException @Timeout(60) public void testBasicSendReceive() throws Exception { mockWebService.enqueueResponses(expect); - LOG.info("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX: {}", toPath("client-truststore.jks")); + LOG.info("Trusted store path: {}", toPath("client-truststore.jks")); String uri = mockServer.getHostName() + ":" + mockServer.getPort() + "/ckc"; ConnectorPropertyFactory connectorPropertyFactory = CamelHTTPSPropertyFactory.basic() .withTopics(topicName) diff --git a/tests/itests-mongodb/pom.xml b/tests/itests-mongodb/pom.xml index 19f73216b5..502606e633 100644 --- a/tests/itests-mongodb/pom.xml +++ b/tests/itests-mongodb/pom.xml @@ -59,6 +59,13 @@ camel-mongodb + + + org.apache.camel.kamelets + camel-kamelets-utils + ${camel.kamelet.catalog.version} + + org.mongodb mongodb-driver-legacy diff --git a/tests/itests-parent/pom.xml b/tests/itests-parent/pom.xml index c8fe66b53d..e66321fb5e 100644 --- a/tests/itests-parent/pom.xml +++ b/tests/itests-parent/pom.xml @@ -98,7 +98,7 @@ org.apache.logging.log4j - log4j-slf4j-impl + log4j-slf4j2-impl test diff --git a/tests/itests-sjms2/src/test/java/org/apache/camel/kafkaconnector/sjms2/clients/JMSClient.java b/tests/itests-sjms2/src/test/java/org/apache/camel/kafkaconnector/sjms2/clients/JMSClient.java index a108a82fb0..868c0362fc 100644 --- a/tests/itests-sjms2/src/test/java/org/apache/camel/kafkaconnector/sjms2/clients/JMSClient.java +++ b/tests/itests-sjms2/src/test/java/org/apache/camel/kafkaconnector/sjms2/clients/JMSClient.java @@ -29,7 +29,6 @@ import jakarta.jms.MessageConsumer; import jakarta.jms.MessageProducer; import jakarta.jms.Session; - import org.junit.jupiter.api.Assertions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/tests/itests-sjms2/src/test/java/org/apache/camel/kafkaconnector/sjms2/sink/CamelSinkIdempotentJMSITCase.java b/tests/itests-sjms2/src/test/java/org/apache/camel/kafkaconnector/sjms2/sink/CamelSinkIdempotentJMSITCase.java index 2f3eaa61a1..a36aa8b027 100644 --- a/tests/itests-sjms2/src/test/java/org/apache/camel/kafkaconnector/sjms2/sink/CamelSinkIdempotentJMSITCase.java +++ b/tests/itests-sjms2/src/test/java/org/apache/camel/kafkaconnector/sjms2/sink/CamelSinkIdempotentJMSITCase.java @@ -27,7 +27,6 @@ import jakarta.jms.Message; import jakarta.jms.MessageConsumer; import jakarta.jms.TextMessage; - import org.apache.camel.kafkaconnector.CamelSinkTask; import org.apache.camel.kafkaconnector.common.ConnectorPropertyFactory; import org.apache.camel.kafkaconnector.common.clients.kafka.KafkaClient; diff --git a/tests/itests-sjms2/src/test/java/org/apache/camel/kafkaconnector/sjms2/sink/CamelSinkJMSITCase.java b/tests/itests-sjms2/src/test/java/org/apache/camel/kafkaconnector/sjms2/sink/CamelSinkJMSITCase.java index 6d78a63bc7..4bc118724a 100644 --- a/tests/itests-sjms2/src/test/java/org/apache/camel/kafkaconnector/sjms2/sink/CamelSinkJMSITCase.java +++ b/tests/itests-sjms2/src/test/java/org/apache/camel/kafkaconnector/sjms2/sink/CamelSinkJMSITCase.java @@ -25,7 +25,6 @@ import jakarta.jms.Message; import jakarta.jms.MessageConsumer; import jakarta.jms.TextMessage; - import org.apache.camel.kafkaconnector.common.ConnectorPropertyFactory; import org.apache.camel.kafkaconnector.common.test.CamelSinkTestSupport; import org.apache.camel.kafkaconnector.sjms2.clients.JMSClient;