[james-mime4j] branch master updated: [maven-release-plugin] prepare for next development iteration

2019-03-13 Thread btellier
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-mime4j.git


The following commit(s) were added to refs/heads/master by this push:
 new 8ad6cc6  [maven-release-plugin] prepare for next development iteration
8ad6cc6 is described below

commit 8ad6cc65c1d3378e4630f40e4b5eb066297d5532
Author: Benoit Tellier 
AuthorDate: Thu Mar 14 11:44:49 2019 +0700

[maven-release-plugin] prepare for next development iteration
---
 assemble/pom.xml| 2 +-
 benchmark/pom.xml   | 2 +-
 core/pom.xml| 2 +-
 dom/pom.xml | 2 +-
 examples/pom.xml| 2 +-
 james-utils/pom.xml | 2 +-
 mbox/pom.xml| 2 +-
 pom.xml | 4 ++--
 storage/pom.xml | 2 +-
 9 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/assemble/pom.xml b/assemble/pom.xml
index 028ce16..24a262b 100644
--- a/assemble/pom.xml
+++ b/assemble/pom.xml
@@ -23,7 +23,7 @@
 
 apache-mime4j-project
 org.apache.james
-0.8.3
+0.8.4-SNAPSHOT
 ../pom.xml
 
 
diff --git a/benchmark/pom.xml b/benchmark/pom.xml
index e7b5c3a..5da1d4b 100644
--- a/benchmark/pom.xml
+++ b/benchmark/pom.xml
@@ -23,7 +23,7 @@
 
 apache-mime4j-project
 org.apache.james
-0.8.3
+0.8.4-SNAPSHOT
 ../pom.xml
 
 
diff --git a/core/pom.xml b/core/pom.xml
index 001bfd8..addea0b 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -23,7 +23,7 @@
 
 apache-mime4j-project
 org.apache.james
-0.8.3
+0.8.4-SNAPSHOT
 ../pom.xml
 
 
diff --git a/dom/pom.xml b/dom/pom.xml
index ee0ddd4..2f5de81 100644
--- a/dom/pom.xml
+++ b/dom/pom.xml
@@ -23,7 +23,7 @@
 
 apache-mime4j-project
 org.apache.james
-0.8.3
+0.8.4-SNAPSHOT
 ../pom.xml
 
 
diff --git a/examples/pom.xml b/examples/pom.xml
index 1206fc8..a11c4c6 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -23,7 +23,7 @@
 
 apache-mime4j-project
 org.apache.james
-0.8.3
+0.8.4-SNAPSHOT
 ../pom.xml
 
 
diff --git a/james-utils/pom.xml b/james-utils/pom.xml
index a7a58a1..6a8405c 100644
--- a/james-utils/pom.xml
+++ b/james-utils/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.james
 apache-mime4j-project
-0.8.3
+0.8.4-SNAPSHOT
 ../pom.xml
 
 
diff --git a/mbox/pom.xml b/mbox/pom.xml
index d0fe981..0a15dd1 100644
--- a/mbox/pom.xml
+++ b/mbox/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.james
 apache-mime4j-project
-0.8.3
+0.8.4-SNAPSHOT
 ../pom.xml
 
 
diff --git a/pom.xml b/pom.xml
index 8db6958..0dbd32e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
 
 org.apache.james
 apache-mime4j-project
-0.8.3
+0.8.4-SNAPSHOT
 pom
 
 Apache James :: Mime4j :: Project
@@ -52,7 +52,7 @@
 
scm:git:http://git-wip-us.apache.org/repos/asf/james-mime4j.git
 
scm:git:https://git-wip-us.apache.org/repos/asf/james-mime4j.git
 https://git-wip-us.apache.org/repos/asf/james-mime4j.git
-  apache-mime4j-project-0.8.3
+  HEAD
   
 
 http://issues.apache.org/jira/browse/MIME4J
diff --git a/storage/pom.xml b/storage/pom.xml
index bbf448e..363aedb 100644
--- a/storage/pom.xml
+++ b/storage/pom.xml
@@ -23,7 +23,7 @@
 
 apache-mime4j-project
 org.apache.james
-0.8.3
+0.8.4-SNAPSHOT
 ../pom.xml
 
 


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



[james-mime4j] branch master updated: [maven-release-plugin] prepare release apache-mime4j-project-0.8.3

2019-03-13 Thread btellier
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-mime4j.git


The following commit(s) were added to refs/heads/master by this push:
 new b0fd973  [maven-release-plugin] prepare release 
apache-mime4j-project-0.8.3
b0fd973 is described below

commit b0fd973013f1c68d5200594054ddab890c559d45
Author: Benoit Tellier 
AuthorDate: Thu Mar 14 11:44:09 2019 +0700

[maven-release-plugin] prepare release apache-mime4j-project-0.8.3
---
 assemble/pom.xml| 2 +-
 benchmark/pom.xml   | 2 +-
 core/pom.xml| 2 +-
 dom/pom.xml | 2 +-
 examples/pom.xml| 2 +-
 james-utils/pom.xml | 2 +-
 mbox/pom.xml| 2 +-
 pom.xml | 4 ++--
 storage/pom.xml | 2 +-
 9 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/assemble/pom.xml b/assemble/pom.xml
index 140a31e..028ce16 100644
--- a/assemble/pom.xml
+++ b/assemble/pom.xml
@@ -23,7 +23,7 @@
 
 apache-mime4j-project
 org.apache.james
-0.8.3-SNAPSHOT
+0.8.3
 ../pom.xml
 
 
diff --git a/benchmark/pom.xml b/benchmark/pom.xml
index 65c5018..e7b5c3a 100644
--- a/benchmark/pom.xml
+++ b/benchmark/pom.xml
@@ -23,7 +23,7 @@
 
 apache-mime4j-project
 org.apache.james
-0.8.3-SNAPSHOT
+0.8.3
 ../pom.xml
 
 
diff --git a/core/pom.xml b/core/pom.xml
index bfa7ed6..001bfd8 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -23,7 +23,7 @@
 
 apache-mime4j-project
 org.apache.james
-0.8.3-SNAPSHOT
+0.8.3
 ../pom.xml
 
 
diff --git a/dom/pom.xml b/dom/pom.xml
index 4fd48ab..ee0ddd4 100644
--- a/dom/pom.xml
+++ b/dom/pom.xml
@@ -23,7 +23,7 @@
 
 apache-mime4j-project
 org.apache.james
-0.8.3-SNAPSHOT
+0.8.3
 ../pom.xml
 
 
diff --git a/examples/pom.xml b/examples/pom.xml
index e27078f..1206fc8 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -23,7 +23,7 @@
 
 apache-mime4j-project
 org.apache.james
-0.8.3-SNAPSHOT
+0.8.3
 ../pom.xml
 
 
diff --git a/james-utils/pom.xml b/james-utils/pom.xml
index 1094ad6..a7a58a1 100644
--- a/james-utils/pom.xml
+++ b/james-utils/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.james
 apache-mime4j-project
-0.8.3-SNAPSHOT
+0.8.3
 ../pom.xml
 
 
diff --git a/mbox/pom.xml b/mbox/pom.xml
index d21abe8..d0fe981 100644
--- a/mbox/pom.xml
+++ b/mbox/pom.xml
@@ -23,7 +23,7 @@
 
 org.apache.james
 apache-mime4j-project
-0.8.3-SNAPSHOT
+0.8.3
 ../pom.xml
 
 
diff --git a/pom.xml b/pom.xml
index ca7e58f..8db6958 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
 
 org.apache.james
 apache-mime4j-project
-0.8.3-SNAPSHOT
+0.8.3
 pom
 
 Apache James :: Mime4j :: Project
@@ -52,7 +52,7 @@
 
scm:git:http://git-wip-us.apache.org/repos/asf/james-mime4j.git
 
scm:git:https://git-wip-us.apache.org/repos/asf/james-mime4j.git
 https://git-wip-us.apache.org/repos/asf/james-mime4j.git
-  HEAD
+  apache-mime4j-project-0.8.3
   
 
 http://issues.apache.org/jira/browse/MIME4J
diff --git a/storage/pom.xml b/storage/pom.xml
index beef812..bbf448e 100644
--- a/storage/pom.xml
+++ b/storage/pom.xml
@@ -23,7 +23,7 @@
 
 apache-mime4j-project
 org.apache.james
-0.8.3-SNAPSHOT
+0.8.3
 ../pom.xml
 
 


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



[james-mime4j] annotated tag apache-mime4j-project-0.8.3 created (now 26ba88e)

2019-03-13 Thread btellier
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a change to annotated tag apache-mime4j-project-0.8.3
in repository https://gitbox.apache.org/repos/asf/james-mime4j.git.


  at 26ba88e  (tag)
 tagging b0fd973013f1c68d5200594054ddab890c559d45 (commit)
 replaces apache-mime4j-project-0.8.2
  by Benoit Tellier
  on Thu Mar 14 11:44:34 2019 +0700

- Log -
[maven-release-plugin] copy for tag apache-mime4j-project-0.8.3
---

No new revisions were added by this update.


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



[jira] [Closed] (JAMES-2663) [WebAdmin DMV Route] Restore API

2019-03-13 Thread Tellier Benoit (JIRA)


 [ 
https://issues.apache.org/jira/browse/JAMES-2663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tellier Benoit closed JAMES-2663.
-

> [WebAdmin DMV Route] Restore API
> 
>
> Key: JAMES-2663
> URL: https://issues.apache.org/jira/browse/JAMES-2663
> Project: James Server
>  Issue Type: New Feature
>Reporter: Trần Tiến Đức
>Priority: Major
>
> ### Define `Query` object
> JSON List of criterion objects, logical AND between criteria.
> A criterion looks like this:
> {code:java}
> {
>  "field": 
>  "value":
>  "operator":
> }{code}
> Possible fields:
>  - deletionDate date formatted as string (Operation: Before + After)
>  - deliveryDate date formatted as string (Operation: Before + After)
>  - recipients list of string (Operator: Contains, ContainsIgnoreCase)
>  - sender string (Operator: Equals, EqualsIgnoreCase)
>  - hasAttachment boolean (Operator: Equals)
>  - originMailboxes list string (Operator Contains)
>  - subject string (Operator Equals, Contains + Ignore case)
> ## API proposal
> {code:java}
> POST /deletedMessages/users/:userId?action=restore
> [JSON Query body]
> - 201 Success
> {"taskId":"12e3"}
> - 404 if the user does not exist
> - 503 if `DeletedMessagesVault` is not avaiable
> {code}
> - Create `DeletedMessagesVaultRoutes` class in 
> `/server/protocols/webadmin-mailbox-deleted-messages-vault`
> - Search the `DeletedMessage` with `Flux search(Query)` is 
> define in MAILBOX-381 then move it to `Restored Emails` mailbox. 
> - create unit-test to test this API: configuring webAdmin with 
> `DeletedMessagesVaultRoutes` on top of a memory mbx manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Resolved] (JAMES-2663) [WebAdmin DMV Route] Restore API

