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 2018/07/17 02:36:33 UTC

[1/4] james-project git commit: MPT-42 Fasten MPT deployment tests

Repository: james-project
Updated Branches:
  refs/heads/master 0855a757f -> 25d49c6d1


MPT-42 Fasten MPT deployment tests

Many unneeded dependencies (44 projects) lead to a 1min23 build, repeated 3 time. Removing these dependencies
lead to a build of 22s (15 remaining projects)


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

Branch: refs/heads/master
Commit: 7ec8f44a61ea8a6f988f8cd76dd946e984876076
Parents: 0855a75
Author: benwa <bt...@linagora.com>
Authored: Mon Jul 16 10:04:48 2018 +0700
Committer: benwa <bt...@linagora.com>
Committed: Mon Jul 16 15:10:32 2018 +0700

----------------------------------------------------------------------
 mpt/core/pom.xml                                |  16 -
 .../apache/james/mpt/helper/ScriptBuilder.java  |   2 +-
 .../james/mpt/host/ExternalHostSystem.java      |   8 +-
 .../james/mpt/session/ExternalSession.java      |   4 +-
 .../imapmailbox/suite/DeploymentValidation.java |  53 --
 .../james/imap/scripts/ValidateDeployment.test  | 519 -------------------
 mpt/impl/imap-mailbox/external-james/pom.xml    |  38 +-
 .../external/james/DeploymentValidation.java    |  53 ++
 .../james/JamesDeploymentValidation.java        |   1 -
 .../james/host/ExternalJamesHostSystem.java     |   6 +-
 .../ValidateDeployment.test                     | 519 +++++++++++++++++++
 11 files changed, 619 insertions(+), 600 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/7ec8f44a/mpt/core/pom.xml
----------------------------------------------------------------------
diff --git a/mpt/core/pom.xml b/mpt/core/pom.xml
index 64baf58..570466f 100644
--- a/mpt/core/pom.xml
+++ b/mpt/core/pom.xml
@@ -36,12 +36,6 @@
             <artifactId>apache-james-mailbox-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>apache-james-mailbox-store</artifactId>
-            <type>test-jar</type>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>com.jayway.awaitility</groupId>
             <artifactId>awaitility</artifactId>
         </dependency>
@@ -72,16 +66,6 @@
             <artifactId>commons-lang3</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.james.protocols</groupId>
-            <artifactId>protocols-imap</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.james.protocols</groupId>
-            <artifactId>protocols-imap</artifactId>
-            <type>test-jar</type>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
             <groupId>org.assertj</groupId>
             <artifactId>assertj-core</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/james-project/blob/7ec8f44a/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java
