You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/11/12 09:51:56 UTC

[camel] branch main updated: CAMEL-18608: camel-endpointdsl - Fix port issue in EndpointQueryParamTest

This is an automated email from the ASF dual-hosted git repository.

nfilotto 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 56347de001a CAMEL-18608: camel-endpointdsl - Fix port issue in EndpointQueryParamTest
56347de001a is described below

commit 56347de001a9ca30cea7e7eb5cea3166afcdc744
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Sat Nov 12 10:51:23 2022 +0100

    CAMEL-18608: camel-endpointdsl - Fix port issue in EndpointQueryParamTest
---
 .../camel/builder/endpoint/EndpointQueryParamTest.java   | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/dsl/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/EndpointQueryParamTest.java b/dsl/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/EndpointQueryParamTest.java
index 2bf9fd66e8d..0b45c634556 100644
--- a/dsl/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/EndpointQueryParamTest.java
+++ b/dsl/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/EndpointQueryParamTest.java
@@ -18,28 +18,30 @@ package org.apache.camel.builder.endpoint;
 
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.AvailablePortFinder;
 import org.junit.jupiter.api.Test;
 
-public class EndpointQueryParamTest extends BaseEndpointDslTest {
+class EndpointQueryParamTest extends BaseEndpointDslTest {
     @Override
     protected RoutesBuilder createRouteBuilder() throws Exception {
         return new EndpointRouteBuilder() {
             @Override
-            public void configure() throws Exception {
-                restConfiguration().component("jetty").host("localhost").port(9999);
+            public void configure() {
+                int port = AvailablePortFinder.getNextAvailable();
+                restConfiguration().component("jetty").host("localhost").port(port);
                 rest().get("path/xyz")
                     .to("log:myLogger?level=INFO&showAll=true")
                     .to("mock:result");
                 from(direct("test"))
-                        .to(http("localhost:9999/path/xyz?param1=1&param2=2").httpMethod("GET"));
+                        .to(http(String.format("localhost:%d/path/xyz?param1=1&param2=2", port)).httpMethod("GET"));
                 from(direct("test2"))
-                        .to("http://localhost:9999/path/xyz?param1=1&param2=2&httpMethod=GET");
+                        .toF("http://localhost:%d/path/xyz?param1=1&param2=2&httpMethod=GET", port);
             }
         };
     }
 
     @Test
-    public void testRoute() throws InterruptedException {
+    void testRoute() throws Exception {
         MockEndpoint mockEndpoint = getMockEndpoint("mock:result");
 
         mockEndpoint.expectedHeaderReceived("param1", "1");
@@ -50,7 +52,7 @@ public class EndpointQueryParamTest extends BaseEndpointDslTest {
     }
 
     @Test
-    public void testEndpointDslRoute() throws InterruptedException {
+    void testEndpointDslRoute() throws Exception {
         MockEndpoint mockEndpoint = getMockEndpoint("mock:result");
         mockEndpoint.expectedHeaderReceived("param1", "1");
         mockEndpoint.expectedHeaderReceived("param2", "2");