james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matth...@apache.org
Subject [3/5] james-project git commit: MAILBOX-267 test nextUid as done for nextModSeq
Date Mon, 02 May 2016 08:28:51 GMT
MAILBOX-267 test nextUid as done for nextModSeq


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

Branch: refs/heads/master
Commit: 8eb0a5ec28ca30c0fafa58736e1732ba7f8fee0c
Parents: 267f9c3
Author: Matthieu Baechler <matthieu.baechler@linagora.com>
Authored: Tue Apr 19 15:53:26 2016 +0200
Committer: Matthieu Baechler <matthieu.baechler@linagora.com>
Committed: Mon May 2 10:24:48 2016 +0200

----------------------------------------------------------------------
 .../mail/CassandraUidAndModSeqProviderTest.java          | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/8eb0a5ec/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraUidAndModSeqProviderTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraUidAndModSeqProviderTest.java
b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraUidAndModSeqProviderTest.java
index d62d05e..540c87e 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraUidAndModSeqProviderTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraUidAndModSeqProviderTest.java
@@ -171,4 +171,15 @@ public class CassandraUidAndModSeqProviderTest {
         assertThat(nbValues).isEqualTo(nbEntries);
     }
     
+    @Test
+    public void nextUidShouldGenerateUniqueValuesWhenParallelCalls() throws Exception {
+        SimpleMailbox<CassandraId> mailbox = mailboxList.get(mailboxList.size() / 2);
+        int nbEntries = 1000;
+        long nbValues = LongStream.range(0, nbEntries)
+            .parallel()
+            .map(Throwing.longUnaryOperator(x -> uidProvider.nextUid(null, mailbox)))
+            .distinct()
+            .count();
+        assertThat(nbValues).isEqualTo(nbEntries);
+    }
 }


---------------------------------------------------------------------
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