2019-03-13 Thread Tellier Benoit (JIRA)


 [ 
https://issues.apache.org/jira/browse/JAMES-2663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tellier Benoit resolved JAMES-2663.
---
Resolution: Fixed

https://github.com/linagora/james-project/pull/2213 contributed this

> [WebAdmin DMV Route] Restore API
> 
>
> Key: JAMES-2663
> URL: https://issues.apache.org/jira/browse/JAMES-2663
> Project: James Server
>  Issue Type: New Feature
>Reporter: Trần Tiến Đức
>Priority: Major
>
> ### Define `Query` object
> JSON List of criterion objects, logical AND between criteria.
> A criterion looks like this:
> {code:java}
> {
>  "field": 
>  "value":
>  "operator":
> }{code}
> Possible fields:
>  - deletionDate date formatted as string (Operation: Before + After)
>  - deliveryDate date formatted as string (Operation: Before + After)
>  - recipients list of string (Operator: Contains, ContainsIgnoreCase)
>  - sender string (Operator: Equals, EqualsIgnoreCase)
>  - hasAttachment boolean (Operator: Equals)
>  - originMailboxes list string (Operator Contains)
>  - subject string (Operator Equals, Contains + Ignore case)
> ## API proposal
> {code:java}
> POST /deletedMessages/users/:userId?action=restore
> [JSON Query body]
> - 201 Success
> {"taskId":"12e3"}
> - 404 if the user does not exist
> - 503 if `DeletedMessagesVault` is not avaiable
> {code}
> - Create `DeletedMessagesVaultRoutes` class in 
> `/server/protocols/webadmin-mailbox-deleted-messages-vault`
> - Search the `DeletedMessage` with `Flux search(Query)` is 
> define in MAILBOX-381 then move it to `Restored Emails` mailbox. 
> - create unit-test to test this API: configuring webAdmin with 
> `DeletedMessagesVaultRoutes` on top of a memory mbx manager



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (JAMES-2665) [Integration Tests] Webadmin restore API

2019-03-13 Thread Tellier Benoit (JIRA)


[ 
https://issues.apache.org/jira/browse/JAMES-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16792254#comment-16792254
 ] 

Tellier Benoit commented on JAMES-2665:
---

https://github.com/linagora/james-project/pull/2223 JAMES-2665 Integration 
tests for DeletedMessageVault - Search

https://github.com/linagora/james-project/pull/2226 MAILBOX-379 Run 
PreDeletionHooks upon mailbox deletion

had been merged

> [Integration Tests] Webadmin restore API
> 
>
> Key: JAMES-2665
> URL: https://issues.apache.org/jira/browse/JAMES-2665
> Project: James Server
>  Issue Type: New Feature
>Reporter: Trần Tiến Đức
>Priority: Major
> Fix For: 3.4.0
>
>
> In cassandra and memory in `/server/protocols/jmap-integration-testing`, 
> write following tests to restore mails from the supertrash feature. Make sure 
> as well to setup correctly guice bindings to prove that this new feature 
> integrates well into our system.
> {code:java}
> Given an user with emails present in the vault
> When admin is using restore with a query matching some of those mails
> Then the selected emails should be restored in user's mailbox and not be 
> present in the vault anymore{code}
> *Note* : can vary queries, 1 or multiple mails restored, etc
> {code:java}
> Given an user with emails present in the vault
> When admin is using restore with a query not matching any email
> Then no emails should be restored in user's mailbox{code}
> {code:java}
> Given an user with no emails in the vault
> When admin is using restore
> Then nothing should happen{code}
>  
> {code:java}
> Given an user with emails present in the vault
> When admin is using restore multiple times with the same matching query
> Then the result should be idempotent{code}
>  
> {code:java}
> Given user1 and user2 with emails present in their vault
> When admin is using restore multiple times with the same matching query on 
> user1's vault
> Then user1's selected emails should be restored, but not user2's emails{code}
>  
> {code:java}
> Upon mailbox deletion of the user
> Then his mails should go the vault
> When admin is using restore with a query matching some of those mails
> Then the selected emails should be restored in user's mailbox and not be 
> present in the vault anymore{code}
>  
> {code:java}
> Upon moving a mail from a mailbox to an other
> When admin is using restore with a query matching this mail
> Then the mail should not be restored in the first mailbox, as it shouldn't be 
> present in the vault in the first place{code}
>  
>  
> **IMAP and JMAP**
> We need those test cases being conducted with messages that have been deleted 
> by both IMAP and JMAP processes.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[james-project] 03/07: JAMES-2663 Vault route: restore by query

2019-03-13 Thread btellier
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 8174c65554645bc6487e9996b3cd8e711dda3672
Author: Tran Tien Duc 
AuthorDate: Thu Mar 7 11:51:35 2019 +0700

JAMES-2663 Vault route: restore by query
---
 .../java/org/apache/james/vault/search/Query.java  |2 +-
 .../integration/DeletedMessagesVaultTest.java  |6 +
 .../routes/DeletedMessagesVaultRestoreTask.java|7 +-
 .../vault/routes/DeletedMessagesVaultRoutes.java   |   47 +-
 .../webadmin/vault/routes/RestoreService.java  |4 +-
 .../webadmin/vault/routes/query/QueryElement.java  |2 +-
 .../vault/routes/query/QueryTranslator.java|   21 +-
 .../routes/DeletedMessagesVaultRoutesTest.java | 1270 +++-
 .../vault/routes/query/QueryTranslatorTest.java|7 +
 src/site/markdown/server/manage-webadmin.md|  101 +-
 10 files changed, 1402 insertions(+), 65 deletions(-)

diff --git 
a/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/Query.java
 
b/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/Query.java
index 8595a43..3092cb9 100644
--- 
a/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/Query.java
+++ 
b/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/Query.java
@@ -30,7 +30,7 @@ public class Query {
 public static final Query ALL = new Query(ImmutableList.of());
 private static final Predicate MATCH_ALL = any -> true;
 
-public static Query of(List criteria) {
+public static Query and(List criteria) {
 return new Query(criteria);
 }
 
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
index 55476f0..4336a08 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
@@ -76,6 +76,11 @@ public abstract class DeletedMessagesVaultTest {
 private static final ConditionFactory WAIT_TWO_MINUTES = 
calmlyAwait.atMost(Duration.TWO_MINUTES);
 private static final String SUBJECT = "This mail will be restored from the 
vault!!";
 private static final String MAILBOX_NAME = "toBeDeleted";
+private static final String MATCH_ALL_QUERY = "{" +
+"\"combinator\": \"and\"," +
+"\"criteria\": []" +
+"}";
+
 private MailboxId otherMailboxId;
 
 protected abstract GuiceJamesServer createJmapServer() throws IOException;
@@ -416,6 +421,7 @@ public abstract class DeletedMessagesVaultTest {
 
 private void restoreMessagesFor(String user) {
 String taskId = webAdminApi.with()
+.body(MATCH_ALL_QUERY)
 .post("/deletedMessages/user/" + user + "?action=restore")
 .jsonPath()
 .get("taskId");
diff --git 
a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRestoreTask.java
 
b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRestoreTask.java
index b6aa3e5..9d855b8 100644
--- 
a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRestoreTask.java
+++ 
b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRestoreTask.java
@@ -28,6 +28,7 @@ import org.apache.james.core.User;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.task.Task;
 import org.apache.james.task.TaskExecutionDetails;
+import org.apache.james.vault.search.Query;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -72,8 +73,10 @@ class DeletedMessagesVaultRestoreTask implements Task {
 private final User userToRestore;
 private final RestoreService vaultRestore;
 private final AdditionalInformation additionalInformation;
+private final Query query;
 
-DeletedMessagesVaultRestoreTask(User userToRestore, RestoreService 
vaultRestore) {
+DeletedMessagesVaultRestoreTask(RestoreService vaultRestore, User 
userToRestore, Query query) {
+this.query = query;
 this.userToRestore = userToRestore;
 this.vaultRestore = vaultRestore;
 this.additionalInformation = new Add

[james-project] 06/07: MAILBOX-379 Factorize PreDeletionHook execution

2019-03-13 Thread btellier
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 950616869972fbb9ac86e9fd5a924dd510c01e43
Author: Benoit Tellier 
AuthorDate: Thu Mar 7 11:18:38 2019 +0700

MAILBOX-379 Factorize PreDeletionHook execution

Not only does it reduce code duplication but also does it ease MDC context
setting and metric recording.
---
 .../mailbox/cassandra/CassandraMailboxManager.java |   5 +-
 .../mailbox/cassandra/CassandraMessageManager.java |   5 +-
 .../CassandraCombinationManagerTestSystem.java |   6 +-
 .../cassandra/CassandraMailboxManagerProvider.java |   6 +-
 .../CassandraMailboxManagerStressTest.java |   3 +-
 .../cassandra/CassandraMailboxManagerTest.java |   3 +-
 .../CassandraMessageIdManagerTestSystem.java   |   5 +-
 .../cassandra/CassandraTestSystemFixture.java  |   5 +-
 .../CassandraMailboxManagerAttachmentTest.java |   6 +-
 .../ElasticSearchIntegrationTest.java  |   6 +-
 .../james/mailbox/jpa/JPAMailboxManager.java   |   4 +-
 .../james/mailbox/jpa/JPAMessageManager.java   |   4 +-
 .../search/LuceneMessageSearchIndexTest.java   |   6 +-
 .../resources/META-INF/spring/mailbox-maildir.xml  |   2 +-
 .../maildir/MaildirMailboxManagerProvider.java |   3 +-
 .../mailbox/inmemory/InMemoryMailboxManager.java   |   5 +-
 .../mailbox/inmemory/InMemoryMessageManager.java   |   5 +-
 .../resources/META-INF/spring/mailbox-memory.xml   |   2 +-
 .../mail/InMemoryMailboxManagerAttachmentTest.java |   6 +-
 .../manager/InMemoryIntegrationResources.java  |   5 +-
 .../InMemoryMessageIdManagerSideEffectTest.java|   5 +-
 .../store/search/SimpleMessageSearchIndexTest.java |   4 +-
 .../resources/META-INF/spring/spring-mailbox.xml   |   4 +
 .../james/mailbox/store/PreDeletionHooks.java} |  50 ---
 .../james/mailbox/store/StoreMailboxManager.java   |  16 +--
 .../james/mailbox/store/StoreMessageIdManager.java |   8 +-
 .../james/mailbox/store/StoreMessageManager.java   |  11 +-
 .../james/mailbox/store/PreDeletionHooksTest.java  | 156 +
 .../mailbox/store/StoreMailboxManagerTest.java |   3 +-
 .../tools/indexer/CassandraReIndexerImplTest.java  |   4 +-
 .../cassandra/host/CassandraHostSystem.java|   4 +-
 .../host/ElasticSearchHostSystem.java  |   4 +-
 .../lucenesearch/host/LuceneSearchHostSystem.java  |   3 +-
 .../maildir/host/MaildirHostSystem.java|   3 +-
 34 files changed, 262 insertions(+), 105 deletions(-)

diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java
 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java
index e1b4442..9cda458 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java
+++ 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java
@@ -20,7 +20,6 @@
 package org.apache.james.mailbox.cassandra;
 
 import java.util.EnumSet;
-import java.util.Set;
 
 import javax.inject.Inject;
 
@@ -28,11 +27,11 @@ import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxPathLocker;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.events.EventBus;
-import org.apache.james.mailbox.extension.PreDeletionHook;
 import org.apache.james.mailbox.model.MailboxACL;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.store.MailboxManagerConfiguration;
+import org.apache.james.mailbox.store.PreDeletionHooks;
 import org.apache.james.mailbox.store.SessionProvider;
 import org.apache.james.mailbox.store.StoreMailboxAnnotationManager;
 import org.apache.james.mailbox.store.StoreMailboxManager;
@@ -67,7 +66,7 @@ public class CassandraMailboxManager extends 
StoreMailboxManager {
StoreMailboxAnnotationManager 
annotationManager, StoreRightManager storeRightManager,
QuotaComponents quotaComponents, 
MessageSearchIndex index,
MailboxManagerConfiguration configuration,
-   Set preDeletionHooks) {
+   PreDeletionHooks preDeletionHooks) {
 super(mapperFactory,
 sessionProvider,
 locker,
diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMessageManager.java
 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMessageManager.java
index 29114a4..45c620a 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMessageManager.java
+++ 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMessageManager.

[james-project] 05/07: MAILBOX-379 Trigger pre-deletion hooks upon mailbox delete

2019-03-13 Thread btellier
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 3e97afc17df4ae50f829e151da8ea8ed46403c12
Author: Benoit Tellier 
AuthorDate: Thu Mar 7 10:16:40 2019 +0700

MAILBOX-379 Trigger pre-deletion hooks upon mailbox delete
---
 .../apache/james/mailbox/MailboxManagerTest.java   | 21 
 .../james/mailbox/store/StoreMailboxManager.java   | 23 +++---
 2 files changed, 41 insertions(+), 3 deletions(-)

diff --git 
a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java 
b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
index 4e675b0..aba8e3a 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
@@ -1381,6 +1381,27 @@ public abstract class MailboxManagerTest {
 }
 
 @Test
+void deleteMailboxShouldCallAllPreDeletionHooks() throws Exception 
{
+ComposedMessageId composeId = 
inboxManager.appendMessage(AppendCommand.builder()
+.withFlags(new Flags(Flags.Flag.DELETED))
+.build(message), session);
+mailboxManager.deleteMailbox(inbox, session);
+
+ArgumentCaptor 
preDeleteCaptor1 = 
ArgumentCaptor.forClass(PreDeletionHook.DeleteOperation.class);
+ArgumentCaptor 
preDeleteCaptor2 = 
ArgumentCaptor.forClass(PreDeletionHook.DeleteOperation.class);
+verify(preDeletionHook1, 
times(1)).notifyDelete(preDeleteCaptor1.capture());
+verify(preDeletionHook2, 
times(1)).notifyDelete(preDeleteCaptor2.capture());
+
+
assertThat(preDeleteCaptor1.getValue().getDeletionMetadataList())
+.hasSize(1)
+
.hasSameElementsAs(preDeleteCaptor2.getValue().getDeletionMetadataList())
+.allSatisfy(deleteMetadata -> 
SoftAssertions.assertSoftly(softy -> {
+
softy.assertThat(deleteMetadata.getMailboxId()).isEqualTo(inboxId);
+
softy.assertThat(deleteMetadata.getMessageMetaData().getMessageId()).isEqualTo(composeId.getMessageId());
+}));
+}
+
+@Test
 void 
expungeShouldCallAllPreDeletionHooksOnEachMessageDeletionCall() throws 
Exception {
 ComposedMessageId composeId1 = 
inboxManager.appendMessage(AppendCommand.builder()
 .withFlags(new Flags(Flags.Flag.DELETED))
diff --git 
a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
 
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
index 09ca79f..a0d795d 100644
--- 
a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
+++ 
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
@@ -39,6 +39,7 @@ import org.apache.james.mailbox.MailboxPathLocker;
 import org.apache.james.mailbox.MailboxPathLocker.LockAwareExecution;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
+import org.apache.james.mailbox.MetadataWithMailboxId;
 import org.apache.james.mailbox.StandardMailboxMetaDataComparator;
 import org.apache.james.mailbox.events.EventBus;
 import org.apache.james.mailbox.events.MailboxIdRegistrationKey;
@@ -59,6 +60,7 @@ import 
org.apache.james.mailbox.model.MailboxMetaData.Selectability;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.model.MessageId.Factory;
+import org.apache.james.mailbox.model.MessageMetaData;
 import org.apache.james.mailbox.model.MessageRange;
 import org.apache.james.mailbox.model.MultimailboxesSearchQuery;
 import org.apache.james.mailbox.model.QuotaRoot;
@@ -70,7 +72,6 @@ import org.apache.james.mailbox.store.event.EventFactory;
 import org.apache.james.mailbox.store.mail.MailboxMapper;
 import org.apache.james.mailbox.store.mail.MessageMapper;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
-import org.apache.james.mailbox.store.mail.model.Message;
 import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
 import org.apache.james.mailbox.store.mail.model.impl.SimpleMailbox;
 import org.apache.james.mailbox.store.quota.QuotaComponents;
@@ -87,6 +88,9 @@ import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 
+import reactor.core.publisher.Flux;
+import reactor.core.scheduler.Schedulers;
+
 /**
  * This base class of an {@link MailboxManager} implementation provides a 
high-level api for writing your own
  * {@link MailboxManager} implementation. If you plan to write your own {@link 
MailboxManager} its mos

[james-project] branch master updated (1a607e7 -> 8f8c4c8)

2019-03-13 Thread btellier
This is an automated email from the ASF dual-hosted git repository.

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


from 1a607e7  JAMES-2676 refactor zip header string id  to little endian 
short
 new c056f4f  JAMES-2663 Make Vault components public
 new 102b8db  JAMES-2663 QueryDTO with deserializer and translator
 new 8174c65  JAMES-2663 Vault route: restore by query
 new 549fa5d  JAMES-2665 Integration test for "vault" queries
 new 3e97afc  MAILBOX-379 Trigger pre-deletion hooks upon mailbox delete
 new 9506168  MAILBOX-379 Factorize PreDeletionHook execution
 new 8f8c4c8  JAMES-2665 Re-enable vault integration test about mailbox 
deletion

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/james/mailbox/MailboxManagerTest.java   |   21 +
 .../mailbox/cassandra/CassandraMailboxManager.java |5 +-
 .../mailbox/cassandra/CassandraMessageManager.java |5 +-
 .../CassandraCombinationManagerTestSystem.java |6 +-
 .../cassandra/CassandraMailboxManagerProvider.java |6 +-
 .../CassandraMailboxManagerStressTest.java |3 +-
 .../cassandra/CassandraMailboxManagerTest.java |3 +-
 .../CassandraMessageIdManagerTestSystem.java   |5 +-
 .../cassandra/CassandraTestSystemFixture.java  |5 +-
 .../CassandraMailboxManagerAttachmentTest.java |6 +-
 .../ElasticSearchIntegrationTest.java  |6 +-
 .../james/mailbox/jpa/JPAMailboxManager.java   |4 +-
 .../james/mailbox/jpa/JPAMessageManager.java   |4 +-
 .../search/LuceneMessageSearchIndexTest.java   |6 +-
 .../resources/META-INF/spring/mailbox-maildir.xml  |2 +-
 .../maildir/MaildirMailboxManagerProvider.java |3 +-
 .../mailbox/inmemory/InMemoryMailboxManager.java   |5 +-
 .../mailbox/inmemory/InMemoryMessageManager.java   |5 +-
 .../resources/META-INF/spring/mailbox-memory.xml   |2 +-
 .../mail/InMemoryMailboxManagerAttachmentTest.java |6 +-
 .../manager/InMemoryIntegrationResources.java  |5 +-
 .../InMemoryMessageIdManagerSideEffectTest.java|5 +-
 .../org/apache/james/vault/DeletedMessage.java |   16 +-
 .../org/apache/james/vault/search/Criterion.java   |6 +-
 .../james/vault/search/DeletedMessageField.java|2 +-
 .../java/org/apache/james/vault/search/Query.java  |4 +
 .../store/search/SimpleMessageSearchIndexTest.java |4 +-
 .../resources/META-INF/spring/spring-mailbox.xml   |4 +
 .../james/mailbox/store/PreDeletionHooks.java  |   38 +-
 .../james/mailbox/store/StoreMailboxManager.java   |   21 +-
 .../james/mailbox/store/StoreMessageIdManager.java |8 +-
 .../james/mailbox/store/StoreMessageManager.java   |   11 +-
 .../james/mailbox/store/PreDeletionHooksTest.java  |  156 +++
 .../mailbox/store/StoreMailboxManagerTest.java |3 +-
 .../tools/indexer/CassandraReIndexerImplTest.java  |4 +-
 .../cassandra/host/CassandraHostSystem.java|4 +-
 .../host/ElasticSearchHostSystem.java  |4 +-
 .../lucenesearch/host/LuceneSearchHostSystem.java  |3 +-
 .../maildir/host/MaildirHostSystem.java|3 +-
 .../CassandraDeletedMessageVaultTest.java  |   13 -
 .../integration/DeletedMessagesVaultTest.java  |   84 +-
 .../memory/MemoryDeletedMessagesVaultTest.java |   13 -
 .../rabbitmq/RabbitMQDeletedMessagesVaultTest.java |   14 -
 .../webadmin-mailbox-deleted-message-vault/pom.xml |   10 +
 .../routes/DeletedMessagesVaultRestoreTask.java|7 +-
 .../vault/routes/DeletedMessagesVaultRoutes.java   |   47 +-
 .../webadmin/vault/routes/RestoreService.java  |4 +-
 .../webadmin/vault/routes/query/CriterionDTO.java} |   51 +-
 .../webadmin/vault/routes/query/QueryDTO.java} |   48 +-
 .../webadmin/vault/routes/query/QueryElement.java} |9 +-
 .../routes/query/QueryElementDeserializer.java}|   43 +-
 .../vault/routes/query/QueryTranslator.java|  238 
 .../routes/DeletedMessagesVaultRoutesTest.java | 1270 +++-
 .../routes/query/QueryElementDeserializerTest.java |   89 ++
 .../vault/routes/query/QueryElementTest.java}  |   14 +-
 .../vault/routes/query/QueryTranslatorTest.java|   74 ++
 src/site/markdown/server/manage-webadmin.md|  101 +-
 57 files changed, 2260 insertions(+), 278 deletions(-)
 copy server/container/util/src/main/java/org/apache/james/util/Runnables.java 
=> 
mailbox/store/src/main/java/org/apache/james/mailbox/store/PreDeletionHooks.java
 (65%)
 create mode 100644 
mailbox/store/src/test/java/org/apache/james/mailbox/store/PreDeletionHooksTest.java
 copy 
server/{data/data-api/src/main/java/org/apache/james/sieverepository/api/ScriptContent.java
 => 
protocols/w

[james-project] 02/07: JAMES-2663 QueryDTO with deserializer and translator

2019-03-13 Thread btellier
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 102b8db50d2a08a15e713291590e492e41b34b48
Author: Tran Tien Duc 
AuthorDate: Thu Mar 7 11:50:01 2019 +0700

JAMES-2663 QueryDTO with deserializer and translator
---
 .../java/org/apache/james/vault/search/Query.java  |   4 +
 .../webadmin-mailbox-deleted-message-vault/pom.xml |  10 +
 .../webadmin/vault/routes/query/CriterionDTO.java  |  88 
 .../webadmin/vault/routes/query/QueryDTO.java  |  71 +++
 .../webadmin/vault/routes/query/QueryElement.java  |  31 +--
 .../routes/query/QueryElementDeserializer.java |  51 +
 .../vault/routes/query/QueryTranslator.java| 225 +
 .../routes/query/QueryElementDeserializerTest.java |  89 
 .../vault/routes/query/QueryElementTest.java   |  36 ++--
 .../vault/routes/query/QueryTranslatorTest.java|  67 ++
 10 files changed, 622 insertions(+), 50 deletions(-)

diff --git 
a/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/Query.java
 
b/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/Query.java
index 039fd52..8595a43 100644
--- 
a/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/Query.java
+++ 
b/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/Query.java
@@ -30,6 +30,10 @@ public class Query {
 public static final Query ALL = new Query(ImmutableList.of());
 private static final Predicate MATCH_ALL = any -> true;
 
+public static Query of(List criteria) {
+return new Query(criteria);
+}
+
 public static Query of(Criterion... criteria) {
 return new Query(ImmutableList.copyOf(criteria));
 }
diff --git 
a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/pom.xml 
b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/pom.xml
index aa6847d..2c06be8 100644
--- a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/pom.xml
+++ b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/pom.xml
@@ -105,6 +105,16 @@
 test
 
 
+net.javacrumbs.json-unit
+json-unit-assertj
+test
+
+
+nl.jqno.equalsverifier
+equalsverifier
+test
+
+
 org.assertj
 assertj-core
 test
diff --git 
a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/query/CriterionDTO.java
 
b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/query/CriterionDTO.java
new file mode 100644
index 000..547d3c0
--- /dev/null
+++ 
b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/query/CriterionDTO.java
@@ -0,0 +1,88 @@
+/
+ * 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.webadmin.vault.routes.query;
+
+import java.util.Objects;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.MoreObjects;
+
+@JsonDeserialize(as = CriterionDTO.class)
+public class CriterionDTO implements QueryElement {
+
+@VisibleForTesting
+static CriterionDTO from(QueryTranslator.FieldName fieldName, 
QueryTranslator.Operator operator, String value) {
+return new CriterionDTO(fieldName.getValue(), operator.getValue(), 
value);
+}

[james-project] 01/07: JAMES-2663 Make Vault components public

2019-03-13 Thread btellier
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 c056f4f2546e0e267ff0e723df00f312f26c0d05
Author: Tran Tien Duc 
AuthorDate: Wed Mar 6 10:22:06 2019 +0700

JAMES-2663 Make Vault components public
---
 .../main/java/org/apache/james/vault/DeletedMessage.java | 16 
 .../java/org/apache/james/vault/search/Criterion.java|  6 +++---
 .../apache/james/vault/search/DeletedMessageField.java   |  2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git 
a/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/DeletedMessage.java
 
b/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/DeletedMessage.java
index c30e80b..dd320d6 100644
--- 
a/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/DeletedMessage.java
+++ 
b/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/DeletedMessage.java
@@ -39,17 +39,17 @@ import com.google.common.collect.ImmutableList;
 public class DeletedMessage {
 public static class Builder {
 @FunctionalInterface
-interface RequireMessageId {
+public interface RequireMessageId {
 T messageId(MessageId messageId);
 }
 
 @FunctionalInterface
-interface RequireUser {
+public interface RequireUser {
 T user(User user);
 }
 
 @FunctionalInterface
-interface RequireOriginMailboxes {
+public interface RequireOriginMailboxes {
 T originMailboxes(List mailboxIds);
 
 default T originMailboxes(MailboxId... mailboxIds) {
@@ -58,22 +58,22 @@ public class DeletedMessage {
 }
 
 @FunctionalInterface
-interface RequireDeliveryDate {
+public interface RequireDeliveryDate {
 T deliveryDate(ZonedDateTime deliveryDate);
 }
 
 @FunctionalInterface
-interface RequireDeletionDate {
+public interface RequireDeletionDate {
 T deletionDate(ZonedDateTime deletionDate);
 }
 
 @FunctionalInterface
-interface RequireSender {
+public interface RequireSender {
 T sender(MaybeSender sender);
 }
 
 @FunctionalInterface
-interface RequireRecipients {
+public interface RequireRecipients {
 T recipients(Collection recipients);
 
 default T recipients(MailAddress... recipients) {
@@ -82,7 +82,7 @@ public class DeletedMessage {
 }
 
 @FunctionalInterface
-interface RequireHasAttachment {
+public interface RequireHasAttachment {
 T hasAttachment(boolean value);
 
 default T hasAttachment() {
diff --git 
a/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/Criterion.java
 
b/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/Criterion.java
index d577f21..0e18380 100644
--- 
a/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/Criterion.java
+++ 
b/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/Criterion.java
@@ -25,15 +25,15 @@ import org.apache.james.vault.DeletedMessage;
 
 public class Criterion {
 
-interface ValueMatcher {
+public interface ValueMatcher {
 boolean matches(T referenceValue);
 }
 
-interface ExpectMatcher {
+public interface ExpectMatcher {
 Criterion withMatcher(ValueMatcher valueMatcher);
 }
 
-interface Builder {
+public interface Builder {
 static  ExpectMatcher forField(DeletedMessageField field) {
 return matcher -> new Criterion<>(field, matcher);
 }
diff --git 
a/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/DeletedMessageField.java
 
b/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/DeletedMessageField.java
index 4662ca7..ffe5737 100644
--- 
a/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/DeletedMessageField.java
+++ 
b/mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/search/DeletedMessageField.java
@@ -27,7 +27,7 @@ import org.apache.james.core.MailAddress;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.vault.DeletedMessage;
 
-interface DeletedMessageField {
+public interface DeletedMessageField {
 interface ValueExtractor {
 Optional extract(DeletedMessage deletedMessage);
 


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



[james-project] 07/07: JAMES-2665 Re-enable vault integration test about mailbox deletion

2019-03-13 Thread btellier
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 8f8c4c855512f3a4d5bea186a487c31bca676f62
Author: Benoit Tellier 
AuthorDate: Tue Mar 12 11:04:32 2019 +0700

JAMES-2665 Re-enable vault integration test about mailbox deletion
---
 .../jmap/cassandra/CassandraDeletedMessageVaultTest.java   | 13 -
 .../jmap/methods/integration/DeletedMessagesVaultTest.java |  2 --
 .../james/jmap/memory/MemoryDeletedMessagesVaultTest.java  | 13 -
 .../jmap/rabbitmq/RabbitMQDeletedMessagesVaultTest.java| 14 --
 4 files changed, 42 deletions(-)

diff --git 
a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraDeletedMessageVaultTest.java
 
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraDeletedMessageVaultTest.java
index 38d20d6..1f331c4 100644
--- 
a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraDeletedMessageVaultTest.java
+++ 
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraDeletedMessageVaultTest.java
@@ -24,7 +24,6 @@ import java.io.IOException;
 import org.apache.james.CassandraJmapTestRule;
 import org.apache.james.DockerCassandraRule;
 import org.apache.james.GuiceJamesServer;
-import org.apache.james.jmap.categories.BasicFeature;
 import org.apache.james.jmap.methods.integration.DeletedMessagesVaultTest;
 import org.apache.james.mailrepository.api.MailRepositoryUrl;
 import org.apache.james.modules.mailbox.PreDeletionHookConfiguration;
@@ -34,12 +33,8 @@ import 
org.apache.james.vault.MailRepositoryDeletedMessageVault;
 import org.apache.james.webadmin.WebAdminConfiguration;
 import org.junit.ClassRule;
 import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.jupiter.api.Disabled;
 
 public class CassandraDeletedMessageVaultTest extends DeletedMessagesVaultTest 
{
-
 @ClassRule
 public static DockerCassandraRule cassandra = new DockerCassandraRule();
 
@@ -61,12 +56,4 @@ public class CassandraDeletedMessageVaultTest extends 
DeletedMessagesVaultTest {
 protected void awaitSearchUpToDate() {
 rule.await();
 }
-
-@Disabled("MAILBOX-379 PreDeletionHook are not yet triggered upon mailbox 
deletion")
-@Category(BasicFeature.class)
-@Override
-@Test
-public void vaultEndpointShouldRestoreImapDeletedMailbox() {
-
-}
 }
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
index 7ffaf6e..2b32dde 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
@@ -59,7 +59,6 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.junit.jupiter.api.Disabled;
 import org.testcontainers.shaded.com.google.common.collect.ImmutableList;
 
 import com.google.common.base.Strings;
@@ -181,7 +180,6 @@ public abstract class DeletedMessagesVaultTest {
 .body(ARGUMENTS + ".list.subject", hasItem(SUBJECT));
 }
 
-@Disabled("MAILBOX-379 PreDeletionHook are not yet triggered upon mailbox 
deletion")
 @Category(BasicFeature.class)
 @Test
 public void vaultEndpointShouldRestoreImapDeletedMailbox() throws 
Exception {
diff --git 
a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryDeletedMessagesVaultTest.java
 
b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryDeletedMessagesVaultTest.java
index c3c2516..d83717d 100644
--- 
a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryDeletedMessagesVaultTest.java
+++ 
b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/java/org/apache/james/jmap/memory/MemoryDeletedMessagesVaultTest.java
@@ -23,7 +23,6 @@ import java.io.IOException;
 
 import org.apache.james.GuiceJamesServer;
 import org.apache.james.MemoryJmapTestRule;
-import org.apache.james.jmap.categories.BasicFeature;

[james-project] 04/07: JAMES-2665 Integration test for "vault" queries

2019-03-13 Thread btellier
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 549fa5d4cb3228a5a6570576b6aa648ecc89075d
Author: Benoit Tellier 
AuthorDate: Wed Mar 6 11:39:14 2019 +0700

JAMES-2665 Integration test for "vault" queries
---
 .../integration/DeletedMessagesVaultTest.java  | 78 +-
 .../vault/routes/query/QueryTranslator.java|  2 +
 2 files changed, 78 insertions(+), 2 deletions(-)

diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
index 4336a08..7ffaf6e 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/DeletedMessagesVaultTest.java
@@ -214,6 +214,72 @@ public abstract class DeletedMessagesVaultTest {
 }
 
 @Test
+public void postShouldRestoreMatchingMessages() {
+bartSendMessageToHomerWithSubject("a");
+bartSendMessageToHomerWithSubject("b");
+WAIT_TWO_MINUTES.until(() -> 
listMessageIdsForAccount(homerAccessToken).size() == 2);
+
+homerDeletesMessages(listMessageIdsForAccount(homerAccessToken));
+
+WAIT_TWO_MINUTES.until(() -> 
listMessageIdsForAccount(homerAccessToken).size() == 0);
+
+String query = "{" +
+"  \"combinator\": \"and\"," +
+"  \"criteria\": [" +
+"{" +
+"  \"fieldName\": \"subject\"," +
+"  \"operator\": \"equals\"," +
+"  \"value\": \"a\"" +
+"}" +
+"  ]" +
+"}";
+restoreMessagesFor(HOMER, query);
+
+WAIT_TWO_MINUTES.until(() -> 
listMessageIdsForAccount(homerAccessToken).size() == 1);
+
+String messageId = listMessageIdsForAccount(homerAccessToken).get(0);
+given()
+.header("Authorization", homerAccessToken.serialize())
+.body("[[\"getMessages\", {\"ids\": [\"" + messageId + "\"]}, 
\"#0\"]]")
+.when()
+.post("/jmap")
+.then()
+.statusCode(200)
+.log().ifValidationFails()
+.body(ARGUMENTS + ".list.subject", hasItem("a"));
+}
+
+@Test
+public void postShouldNotRestoreWhenNoMatchingMessages() throws Exception {
+bartSendMessageToHomerWithSubject("a");
+bartSendMessageToHomerWithSubject("b");
+WAIT_TWO_MINUTES.until(() -> 
listMessageIdsForAccount(homerAccessToken).size() == 2);
+
+homerDeletesMessages(listMessageIdsForAccount(homerAccessToken));
+
+WAIT_TWO_MINUTES.until(() -> 
listMessageIdsForAccount(homerAccessToken).size() == 0);
+
+String query = "{" +
+"  \"combinator\": \"and\"," +
+"  \"criteria\": [" +
+"{" +
+"  \"fieldName\": \"subject\"," +
+"  \"operator\": \"equals\"," +
+"  \"value\": \"c\"" +
+"}" +
+"  ]" +
+"}";
+restoreMessagesFor(HOMER, query);
+
+
+Thread.sleep(Duration.FIVE_SECONDS.getValueInMS());
+
+// No additional had been restored for Bart as the vault is empty
+assertThat(listMessageIdsForAccount(homerAccessToken).size())
+.isEqualTo(0);
+}
+
+@Test
 public void imapMovedMessageShouldNotEndUpInTheVault() throws Exception {
 bartSendMessageToHomer();
 WAIT_TWO_MINUTES.until(() -> 
listMessageIdsForAccount(homerAccessToken).size() == 1);
@@ -365,6 +431,10 @@ public abstract class DeletedMessagesVaultTest {
 }
 
 private void bartSendMessageToHomer() {
+bartSendMessageToHomerWithSubject(SUBJECT);
+}
+
+private void bartSendMessageToHomerWithSubject(String subject) {
 String messageCreationId = "creationId";
 String outboxId = getOutboxId(bartAccessToken);
 String bigEnoughBody = Strings.repeat("123456789\n", 12 * 100);
@@ -376,7 +446,7 @@ public abstract class DeletedMessagesVaultTest {
 "\"headers\":{\"Disposition-Notification-To\":\"" + BART + 
"\"}," +
 "\"from\": { \"name\": \"Bob\", \"email\": \"" + BART + 
"\"}," +
 "\"to\": [{ \"name\": \"User\", \"email\": \"" + HOMER + 
"\"}]," +
-"\"subject\": \"" + SUBJECT + "\"," +
+"\"subject\": \"" + subject + "\"," +
 "\"textBody\": \"" + bigEnoughBody + "\"," +
 

[jira] [Closed] (JAMES-2676) [Export] Handle folder annotations in the archive format

2019-03-13 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/JAMES-2676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rémi Kowalski closed JAMES-2676.


fixed by : https://github.com/linagora/james-project/pull/2228

> [Export] Handle folder annotations in the archive format
> 
>
> Key: JAMES-2676
> URL: https://issues.apache.org/jira/browse/JAMES-2676
> Project: James Server
>  Issue Type: Improvement
>Reporter: Rémi Kowalski
>Priority: Major
> Fix For: 3.4.0
>
>
> We are introducing an export format to allow to export data from a user.
> The export format is based on the ZIP format, with specific headers to store 
> mailbox and mail metadatas.
> There is a metadata that has been introduced recently and is still not 
> handled in this format: mailbox annotations.
> The goal of this ticket is to introduce mailbox annotations metadata in the 
> archive format.
> In the header of the mailbox archive entry, you'll add the annotations,



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Resolved] (JAMES-2676) [Export] Handle folder annotations in the archive format

2019-03-13 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/JAMES-2676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rémi Kowalski resolved JAMES-2676.
--
Resolution: Fixed

> [Export] Handle folder annotations in the archive format
> 
>
> Key: JAMES-2676
> URL: https://issues.apache.org/jira/browse/JAMES-2676
> Project: James Server
>  Issue Type: Improvement
>Reporter: Rémi Kowalski
>Priority: Major
> Fix For: 3.4.0
>
>
> We are introducing an export format to allow to export data from a user.
> The export format is based on the ZIP format, with specific headers to store 
> mailbox and mail metadatas.
> There is a metadata that has been introduced recently and is still not 
> handled in this format: mailbox annotations.
> The goal of this ticket is to introduce mailbox annotations metadata in the 
> archive format.
> In the header of the mailbox archive entry, you'll add the annotations,



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Updated] (JAMES-2676) [Export] Handle folder annotations in the archive format

2019-03-13 Thread JIRA


 [ 
https://issues.apache.org/jira/browse/JAMES-2676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rémi Kowalski updated JAMES-2676:
-
Fix Version/s: 3.4.0

> [Export] Handle folder annotations in the archive format
> 
>
> Key: JAMES-2676
> URL: https://issues.apache.org/jira/browse/JAMES-2676
> Project: James Server
>  Issue Type: Improvement
>Reporter: Rémi Kowalski
>Priority: Major
> Fix For: 3.4.0
>
>
> We are introducing an export format to allow to export data from a user.
> The export format is based on the ZIP format, with specific headers to store 
> mailbox and mail metadatas.
> There is a metadata that has been introduced recently and is still not 
> handled in this format: mailbox annotations.
> The goal of this ticket is to introduce mailbox annotations metadata in the 
> archive format.
> In the header of the mailbox archive entry, you'll add the annotations,



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (JAMES-2676) [Export] Handle folder annotations in the archive format

2019-03-13 Thread JIRA


[ 
https://issues.apache.org/jira/browse/JAMES-2676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16791850#comment-16791850
 ] 

Raphaël Ouazana commented on JAMES-2676:


https://github.com/linagora/james-project/pull/2228 has been merged

> [Export] Handle folder annotations in the archive format
> 
>
> Key: JAMES-2676
> URL: https://issues.apache.org/jira/browse/JAMES-2676
> Project: James Server
>  Issue Type: Improvement
>Reporter: Rémi Kowalski
>Priority: Major
>
> We are introducing an export format to allow to export data from a user.
> The export format is based on the ZIP format, with specific headers to store 
> mailbox and mail metadatas.
> There is a metadata that has been introduced recently and is still not 
> handled in this format: mailbox annotations.
> The goal of this ticket is to introduce mailbox annotations metadata in the 
> archive format.
> In the header of the mailbox archive entry, you'll add the annotations,



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[james-project] branch master updated (c4f44dd -> 1a607e7)

2019-03-13 Thread rouazana
This is an automated email from the ASF dual-hosted git repository.

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


from c4f44dd  Merge remote-tracking branch 
'blackheaven/MAILBOX-374-updateFlags-modSeq'
 new 8a8ca67  JAMES-2676 refactor build zip file in ZipAssertTest
 new d3238e1  JAMES-2676 add mailbox annotations in backup zip
 new 1a607e7  JAMES-2676 refactor zip header string id  to little endian 
short

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../james/mailbox/model/MailboxAnnotationKey.java  |   2 +-
 .../org/apache/james/mailbox/backup/Backup.java|   7 +-
 .../james/mailbox/backup/FlagsExtraField.java  |   4 +-
 .../mailbox/backup/InternalDateExtraField.java |   4 +-
 .../james/mailbox/backup/MailboxIdExtraField.java  |   4 +-
 .../mailbox/backup/MailboxWithAnnotations.java}|  51 +++
 .../james/mailbox/backup/MessageIdExtraField.java  |   4 +-
 .../james/mailbox/backup/SizeExtraField.java   |   5 +-
 .../apache/james/mailbox/backup/UidExtraField.java |   4 +-
 .../mailbox/backup/UidValidityExtraField.java  |   5 +-
 .../backup/{Directory.java => WithZipHeader.java}  |  15 +-
 .../org/apache/james/mailbox/backup/Zipper.java|  59 +--
 .../mailbox/backup/MailboxMessageFixture.java  |  22 ++-
 .../{DirectoryTest.java => WithZipHeaderTest.java} |  13 +-
 .../apache/james/mailbox/backup/ZipAssertTest.java | 170 +
 .../apache/james/mailbox/backup/ZipperTest.java|  86 ++-
 16 files changed, 241 insertions(+), 214 deletions(-)
 copy 
mailbox/{elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/FieldImpl.java
 => 
backup/src/main/java/org/apache/james/mailbox/backup/MailboxWithAnnotations.java}
 (62%)
 copy 
mailbox/backup/src/main/java/org/apache/james/mailbox/backup/{Directory.java => 
WithZipHeader.java} (77%)
 copy 
mailbox/backup/src/test/java/org/apache/james/mailbox/backup/{DirectoryTest.java
 => WithZipHeaderTest.java} (75%)


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



[james-project] 03/03: JAMES-2676 refactor zip header string id to little endian short

2019-03-13 Thread rouazana
This is an automated email from the ASF dual-hosted git repository.

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

commit 1a607e7e6833fedd4c0c8f7f05f59cfea1ab4bba
Author: Rémi Kowalski 
AuthorDate: Wed Mar 6 15:55:26 2019 +0100

JAMES-2676 refactor zip header string id  to little endian short
---
 .../james/mailbox/backup/FlagsExtraField.java  |  4 ++--
 .../mailbox/backup/InternalDateExtraField.java |  4 ++--
 .../james/mailbox/backup/MailboxIdExtraField.java  |  4 ++--
 .../james/mailbox/backup/MessageIdExtraField.java  |  4 ++--
 .../james/mailbox/backup/SizeExtraField.java   |  5 ++--
 .../apache/james/mailbox/backup/UidExtraField.java |  4 ++--
 .../mailbox/backup/UidValidityExtraField.java  |  5 ++--
 .../{UidExtraField.java => WithZipHeader.java} | 28 ++
 .../james/mailbox/backup/WithZipHeaderTest.java}   | 28 +-
 9 files changed, 34 insertions(+), 52 deletions(-)

diff --git 
a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/FlagsExtraField.java
 
b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/FlagsExtraField.java
index d290472..3d7f7b3 100644
--- 
a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/FlagsExtraField.java
+++ 
b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/FlagsExtraField.java
@@ -28,9 +28,9 @@ import javax.mail.Flags;
 import org.apache.commons.compress.archivers.zip.ZipShort;
 import org.apache.james.util.StreamUtils;
 
-public class FlagsExtraField extends StringExtraField {
+public class FlagsExtraField extends StringExtraField implements WithZipHeader 
{
 
-public static final ZipShort ID_AP = new ZipShort(0x7061); // "ap" in 
little-endian
+public static final ZipShort ID_AP = new 
ZipShort(WithZipHeader.toLittleEndian('a', 'p'));
 
 private static String serializeFlags(Flags flags) {
 return Stream.concat(
diff --git 
a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/InternalDateExtraField.java
 
b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/InternalDateExtraField.java
index 8d57370..0774647 100644
--- 
a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/InternalDateExtraField.java
+++ 
b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/InternalDateExtraField.java
@@ -24,9 +24,9 @@ import java.util.Optional;
 
 import org.apache.commons.compress.archivers.zip.ZipShort;
 
-public class InternalDateExtraField extends LongExtraField {
+public class InternalDateExtraField extends LongExtraField implements 
WithZipHeader {
 
-public static final ZipShort ID_AO = new ZipShort(0x6F61); // "ao" in 
little-endian
+public static final ZipShort ID_AO = new 
ZipShort(WithZipHeader.toLittleEndian('a', 'o'));
 
 public InternalDateExtraField() {
 super();
diff --git 
a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/MailboxIdExtraField.java
 
b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/MailboxIdExtraField.java
index c5bbaf1..5ca19db 100644
--- 
a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/MailboxIdExtraField.java
+++ 
b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/MailboxIdExtraField.java
@@ -24,9 +24,9 @@ import java.util.Optional;
 import org.apache.commons.compress.archivers.zip.ZipShort;
 import org.apache.james.mailbox.model.MailboxId;
 
-public class MailboxIdExtraField extends StringExtraField {
+public class MailboxIdExtraField extends StringExtraField implements 
WithZipHeader {
 
-public static final ZipShort ID_AM = new ZipShort(0x6D61); // "am" in 
little-endian
+public static final ZipShort ID_AM = new 
ZipShort(WithZipHeader.toLittleEndian('a', 'm'));
 
 public MailboxIdExtraField() {
 super();
diff --git 
a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/MessageIdExtraField.java
 
b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/MessageIdExtraField.java
index 1cbb1e2..46a971b 100644
--- 
a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/MessageIdExtraField.java
+++ 
b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/MessageIdExtraField.java
@@ -24,9 +24,9 @@ import java.util.Optional;
 import org.apache.commons.compress.archivers.zip.ZipShort;
 import org.apache.james.mailbox.model.MessageId;
 
-public class MessageIdExtraField extends StringExtraField {
+public class MessageIdExtraField extends StringExtraField implements 
WithZipHeader {
 
-public static final ZipShort ID_AL = new ZipShort(0x6C61); // "al" in 
little-endian
+public static final ZipShort ID_AL = new 
ZipShort(WithZipHeader.toLittleEndian('a', 'l'));
 
 public MessageIdExtraField() {
 super();
diff --git 
a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/SizeExtraField.java
 
b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/SizeExtraField.java
index f9328

[james-project] 01/03: JAMES-2676 refactor build zip file in ZipAssertTest

2019-03-13 Thread rouazana
This is an automated email from the ASF dual-hosted git repository.

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

commit 8a8ca6759e8fc080cd84ba5832d874466bcd4781
Author: Rémi Kowalski 
AuthorDate: Tue Mar 5 11:20:35 2019 +0100

JAMES-2676 refactor build zip file in ZipAssertTest
---
 .../apache/james/mailbox/backup/ZipAssertTest.java | 170 +
 1 file changed, 37 insertions(+), 133 deletions(-)

diff --git 
a/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/ZipAssertTest.java
 
b/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/ZipAssertTest.java
index c726da8..1cc03a8 100644
--- 
a/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/ZipAssertTest.java
+++ 
b/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/ZipAssertTest.java
@@ -27,6 +27,7 @@ import static 
org.assertj.core.api.Assertions.assertThatThrownBy;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.nio.charset.StandardCharsets;
+import java.util.AbstractMap.SimpleImmutableEntry;
 
 import org.apache.commons.compress.archivers.zip.ExtraFieldUtils;
 import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
@@ -40,16 +41,17 @@ import org.junit.jupiter.api.extension.ExtendWith;
 
 @ExtendWith(TemporaryFolderExtension.class)
 public class ZipAssertTest {
-public static final String ENTRY_NAME = "entryName";
-public static final String ENTRY_NAME_2 = "entryName2";
-public static final String DIRECTORY_NAME = "folder/";
-public static final String STRING_ENTRY_CONTENT = "abcdefghijkl";
-public static final String STRING_ENTRY_CONTENT_2 = "mnopqrstuvwxyz";
-public static final byte[] ENTRY_CONTENT = 
STRING_ENTRY_CONTENT.getBytes(StandardCharsets.UTF_8);
-public static final byte[] ENTRY_CONTENT_2 = 
STRING_ENTRY_CONTENT_2.getBytes(StandardCharsets.UTF_8);
-public static final SizeExtraField EXTRA_FIELD = new SizeExtraField(42);
-
-
+private static final String ENTRY_NAME = "entryName";
+private static final String ENTRY_NAME_2 = "entryName2";
+private static final String DIRECTORY_NAME = "folder/";
+private static final String STRING_ENTRY_CONTENT = "abcdefghijkl";
+private static final String STRING_ENTRY_CONTENT_2 = "mnopqrstuvwxyz";
+private static final byte[] ENTRY_CONTENT = 
STRING_ENTRY_CONTENT.getBytes(StandardCharsets.UTF_8);
+private static final byte[] ENTRY_CONTENT_2 = 
STRING_ENTRY_CONTENT_2.getBytes(StandardCharsets.UTF_8);
+private static final SizeExtraField EXTRA_FIELD = new SizeExtraField(42);
+
+private static final SimpleImmutableEntry ENTRY = new 
SimpleImmutableEntry<>(ENTRY_NAME, ENTRY_CONTENT);
+private static final SimpleImmutableEntry ENTRY_2 = new 
SimpleImmutableEntry<>(ENTRY_NAME_2, ENTRY_CONTENT_2);
 private File destination;
 
 @BeforeEach
@@ -59,30 +61,32 @@ public class ZipAssertTest {
 ExtraFieldUtils.register(SizeExtraField.class);
 }
 
-@Test
-public void hasNoEntryShouldNotThrowWhenEmpty() throws Exception {
+private void buildZipFile(SimpleImmutableEntry... entries) 
throws Exception {
 try (ZipArchiveOutputStream archiveOutputStream = new 
ZipArchiveOutputStream(destination)) {
+   for (SimpleImmutableEntry entry : entries) {
+ZipArchiveEntry archiveEntry = (ZipArchiveEntry) 
archiveOutputStream.createArchiveEntry(new File("any"), entry.getKey());
+archiveOutputStream.putArchiveEntry(archiveEntry);
+IOUtils.copy(new ByteArrayInputStream(entry.getValue()), 
archiveOutputStream);
+archiveOutputStream.closeArchiveEntry();
+}
 archiveOutputStream.finish();
 }
+}
+
+@Test
+public void hasNoEntryShouldNotThrowWhenEmpty() throws Exception {
+   buildZipFile();
 
 try (ZipFile zipFile = new ZipFile(destination)) {
 assertThatCode(() -> assertThatZip(zipFile)
-.hasNoEntry())
+.hasNoEntry())
 .doesNotThrowAnyException();
 }
 }
 
 @Test
 public void hasNoEntryShouldThrowWhenNotEmpty() throws Exception {
-try (ZipArchiveOutputStream archiveOutputStream = new 
ZipArchiveOutputStream(destination)) {
-
-ZipArchiveEntry archiveEntry = (ZipArchiveEntry) 
archiveOutputStream.createArchiveEntry(new File("any"), ENTRY_NAME);
-archiveOutputStream.putArchiveEntry(archiveEntry);
-IOUtils.copy(new ByteArrayInputStream(ENTRY_CONTENT), 
archiveOutputStream);
-archiveOutputStream.closeArchiveEntry();
-
-archiveOutputStream.finish();
-}
+buildZipFile(ENTRY);
 
 try (ZipFile zipFile = new ZipFile(destination)) {
 assertThatThrownBy(() -> assertThatZip(zipFile)
@@ -93,9 +97,7 @@ public class ZipAssertTest {
 
 @Test
 public void containsExa

[james-project] 02/03: JAMES-2676 add mailbox annotations in backup zip

2019-03-13 Thread rouazana
This is an automated email from the ASF dual-hosted git repository.

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

commit d3238e1d6d8eff96045ae82ab4dafc4a9df3a5ad
Author: Rémi Kowalski 
AuthorDate: Tue Mar 5 14:26:22 2019 +0100

JAMES-2676 add mailbox annotations in backup zip
---
 .../james/mailbox/model/MailboxAnnotationKey.java  |  2 +-
 .../org/apache/james/mailbox/backup/Backup.java|  7 +-
 .../{Backup.java => MailboxWithAnnotations.java}   | 35 ++---
 .../org/apache/james/mailbox/backup/Zipper.java| 59 ---
 .../mailbox/backup/MailboxMessageFixture.java  | 22 +-
 .../apache/james/mailbox/backup/ZipperTest.java| 86 --
 6 files changed, 177 insertions(+), 34 deletions(-)

diff --git 
a/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxAnnotationKey.java
 
b/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxAnnotationKey.java
index 1e7349d..a4ac543 100644
--- 
a/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxAnnotationKey.java
+++ 
b/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxAnnotationKey.java
@@ -46,7 +46,7 @@ public class MailboxAnnotationKey {
 public MailboxAnnotationKey(String key) {
 this.key = key;
 Preconditions.checkArgument(isValid(),
-"Key must start with '/' and not end with '/' and does not contain 
charater with hex from '\u' to '\u00019' or {'*', '%', two consecutive '/'} 
");
+"Key must start with '/' and not end with '/' and does not contain 
character with hex from '\u' to '\u00019' or {'*', '%', two consecutive 
'/'} ");
 }
 
 private boolean isValid() {
diff --git 
a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/Backup.java 
b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/Backup.java
index 81ebddb..e77871e 100644
--- a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/Backup.java
+++ b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/Backup.java
@@ -23,15 +23,14 @@ import java.io.OutputStream;
 import java.util.List;
 import java.util.stream.Stream;
 
-import org.apache.james.mailbox.store.mail.model.Mailbox;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;
 
 public interface Backup {
 
 /**
- * @param mailboxes list of mailboxes to be stored in the archive
- * @param messages a stream of MailboxMessages that will be consumed
+ * @param mailboxes   list of mailboxes and their annotations to be stored 
in the archive
+ * @param messagesa stream of MailboxMessages that will be consumed
  * @param destination an OutputStream in which the zip will be written
  */
-void archive(List mailboxes, Stream messages, 
OutputStream destination) throws IOException;
+void archive(List mailboxes, 
Stream messages, OutputStream destination) throws IOException;
 }
diff --git 
a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/Backup.java 
b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/MailboxWithAnnotations.java
similarity index 62%
copy from 
mailbox/backup/src/main/java/org/apache/james/mailbox/backup/Backup.java
copy to 
mailbox/backup/src/main/java/org/apache/james/mailbox/backup/MailboxWithAnnotations.java
index 81ebddb..c460685 100644
--- a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/Backup.java
+++ 
b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/MailboxWithAnnotations.java
@@ -18,20 +18,33 @@
  /
 package org.apache.james.mailbox.backup;
 
-import java.io.IOException;
-import java.io.OutputStream;
 import java.util.List;
-import java.util.stream.Stream;
+import java.util.Objects;
 
+import org.apache.james.mailbox.model.MailboxAnnotation;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
-import org.apache.james.mailbox.store.mail.model.MailboxMessage;
 
-public interface Backup {
+public class MailboxWithAnnotations {
+public final Mailbox mailbox;
+public final List annotations;
 
-/**
- * @param mailboxes list of mailboxes to be stored in the archive
- * @param messages a stream of MailboxMessages that will be consumed
- * @param destination an OutputStream in which the zip will be written
- */
-void archive(List mailboxes, Stream messages, 
OutputStream destination) throws IOException;
+public MailboxWithAnnotations(Mailbox mailbox, List 
annotations) {
+this.mailbox = mailbox;
+this.annotations = annotations;
+}
+
+@Override
+public boolean equals(Object o) {
+if (o instanceof MailboxAnnotation) {
+MailboxWithAnnotations that = (MailboxWithAnnotations) o;
+return Objects.equals(mailbox, that.mailbox) &&
+Objects.equals(annotations, that.annotations);
+}
+return false;
+}
+

[jira] [Created] (JAMES-2692) Blob encryption with InputStream

2019-03-13 Thread Antoine Duprat (JIRA)
Antoine Duprat created JAMES-2692:
-

 Summary: Blob encryption with InputStream
 Key: JAMES-2692
 URL: https://issues.apache.org/jira/browse/JAMES-2692
 Project: James Server
  Issue Type: New Feature
  Components: Blob
Reporter: Antoine Duprat


Due to the support of the AWS S3 implementation, we had to modify the API in 
order to give the length of the InputStream.

While encrypting the InputStream, we are not able to retrieve it's length with 
a smart solution.

The goal of this issue is to handle encryption with InputStream.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Created] (JAMES-2691) Missing Elasticsearch metrics

2019-03-13 Thread JIRA
Rémi Kowalski created JAMES-2691:


 Summary: Missing Elasticsearch metrics
 Key: JAMES-2691
 URL: https://issues.apache.org/jira/browse/JAMES-2691
 Project: James Server
  Issue Type: Improvement
Reporter: Rémi Kowalski


In James, we have many metrics to monitor the time spend in different 
components.
But we miss to measure the number of  ElasticSearch requests.
In this ticket, you will:

add measures on ElasticSearch requests
add a Grafana board to show this measures



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Commented] (JAMES-2671) Implement BlobStore for AWS S3

2019-03-13 Thread Antoine Duprat (JIRA)


[ 
https://issues.apache.org/jira/browse/JAMES-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16791525#comment-16791525
 ] 

Antoine Duprat commented on JAMES-2671:
---

[https://github.com/linagora/james-project/pull/2215] contributed this

> Implement BlobStore for AWS S3
> --
>
> Key: JAMES-2671
> URL: https://issues.apache.org/jira/browse/JAMES-2671
> Project: James Server
>  Issue Type: New Feature
>  Components: Blob
>Reporter: Antoine Duprat
>Priority: Major
>
> Here BlobStore interface have to be implemented using jcloud.  
> A Configuration class maybe be created, but we do not expect it to be 
> finalized here.  
> Add Docker's Rules/extension/etc. and duplicate Swift-related tests for AWS 
> S3. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Created] (JAMES-2690) ObjectStorageBlobsDAO.read is brittle

2019-03-13 Thread Gautier DI FOLCO (JIRA)
Gautier DI FOLCO created JAMES-2690:
---

 Summary: ObjectStorageBlobsDAO.read is brittle
 Key: JAMES-2690
 URL: https://issues.apache.org/jira/browse/JAMES-2690
 Project: James Server
  Issue Type: Improvement
  Components: Blob
Reporter: Gautier DI FOLCO


ObjectStorageBlobsDAO.read is brittle

https://github.com/linagora/james-project/pull/2236



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Resolved] (JAMES-2689) CassandraMessageMapper.updateFlags poor performance due to modSeq conflicts

2019-03-13 Thread Gautier DI FOLCO (JIRA)


 [ 
https://issues.apache.org/jira/browse/JAMES-2689?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gautier DI FOLCO resolved JAMES-2689.
-
Resolution: Fixed

> CassandraMessageMapper.updateFlags poor performance due to modSeq conflicts
> ---
>
> Key: JAMES-2689
> URL: https://issues.apache.org/jira/browse/JAMES-2689
> Project: James Server
>  Issue Type: Improvement
>  Components: cassandra
>Reporter: Gautier DI FOLCO
>Priority: Minor
> Fix For: 3.4.0
>
>
> CassandraMessageMapper.updateFlags use modSeq generation in parallel which 
> causes conflicts
> https://github.com/linagora/james-project/pull/2237



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Created] (JAMES-2689) CassandraMessageMapper.updateFlags poor performance due to modSeq conflicts

2019-03-13 Thread Gautier DI FOLCO (JIRA)
Gautier DI FOLCO created JAMES-2689:
---

 Summary: CassandraMessageMapper.updateFlags poor performance due 
to modSeq conflicts
 Key: JAMES-2689
 URL: https://issues.apache.org/jira/browse/JAMES-2689
 Project: James Server
  Issue Type: Improvement
  Components: cassandra
Reporter: Gautier DI FOLCO
 Fix For: 3.4.0


CassandraMessageMapper.updateFlags use modSeq generation in parallel which 
causes conflicts

https://github.com/linagora/james-project/pull/2237



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[james-project] 03/03: Merge remote-tracking branch 'blackheaven/MAILBOX-374-updateFlags-modSeq'

2019-03-13 Thread rouazana
This is an automated email from the ASF dual-hosted git repository.

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

commit c4f44dd9869afb553bdde0a2497c781c492aa018
Merge: c359840 db0bc92
Author: Raphael Ouazana 
AuthorDate: Wed Mar 13 10:39:35 2019 +0100

Merge remote-tracking branch 'blackheaven/MAILBOX-374-updateFlags-modSeq'

 .../init/configuration/CassandraConfiguration.java | 28 ++
 .../init/CassandraConfigurationReadingTest.java| 11 -
 .../cassandra/init/CassandraConfigurationTest.java | 17 -
 .../src/test/resources/cassandra.properties| 11 -
 .../destination/conf/cassandra.properties  |  1 -
 .../destination/conf/cassandra.properties  |  1 -
 .../destination/conf/cassandra.properties  |  1 -
 .../destination/conf/cassandra.properties  |  1 -
 .../cassandra/mail/CassandraMessageMapper.java |  2 +-
 .../store/mail/model/MessageMapperTest.java|  2 ++
 .../resources/modules/mailbox/cassandra.properties | 11 -
 src/site/xdoc/server/config-cassandra.xml  |  2 --
 12 files changed, 20 insertions(+), 68 deletions(-)


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



[james-project] branch master updated (c359840 -> c4f44dd)

2019-03-13 Thread rouazana
This is an automated email from the ASF dual-hosted git repository.

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


from c359840  Merge remote-tracking branch 'blackheaven/JAMES-2578-reboot-9'
 new 9e7f335  MAILBOX-374 Serialize CassandraMessageMapper.updateFlags to 
avoid modSeq conflicts
 new db0bc92  MAILBOX-374 Drop Cassandra chunk.size.flags.update 
configuration
 new c4f44dd  Merge remote-tracking branch 
'blackheaven/MAILBOX-374-updateFlags-modSeq'

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../init/configuration/CassandraConfiguration.java | 28 ++
 .../init/CassandraConfigurationReadingTest.java| 11 -
 .../cassandra/init/CassandraConfigurationTest.java | 17 -
 .../src/test/resources/cassandra.properties| 11 -
 .../destination/conf/cassandra.properties  |  1 -
 .../destination/conf/cassandra.properties  |  1 -
 .../destination/conf/cassandra.properties  |  1 -
 .../destination/conf/cassandra.properties  |  1 -
 .../cassandra/mail/CassandraMessageMapper.java |  2 +-
 .../store/mail/model/MessageMapperTest.java|  2 ++
 .../resources/modules/mailbox/cassandra.properties | 11 -
 src/site/xdoc/server/config-cassandra.xml  |  2 --
 12 files changed, 20 insertions(+), 68 deletions(-)


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



[james-project] 01/03: MAILBOX-374 Serialize CassandraMessageMapper.updateFlags to avoid modSeq conflicts

2019-03-13 Thread rouazana
This is an automated email from the ASF dual-hosted git repository.

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

commit 9e7f3357fc69ca39468bad163cd0e6a6ed0ee96d
Author: Gautier DI FOLCO 
AuthorDate: Wed Feb 20 12:00:32 2019 +0100

MAILBOX-374 Serialize CassandraMessageMapper.updateFlags to avoid modSeq 
conflicts
---
 .../org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java | 2 +-
 .../org/apache/james/mailbox/store/mail/model/MessageMapperTest.java| 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
index dee5b98..73f55e7 100644
--- 
a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
+++ 
b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
@@ -319,7 +319,7 @@ public class CassandraMessageMapper implements 
MessageMapper {
 private Mono runUpdateStage(CassandraId mailboxId, 
Flux toBeUpdated, FlagsUpdateCalculator 
flagsUpdateCalculator) {
 Mono newModSeq = computeNewModSeq(mailboxId);
 return toBeUpdated
-.limitRate(cassandraConfiguration.getFlagsUpdateChunkSize())
+.limitRate(1)
 .flatMapSequential(metadata -> newModSeq.flatMap(modSeq -> 
tryFlagsUpdate(flagsUpdateCalculator, modSeq, metadata)))
 .reduce(FlagsUpdateStageResult.none(), 
FlagsUpdateStageResult::merge)
 .flatMap(result -> updateIndexesForUpdatesResult(mailboxId, 
result));
diff --git 
a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageMapperTest.java
 
b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageMapperTest.java
index 622e6ba..acc55b0 100644
--- 
a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageMapperTest.java
+++ 
b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MessageMapperTest.java
@@ -31,6 +31,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+import java.util.function.Consumer;
 
 import javax.mail.Flags;
 import javax.mail.Flags.Flag;
@@ -59,6 +60,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
+import com.github.fge.lambdas.Throwing;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 


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



[james-project] 02/03: MAILBOX-374 Drop Cassandra chunk.size.flags.update configuration

2019-03-13 Thread rouazana
This is an automated email from the ASF dual-hosted git repository.

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

commit db0bc922adac7f5d06dc2a7c55ef33fef64bdc1f
Author: Gautier DI FOLCO 
AuthorDate: Wed Feb 27 15:50:56 2019 +0100

MAILBOX-374 Drop Cassandra chunk.size.flags.update configuration
---
 .../init/configuration/CassandraConfiguration.java | 28 ++
 .../init/CassandraConfigurationReadingTest.java| 11 -
 .../cassandra/init/CassandraConfigurationTest.java | 17 -
 .../src/test/resources/cassandra.properties| 11 -
 .../destination/conf/cassandra.properties  |  1 -
 .../destination/conf/cassandra.properties  |  1 -
 .../destination/conf/cassandra.properties  |  1 -
 .../destination/conf/cassandra.properties  |  1 -
 .../resources/modules/mailbox/cassandra.properties | 11 -
 src/site/xdoc/server/config-cassandra.xml  |  2 --
 10 files changed, 17 insertions(+), 67 deletions(-)

diff --git 
a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/configuration/CassandraConfiguration.java
 
b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/configuration/CassandraConfiguration.java
index e87249a..69a8736 100644
--- 
a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/configuration/CassandraConfiguration.java
+++ 
b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/configuration/CassandraConfiguration.java
@@ -52,7 +52,6 @@ public class CassandraConfiguration {
 private static final String MAILBOX_MAX_RETRY_MESSAGE_FLAGS_UPDATE = 
"mailbox.max.retry.message.flags.update";
 private static final String MAILBOX_MAX_RETRY_MESSAGE_ID_FLAGS_UPDATE = 
"mailbox.max.retry.message.id.flags.update";
 private static final String FETCH_ADVANCE_ROW_COUNT = 
"fetch.advance.row.count";
-private static final String CHUNK_SIZE_FLAGS_UPDATE = 
"chunk.size.flags.update";
 private static final String CHUNK_SIZE_MESSAGE_READ = 
"chunk.size.message.read";
 private static final String CHUNK_SIZE_EXPUNGE = "chunk.size.expunge";
 private static final String BLOB_PART_SIZE = "mailbox.blob.part.size";
@@ -64,7 +63,6 @@ public class CassandraConfiguration {
 public static class Builder {
 private Optional messageReadChunkSize = Optional.empty();
 private Optional expungeChunkSize = Optional.empty();
-private Optional flagsUpdateChunkSize = Optional.empty();
 private Optional flagsUpdateMessageIdMaxRetry = 
Optional.empty();
 private Optional flagsUpdateMessageMaxRetry = 
Optional.empty();
 private Optional modSeqMaxRetry = Optional.empty();
@@ -87,12 +85,6 @@ public class CassandraConfiguration {
 return this;
 }
 
-public Builder flagsUpdateChunkSize(int value) {
-Preconditions.checkArgument(value > 0, "flagsUpdateChunkSize needs 
to be strictly positive");
-this.flagsUpdateChunkSize = Optional.of(value);
-return this;
-}
-
 public Builder flagsUpdateMessageIdMaxRetry(int value) {
 Preconditions.checkArgument(value > 0, 
"flagsUpdateMessageIdMaxRetry needs to be strictly positive");
 this.flagsUpdateMessageIdMaxRetry = Optional.of(value);
@@ -157,11 +149,6 @@ public class CassandraConfiguration {
 return this;
 }
 
-public Builder flagsUpdateChunkSize(Optional value) {
-value.ifPresent(this::flagsUpdateChunkSize);
-return this;
-}
-
 public Builder flagsUpdateMessageIdMaxRetry(Optional value) {
 value.ifPresent(this::flagsUpdateMessageIdMaxRetry);
 return this;
@@ -211,7 +198,6 @@ public class CassandraConfiguration {
 return new 
CassandraConfiguration(aclMaxRetry.orElse(DEFAULT_ACL_MAX_RETRY),
 
messageReadChunkSize.orElse(DEFAULT_MESSAGE_CHUNK_SIZE_ON_READ),
 expungeChunkSize.orElse(DEFAULT_EXPUNGE_BATCH_SIZE),
-flagsUpdateChunkSize.orElse(DEFAULT_UPDATE_FLAGS_BATCH_SIZE),
 
flagsUpdateMessageIdMaxRetry.orElse(DEFAULT_FLAGS_UPDATE_MESSAGE_ID_MAX_RETRY),
 
flagsUpdateMessageMaxRetry.orElse(DEFAULT_FLAGS_UPDATE_MESSAGE_MAX_RETRY),
 modSeqMaxRetry.orElse(DEFAULT_MODSEQ_MAX_RETRY),
@@ -241,8 +227,6 @@ public class CassandraConfiguration {
 
propertiesConfiguration.getInteger(MAILBOX_MAX_RETRY_MESSAGE_ID_FLAGS_UPDATE, 
null)))
 .fetchNextPageInAdvanceRow(Optional.ofNullable(
 propertiesConfiguration.getInteger(FETCH_ADVANCE_ROW_COUNT, 
null)))
-.flagsUpdateChunkSize(Optional.ofNullable(
-propertiesConfiguration.getInteger(CHUNK_SIZE_FLAGS_UPDATE, 
null)))
 .messageReadChunkSize(Optio

[jira] [Commented] (JAMES-2578) MQs should not rely on Serializable

2019-03-13 Thread JIRA


[ 
https://issues.apache.org/jira/browse/JAMES-2578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16791510#comment-16791510
 ] 

Raphaël Ouazana commented on JAMES-2578:


https://github.com/linagora/james-project/pull/2219

> MQs should not rely on Serializable
> ---
>
> Key: JAMES-2578
> URL: https://issues.apache.org/jira/browse/JAMES-2578
> Project: James Server
>  Issue Type: Improvement
>Reporter: Gautier DI FOLCO
>Priority: Major
>
> Mail interface allows people to insert any Serializable object as an 
> attribute.
> For now, we then relied on java serialization when putting Mail object into a 
> MQ.
> Now that we try to write a new MailQueue on top of RabbitMQ, it makes sense 
> to try to avoid this use of Serializable.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[james-project] branch master updated: JAMES-2578 Fix warning using Mailet new API on FakeMail.Builder

2019-03-13 Thread rouazana
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 4c73600  JAMES-2578 Fix warning using Mailet new API on 
FakeMail.Builder
 new c359840  Merge remote-tracking branch 'blackheaven/JAMES-2578-reboot-9'
4c73600 is described below

commit 4c736003ddad550d191f477166c3615181267802
Author: Gautier DI FOLCO 
AuthorDate: Tue Mar 5 10:16:55 2019 +0100

JAMES-2578 Fix warning using Mailet new API on FakeMail.Builder
---
 .../apache/james/transport/mailets/ICALToHeader.java   |  1 +
 .../james/transport/mailets/ICALToHeadersTest.java | 18 --
 .../james/transport/mailets/ICalendarParserTest.java   | 10 +++---
 .../apache/james/transport/mailets/DSNBounceTest.java  | 14 --
 .../james/transport/matchers/IsMarkedAsSpamTest.java   |  3 ++-
 .../webadmin/routes/MailRepositoriesRoutesTest.java|  5 +++--
 6 files changed, 33 insertions(+), 18 deletions(-)

diff --git 
a/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToHeader.java
 
b/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToHeader.java
index 4a4df5d..025dfc3 100644
--- 
a/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToHeader.java
+++ 
b/mailet/icalendar/src/main/java/org/apache/james/transport/mailets/ICALToHeader.java
@@ -66,6 +66,7 @@ public class ICALToHeader extends GenericMailet {
 
 public static final String ATTRIBUTE_PROPERTY = "attribute";
 public static final String ATTRIBUTE_DEFAULT_NAME = "icalendar";
+public static final AttributeName ATTRIBUTE_DEFAULT = 
AttributeName.of(ATTRIBUTE_DEFAULT_NAME);
 
 public static final String X_MEETING_UID_HEADER = "X-MEETING-UID";
 public static final String X_MEETING_METHOD_HEADER = "X-MEETING-METHOD";
diff --git 
a/mailet/icalendar/src/test/java/org/apache/james/transport/mailets/ICALToHeadersTest.java
 
b/mailet/icalendar/src/test/java/org/apache/james/transport/mailets/ICALToHeadersTest.java
index d49beed..79bd7ce 100644
--- 
a/mailet/icalendar/src/test/java/org/apache/james/transport/mailets/ICALToHeadersTest.java
+++ 
b/mailet/icalendar/src/test/java/org/apache/james/transport/mailets/ICALToHeadersTest.java
@@ -24,6 +24,8 @@ import static org.assertj.core.api.Assertions.assertThat;
 import javax.mail.MessagingException;
 
 import org.apache.james.util.MimeMessageUtil;
+import org.apache.mailet.Attribute;
+import org.apache.mailet.AttributeValue;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
@@ -103,7 +105,7 @@ public class ICALToHeadersTest {
 Mail mail = FakeMail.builder()
 .name("mail")
 .mimeMessage(MimeMessageUtil.defaultMimeMessage())
-.attribute(ICALToHeader.ATTRIBUTE_DEFAULT_NAME, "This is the wrong 
type")
+.attribute(makeAttribute("This is the wrong type"))
 .build();
 
 testee.service(mail);
@@ -121,7 +123,7 @@ public class ICALToHeadersTest {
 Mail mail = FakeMail.builder()
 .name("mail")
 .mimeMessage(MimeMessageUtil.defaultMimeMessage())
-.attribute(ICALToHeader.ATTRIBUTE_DEFAULT_NAME, 
wrongParametrizedMap)
+.attribute(makeAttribute(wrongParametrizedMap))
 .build();
 
 testee.service(mail);
@@ -140,7 +142,7 @@ public class ICALToHeadersTest {
 Mail mail = FakeMail.builder()
 .name("mail")
 .mimeMessage(MimeMessageUtil.defaultMimeMessage())
-.attribute(ICALToHeader.ATTRIBUTE_DEFAULT_NAME, icals)
+.attribute(makeAttribute(icals))
 .build();
 
 testee.service(mail);
@@ -164,7 +166,7 @@ public class ICALToHeadersTest {
 Mail mail = FakeMail.builder()
 .name("mail")
 .mimeMessage(MimeMessageUtil.defaultMimeMessage())
-.attribute(ICALToHeader.ATTRIBUTE_DEFAULT_NAME, icals)
+.attribute(makeAttribute(icals))
 .build();
 
 testee.service(mail);
@@ -190,7 +192,7 @@ public class ICALToHeadersTest {
 Mail mail = FakeMail.builder()
 .name("mail")
 .mimeMessage(MimeMessageUtil.defaultMimeMessage())
-.attribute(ICALToHeader.ATTRIBUTE_DEFAULT_NAME, icals)
+.attribute(makeAttribute(icals))
 .build();
 
 testee.service(mail);
@@ -207,11 +209,15 @@ public class ICALToHeadersTest {
 Mail mail = FakeMail.builder()
 .name("mail")
 .mimeMessage(MimeMessageUtil.defaultMimeMessage())
-.attribute(ICALToHeader.ATTRIBUTE_DEFAULT_NAME, icals)
+.attribute(makeAttribute(icals))
 .build();
 
 testee.service(mail);
 
 
assertThat(mail.getMessage().get

[jira] [Commented] (JAMES-2666) Integration tests for EventDeadLetter

2019-03-13 Thread Rene Cordier (JIRA)


[ 
https://issues.apache.org/jira/browse/JAMES-2666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16791449#comment-16791449
 ] 

Rene Cordier commented on JAMES-2666:
-

PR regarding integration tests for dead letters with real group listener : 
https://github.com/linagora/james-project/pull/2239

> Integration tests for EventDeadLetter
> -
>
> Key: JAMES-2666
> URL: https://issues.apache.org/jira/browse/JAMES-2666
> Project: James Server
>  Issue Type: Improvement
>Reporter: Trần Tiến Đức
>Priority: Major
>
> In webAdmin integration test, write a DeadLetterTest
> You will:
> - Create a stateful listener that fails 'n' times on a given eventId, then 
> succeeds and allow retrieving the list of successfully processed eventIds.
> - Load this listener into a James server
> {code:java}
> When an event is initially processed
> Then the processing of this event is failing
> And I can retrieve this event in the EventDeadLetter using webAdmin{code}
>  
> {code:java}
> Given an event is initially processed
> And the processing of this event is failing
> When I do reprocess this event stored in EventDeadLetter
> Then The new processing succeed (n = num-retry){code}
>  
> {code:java}
> Given an event is initially processed
> And the processing of this event is failing
> When I do reprocess this event stored in EventDeadLetter
> Then The still fails (n > 2 * num-retry)
> And the event is still in deadLetter{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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