You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/08/02 17:41:15 UTC

[camel] branch main updated: CAMEL-19684: zookeeper master (#10969)

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 ed287840db3 CAMEL-19684: zookeeper master (#10969)
ed287840db3 is described below

commit ed287840db3022d428f3b7933ceb7cb57c862396
Author: Federico Mariani <34...@users.noreply.github.com>
AuthorDate: Wed Aug 2 19:41:09 2023 +0200

    CAMEL-19684: zookeeper master (#10969)
---
 components/camel-zookeeper-master/pom.xml                        | 6 ++++++
 .../apache/camel/component/zookeepermaster/MasterEndpointIT.java | 9 +++++----
 .../camel/component/zookeepermaster/MasterEndpointIT-context.xml | 4 ++--
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/components/camel-zookeeper-master/pom.xml b/components/camel-zookeeper-master/pom.xml
index 97460c31408..830ab0f2412 100644
--- a/components/camel-zookeeper-master/pom.xml
+++ b/components/camel-zookeeper-master/pom.xml
@@ -108,6 +108,12 @@
             <artifactId>camel-ftp</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <version>${awaitility-version}</version>
+            <scope>test</scope>
+        </dependency>
 
         <!-- test infra -->
         <dependency>
diff --git a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointIT.java b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointIT.java
index 013d56fb44d..6e2441c3efd 100644
--- a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointIT.java
+++ b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/MasterEndpointIT.java
@@ -28,6 +28,7 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.zookeepermaster.group.ZookeeprContainer;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.test.spring.junit5.CamelSpringTest;
+import org.awaitility.Awaitility;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -45,7 +46,7 @@ public class MasterEndpointIT {
     @EndpointInject("mock:results")
     protected MockEndpoint resultEndpoint;
 
-    @Produce("seda:bar")
+    @Produce("direct:bar")
     protected ProducerTemplate template;
 
     @Test
@@ -54,14 +55,14 @@ public class MasterEndpointIT {
         List<Route> registeredRoutes = camelContext.getRoutes();
         assertEquals(1, registeredRoutes.size(), "number of routes");
         MasterEndpoint endpoint = (MasterEndpoint) registeredRoutes.get(0).getEndpoint();
-        assertEquals("seda:bar", endpoint.getConsumerEndpointUri(), "wrong endpoint uri");
+        assertEquals("direct:bar", endpoint.getConsumerEndpointUri(), "wrong endpoint uri");
 
         String expectedBody = "<matched/>";
 
         resultEndpoint.expectedBodiesReceived(expectedBody);
 
-        // lets wait for the entry to be registered...
-        Thread.sleep(5000);
+        MasterConsumer masterConsumer = (MasterConsumer) camelContext.getRoute("zookeeper-master-to-direct").getConsumer();
+        Awaitility.await().until(() -> masterConsumer.isMaster() && masterConsumer.isConnected());
 
         template.sendBodyAndHeader(expectedBody, "foo", "bar");
 
diff --git a/components/camel-zookeeper-master/src/test/resources/org/apache/camel/component/zookeepermaster/MasterEndpointIT-context.xml b/components/camel-zookeeper-master/src/test/resources/org/apache/camel/component/zookeepermaster/MasterEndpointIT-context.xml
index 9a341e14140..ea7d4a6f34c 100644
--- a/components/camel-zookeeper-master/src/test/resources/org/apache/camel/component/zookeepermaster/MasterEndpointIT-context.xml
+++ b/components/camel-zookeeper-master/src/test/resources/org/apache/camel/component/zookeepermaster/MasterEndpointIT-context.xml
@@ -40,8 +40,8 @@
   </bean>
 
   <camelContext xmlns="http://camel.apache.org/schema/spring" depends-on="curator">
-    <route>
-      <from uri="zookeeper-master:master-000:seda:bar"/>
+    <route id="zookeeper-master-to-direct">
+      <from uri="zookeeper-master:master-000:direct:bar"/>
       <to uri="mock:results"/>
     </route>