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 2017/07/05 19:58:08 UTC

camel git commit: CAMEL-11446: Use awaitility in camel-core for testing where we otherwise use thred sleep which can be speeded up.

Repository: camel
Updated Branches:
  refs/heads/master d4e01d7a6 -> 869d3edf5


CAMEL-11446: Use awaitility in camel-core for testing where we otherwise use thred sleep which can be speeded up.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/869d3edf
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/869d3edf
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/869d3edf

Branch: refs/heads/master
Commit: 869d3edf57d22dd07c7281d4ff828f18b78c56f3
Parents: d4e01d7
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jul 5 21:57:53 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jul 5 21:57:53 2017 +0200

----------------------------------------------------------------------
 camel-core/pom.xml                                   |  5 +++++
 .../management/ManagedRouteNoAutoStartupTest.java    |  8 +++++++-
 components/camel-ignite/pom.xml                      |  2 +-
 .../camel/component/ignite/IgniteMessagingTest.java  | 15 ++++++---------
 components/camel-spring-boot/pom.xml                 |  5 -----
 parent/pom.xml                                       |  6 +++---
 .../camel-spring-boot-dependencies/pom.xml           | 10 +++++-----
 7 files changed, 27 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/869d3edf/camel-core/pom.xml
----------------------------------------------------------------------
diff --git a/camel-core/pom.xml b/camel-core/pom.xml
index 757d3dd..598e216 100644
--- a/camel-core/pom.xml
+++ b/camel-core/pom.xml
@@ -160,6 +160,11 @@
       <version>${hamcrest-version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.awaitility</groupId>
+      <artifactId>awaitility</artifactId>
+      <scope>test</scope>
+    </dependency>
 
     <!-- logging -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/869d3edf/camel-core/src/test/java/org/apache/camel/management/ManagedRouteNoAutoStartupTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedRouteNoAutoStartupTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedRouteNoAutoStartupTest.java
index 5a4bda4..cd780f9 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedRouteNoAutoStartupTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedRouteNoAutoStartupTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.management;
 
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
@@ -24,6 +25,8 @@ import org.apache.camel.ServiceStatus;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 
+import static org.awaitility.Awaitility.await;
+
 /**
  * Extended test to see if mbeans is removed and stats are correct
  *
@@ -73,7 +76,10 @@ public class ManagedRouteNoAutoStartupTest extends ManagementTestSupport {
         assertMockEndpointsSatisfied();
 
         // need a bit time to let JMX update
-        Thread.sleep(1000);
+        await().atMost(1, TimeUnit.SECONDS).until(() -> {
+            Long completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");
+            return completed > 0;
+        });
 
         // should have 1 completed exchange
         Long completed = (Long) mbeanServer.getAttribute(on, "ExchangesCompleted");

http://git-wip-us.apache.org/repos/asf/camel/blob/869d3edf/components/camel-ignite/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-ignite/pom.xml b/components/camel-ignite/pom.xml
index f98c452..85417bf 100644
--- a/components/camel-ignite/pom.xml
+++ b/components/camel-ignite/pom.xml
@@ -92,7 +92,7 @@
     </dependency>
     
     <dependency>
-      <groupId>com.jayway.awaitility</groupId>
+      <groupId>org.awaitility</groupId>
       <artifactId>awaitility</artifactId>
       <scope>test</scope>
     </dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/869d3edf/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java
----------------------------------------------------------------------
diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java
index a90de6d..aaebdc9 100644
--- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java
+++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java
@@ -26,7 +26,6 @@ import com.google.common.collect.ContiguousSet;
 import com.google.common.collect.DiscreteDomain;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Range;
-
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
@@ -36,9 +35,7 @@ import org.junit.After;
 import org.junit.Test;
 
 import static com.google.common.truth.Truth.assert_;
-import static com.jayway.awaitility.Awaitility.await;
-import static com.jayway.awaitility.Awaitility.to;
-import static org.hamcrest.Matchers.equalTo;
+import static org.awaitility.Awaitility.await;
 
 public class IgniteMessagingTest extends AbstractIgniteTest implements Serializable {
 
@@ -65,7 +62,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa
 
         template.requestBody("ignite-messaging:TOPIC1", 1);
 
-        await().atMost(5, TimeUnit.SECONDS).untilCall(to(messages).size(), equalTo(1));
+        await().atMost(5, TimeUnit.SECONDS).until(() -> messages.size() == 1);
         assert_().that(messages.get(0)).isEqualTo(1);
     }
 
@@ -92,7 +89,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa
         Set<Integer> request = ContiguousSet.create(Range.closedOpen(0, 100), DiscreteDomain.integers());
         template.requestBody("ignite-messaging:TOPIC1", request);
 
-        await().atMost(5, TimeUnit.SECONDS).untilCall(to(messages).size(), equalTo(100));
+        await().atMost(5, TimeUnit.SECONDS).until(() -> messages.size() == 100);
         assert_().that(messages).containsAllIn(request);
     }
 
@@ -106,7 +103,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa
             template.requestBody("ignite-messaging:TOPIC1?sendMode=ORDERED&timeout=1000", i);
         }
 
-        await().atMost(5, TimeUnit.SECONDS).untilCall(to(messages).size(), equalTo(100));
+        await().atMost(5, TimeUnit.SECONDS).until(() -> messages.size() == 100);
         assert_().that(messages).containsAllIn(set);
     }
 
@@ -118,7 +115,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa
         Set<Integer> request = ContiguousSet.create(Range.closedOpen(0, 100), DiscreteDomain.integers());
         template.requestBody("ignite-messaging:TOPIC1?treatCollectionsAsCacheObjects=true", request);
 
-        await().atMost(5, TimeUnit.SECONDS).untilCall(to(messages).size(), equalTo(1));
+        await().atMost(5, TimeUnit.SECONDS).until(() -> messages.size() == 1);
         assert_().that(messages.get(0)).isEqualTo(request);
     }
 
@@ -131,7 +128,7 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa
         Set<Integer> messagesToSend = ContiguousSet.create(Range.closedOpen(0, 100), DiscreteDomain.integers());
         ignite().message().send(TOPIC1, messagesToSend);
 
-        await().atMost(5, TimeUnit.SECONDS).untilCall(to(messages).size(), equalTo(100));
+        await().atMost(5, TimeUnit.SECONDS).until(() -> messages.size() == 100);
 
         consumer.stop();
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/869d3edf/components/camel-spring-boot/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/pom.xml b/components/camel-spring-boot/pom.xml
index c2dd5b5..3b5ba84 100644
--- a/components/camel-spring-boot/pom.xml
+++ b/components/camel-spring-boot/pom.xml
@@ -93,11 +93,6 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>com.jayway.awaitility</groupId>
-      <artifactId>awaitility</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/camel/blob/869d3edf/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 1187c2b..517a784 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -80,7 +80,7 @@
     <avro-version>1.8.2</avro-version>
     <avro-bundle-version>1.8.2_1</avro-bundle-version>
     <avro-ipc-bundle-version>1.8.2_1</avro-ipc-bundle-version>
-    <awaitility.version>1.7.0</awaitility.version>
+    <awaitility-version>3.0.0</awaitility-version>
     <aws-java-sdk-bundle-version>1.11.136_1</aws-java-sdk-bundle-version>
     <aws-java-sdk-version>1.11.136</aws-java-sdk-version>
     <axiom-version>1.2.14</axiom-version>
@@ -4212,9 +4212,9 @@
         <version>${google-truth-version}</version>
       </dependency>
       <dependency>
-        <groupId>com.jayway.awaitility</groupId>
+        <groupId>org.awaitility</groupId>
         <artifactId>awaitility</artifactId>
-        <version>${awaitility.version}</version>
+        <version>${awaitility-version}</version>
       </dependency>
       <dependency>
         <groupId>org.easymock</groupId>

http://git-wip-us.apache.org/repos/asf/camel/blob/869d3edf/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
index c435edf..a690041 100644
--- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
+++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml
@@ -86,11 +86,6 @@
         <version>0.30</version>
       </dependency>
       <dependency>
-        <groupId>com.jayway.awaitility</groupId>
-        <artifactId>awaitility</artifactId>
-        <version>1.7.0</version>
-      </dependency>
-      <dependency>
         <groupId>com.lmax</groupId>
         <artifactId>disruptor</artifactId>
         <version>3.3.6</version>
@@ -3055,6 +3050,11 @@
         <version>3.4.10</version>
       </dependency>
       <dependency>
+        <groupId>org.awaitility</groupId>
+        <artifactId>awaitility</artifactId>
+        <version>3.0.0</version>
+      </dependency>
+      <dependency>
         <groupId>org.cassandraunit</groupId>
         <artifactId>cassandra-unit</artifactId>
         <version>3.1.3.2</version>