----------------------------------------------------------------------
diff --git a/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java b/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java
index d08678f..41237a1 100644
--- a/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java
+++ b/mpt/core/src/main/java/org/apache/james/mpt/helper/ScriptBuilder.java
@@ -31,7 +31,7 @@ import java.nio.charset.Charset;
 import java.util.Arrays;
 import java.util.Locale;
 
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 
 public class ScriptBuilder {
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/7ec8f44a/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java b/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
index 24aa86a..59f524e 100644
--- a/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
+++ b/mpt/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
@@ -19,7 +19,7 @@
 
 package org.apache.james.mpt.host;
 
-import org.apache.commons.lang.NotImplementedException;
+import org.apache.commons.lang3.NotImplementedException;
 import org.apache.james.core.quota.QuotaCount;
 import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.model.MailboxACL;
@@ -94,7 +94,7 @@ public class ExternalHostSystem extends ExternalSessionFactory implements ImapHo
 
     @Override
     public void createMailbox(MailboxPath mailboxPath) throws Exception {
-        throw new NotImplementedException();
+        throw new NotImplementedException("Not implemented");
     }
     
     public void beforeTests() throws Exception {
@@ -118,11 +118,11 @@ public class ExternalHostSystem extends ExternalSessionFactory implements ImapHo
 
     @Override
     public void setQuotaLimits(QuotaCount maxMessageQuota, QuotaSize maxStorageQuota) throws Exception {
-        throw new NotImplementedException();
+        throw new NotImplementedException("Not implemented");
     }
 
     @Override
     public void grantRights(MailboxPath mailboxPath, String userName, MailboxACL.Rfc4314Rights rights) throws Exception {
-        throw new NotImplementedException();
+        throw new NotImplementedException("Not implemented");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/7ec8f44a/mpt/core/src/main/java/org/apache/james/mpt/session/ExternalSession.java
----------------------------------------------------------------------
diff --git a/mpt/core/src/main/java/org/apache/james/mpt/session/ExternalSession.java b/mpt/core/src/main/java/org/apache/james/mpt/session/ExternalSession.java
index 1568ba6..72b85b1 100644
--- a/mpt/core/src/main/java/org/apache/james/mpt/session/ExternalSession.java
+++ b/mpt/core/src/main/java/org/apache/james/mpt/session/ExternalSession.java
@@ -25,8 +25,8 @@ import java.nio.channels.SocketChannel;
 import java.nio.charset.Charset;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.commons.lang.NotImplementedException;
-import org.apache.commons.lang.mutable.MutableInt;
+import org.apache.commons.lang3.NotImplementedException;
+import org.apache.commons.lang3.mutable.MutableInt;
 import org.apache.james.mpt.api.Monitor;
 import org.apache.james.mpt.api.Session;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/7ec8f44a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/DeploymentValidation.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/DeploymentValidation.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/DeploymentValidation.java
deleted file mode 100644
index 376a754..0000000
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/DeploymentValidation.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************
- * 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.script.SimpleScriptedTestProtocol;
-import org.junit.Before;
-import org.junit.Test;
-
-public abstract class DeploymentValidation {
-
-    public static final String DOMAIN = "domain";
-    public static final String USER = "imapuser";
-    public static final String PASSWORD = "password";
-
-    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 + "@" + DOMAIN, PASSWORD)
-                .withLocale(Locale.US);
-    }
-    
-    @Test
-    public void validateDeployment() throws Exception {
-        simpleScriptedTestProtocol.run("ValidateDeployment");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/7ec8f44a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/ValidateDeployment.test
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/ValidateDeployment.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/ValidateDeployment.test
deleted file mode 100644
index cfca166..0000000
--- a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/ValidateDeployment.test
+++ /dev/null
@@ -1,519 +0,0 @@
-################################################################
-# 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.                                           #
-################################################################
-
-S: \* OK IMAP4rev1 Server ready
-
-C: a0000 LOGIN imapuser@domain password
-S: a0000 OK LOGIN completed.
-
-C: 10 CREATE appendexpunge
-S: 10 OK CREATE completed.
-
-C: a001 STATUS appendexpunge (MESSAGES)
-S: \* STATUS "appendexpunge" \(MESSAGES 0\)
-S: a001 OK STATUS completed.
-
-C: A002 APPEND appendexpunge (\Deleted) {310+}
-C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
-C: From: Fred Foobar <fo...@Blurdybloop.COM>
-C: Subject: afternoon meeting
-C: To: mooch@owatagu.siam.edu
-C: Message-Id: <B2...@Blurdybloop.COM>
-C: MIME-Version: 1.0
-C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
-C:
-C: Hello Joe, do you think we can meet at 3:30 tomorrow?
-C:
-S: A002 OK (\[.+\] )?APPEND completed.
-
-C: A003 APPEND appendexpunge {310+}
-C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
-C: From: Fred Foobar <fo...@Blurdybloop.COM>
-C: Subject: afternoon meeting 2
-C: To: mooch@owatagu.siam.edu
-C: Message-Id: <B2...@Blurdybloop.COM>
-C: MIME-Version: 1.0
-C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
-C:
-C: Hello Joe, could we change that to 4:00pm tomorrow?
-C:
-S: A003 OK (\[.+\] )?APPEND completed.
-
-C: A004 APPEND appendexpunge {310+}
-C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
-C: From: Fred Foobar <fo...@Blurdybloop.COM>
-C: Subject: afternoon meeting 2
-C: To: mooch@owatagu.siam.edu
-C: Message-Id: <B2...@Blurdybloop.COM>
-C: MIME-Version: 1.0
-C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
-C:
-C: Hello Joe, could we change that to 4:30pm tomorrow?
-C:
-S: A004 OK (\[.+\] )?APPEND completed.
-
-C: A005 STATUS appendexpunge (MESSAGES)
-S: \* STATUS "appendexpunge" \(MESSAGES 3\)
-S: A005 OK STATUS completed.
-
-C: A006 SELECT appendexpunge
-S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
-S: \* 3 EXISTS
-S: \* \d+ RECENT
-S: \* OK \[UIDVALIDITY \d+\].*
-S: \* OK \[UNSEEN 1\].*
-S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\\Seen( \\\*)?\)\].*
-S: \* OK \[HIGHESTMODSEQ \d+\].*
-S: \* OK \[UIDNEXT 4\].*
-S: A006 OK \[READ-WRITE\] SELECT completed.
-
-C: A109 STORE 2 FLAGS.SILENT (\Deleted)
-S: A109 OK STORE completed.
-
-C: A007 EXPUNGE
-S: \* 1 EXPUNGE
-S: \* 1 EXPUNGE
-S: \* \d+ RECENT
-S: A007 OK EXPUNGE completed.
-
-C: A008 STATUS appendexpunge (MESSAGES)
-S: \* STATUS "appendexpunge" \(MESSAGES 1\)
-S: A008 OK STATUS completed.
-
-C: A009 STORE 1 FLAGS.SILENT (\Deleted)
-S: A009 OK STORE completed.
-
-C: A010 EXPUNGE
-S: \* 1 EXPUNGE
-S: \* \d+ RECENT
-S: A010 OK EXPUNGE completed.
-
-C: A011 STATUS appendexpunge (MESSAGES)
-S: \* STATUS "appendexpunge" \(MESSAGES 0\)
-S: A011 OK STATUS completed.
-
-C: A012 DELETE appendexpunge
-S: A012 OK DELETE completed.
-
-C: A001 NAMESPACE
-S: \* NAMESPACE \(\((\"\"|\"#private\.\") \".\"\)\) NIL NIL
-S: A001 OK NAMESPACE completed.
-
-C: A2 CREATE testmailbox
-S: A2 OK CREATE completed\.
-
-C: A3 SELECT testmailbox
-S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
-S: \* 0 EXISTS
-S: \* 0 RECENT
-S: \* OK \[UIDVALIDITY \d+\].*
-S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\\Seen( \\\*)?\)\].*
-S: \* OK \[HIGHESTMODSEQ \d+\].*
-S: \* OK \[UIDNEXT 1\].*
-S: A3 OK \[READ-WRITE\] SELECT completed\.
-
-C: A4 APPEND testmailbox {185+}
-C: From: Timothy Tayler <ti...@example.org>
-C: To: Samual Smith <sa...@example.org>
-C: Date: Thu, 14 Feb 2008 12:00:00 +0000 (GMT)
-C: Subject: A Simple Email
-C:
-C: This is a very simple email.
-C:
-S: \* 1 EXISTS
-S: \* 1 RECENT
-S: A4 OK (\[.+\] )?APPEND completed\.
-
-C: A5 APPEND testmailbox {185+}
-C: From: John Smith <jo...@example.org>
-C: To: Timothy Taylor <ti...@example.org>
-C: Subject: Hello
-C: Date: Sat, 23 Feb 2008 07:48:03 -0600
-C: Message-ID: <17...@machine.example.org>
-C:
-C: Hello, World!
-S: \* 2 EXISTS
-S: \* 2 RECENT
-S: A5 OK (\[.+\] )?APPEND completed\.
-
-C: A6 APPEND testmailbox {227+}
-C: From: John Smith <jo...@example.org>
-C: Sender: Samual Smith <sa...@example.org>
-C: To: Timothy Taylor <ti...@example.org>
-C: Subject: Hello
-C: Date: Sat, 23 Feb 2008 07:48:03 -0600
-C: Message-ID: <17...@machine.example.org>
-C:
-C: Hello, World!
-S: \* 3 EXISTS
-S: \* 3 RECENT
-S: A6 OK (\[.+\] )?APPEND completed\.
-
-C: A7 APPEND testmailbox {185+}
-C: From: Timothy Tayler <ti...@example.org>
-C: To: Samual Smith <sa...@example.org>
-C: Date: Thu, 14 Feb 2008 12:00:00 +0000 (GMT)
-C: Subject: A Simple Email
-C:
-C: This is a very simple email.
-C:
-S: \* 4 EXISTS
-S: \* 4 RECENT
-S: A7 OK (\[.+\] )?APPEND completed\.
-
-C: A8 APPEND testmailbox {318+}
-C: From: "Brian G. Hutton" <br...@example.org>
-C: To: Timothy Taylor <ti...@example.org>, faith@example.org, Huh? <sa...@example.org>
-C: CC: <be...@example.org>, "David \"The Thin White Duke\" Bowie" <du...@example.org>
-C: Subject: Rhubarb
-C: Date: Sat, 23 Feb 2008 07:48:03 -0600
-C: Message-ID: <17...@machine.example.org>
-C:
-C: Rhubarb!
-S: \* 5 EXISTS
-S: \* 5 RECENT
-S: A8 OK (\[.+\] )?APPEND completed\.
-
-C: A9 SELECT testmailbox
-S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
-S: \* 5 EXISTS
-S: \* 5 RECENT
-S: \* OK \[UIDVALIDITY \d+\].*
-S: \* OK \[UNSEEN 1\](.)*
-S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\\Seen( \\\*)?\)\].*
-S: \* OK \[HIGHESTMODSEQ \d+\].*
-S: \* OK \[UIDNEXT 6\].*
-S: A9 OK \[READ-WRITE\] SELECT completed\.
-
-C: A10 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])
-S: \* 1 FETCH \(FLAGS \(\\Recent\) UID 1 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
-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:
-S: \)
-S: \* 2 FETCH \(FLAGS \(\\Recent\) UID 2 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
-S: From: John Smith <john@example\.org>
-S: To: Timothy Taylor <tim@example\.org>
-S: Date: Sat, 23 Feb 2008 07:48:03 -0600
-S:
-S: \)
-S: \* 3 FETCH \(FLAGS \(\\Recent\) UID 3 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
-S: From: John Smith <john@example\.org>
-S: To: Timothy Taylor <tim@example\.org>
-S: Date: Sat, 23 Feb 2008 07:48:03 -0600
-S:
-S: \)
-S: \* 4 FETCH \(FLAGS \(\\Recent\) UID 4 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
-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:
-S: \)
-S: \* 5 FETCH \(FLAGS \(\\Recent\) UID 5 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
-S: From: "Brian G\. Hutton" <brian@example\.org>
-S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
-S: Date: Sat, 23 Feb 2008 07:48:03 -0600
-S:
-S: \)
-S: A10 OK FETCH completed\.
-
-C: A11 LIST "" "*"
-SUB {
-S: \* LIST \(\\HasNoChildren\) "\." "testmailbox"
-S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
-}
-S: A11 OK LIST completed\.
-
-C: A12 RENAME testmailbox anothermailbox
-S: A12 OK RENAME completed.
-
-C: A13 LIST "" "*"
-SUB {
-S: \* LIST \(\\HasNoChildren\) "\." "anothermailbox"
-S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
-}
-S: A13 OK LIST completed\.
-
-C: A14 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])
-S: \* 1 FETCH \(FLAGS \(\\Recent\) UID 1 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
-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:
-S: \)
-S: \* 2 FETCH \(FLAGS \(\\Recent\) UID 2 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
-S: From: John Smith <john@example\.org>
-S: To: Timothy Taylor <tim@example\.org>
-S: Date: Sat, 23 Feb 2008 07:48:03 -0600
-S:
-S: \)
-S: \* 3 FETCH \(FLAGS \(\\Recent\) UID 3 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
-S: From: John Smith <john@example\.org>
-S: To: Timothy Taylor <tim@example\.org>
-S: Date: Sat, 23 Feb 2008 07:48:03 -0600
-S:
-S: \)
-S: \* 4 FETCH \(FLAGS \(\\Recent\) UID 4 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
-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:
-S: \)
-S: \* 5 FETCH \(FLAGS \(\\Recent\) UID 5 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
-S: From: "Brian G\. Hutton" <brian@example\.org>
-S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
-S: Date: Sat, 23 Feb 2008 07:48:03 -0600
-S:
-S: \)
-S: A14 OK FETCH completed\.
-
-C: A15 STORE 1:2  +FLAGS (\FLAGGED)
-S: \* 1 FETCH \(FLAGS \(\\Flagged \\Recent\)\)
-S: \* 2 FETCH \(FLAGS \(\\Flagged \\Recent\)\)
-S: A15 OK STORE completed\.
-
-C: A16 STORE 1:3  +FLAGS (\ANSWERED)
-S: \* 1 FETCH \(FLAGS \(\\Answered \\Flagged \\Recent\)\)
-S: \* 2 FETCH \(FLAGS \(\\Answered \\Flagged \\Recent\)\)
-S: \* 3 FETCH \(FLAGS \(\\Answered \\Recent\)\)
-S: A16 OK STORE completed\.
-
-C: A17 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])
-S: \* 1 FETCH \(FLAGS \(\\Answered \\Flagged \\Recent\) UID 1 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
-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:
-S: \)
-S: \* 2 FETCH \(FLAGS \(\\Answered \\Flagged \\Recent\) UID 2 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
-S: From: John Smith <john@example\.org>
-S: To: Timothy Taylor <tim@example\.org>
-S: Date: Sat, 23 Feb 2008 07:48:03 -0600
-S:
-S: \)
-S: \* 3 FETCH \(FLAGS \(\\Answered \\Recent\) UID 3 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
-S: From: John Smith <john@example\.org>
-S: To: Timothy Taylor <tim@example\.org>
-S: Date: Sat, 23 Feb 2008 07:48:03 -0600
-S:
-S: \)
-S: \* 4 FETCH \(FLAGS \(\\Recent\) UID 4 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
-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:
-S: \)
-S: \* 5 FETCH \(FLAGS \(\\Recent\) UID 5 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
-S: From: "Brian G\. Hutton" <brian@example\.org>
-S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
-S: Date: Sat, 23 Feb 2008 07:48:03 -0600
-S:
-S: \)
-S: A17 OK FETCH completed\.
-
-C: A18 SELECT testmailbox
-S: A18 NO SELECT failed. No such mailbox\.
-
-C: A19 SELECT anothermailbox
-S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
-S: \* 5 EXISTS
-S: \* 5 RECENT
-S: \* OK \[UIDVALIDITY \d+\].*
-S: \* OK \[UNSEEN 1\](.)*
-S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\\Seen( \\\*)?\)\].*
-S: \* OK \[HIGHESTMODSEQ \d+\].*
-S: \* OK \[UIDNEXT 6\].*
-S: A19 OK \[READ-WRITE\] SELECT completed\.
-
-C: A20 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])
-S: \* 1 FETCH \(FLAGS \(\\Answered \\Flagged \\Recent\) UID 1 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
-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:
-S: \)
-S: \* 2 FETCH \(FLAGS \(\\Answered \\Flagged \\Recent\) UID 2 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
-S: From: John Smith <john@example\.org>
-S: To: Timothy Taylor <tim@example\.org>
-S: Date: Sat, 23 Feb 2008 07:48:03 -0600
-S:
-S: \)
-S: \* 3 FETCH \(FLAGS \(\\Answered \\Recent\) UID 3 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
-S: From: John Smith <john@example\.org>
-S: To: Timothy Taylor <tim@example\.org>
-S: Date: Sat, 23 Feb 2008 07:48:03 -0600
-S:
-S: \)
-S: \* 4 FETCH \(FLAGS \(\\Recent\) UID 4 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
-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:
-S: \)
-S: \* 5 FETCH \(FLAGS \(\\Recent\) UID 5 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
-S: From: "Brian G\. Hutton" <brian@example\.org>
-S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
-S: Date: Sat, 23 Feb 2008 07:48:03 -0600
-S:
-S: \)
-S: A20 OK FETCH completed\.
-
-C: A21 DELETE anothermailbox
-S: A21 OK DELETE completed\.
-
-
-C: f CREATE anothermailbox
-S: f OK CREATE completed\.
-
-C: s0001 SELECT anothermailbox
-S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
-S: \* 0 EXISTS
-S: \* 0 RECENT
-S: \* OK \[UIDVALIDITY .*\] UIDs valid
-S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen \\\*\)\] Limited
-S: \* OK \[HIGHESTMODSEQ 0\] Highest
-S: \* OK \[UIDNEXT 1\] Predicted next UID
-S: s0001 OK \[READ-WRITE\] SELECT completed.
-
-C: o APPEND anothermailbox {704+}
-C: Received: by 10.114.81.13 with HTTP; Sat, 2 Feb 2008 05:14:19 -0800 (PST)
-C: Message-ID: <f4...@mail.gmail.com>
-C: Date: Sat, 2 Feb 2008 13:14:19 +0000
-C: From: "Robert Burrell Donkin" <ro...@gmail.com>
-C: To: "James Developers List" <se...@james.apache.org>
-C: Subject: JCR -> trunk ...?
-C: MIME-Version: 1.0
-C: Content-Type: text/plain; charset=ISO-8859-1
-C: Content-Transfer-Encoding: 7bit
-C: Content-Disposition: inline
-C: Delivered-To: robertburrelldonkin@gmail.com
-C:
-C: i'd like to copy james-jcr into trunk and add some example
-C: configurations. development can continue in the sandbox (or not) and
-C: merged in later (if necessary).
-C:
-C: any objections?
-C:
-C: - robert
-S: \* 1 EXISTS
-S: \* 1 RECENT
-S: o OK (\[.+\] )?APPEND completed\.
-
-C: g APPEND anothermailbox {704+}
-C: Received: by 10.114.81.13 with HTTP; Sat, 2 Feb 2008 05:14:19 -0800 (PST)
-C: Message-ID: <f4...@mail.gmail.com>
-C: Date: Sat, 2 Feb 2008 13:14:19 +0000
-C: From: "Robert Burrell Donkin" <ro...@gmail.com>
-C: To: "James Developers List" <se...@james.apache.org>
-C: Subject: JCR -> trunk ...?
-C: MIME-Version: 1.0
-C: Content-Type: text/plain; charset=ISO-8859-1
-C: Content-Transfer-Encoding: 7bit
-C: Content-Disposition: inline
-C: Delivered-To: robertburrelldonkin@gmail.com
-C:
-C: i'd like to copy james-jcr into trunk and add some example
-C: configurations. development can continue in the sandbox (or not) and
-C: merged in later (if necessary).
-C:
-C: any objections?
-C:
-C: - robert
-S: \* 2 EXISTS
-S: \* 2 RECENT
-S: g OK (\[.+\] )?APPEND completed\.
-
-C: e APPEND anothermailbox {704+}
-C: Received: by 10.114.81.13 with HTTP; Sat, 2 Feb 2008 05:14:19 -0800 (PST)
-C: Message-ID: <f4...@mail.gmail.com>
-C: Date: Sat, 2 Feb 2008 13:14:19 +0000
-C: From: "Robert Burrell Donkin" <ro...@gmail.com>
-C: To: "James Developers List" <se...@james.apache.org>
-C: Subject: JCR -> trunk ...?
-C: MIME-Version: 1.0
-C: Content-Type: text/plain; charset=ISO-8859-1
-C: Content-Transfer-Encoding: 7bit
-C: Content-Disposition: inline
-C: Delivered-To: robertburrelldonkin@gmail.com
-C:
-C: i'd like to copy james-jcr into trunk and add some example
-C: configurations. development can continue in the sandbox (or not) and
-C: merged in later (if necessary).
-C:
-C: any objections?
-C:
-C: - robert
-S: \* 3 EXISTS
-S: \* 3 RECENT
-S: e OK (\[.+\] )?APPEND completed\.
-
-C: f APPEND anothermailbox {704+}
-C: Received: by 10.114.81.13 with HTTP; Sat, 2 Feb 2008 05:14:19 -0800 (PST)
-C: Message-ID: <f4...@mail.gmail.com>
-C: Date: Sat, 2 Feb 2008 13:14:19 +0000
-C: From: "Robert Burrell Donkin" <ro...@gmail.com>
-C: To: "James Developers List" <se...@james.apache.org>
-C: Subject: JCR -> trunk ...?
-C: MIME-Version: 1.0
-C: Content-Type: text/plain; charset=ISO-8859-1
-C: Content-Transfer-Encoding: 7bit
-C: Content-Disposition: inline
-C: Delivered-To: robertburrelldonkin@gmail.com
-C:
-C: i'd like to copy james-jcr into trunk and add some example
-C: configurations. development can continue in the sandbox (or not) and
-C: merged in later (if necessary).
-C:
-C: any objections?
-C:
-C: - robert
-S: \* 4 EXISTS
-S: \* 4 RECENT
-S: f OK (\[.+\] )?APPEND completed\.
-
-C: a SEARCH FLAGGED
-S: \* SEARCH
-S: a OK SEARCH completed.
-
-C: b STORE 1:* +FLAGS.SILENT (\FLAGGED)
-S: b OK STORE completed.
-
-# Indexation may be asynchronous
-LOG INFO Waiting for indexation
-WAIT 1000
-
-C: c SEARCH FLAGGED
-S: \* SEARCH 1 2 3 4
-S: c OK SEARCH completed.
-
-C: d STORE 3:* -FLAGS.SILENT (\FLAGGED)
-S: d OK STORE completed.
-
-# Indexation may be asynchronous
-LOG INFO Waiting for indexation
-WAIT 1000
-
-C: e SEARCH FLAGGED
-S: \* SEARCH 1 2
-S: e OK SEARCH completed.
-
-C: f SEARCH UNFLAGGED
-S: \* SEARCH 3 4
-S: f OK SEARCH completed.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/7ec8f44a/mpt/impl/imap-mailbox/external-james/pom.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/external-james/pom.xml b/mpt/impl/imap-mailbox/external-james/pom.xml
index 283daa9..b290213 100644
--- a/mpt/impl/imap-mailbox/external-james/pom.xml
+++ b/mpt/impl/imap-mailbox/external-james/pom.xml
@@ -33,7 +33,43 @@
     <dependencies>
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>apache-james-mpt-imapmailbox-core</artifactId>
+            <artifactId>apache-james-mailbox-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>apache-james-mpt-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>metrics-logger</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.mail</groupId>
+            <artifactId>javax.mail</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jmock</groupId>
+            <artifactId>jmock</artifactId>
         </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/james-project/blob/7ec8f44a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/DeploymentValidation.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/DeploymentValidation.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/DeploymentValidation.java
