You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2020/10/06 01:20:47 UTC

[james-project] 02/02: JAMES-3402 Add performance tests for UidMsnConverter::getMSN

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit e70905f33a955dc542d880bb652cc40da6c28abb
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Oct 5 15:34:44 2020 +0700

    JAMES-3402 Add performance tests for UidMsnConverter::getMSN
    
    This gets the MSN for each messages in a mailbox.
---
 .../james/imap/processor/base/UidMsnConverterTest.java      | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/base/UidMsnConverterTest.java b/protocols/imap/src/test/java/org/apache/james/imap/processor/base/UidMsnConverterTest.java
index 438db40..243abf9 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/processor/base/UidMsnConverterTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/base/UidMsnConverterTest.java
@@ -23,6 +23,8 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import java.time.Duration;
 import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
 
 import org.apache.james.mailbox.MessageUid;
 import org.apache.james.mailbox.NullableMessageSequenceNumber;
@@ -62,6 +64,17 @@ public class UidMsnConverterTest {
     }
 
     @Test
+    public void loopingGetMSNShouldSucceedForAMillionItems() {
+        int count = 1000;
+        testee.addAll(IntStream.range(0, count)
+            .mapToObj(i -> MessageUid.of(i + 1))
+            .collect(Collectors.toList()));
+
+        IntStream.range(0, 1000000)
+            .forEach(i -> testee.getMsn(MessageUid.of(i + 1)));
+    }
+
+    @Test
     public void getUidShouldTheCorrespondingUidIfItExist() {
         testee.addUid(messageUid1);
 


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