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 2020/06/22 11:41:02 UTC
[james-project] 02/04: MAILBOX-398 ElasticSearch backend do not
take into account session recent messages
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 7008a8d00687b44b07324f7f05b84fa603622907
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Jun 19 18:46:36 2020 +0700
MAILBOX-398 ElasticSearch backend do not take into account session recent messages
---
.../apache/james/mpt/imapmailbox/suite/Recent.java | 50 +++++++++++++++++++++
.../org/apache/james/imap/scripts/Recent.test | 49 +++++++-------------
.../elasticsearch/ElasticSearchRecentTest.java | 52 ++++++++++++++++++++++
.../imapmailbox/inmemory/InMemoryRecentTest.java | 44 ++++++++++++++++++
.../imapmailbox/lucenesearch/LuceneRecentTest.java | 50 +++++++++++++++++++++
5 files changed, 213 insertions(+), 32 deletions(-)
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Recent.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Recent.java
new file mode 100644
index 0000000..39bdebe
--- /dev/null
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Recent.java
@@ -0,0 +1,50 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mpt.imapmailbox.suite;
+
+import java.util.Locale;
+
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.suite.base.BasicImapCommands;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.Before;
+import org.junit.Test;
+
+public abstract class Recent extends BasicImapCommands {
+ protected abstract ImapHostSystem createImapHostSystem();
+
+ private ImapHostSystem system;
+ private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
+
+ @Before
+ public void setUp() throws Exception {
+ system = createImapHostSystem();
+ simpleScriptedTestProtocol = new SimpleScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
+ .withUser(USER, PASSWORD)
+ .withLocale(Locale.US);
+ BasicImapCommands.welcome(simpleScriptedTestProtocol);
+ BasicImapCommands.authenticate(simpleScriptedTestProtocol);
+ }
+
+ @Test
+ public void testRecent() throws Exception {
+ simpleScriptedTestProtocol.run("Recent");
+ }
+}
diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Recent.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Recent.test
index 5336637..803e80f 100644
--- a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Recent.test
+++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Recent.test
@@ -17,16 +17,18 @@
# under the License. #
################################################################
C: A2 CREATE testmailbox
-S: A2 OK Create completed\.
-C: A3 SELECT testmailbox
-S: \* FLAGS \(\\Answered \\Flagged \\Deleted \\Seen \\Draft\)
-S: \* OK \[PERMANENTFLAGS \(\\Answered \\Flagged \\Deleted \\Seen \\Draft \\\*\)\] Flags permitted\.
+S: A2 OK CREATE completed\.
+
+C: A5 SELECT testmailbox
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
S: \* 0 EXISTS
S: \* 0 RECENT
-S: \* OK \[UIDVALIDITY 1203172345\] UIDs valid
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[PERMANENTFLAGS .*
S: \* OK \[HIGHESTMODSEQ \d+\].*
S: \* OK \[UIDNEXT 1\] Predicted next UID
-S: A3 OK \[READ-WRITE\] SELECT completed\.
+S: A5 OK \[READ-WRITE\] SELECT completed\.
+
C: A4 APPEND testmailbox {185+}
C: From: Timothy Tayler <ti...@example.org>
C: To: Samual Smith <sa...@example.org>
@@ -37,32 +39,15 @@ C: This is a very simple email.
C:
S: \* 1 EXISTS
S: \* 1 RECENT
-S: A4 OK Append completed\.
-C: A5 SELECT testmailbox
-S: \* FLAGS \(\\Answered \\Flagged \\Deleted \\Seen \\Draft\)
-S: \* OK \[PERMANENTFLAGS \(\\Answered \\Flagged \\Deleted \\Seen \\Draft \\\*\)\] Flags permitted\.
-S: \* 1 EXISTS
-S: \* 1 RECENT
-S: \* OK \[UNSEEN 1\] First unseen\.
-S: \* OK \[UIDVALIDITY 1203172345\] UIDs valid
-S: \* OK \[HIGHESTMODSEQ \d+\].*
-S: \* OK \[UIDNEXT 2\] Predicted next UID
-S: A5 OK \[READ-WRITE\] Select completed\.
+S: A4 OK .*
+
+C: A146 UID SEARCH RECENT
+S: \* SEARCH 1
+S: A146 OK SEARCH completed\.
+
C: A6 FETCH 1 (FLAGS)
S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
-S: A6 OK Fetch completed\.
-C: A7 FETCH 1 (BODY[])
-S: \* 1 FETCH \(FLAGS \(\\Seen \\Recent\) BODY\[\] {185}
-S: From: Timothy Tayler <timothy@example\.org>
-S: To: Samual Smith <samual@example\.org>
-S: Date: Thu, 14 Feb 2008 12:00:00 \+0000 \(GMT\)
-S: Subject: A Simple Email
-S:
-S: This is a very simple email\.
-S: \)
-S: A7 OK Fetch completed\.
-C: A8 FETCH 1 (FLAGS)
-S: \* 1 FETCH \(FLAGS \(\\Seen \\Recent\)\)
-S: A8 OK Fetch completed\.
+S: A6 OK FETCH completed\.
+
C: A9 DELETE testmailbox
-S: A9 OK Delete completed\..
+S: A9 OK DELETE completed\.
diff --git a/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/ElasticSearchRecentTest.java b/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/ElasticSearchRecentTest.java
new file mode 100644
index 0000000..7265bf4
--- /dev/null
+++ b/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/ElasticSearchRecentTest.java
@@ -0,0 +1,52 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mpt.imapmailbox.elasticsearch;
+
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.elasticsearch.host.ElasticSearchHostSystem;
+import org.apache.james.mpt.imapmailbox.suite.Recent;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+
+@Ignore("MAILBOX-398 ElasticSearch backend do not take into account session recent messages")
+public class ElasticSearchRecentTest extends Recent {
+
+ private ImapHostSystem system;
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ system = new ElasticSearchHostSystem();
+ system.beforeTest();
+ super.setUp();
+ }
+
+ @Override
+ protected ImapHostSystem createImapHostSystem() {
+ return system;
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ system.afterTest();
+ }
+
+}
diff --git a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryRecentTest.java b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryRecentTest.java
new file mode 100644
index 0000000..5d2f4d9
--- /dev/null
+++ b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryRecentTest.java
@@ -0,0 +1,44 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mpt.imapmailbox.inmemory;
+
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.inmemory.host.InMemoryHostSystem;
+import org.apache.james.mpt.imapmailbox.suite.Recent;
+import org.junit.Before;
+
+public class InMemoryRecentTest extends Recent {
+
+ private ImapHostSystem system;
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ system = new InMemoryHostSystem();
+ system.beforeTest();
+ super.setUp();
+ }
+
+ @Override
+ protected ImapHostSystem createImapHostSystem() {
+ return system;
+ }
+
+}
diff --git a/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/LuceneRecentTest.java b/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/LuceneRecentTest.java
new file mode 100644
index 0000000..40608eb
--- /dev/null
+++ b/mpt/impl/imap-mailbox/lucenesearch/src/test/java/org/apache/james/mpt/imapmailbox/lucenesearch/LuceneRecentTest.java
@@ -0,0 +1,50 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.mpt.imapmailbox.lucenesearch;
+
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.lucenesearch.host.LuceneSearchHostSystem;
+import org.apache.james.mpt.imapmailbox.suite.Recent;
+import org.junit.After;
+import org.junit.Before;
+
+public class LuceneRecentTest extends Recent {
+
+ private ImapHostSystem system;
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ system = new LuceneSearchHostSystem();
+ system.beforeTest();
+ super.setUp();
+ }
+
+ @Override
+ protected ImapHostSystem createImapHostSystem() {
+ return system;
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ system.afterTest();
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org