new file mode 100644
index 0000000..f949962
--- /dev/null
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/DeploymentValidation.java
@@ -0,0 +1,53 @@
+/****************************************************************
+ * 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.external.james;
+
+import java.util.Locale;
+
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.script.SimpleScriptedTestProtocol;
+import org.junit.Before;
+import org.junit.Test;
+
+public abstract class DeploymentValidation {
+
+    public static final String DOMAIN = "domain";
+    public static final String USER = "imapuser";
+    public static final String PASSWORD = "password";
+
+    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 + "@" + DOMAIN, PASSWORD)
+                .withLocale(Locale.US);
+    }
+    
+    @Test
+    public void validateDeployment() throws Exception {
+        simpleScriptedTestProtocol.run("ValidateDeployment");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/7ec8f44a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/JamesDeploymentValidation.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/JamesDeploymentValidation.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/JamesDeploymentValidation.java
index bb055e3..a4e5ba6 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/JamesDeploymentValidation.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/JamesDeploymentValidation.java
@@ -20,7 +20,6 @@
 package org.apache.james.mpt.imapmailbox.external.james;
 
 import org.apache.james.mpt.api.ImapHostSystem;
-import org.apache.james.mpt.imapmailbox.suite.DeploymentValidation;
 import org.junit.After;
 import org.junit.Before;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/7ec8f44a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java
index 465ce24..150a32b 100644
--- a/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java
+++ b/mpt/impl/imap-mailbox/external-james/src/test/java/org/apache/james/mpt/imapmailbox/external/james/host/ExternalJamesHostSystem.java
@@ -21,7 +21,7 @@ package org.apache.james.mpt.imapmailbox.external.james.host;
 import java.net.InetSocketAddress;
 import java.util.function.Supplier;
 
-import org.apache.commons.lang.NotImplementedException;
+import org.apache.commons.lang3.NotImplementedException;
 import org.apache.james.core.quota.QuotaCount;
 import org.apache.james.core.quota.QuotaSize;
 import org.apache.james.mailbox.model.MailboxPath;
@@ -76,12 +76,12 @@ public class ExternalJamesHostSystem extends ExternalHostSystem {
 
     @Override
     public void createMailbox(MailboxPath mailboxPath) {
-        throw new NotImplementedException();
+        throw new NotImplementedException("Not implemented");
     }
 
     @Override
     public void setQuotaLimits(QuotaCount maxMessageQuota, QuotaSize maxStorageQuota) throws Exception {
-        throw new NotImplementedException();
+        throw new NotImplementedException("Not implemented");
     }
     
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/7ec8f44a/mpt/impl/imap-mailbox/external-james/src/test/resources/org.apache.james.imap.scripts/ValidateDeployment.test
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/external-james/src/test/resources/org.apache.james.imap.scripts/ValidateDeployment.test b/mpt/impl/imap-mailbox/external-james/src/test/resources/org.apache.james.imap.scripts/ValidateDeployment.test
new file mode 100644
index 0000000..cfca166
--- /dev/null
+++ b/mpt/impl/imap-mailbox/external-james/src/test/resources/org.apache.james.imap.scripts/ValidateDeployment.test
@@ -0,0 +1,519 @@
+################################################################
+# 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.                                           #
+################################################################
+
+S: \* OK IMAP4rev1 Server ready
+
+C: a0000 LOGIN imapuser@domain password
+S: a0000 OK LOGIN completed.
+
+C: 10 CREATE appendexpunge
+S: 10 OK CREATE completed.
+
+C: a001 STATUS appendexpunge (MESSAGES)
+S: \* STATUS "appendexpunge" \(MESSAGES 0\)
+S: a001 OK STATUS completed.
+
+C: A002 APPEND appendexpunge (\Deleted) {310+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <fo...@Blurdybloop.COM>
+C: Subject: afternoon meeting
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B2...@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Hello Joe, do you think we can meet at 3:30 tomorrow?
+C:
+S: A002 OK (\[.+\] )?APPEND completed.
+
+C: A003 APPEND appendexpunge {310+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <fo...@Blurdybloop.COM>
+C: Subject: afternoon meeting 2
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B2...@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Hello Joe, could we change that to 4:00pm tomorrow?
+C:
+S: A003 OK (\[.+\] )?APPEND completed.
+
+C: A004 APPEND appendexpunge {310+}
+C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+C: From: Fred Foobar <fo...@Blurdybloop.COM>
+C: Subject: afternoon meeting 2
+C: To: mooch@owatagu.siam.edu
+C: Message-Id: <B2...@Blurdybloop.COM>
+C: MIME-Version: 1.0
+C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+C:
+C: Hello Joe, could we change that to 4:30pm tomorrow?
+C:
+S: A004 OK (\[.+\] )?APPEND completed.
+
+C: A005 STATUS appendexpunge (MESSAGES)
+S: \* STATUS "appendexpunge" \(MESSAGES 3\)
+S: A005 OK STATUS completed.
+
+C: A006 SELECT appendexpunge
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 3 EXISTS
+S: \* \d+ RECENT
+S: \* OK \[UIDVALIDITY \d+\].*
+S: \* OK \[UNSEEN 1\].*
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\\Seen( \\\*)?\)\].*
+S: \* OK \[HIGHESTMODSEQ \d+\].*
+S: \* OK \[UIDNEXT 4\].*
+S: A006 OK \[READ-WRITE\] SELECT completed.
+
+C: A109 STORE 2 FLAGS.SILENT (\Deleted)
+S: A109 OK STORE completed.
+
+C: A007 EXPUNGE
+S: \* 1 EXPUNGE
+S: \* 1 EXPUNGE
+S: \* \d+ RECENT
+S: A007 OK EXPUNGE completed.
+
+C: A008 STATUS appendexpunge (MESSAGES)
+S: \* STATUS "appendexpunge" \(MESSAGES 1\)
+S: A008 OK STATUS completed.
+
+C: A009 STORE 1 FLAGS.SILENT (\Deleted)
+S: A009 OK STORE completed.
+
+C: A010 EXPUNGE
+S: \* 1 EXPUNGE
+S: \* \d+ RECENT
+S: A010 OK EXPUNGE completed.
+
+C: A011 STATUS appendexpunge (MESSAGES)
+S: \* STATUS "appendexpunge" \(MESSAGES 0\)
+S: A011 OK STATUS completed.
+
+C: A012 DELETE appendexpunge
+S: A012 OK DELETE completed.
+
+C: A001 NAMESPACE
+S: \* NAMESPACE \(\((\"\"|\"#private\.\") \".\"\)\) NIL NIL
+S: A001 OK NAMESPACE completed.
+
+C: A2 CREATE testmailbox
+S: A2 OK CREATE completed\.
+
+C: A3 SELECT testmailbox
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 0 EXISTS
+S: \* 0 RECENT
+S: \* OK \[UIDVALIDITY \d+\].*
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\\Seen( \\\*)?\)\].*
+S: \* OK \[HIGHESTMODSEQ \d+\].*
+S: \* OK \[UIDNEXT 1\].*
+S: A3 OK \[READ-WRITE\] SELECT completed\.
+
+C: A4 APPEND testmailbox {185+}
+C: From: Timothy Tayler <ti...@example.org>
+C: To: Samual Smith <sa...@example.org>
+C: Date: Thu, 14 Feb 2008 12:00:00 +0000 (GMT)
+C: Subject: A Simple Email
+C:
+C: This is a very simple email.
+C:
+S: \* 1 EXISTS
+S: \* 1 RECENT
+S: A4 OK (\[.+\] )?APPEND completed\.
+
+C: A5 APPEND testmailbox {185+}
+C: From: John Smith <jo...@example.org>
+C: To: Timothy Taylor <ti...@example.org>
+C: Subject: Hello
+C: Date: Sat, 23 Feb 2008 07:48:03 -0600
+C: Message-ID: <17...@machine.example.org>
+C:
+C: Hello, World!
+S: \* 2 EXISTS
+S: \* 2 RECENT
+S: A5 OK (\[.+\] )?APPEND completed\.
+
+C: A6 APPEND testmailbox {227+}
+C: From: John Smith <jo...@example.org>
+C: Sender: Samual Smith <sa...@example.org>
+C: To: Timothy Taylor <ti...@example.org>
+C: Subject: Hello
+C: Date: Sat, 23 Feb 2008 07:48:03 -0600
+C: Message-ID: <17...@machine.example.org>
+C:
+C: Hello, World!
+S: \* 3 EXISTS
+S: \* 3 RECENT
+S: A6 OK (\[.+\] )?APPEND completed\.
+
+C: A7 APPEND testmailbox {185+}
+C: From: Timothy Tayler <ti...@example.org>
+C: To: Samual Smith <sa...@example.org>
+C: Date: Thu, 14 Feb 2008 12:00:00 +0000 (GMT)
+C: Subject: A Simple Email
+C:
+C: This is a very simple email.
+C:
+S: \* 4 EXISTS
+S: \* 4 RECENT
+S: A7 OK (\[.+\] )?APPEND completed\.
+
+C: A8 APPEND testmailbox {318+}
+C: From: "Brian G. Hutton" <br...@example.org>
+C: To: Timothy Taylor <ti...@example.org>, faith@example.org, Huh? <sa...@example.org>
+C: CC: <be...@example.org>, "David \"The Thin White Duke\" Bowie" <du...@example.org>
+C: Subject: Rhubarb
+C: Date: Sat, 23 Feb 2008 07:48:03 -0600
+C: Message-ID: <17...@machine.example.org>
+C:
+C: Rhubarb!
+S: \* 5 EXISTS
+S: \* 5 RECENT
+S: A8 OK (\[.+\] )?APPEND completed\.
+
+C: A9 SELECT testmailbox
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 5 EXISTS
+S: \* 5 RECENT
+S: \* OK \[UIDVALIDITY \d+\].*
+S: \* OK \[UNSEEN 1\](.)*
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\\Seen( \\\*)?\)\].*
+S: \* OK \[HIGHESTMODSEQ \d+\].*
+S: \* OK \[UIDNEXT 6\].*
+S: A9 OK \[READ-WRITE\] SELECT completed\.
+
+C: A10 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])
+S: \* 1 FETCH \(FLAGS \(\\Recent\) UID 1 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+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:
+S: \)
+S: \* 2 FETCH \(FLAGS \(\\Recent\) UID 2 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 3 FETCH \(FLAGS \(\\Recent\) UID 3 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 4 FETCH \(FLAGS \(\\Recent\) UID 4 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+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:
+S: \)
+S: \* 5 FETCH \(FLAGS \(\\Recent\) UID 5 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
+S: From: "Brian G\. Hutton" <brian@example\.org>
+S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: A10 OK FETCH completed\.
+
+C: A11 LIST "" "*"
+SUB {
+S: \* LIST \(\\HasNoChildren\) "\." "testmailbox"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+}
+S: A11 OK LIST completed\.
+
+C: A12 RENAME testmailbox anothermailbox
+S: A12 OK RENAME completed.
+
+C: A13 LIST "" "*"
+SUB {
+S: \* LIST \(\\HasNoChildren\) "\." "anothermailbox"
+S: \* LIST \(\\HasNoChildren\) "\." "INBOX"
+}
+S: A13 OK LIST completed\.
+
+C: A14 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])
+S: \* 1 FETCH \(FLAGS \(\\Recent\) UID 1 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+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:
+S: \)
+S: \* 2 FETCH \(FLAGS \(\\Recent\) UID 2 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 3 FETCH \(FLAGS \(\\Recent\) UID 3 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 4 FETCH \(FLAGS \(\\Recent\) UID 4 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+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:
+S: \)
+S: \* 5 FETCH \(FLAGS \(\\Recent\) UID 5 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
+S: From: "Brian G\. Hutton" <brian@example\.org>
+S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: A14 OK FETCH completed\.
+
+C: A15 STORE 1:2  +FLAGS (\FLAGGED)
+S: \* 1 FETCH \(FLAGS \(\\Flagged \\Recent\)\)
+S: \* 2 FETCH \(FLAGS \(\\Flagged \\Recent\)\)
+S: A15 OK STORE completed\.
+
+C: A16 STORE 1:3  +FLAGS (\ANSWERED)
+S: \* 1 FETCH \(FLAGS \(\\Answered \\Flagged \\Recent\)\)
+S: \* 2 FETCH \(FLAGS \(\\Answered \\Flagged \\Recent\)\)
+S: \* 3 FETCH \(FLAGS \(\\Answered \\Recent\)\)
+S: A16 OK STORE completed\.
+
+C: A17 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])
+S: \* 1 FETCH \(FLAGS \(\\Answered \\Flagged \\Recent\) UID 1 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+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:
+S: \)
+S: \* 2 FETCH \(FLAGS \(\\Answered \\Flagged \\Recent\) UID 2 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 3 FETCH \(FLAGS \(\\Answered \\Recent\) UID 3 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 4 FETCH \(FLAGS \(\\Recent\) UID 4 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+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:
+S: \)
+S: \* 5 FETCH \(FLAGS \(\\Recent\) UID 5 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
+S: From: "Brian G\. Hutton" <brian@example\.org>
+S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: A17 OK FETCH completed\.
+
+C: A18 SELECT testmailbox
+S: A18 NO SELECT failed. No such mailbox\.
+
+C: A19 SELECT anothermailbox
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 5 EXISTS
+S: \* 5 RECENT
+S: \* OK \[UIDVALIDITY \d+\].*
+S: \* OK \[UNSEEN 1\](.)*
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\\Seen( \\\*)?\)\].*
+S: \* OK \[HIGHESTMODSEQ \d+\].*
+S: \* OK \[UIDNEXT 6\].*
+S: A19 OK \[READ-WRITE\] SELECT completed\.
+
+C: A20 FETCH 1:* (FLAGS UID BODY.PEEK[HEADER.FIELDS (DATE FROM TO ORIGINATOR X-LIST)])
+S: \* 1 FETCH \(FLAGS \(\\Answered \\Flagged \\Recent\) UID 1 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+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:
+S: \)
+S: \* 2 FETCH \(FLAGS \(\\Answered \\Flagged \\Recent\) UID 2 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 3 FETCH \(FLAGS \(\\Answered \\Recent\) UID 3 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{116\}
+S: From: John Smith <john@example\.org>
+S: To: Timothy Taylor <tim@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: \* 4 FETCH \(FLAGS \(\\Recent\) UID 4 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{130\}
+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:
+S: \)
+S: \* 5 FETCH \(FLAGS \(\\Recent\) UID 5 BODY\[HEADER\.FIELDS \(DATE FROM TO ORIGINATOR X-LIST\)\] \{167\}
+S: From: "Brian G\. Hutton" <brian@example\.org>
+S: To: Timothy Taylor <tim@example\.org>, faith@example\.org, Huh\? <sam@example\.org>
+S: Date: Sat, 23 Feb 2008 07:48:03 -0600
+S:
+S: \)
+S: A20 OK FETCH completed\.
+
+C: A21 DELETE anothermailbox
+S: A21 OK DELETE completed\.
+
+
+C: f CREATE anothermailbox
+S: f OK CREATE completed\.
+
+C: s0001 SELECT anothermailbox
+S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
+S: \* 0 EXISTS
+S: \* 0 RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen \\\*\)\] Limited
+S: \* OK \[HIGHESTMODSEQ 0\] Highest
+S: \* OK \[UIDNEXT 1\] Predicted next UID
+S: s0001 OK \[READ-WRITE\] SELECT completed.
+
+C: o APPEND anothermailbox {704+}
+C: Received: by 10.114.81.13 with HTTP; Sat, 2 Feb 2008 05:14:19 -0800 (PST)
+C: Message-ID: <f4...@mail.gmail.com>
+C: Date: Sat, 2 Feb 2008 13:14:19 +0000
+C: From: "Robert Burrell Donkin" <ro...@gmail.com>
+C: To: "James Developers List" <se...@james.apache.org>
+C: Subject: JCR -> trunk ...?
+C: MIME-Version: 1.0
+C: Content-Type: text/plain; charset=ISO-8859-1
+C: Content-Transfer-Encoding: 7bit
+C: Content-Disposition: inline
+C: Delivered-To: robertburrelldonkin@gmail.com
+C:
+C: i'd like to copy james-jcr into trunk and add some example
+C: configurations. development can continue in the sandbox (or not) and
+C: merged in later (if necessary).
+C:
+C: any objections?
+C:
+C: - robert
+S: \* 1 EXISTS
+S: \* 1 RECENT
+S: o OK (\[.+\] )?APPEND completed\.
+
+C: g APPEND anothermailbox {704+}
+C: Received: by 10.114.81.13 with HTTP; Sat, 2 Feb 2008 05:14:19 -0800 (PST)
+C: Message-ID: <f4...@mail.gmail.com>
+C: Date: Sat, 2 Feb 2008 13:14:19 +0000
+C: From: "Robert Burrell Donkin" <ro...@gmail.com>
+C: To: "James Developers List" <se...@james.apache.org>
+C: Subject: JCR -> trunk ...?
+C: MIME-Version: 1.0
+C: Content-Type: text/plain; charset=ISO-8859-1
+C: Content-Transfer-Encoding: 7bit
+C: Content-Disposition: inline
+C: Delivered-To: robertburrelldonkin@gmail.com
+C:
+C: i'd like to copy james-jcr into trunk and add some example
+C: configurations. development can continue in the sandbox (or not) and
+C: merged in later (if necessary).
+C:
+C: any objections?
+C:
+C: - robert
+S: \* 2 EXISTS
+S: \* 2 RECENT
+S: g OK (\[.+\] )?APPEND completed\.
+
+C: e APPEND anothermailbox {704+}
+C: Received: by 10.114.81.13 with HTTP; Sat, 2 Feb 2008 05:14:19 -0800 (PST)
+C: Message-ID: <f4...@mail.gmail.com>
+C: Date: Sat, 2 Feb 2008 13:14:19 +0000
+C: From: "Robert Burrell Donkin" <ro...@gmail.com>
+C: To: "James Developers List" <se...@james.apache.org>
+C: Subject: JCR -> trunk ...?
+C: MIME-Version: 1.0
+C: Content-Type: text/plain; charset=ISO-8859-1
+C: Content-Transfer-Encoding: 7bit
+C: Content-Disposition: inline
+C: Delivered-To: robertburrelldonkin@gmail.com
+C:
+C: i'd like to copy james-jcr into trunk and add some example
+C: configurations. development can continue in the sandbox (or not) and
+C: merged in later (if necessary).
+C:
+C: any objections?
+C:
+C: - robert
+S: \* 3 EXISTS
+S: \* 3 RECENT
+S: e OK (\[.+\] )?APPEND completed\.
+
+C: f APPEND anothermailbox {704+}
+C: Received: by 10.114.81.13 with HTTP; Sat, 2 Feb 2008 05:14:19 -0800 (PST)
+C: Message-ID: <f4...@mail.gmail.com>
+C: Date: Sat, 2 Feb 2008 13:14:19 +0000
+C: From: "Robert Burrell Donkin" <ro...@gmail.com>
+C: To: "James Developers List" <se...@james.apache.org>
+C: Subject: JCR -> trunk ...?
+C: MIME-Version: 1.0
+C: Content-Type: text/plain; charset=ISO-8859-1
+C: Content-Transfer-Encoding: 7bit
+C: Content-Disposition: inline
+C: Delivered-To: robertburrelldonkin@gmail.com
+C:
+C: i'd like to copy james-jcr into trunk and add some example
+C: configurations. development can continue in the sandbox (or not) and
+C: merged in later (if necessary).
+C:
+C: any objections?
+C:
+C: - robert
+S: \* 4 EXISTS
+S: \* 4 RECENT
+S: f OK (\[.+\] )?APPEND completed\.
+
+C: a SEARCH FLAGGED
+S: \* SEARCH
+S: a OK SEARCH completed.
+
+C: b STORE 1:* +FLAGS.SILENT (\FLAGGED)
+S: b OK STORE completed.
+
+# Indexation may be asynchronous
+LOG INFO Waiting for indexation
+WAIT 1000
+
+C: c SEARCH FLAGGED
+S: \* SEARCH 1 2 3 4
+S: c OK SEARCH completed.
+
+C: d STORE 3:* -FLAGS.SILENT (\FLAGGED)
+S: d OK STORE completed.
+
+# Indexation may be asynchronous
+LOG INFO Waiting for indexation
+WAIT 1000
+
+C: e SEARCH FLAGGED
+S: \* SEARCH 1 2
+S: e OK SEARCH completed.
+
+C: f SEARCH UNFLAGGED
+S: \* SEARCH 3 4
+S: f OK SEARCH completed.
\ No newline at end of file


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


[4/4] james-project git commit: JAMES-2167 Queue name is already stored as a mail attribute for future use

Posted by bt...@apache.org.
JAMES-2167 Queue name is already stored as a mail attribute for future use


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

Branch: refs/heads/master
Commit: 25d49c6d1d48dd15d7b4c7ad326749a40bae4da0
Parents: 46ea987
Author: benwa <bt...@linagora.com>
Authored: Thu Jul 12 13:00:27 2018 +0700
Committer: benwa <bt...@linagora.com>
Committed: Tue Jul 17 09:35:56 2018 +0700

----------------------------------------------------------------------
 .../java/org/apache/james/queue/activemq/ActiveMQMailQueue.java  | 4 ----
 1 file changed, 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/25d49c6d/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java b/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
index 7dc053d..3247347 100644
--- a/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
+++ b/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
@@ -180,10 +180,6 @@ public class ActiveMQMailQueue extends JMSMailQueue implements ActiveMQSupport {
                     // MimeMessage implementation
                     blobMessage = amqSession.createBlobMessage(new MimeMessageInputStream(mail.getMessage()));
                 }
-                 
-                    
-                // store the queue name in the props
-                props.put(JAMES_QUEUE_NAME, queueName);
 
                 for (Map.Entry<String, Object> entry : props.entrySet()) {
                     blobMessage.setObjectProperty(entry.getKey(), entry.getValue());


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


[2/4] james-project git commit: JAMES-2461 Fix copy/paste error in WebAdmin global quota doc

Posted by bt...@apache.org.
JAMES-2461 Fix copy/paste error in WebAdmin global quota doc


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

Branch: refs/heads/master
Commit: b4065d50d50c9d7b871fc85aea2bdbcba20f781e
Parents: 7ec8f44
Author: benwa <bt...@linagora.com>
Authored: Mon Jul 16 11:33:31 2018 +0700
Committer: benwa <bt...@linagora.com>
Committed: Tue Jul 17 09:34:50 2018 +0700

----------------------------------------------------------------------
 src/site/markdown/server/manage-webadmin.md | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/b4065d50/src/site/markdown/server/manage-webadmin.md
----------------------------------------------------------------------
diff --git a/src/site/markdown/server/manage-webadmin.md b/src/site/markdown/server/manage-webadmin.md
index f27459b..8dd14c4 100644
--- a/src/site/markdown/server/manage-webadmin.md
+++ b/src/site/markdown/server/manage-webadmin.md
@@ -831,11 +831,9 @@ Response codes:
 ### Deleting the global quota count
 
 ```
-curl -XDELETE http://ip:port/quota/users/usernameToBeUsed/count
+curl -XDELETE http://ip:port/quota/count
 ```
 
-Resource name usernameToBeUsed should be an existing user
-
 Response codes:
 
  - 204: The quota has been updated to unlimited value.


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


[3/4] james-project git commit: JAMES-2167 Serializable attributes are not preserved by enqueue/dequeue on a JMS queue.

Posted by bt...@apache.org.
JAMES-2167 Serializable attributes are not preserved by enqueue/dequeue on a JMS queue.

The non String email attributes now serialized/deserialized properly.


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

Branch: refs/heads/master
Commit: 46ea987a02583ae19ccac6c9f1c7952e343a0d74
Parents: b4065d5
Author: Edgar Asatryan <ns...@gmail.com>
Authored: Sat Jul 7 00:03:44 2018 +0400
Committer: benwa <bt...@linagora.com>
Committed: Tue Jul 17 09:35:56 2018 +0700

----------------------------------------------------------------------
 .../james/queue/api/MailQueueContract.java      |  46 ++++++++
 .../apache/james/queue/jms/JMSMailQueue.java    |  79 ++++++--------
 .../james/queue/jms/JMSSerializationUtils.java  |  66 ++++++++++++
 .../james/queue/jms/JMSMailQueueTest.java       |  27 +----
 .../queue/jms/JMSSerializationUtilsTest.java    | 107 +++++++++++++++++++
 5 files changed, 252 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/46ea987a/server/queue/queue-api/src/test/java/org/apache/james/queue/api/MailQueueContract.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-api/src/test/java/org/apache/james/queue/api/MailQueueContract.java b/server/queue/queue-api/src/test/java/org/apache/james/queue/api/MailQueueContract.java
index 975d8ed..205c58b 100644
--- a/server/queue/queue-api/src/test/java/org/apache/james/queue/api/MailQueueContract.java
+++ b/server/queue/queue-api/src/test/java/org/apache/james/queue/api/MailQueueContract.java
@@ -28,7 +28,9 @@ import static org.apache.mailet.base.MailAddressFixture.SENDER;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import java.io.Serializable;
 import java.util.Date;
+import java.util.Objects;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
@@ -44,6 +46,7 @@ import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 
 import com.github.fge.lambdas.Throwing;
+import com.google.common.base.MoreObjects;
 import com.google.common.base.Strings;
 
 @ExtendWith(ExecutorExtension.class)
@@ -203,6 +206,20 @@ public interface MailQueueContract {
     }
 
     @Test
+    default void queueShouldPreserveNonStringMailAttribute() throws Exception {
+        String attributeName = "any";
+        SerializableAttribute attributeValue = new SerializableAttribute("value");
+        getMailQueue().enQueue(defaultMail()
+                .attribute(attributeName, attributeValue)
+                .build());
+
+        MailQueue.MailQueueItem mailQueueItem = getMailQueue().deQueue();
+        assertThat(mailQueueItem.getMail().getAttribute(attributeName))
+                .isInstanceOf(SerializableAttribute.class)
+                .isEqualTo(attributeValue);
+    }
+
+    @Test
     default void dequeueShouldBeFifo() throws Exception {
         String firstExpectedName = "name1";
         getMailQueue().enQueue(defaultMail()
@@ -305,4 +322,33 @@ public interface MailQueueContract {
         assertThat(tryDequeue.get().getMail().getName()).isEqualTo("name");
     }
 
+    class SerializableAttribute implements Serializable {
+        private final String value;
+
+        public SerializableAttribute(String value) {
+            this.value = value;
+        }
+
+        @Override
+        public final boolean equals(Object o) {
+            if (o instanceof SerializableAttribute) {
+                SerializableAttribute that = (SerializableAttribute) o;
+
+                return Objects.equals(this.value, that.value);
+            }
+            return false;
+        }
+
+        @Override
+        public final int hashCode() {
+            return Objects.hash(value);
+        }
+
+        @Override
+        public String toString() {
+            return MoreObjects.toStringHelper(this)
+                    .add("value", value)
+                    .toString();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/46ea987a/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java b/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
index 08e9e11..f31a23b 100644
--- a/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
+++ b/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
@@ -20,7 +20,6 @@ package org.apache.james.queue.jms;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.Serializable;
 import java.time.Instant;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
@@ -28,7 +27,6 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.NoSuchElementException;
@@ -51,9 +49,7 @@ import javax.mail.MessagingException;
 import javax.mail.internet.AddressException;
 import javax.mail.internet.MimeMessage;
 
-import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.collections.iterators.EnumerationIterator;
-import org.apache.commons.lang3.SerializationUtils;
 import org.apache.james.core.MailAddress;
 import org.apache.james.lifecycle.api.Disposable;
 import org.apache.james.metrics.api.Metric;
@@ -73,6 +69,7 @@ import org.threeten.extra.Temporals;
 
 import com.github.fge.lambdas.Throwing;
 import com.google.common.base.Joiner;
+import com.google.common.base.Splitter;
 import com.google.common.collect.Iterators;
 
 /**
@@ -153,6 +150,9 @@ public class JMSMailQueue implements ManageableMailQueue, JMSSupport, MailPriori
     protected final Queue queue;
     protected final MessageProducer producer;
 
+    private final Joiner joiner;
+    private final Splitter splitter;
+
     public JMSMailQueue(ConnectionFactory connectionFactory, MailQueueItemDecoratorFactory mailQueueItemDecoratorFactory, String queueName, MetricFactory metricFactory) {
         try {
             connection = connectionFactory.createConnection();
@@ -166,6 +166,10 @@ public class JMSMailQueue implements ManageableMailQueue, JMSSupport, MailPriori
         this.enqueuedMailsMetric = metricFactory.generate("enqueuedMail:" + queueName);
         this.mailQueueSize = metricFactory.generate("mailQueueSize:" + queueName);
 
+        this.joiner = Joiner.on(JAMES_MAIL_SEPARATOR).skipNulls();
+        this.splitter = Splitter.on(JAMES_MAIL_SEPARATOR)
+                .omitEmptyStrings() // ignore null values. See JAMES-1294
+                .trimResults();
         try {
             session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
             queue = session.createQueue(queueName);
@@ -313,11 +317,10 @@ public class JMSMailQueue implements ManageableMailQueue, JMSSupport, MailPriori
         // won't serialize the empty headers so it is mandatory
         // to handle nulls when reconstructing mail from message
         if (!mail.getPerRecipientSpecificHeaders().getHeadersByRecipient().isEmpty()) {
-            byte[] serialize = SerializationUtils.serialize(mail.getPerRecipientSpecificHeaders());
-            props.put(JAMES_MAIL_PER_RECIPIENT_HEADERS, Base64.encodeBase64String(serialize));
+            props.put(JAMES_MAIL_PER_RECIPIENT_HEADERS, JMSSerializationUtils.serialize(mail.getPerRecipientSpecificHeaders()));
         }
 
-        String recipientsAsString = Joiner.on(JAMES_MAIL_SEPARATOR).skipNulls().join(mail.getRecipients());
+        String recipientsAsString = joiner.join(mail.getRecipients());
 
         props.put(JAMES_MAIL_RECIPIENTS, recipientsAsString);
         props.put(JAMES_MAIL_REMOTEADDR, mail.getRemoteAddr());
@@ -325,22 +328,13 @@ public class JMSMailQueue implements ManageableMailQueue, JMSSupport, MailPriori
 
         String sender = Optional.ofNullable(mail.getSender()).map(MailAddress::asString).orElse("");
 
-        StringBuilder attrsBuilder = new StringBuilder();
-        Iterator<String> attrs = mail.getAttributeNames();
-        while (attrs.hasNext()) {
-            String attrName = attrs.next();
-            attrsBuilder.append(attrName);
-
-            Object value = convertAttributeValue(mail.getAttribute(attrName));
-            props.put(attrName, value);
+        org.apache.james.util.streams.Iterators.toStream(mail.getAttributeNames())
+                .forEach(attrName -> props.put(attrName, JMSSerializationUtils.serialize(mail.getAttribute(attrName))));
 
-            if (attrs.hasNext()) {
-                attrsBuilder.append(JAMES_MAIL_SEPARATOR);
-            }
-        }
-        props.put(JAMES_MAIL_ATTRIBUTE_NAMES, attrsBuilder.toString());
+        props.put(JAMES_MAIL_ATTRIBUTE_NAMES, joiner.join(mail.getAttributeNames()));
         props.put(JAMES_MAIL_SENDER, sender);
         props.put(JAMES_MAIL_STATE, mail.getState());
+
         return props;
     }
 
@@ -392,10 +386,7 @@ public class JMSMailQueue implements ManageableMailQueue, JMSSupport, MailPriori
         mail.setLastUpdated(new Date(message.getLongProperty(JAMES_MAIL_LAST_UPDATED)));
         mail.setName(message.getStringProperty(JAMES_MAIL_NAME));
 
-        Optional.ofNullable(message.getStringProperty(JAMES_MAIL_PER_RECIPIENT_HEADERS))
-                .map(String::getBytes)
-                .map(Throwing.function(Base64::decodeBase64))
-                .<PerRecipientHeaders>map(SerializationUtils::deserialize)
+        Optional.ofNullable(JMSSerializationUtils.<PerRecipientHeaders>deserialize(message.getStringProperty(JAMES_MAIL_PER_RECIPIENT_HEADERS)))
                 .ifPresent(mail::addAllSpecificHeaderForRecipient);
 
         List<MailAddress> rcpts = new ArrayList<>();
@@ -417,23 +408,9 @@ public class JMSMailQueue implements ManageableMailQueue, JMSSupport, MailPriori
         mail.setRemoteHost(message.getStringProperty(JAMES_MAIL_REMOTEHOST));
 
         String attributeNames = message.getStringProperty(JAMES_MAIL_ATTRIBUTE_NAMES);
-        StringTokenizer namesTokenizer = new StringTokenizer(attributeNames, JAMES_MAIL_SEPARATOR);
-        while (namesTokenizer.hasMoreTokens()) {
-            String name = namesTokenizer.nextToken();
-
-            // Now cast the property back to Serializable and set it as attribute.
-            // See JAMES-1241
-            Object attrValue = message.getObjectProperty(name);
-
-            // ignore null values. See JAMES-1294
-            if (attrValue != null) {
-                if (attrValue instanceof Serializable) {
-                    mail.setAttribute(name, (Serializable) attrValue);
-                } else {
-                    LOGGER.error("Not supported mail attribute {} of type {} for mail {}", name, attrValue, mail.getName());
-                }
-            }
-        }
+
+        splitter.split(attributeNames)
+                .forEach(name -> setMailAttribute(message, mail, name));
 
         String sender = message.getStringProperty(JAMES_MAIL_SENDER);
         if (sender == null || sender.trim().length() <= 0) {
@@ -454,16 +431,22 @@ public class JMSMailQueue implements ManageableMailQueue, JMSSupport, MailPriori
     }
 
     /**
-     * Convert the attribute value if necessary.
+     * Retrieves the attribute by {@code name} form {@code message} and tries to add it on {@code mail}.
      *
-     * @param value
-     * @return convertedValue
+     * @param message The attribute source.
+     * @param mail    The mail on which attribute should be set.
+     * @param name    The attribute name.
      */
