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 2019/01/17 06:50:30 UTC

[14/27] james-project git commit: JAMES-2641 SetMessagesMethodTest should be using EventCollector

JAMES-2641 SetMessagesMethodTest should be using EventCollector

Rather than implementing its own


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

Branch: refs/heads/master
Commit: 7e0fdc6a6822098b04312e6e8190370b6b1ce6b7
Parents: 0a3b38a
Author: Benoit Tellier <bt...@linagora.com>
Authored: Thu Jan 10 10:50:06 2019 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Thu Jan 17 10:23:41 2019 +0700

----------------------------------------------------------------------
 .../jmap-integration-testing-common/pom.xml       |  6 ++++++
 .../integration/SetMessagesMethodTest.java        | 18 ++++--------------
 .../memory-jmap-integration-testing/pom.xml       |  6 ++++++
 .../rabbitmq-jmap-integration-testing/pom.xml     |  6 ++++++
 4 files changed, 22 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/7e0fdc6a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/pom.xml b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/pom.xml
index d414034..8c52940 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/pom.xml
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/pom.xml
@@ -35,6 +35,12 @@
     <dependencies>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-api</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>apache-james-mailbox-spamassassin</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/7e0fdc6a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
index 0dfd667..c8028bf 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
@@ -96,6 +96,7 @@ import org.apache.james.mailbox.model.SerializableQuotaValue;
 import org.apache.james.mailbox.probe.ACLProbe;
 import org.apache.james.mailbox.probe.MailboxProbe;
 import org.apache.james.mailbox.probe.QuotaProbe;
+import org.apache.james.mailbox.util.EventCollector;
 import org.apache.james.modules.ACLProbeImpl;
 import org.apache.james.modules.MailboxProbeImpl;
 import org.apache.james.modules.QuotaProbesImpl;
@@ -123,7 +124,6 @@ import org.junit.experimental.categories.Category;
 
 import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
 import com.google.common.io.ByteStreams;
 
 import io.restassured.RestAssured;
@@ -2307,18 +2307,8 @@ public abstract class SetMessagesMethodTest {
             "  ]" +
             "]";
 
-        List<Event> events = Lists.newArrayList();
-        jmapServer.getProbe(JmapGuiceProbe.class).addMailboxListener(new MailboxListener() {
-            @Override
-            public ListenerType getType() {
-                return ListenerType.ONCE;
-            }
-
-            @Override
-            public void event(Event event) {
-                events.add(event);
-            }
-        });
+        EventCollector eventCollector = new EventCollector();
+        jmapServer.getProbe(JmapGuiceProbe.class).addMailboxListener(eventCollector);
 
         String messageId = with()
             .header("Authorization", accessToken.serialize())
@@ -2332,7 +2322,7 @@ public abstract class SetMessagesMethodTest {
 
 
 
-        calmlyAwait.atMost(5, TimeUnit.SECONDS).until(() -> events.stream()
+        calmlyAwait.atMost(5, TimeUnit.SECONDS).until(() -> eventCollector.getEvents().stream()
             .anyMatch(event -> isAddedToOutboxEvent(messageId, event, outboxId)));
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/7e0fdc6a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml
index 9ed0bc9..7a653b6 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/pom.xml
@@ -35,6 +35,12 @@
     <dependencies>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-api</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>apache-james-mailbox-spamassassin</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/7e0fdc6a/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/pom.xml b/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/pom.xml
index f20a989..c210fd0 100644
--- a/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/pom.xml
+++ b/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/pom.xml
@@ -37,6 +37,12 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-api</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>apache-james-mailbox-scanning-search</artifactId>
             <type>test-jar</type>
             <scope>test</scope>


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