camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [camel] branch master updated: Fixed flaky test
Date Fri, 01 Mar 2019 08:35:31 GMT
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new e7b18c8  Fixed flaky test
e7b18c8 is described below

commit e7b18c899fb46d027a9eff81e29025e0839e15ba
Author: Claus Ibsen <claus.ibsen@gmail.com>
AuthorDate: Fri Mar 1 09:35:11 2019 +0100

    Fixed flaky test
---
 .../DualCamelContextManagedAutoAssignedNameTest.java  | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/management/DualCamelContextManagedAutoAssignedNameTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/management/DualCamelContextManagedAutoAssignedNameTest.java
index 337a780..bb6d07f 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/management/DualCamelContextManagedAutoAssignedNameTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/management/DualCamelContextManagedAutoAssignedNameTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.spring.management;
 
 import java.util.Iterator;
 import java.util.Set;
+import java.util.TreeSet;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -50,23 +51,33 @@ public class DualCamelContextManagedAutoAssignedNameTest extends DualCamelContex
         set = mbeanServer.queryNames(new ObjectName("*:type=endpoints,*"), null);
         assertTrue("Size should be 4 or higher, was: " + set.size(), set.size() >= 4);
 
+        Set<String> ids1 = new TreeSet<>();
+        Set<String> ids2 = new TreeSet<>();
         for (ObjectName on : set) {
             String name = on.getCanonicalName();
 
+            log.info("ObjectName: {}", on);
+
             if (name.contains("mock://mock1")) {
                 String id = (String) mbeanServer.getAttribute(on, "CamelId");
-                assertEquals("camel-1", id);
+                ids1.add(id);
             } else if (name.contains("mock://mock2")) {
                 String id = (String) mbeanServer.getAttribute(on, "CamelId");
-                assertEquals("camel-2", id);
+                ids2.add(id);
             } else if (name.contains("file://target/route1")) {
                 String id = (String) mbeanServer.getAttribute(on, "CamelId");
-                assertEquals("camel-1", id);
+                ids1.add(id);
             } else if (name.contains("file://target/route2")) {
                 String id = (String) mbeanServer.getAttribute(on, "CamelId");
-                assertEquals("camel-2", id);
+                ids2.add(id);
             }
         }
+        assertEquals(1, ids1.size());
+        assertEquals(1, ids2.size());
+        String camel1 = ids1.iterator().next();
+        String camel2 = ids2.iterator().next();
+        // should be different Camels
+        assertNotEquals(camel1, camel2);
     }
 
 }


Mime
View raw message