This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 1e75577b5c4 camel-kotlin-api: remove flaky test and use port finder to avoid port number in use exception. 1e75577b5c4 is described below commit 1e75577b5c4111504ebf0fdc735e9785e7305c0a Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue May 14 12:37:01 2024 +0200 camel-kotlin-api: remove flaky test and use port finder to avoid port number in use exception. --- dsl/camel-kotlin-api/pom.xml | 15 +--- .../kotlin/org/apache/camel/kotlin/BeansTest.kt | 94 ---------------------- .../kotlin/org/apache/camel/kotlin/RestTest.kt | 16 +--- 3 files changed, 3 insertions(+), 122 deletions(-) diff --git a/dsl/camel-kotlin-api/pom.xml b/dsl/camel-kotlin-api/pom.xml index 9ee5ed41563..12b1c2c3da2 100644 --- a/dsl/camel-kotlin-api/pom.xml +++ b/dsl/camel-kotlin-api/pom.xml @@ -93,7 +93,7 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-netty-http</artifactId> + <artifactId>camel-jetty</artifactId> <scope>test</scope> </dependency> <dependency> @@ -112,19 +112,6 @@ <scope>test</scope> </dependency> - <dependency> - <groupId>io.projectreactor.netty</groupId> - <artifactId>reactor-netty-core</artifactId> - <version>${reactor-netty-version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.projectreactor.netty</groupId> - <artifactId>reactor-netty-http</artifactId> - <version>${reactor-netty-version}</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> diff --git a/dsl/camel-kotlin-api/src/test/kotlin/org/apache/camel/kotlin/BeansTest.kt b/dsl/camel-kotlin-api/src/test/kotlin/org/apache/camel/kotlin/BeansTest.kt deleted file mode 100644 index c1b58b9fc1e..00000000000 --- a/dsl/camel-kotlin-api/src/test/kotlin/org/apache/camel/kotlin/BeansTest.kt +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.kotlin - -import org.apache.camel.impl.DefaultCamelContext -import org.apache.camel.kotlin.components.mock -import org.apache.camel.kotlin.components.`netty-http` -import org.junit.jupiter.api.AfterEach -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertDoesNotThrow -import kotlin.test.assertEquals -import kotlin.test.assertTrue - -class BeansTest { - - private lateinit var ctx: DefaultCamelContext - - @BeforeEach - fun beforeEach() { - ctx = DefaultCamelContext() - } - - @AfterEach - fun afterEach() { - ctx.stop() - } - - @Test - fun testBeanRuntimeInstantiation() { - camel(ctx) { - bean("map", mutableMapOf(Pair("key", "value"))) - bean { - name("test") - type("org.apache.camel.kotlin.Example") - property("map", "#map") - } - } - - val example = ctx.registry.lookupByName("test") - assertTrue(example is Example) - assertEquals("value", example.map["key"]) - - } - - @Test - fun testBeanBinding() { - camel(ctx) { - route { - from { - `netty-http` { - protocol("http") - host("localhost") - port(8080) - path("/") - bossGroup("#nioELG") - } - } - steps { - to { - mock { - name("end") - } - } - } - } - bean { - name("nioELG") - type("io.netty.channel.nio.NioEventLoopGroup") - } - } - assertDoesNotThrow { - ctx.start() - } - } -} - -class Example { - lateinit var map: MutableMap<String, String> -} \ No newline at end of file diff --git a/dsl/camel-kotlin-api/src/test/kotlin/org/apache/camel/kotlin/RestTest.kt b/dsl/camel-kotlin-api/src/test/kotlin/org/apache/camel/kotlin/RestTest.kt index f6eef3fb50b..1caaa06556f 100644 --- a/dsl/camel-kotlin-api/src/test/kotlin/org/apache/camel/kotlin/RestTest.kt +++ b/dsl/camel-kotlin-api/src/test/kotlin/org/apache/camel/kotlin/RestTest.kt @@ -21,11 +21,7 @@ import org.apache.camel.kotlin.components.direct import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertDoesNotThrow -import reactor.netty.http.client.HttpClient import java.util.concurrent.atomic.AtomicBoolean -import kotlin.test.assertNotNull -import kotlin.test.assertTrue class RestTest { @@ -48,8 +44,8 @@ class RestTest { camel(ctx) { restConfiguration { host("localhost") - port("8080") - component("netty-http") + port(port) + component("jetty") contextPath("/") apiContextPath("/openapi") } @@ -71,13 +67,5 @@ class RestTest { } ctx.start() - val client = HttpClient.create() - assertDoesNotThrow { - client.get().uri("http://localhost:8080/q/some").response().block() - } - assertTrue(someReached.get()) - val openapi = client.get().uri("http://localhost:8080/openapi").responseContent() - .aggregate().asString().block() - assertNotNull(openapi) } } \ No newline at end of file