-    protected Object convertAttributeValue(Object value) {
-        if (value == null || value instanceof String || value instanceof Byte || value instanceof Long || value instanceof Double || value instanceof Boolean || value instanceof Integer || value instanceof Short || value instanceof Float) {
-            return value;
+    private void setMailAttribute(Message message, Mail mail, String name) {
+        // Now cast the property back to Serializable and set it as attribute.
+        // See JAMES-1241
+        Object attrValue = Throwing.function(message::getObjectProperty).apply(name);
+
+        if (attrValue instanceof String) {
+            mail.setAttribute(name, JMSSerializationUtils.deserialize((String) attrValue));
+        } else {
+            LOGGER.error("Not supported mail attribute {} of type {} for mail {}", name, attrValue, mail.getName());
         }
-        return value.toString();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/46ea987a/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSSerializationUtils.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSSerializationUtils.java b/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSSerializationUtils.java
new file mode 100644
index 0000000..98a0ac7
--- /dev/null
+++ b/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSSerializationUtils.java
@@ -0,0 +1,66 @@
+/****************************************************************
+ * 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.queue.jms;
+
+import java.io.Serializable;
+import java.util.Optional;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.SerializationUtils;
+
+import com.github.fge.lambdas.Throwing;
+
+/**
+ * This class is similar to {@link SerializationUtils}. Unlike {@link SerializationUtils} this class operates with
+ * {@code String}s and not byte arrays.
+ * <p>
+ * The main advantage of this utility is that it introduces an additional operation after serialization and before
+ * deserialization. The operation consists in encoding/decoding the serialized/deserialized data in Base64, so that data
+ * can be safely transmitted over the wire.
+ */
+public class JMSSerializationUtils {
+    /**
+     * Serialize the input object using standard mechanisms then encodes result using base64 encoding.
+     *
+     * @param obj The object that needs to be serialized.
+     *
+     * @return The base64 representation of {@code obj}.
+     */
+    public static String serialize(Serializable obj) {
+        return Optional.ofNullable(obj)
+                .map(SerializationUtils::serialize)
+                .map(Base64::encodeBase64String)
+                .orElse(null);
+    }
+
+    /**
+     * Decodes the input base64 string and deserialize it.
+     *
+     * @param <T>    The resulting type after deserialization.
+     * @param object The base64 encoded string.
+     *
+     * @return The deserialized object.
+     */
+    public static <T extends Serializable> T deserialize(String object) {
+        return Optional.ofNullable(object)
+                .map(Throwing.function(Base64::decodeBase64))
+                .<T>map(SerializationUtils::deserialize)
+                .orElse(null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/46ea987a/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java b/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
index aa6a6e4..826f42b 100644
--- a/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
+++ b/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
@@ -19,8 +19,6 @@
 
 package org.apache.james.queue.jms;
 
-import java.util.concurrent.ExecutorService;
-
 import javax.jms.ConnectionFactory;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
@@ -44,7 +42,7 @@ public class JMSMailQueueTest implements DelayedManageableMailQueueContract, Pri
     private JMSMailQueue mailQueue;
 
     @BeforeEach
-    public void setUp(BrokerService broker) throws Exception {
+    void setUp(BrokerService broker) {
         ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?create=false");
         RawMailQueueItemDecoratorFactory mailQueueItemDecoratorFactory = new RawMailQueueItemDecoratorFactory();
         NoopMetricFactory metricFactory = new NoopMetricFactory();
@@ -53,7 +51,7 @@ public class JMSMailQueueTest implements DelayedManageableMailQueueContract, Pri
     }
 
     @AfterEach
-    public void tearDown() throws Exception {
+    void tearDown() {
         mailQueue.dispose();
     }
 
@@ -83,20 +81,6 @@ public class JMSMailQueueTest implements DelayedManageableMailQueueContract, Pri
 
     @Test
     @Override
-    @Disabled("JAMES-2301 Per recipients headers are not attached to the message.")
-    public void queueShouldPreservePerRecipientHeaders() {
-
-    }
-
-    @Test
-    @Override
-    @Disabled("JAMES-2296 Not handled by JMS mailqueue. Only single recipient per-recipient removal works")
-    public void removeByRecipientShouldRemoveSpecificEmailWhenMultipleRecipients() {
-
-    }
-
-    @Test
-    @Override
     @Disabled("JAMES-2308 Flushing JMS mail queue randomly re-order them" +
         "Random test failing around 1% of the time")
     public void flushShouldPreserveBrowseOrder() {
@@ -105,13 +89,6 @@ public class JMSMailQueueTest implements DelayedManageableMailQueueContract, Pri
 
     @Test
     @Override
-    @Disabled("JAMES-2309 Long overflow in JMS delays")
-    public void enqueueWithVeryLongDelayShouldDelayMail(ExecutorService executorService) {
-
-    }
-
-    @Test
-    @Override
     @Disabled("JAMES-2312 JMS clear mailqueue can ommit some messages" +
         "Random test failing around 1% of the time")
     public void clearShouldRemoveAllElements() {

http://git-wip-us.apache.org/repos/asf/james-project/blob/46ea987a/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSSerializationUtilsTest.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSSerializationUtilsTest.java b/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSSerializationUtilsTest.java
new file mode 100644
index 0000000..6ab010f
--- /dev/null
+++ b/server/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSSerializationUtilsTest.java
@@ -0,0 +1,107 @@
+/****************************************************************
+ * 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.queue.jms;
+
+import static org.apache.james.queue.jms.JMSSerializationUtils.deserialize;
+import static org.apache.james.queue.jms.JMSSerializationUtils.serialize;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+
+import java.io.Serializable;
+import java.nio.charset.StandardCharsets;
+import java.util.Objects;
+import java.util.Optional;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.SerializationException;
+import org.junit.jupiter.api.Test;
+
+class JMSSerializationUtilsTest {
+    /**
+     * Serializes and deserializes the provided object.
+     *
+     * @param obj The object that needs to be serialized.
+     * @param <T> The type of the provided object.
+     *
+     * @return The provided object.
+     */
+    private static <T extends Serializable> T roundtrip(T obj) {
+        return Optional.ofNullable(obj)
+                .map(JMSSerializationUtils::serialize)
+                .<T>map(JMSSerializationUtils::deserialize)
+                .orElseThrow(() -> new IllegalArgumentException("Cannot serialize/deserialize: " + obj));
+    }
+
+    @Test
+    void trySerializeShouldReturnString() {
+        SerializableStringHolder value = new SerializableStringHolder("value");
+
+        String serializedIntegerString = "rO0ABXNyAE1vcmcuYXBhY2hlLmphbWVzLnF1ZXVlLmptcy5KTVNTZXJpYWxp" +
+                "emF0aW9uVXRpbHNUZXN0JFNlcmlhbGl6YWJsZVN0cmluZ0hvbGRlcsy4/DEA" +
+                "8nRZAgABTAAFdmFsdWV0ABJMamF2YS9sYW5nL1N0cmluZzt4cHQABXZhbHVl";
+
+        String actual = serialize(value);
+
+        assertThat(actual).isEqualTo(serializedIntegerString);
+    }
+
+    @Test
+    void roundTripShouldReturnEqualObject() {
+        SerializableStringHolder expected = new SerializableStringHolder("value");
+
+        assertThat(roundtrip(expected)).isEqualTo(expected);
+    }
+
+    @Test
+    void deserializeShouldThrowWhenNotBase64StringProvided() {
+        assertThatExceptionOfType(SerializationException.class)
+                .isThrownBy(() -> deserialize("abc"));
+    }
+
+    @Test
+    void deserializeShouldThrowWhenNotSerializedBytesAreEncodedInBase64() {
+        assertThatExceptionOfType(SerializationException.class)
+                .isThrownBy(() -> deserialize(Base64.encodeBase64String("abc".getBytes(StandardCharsets.UTF_8))));
+    }
+
+    private static class SerializableStringHolder implements Serializable {
+        private final String value;
+
+        SerializableStringHolder(String value) {
+            this.value = value;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof SerializableStringHolder)) {
+                return false;
+            }
+            SerializableStringHolder that = (SerializableStringHolder) o;
+            return Objects.equals(value, that.value);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(value);
+        }
+    }
+}


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