james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [3/4] james-project git commit: JAMES-1945 CompletableFutureUtil::allOf should preserve order
Date Tue, 21 Feb 2017 13:21:23 GMT
JAMES-1945 CompletableFutureUtil::allOf should preserve order


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/66f31108
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/66f31108
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/66f31108

Branch: refs/heads/JAMES-1945
Commit: 66f311082c589ae76e5859c157b29a3a2849100d
Parents: 3e60185
Author: Benoit Tellier <btellier@linagora.com>
Authored: Tue Feb 21 13:13:56 2017 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Tue Feb 21 14:02:39 2017 +0700

----------------------------------------------------------------------
 .../james/util/CompletableFutureUtilTest.java   | 31 ++++++++++++++++++++
 1 file changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/66f31108/server/container/util-java8/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
----------------------------------------------------------------------
diff --git a/server/container/util-java8/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
b/server/container/util-java8/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
index 144cf42..55cef98 100644
--- a/server/container/util-java8/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
+++ b/server/container/util-java8/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
@@ -56,6 +56,37 @@ public class CompletableFutureUtilTest {
             .containsOnly(value1, value2, value3);
     }
 
+
+    @Test
+    public void allOfShouldPreserveOrder() {
+        long value1 = 18L;
+        long value2 = 19L;
+        long value3 = 20L;
+        long value4 = 21L;
+        long value5 = 22L;
+        long value6 = 23L;
+        long value7 = 24L;
+        long value8 = 25L;
+        long value9 = 26L;
+        long value10 = 27L;
+        assertThat(
+            CompletableFutureUtil.allOf(
+                Stream.of(
+                    CompletableFuture.completedFuture(value1),
+                    CompletableFuture.completedFuture(value2),
+                    CompletableFuture.completedFuture(value3),
+                    CompletableFuture.completedFuture(value4),
+                    CompletableFuture.completedFuture(value5),
+                    CompletableFuture.completedFuture(value6),
+                    CompletableFuture.completedFuture(value7),
+                    CompletableFuture.completedFuture(value8),
+                    CompletableFuture.completedFuture(value9),
+                    CompletableFuture.completedFuture(value10)))
+                .join()
+                .collect(Guavate.toImmutableList()))
+            .containsExactly(value1, value2, value3, value4, value5, value6, value7, value8,
value9, value10);
+    }
+
     @Test
     public void allOfShouldWorkOnVeryLargeStream() {
         CompletableFutureUtil.allOf(


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message