You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2017/01/24 01:34:01 UTC
james-project git commit: JAMES-1915 Using concurrent safe collection
for ConcurrentTestRunnerTest
Repository: james-project
Updated Branches:
refs/heads/master 84ed5a28a -> 8813d2e57
JAMES-1915 Using concurrent safe collection for ConcurrentTestRunnerTest
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/8813d2e5
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/8813d2e5
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/8813d2e5
Branch: refs/heads/master
Commit: 8813d2e57195ef60dc2403fedc341e7018059de4
Parents: 84ed5a2
Author: Benoit Tellier <bt...@linagora.com>
Authored: Mon Jan 23 09:47:31 2017 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Tue Jan 24 08:33:14 2017 +0700
----------------------------------------------------------------------
.../mail/model/concurrency/ConcurrentTestRunnerTest.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/8813d2e5/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/concurrency/ConcurrentTestRunnerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/concurrency/ConcurrentTestRunnerTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/concurrency/ConcurrentTestRunnerTest.java
index 60fa367..302ed9e 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/concurrency/ConcurrentTestRunnerTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/concurrency/ConcurrentTestRunnerTest.java
@@ -21,15 +21,13 @@ package org.apache.james.mailbox.store.mail.model.concurrency;
import static org.assertj.core.api.Assertions.assertThat;
-import java.util.List;
+import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.TimeUnit;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import com.google.common.collect.Lists;
-
public class ConcurrentTestRunnerTest {
public static final ConcurrentTestRunner.BiConsumer EMPTY_BI_CONSUMER = new ConcurrentTestRunner.BiConsumer() {
@@ -120,18 +118,18 @@ public class ConcurrentTestRunnerTest {
public void runShouldPerformAllOperations() throws Exception {
int operationCount = 2;
int threadCount = 2;
- final List<String> list = Lists.newArrayList();
+ final ConcurrentLinkedQueue<String> queue = new ConcurrentLinkedQueue<String>();
ConcurrentTestRunner concurrentTestRunner = new ConcurrentTestRunner(threadCount, operationCount,
new ConcurrentTestRunner.BiConsumer() {
@Override
public void consume(int threadNumber, int step) throws Exception {
- list.add(threadNumber + ":" + step);
+ queue.add(threadNumber + ":" + step);
}
})
.run();
assertThat(concurrentTestRunner.awaitTermination(DEFAULT_AWAIT_TIME, TimeUnit.MILLISECONDS)).isTrue();
- assertThat(list).containsOnly("0:0", "0:1", "1:0", "1:1");
+ assertThat(queue).containsOnly("0:0", "0:1", "1:0", "1:1");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org