[jira] [Closed] (JAMES-2279) Write a WithPriority mailet and HasPriority matchers

2019-06-07 Thread Tellier Benoit (JIRA)


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

Tellier Benoit closed JAMES-2279.
-

> Write a WithPriority mailet and HasPriority matchers
> 
>
> Key: JAMES-2279
> URL: https://issues.apache.org/jira/browse/JAMES-2279
> Project: James Server
>  Issue Type: New Feature
>  Components: Mailet Contributions
>Affects Versions: master
>Reporter: Tellier Benoit
>Priority: Major
>  Labels: easyfix, feature, newbie
> Fix For: 3.4.0
>
>
> James mail queues is handling mail priorities. See the *MailPrioritySupport* 
> interface.
> This is done using the MAIL_PRIORITY mail attribute. It is an integer 
> property ranging from 0 (low) to 9 (high) and mail queue component will 
> default to 5.
> Today, the mail processing unit akka mailetContainer can not change the 
> priority set by the SMTP layer (using *MailPriorityHandler*). This is a 
> problem as we can not re-prioritise outgoing emails, for instance in remote 
> delivery queues.
> I would thus propose the following mailet:
> {code:xml}
> 
> 8
> 
> {code}
> Furthermore, we might want to customize processing logic depending on the 
> priority (might it just be for debugging purpose).
> To do so, I propose to introduce the following matchers:
> {code:xml}
> 
> 
> 
> {code}
> *How to do this?*
> In the `server/mailet/mailets` project, in the mailet package create the 
> WithPriority mailet which sets the MAIL_PRIORITY attribute. 
> Create the matchers in  `server/mailet/mailets` in the matcher package.
> Write unit tests for these mailets / matchers.
> Use MailetUtil content to parse the integer conditions/value. You can reuse 
> https://github.com/linagora/james-project/pull/1215 to ease your work.



--
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-2279) Write a WithPriority mailet and HasPriority matchers

2019-06-07 Thread Tellier Benoit (JIRA)


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

Tellier Benoit commented on JAMES-2279:
---

https://github.com/linagora/james-project/pull/2422 contributed this. Thanks to 
ilker yıldırım!

> Write a WithPriority mailet and HasPriority matchers
> 
>
> Key: JAMES-2279
> URL: https://issues.apache.org/jira/browse/JAMES-2279
> Project: James Server
>  Issue Type: New Feature
>  Components: Mailet Contributions
>Affects Versions: master
>Reporter: Tellier Benoit
>Priority: Major
>  Labels: easyfix, feature, newbie
>
> James mail queues is handling mail priorities. See the *MailPrioritySupport* 
> interface.
> This is done using the MAIL_PRIORITY mail attribute. It is an integer 
> property ranging from 0 (low) to 9 (high) and mail queue component will 
> default to 5.
> Today, the mail processing unit akka mailetContainer can not change the 
> priority set by the SMTP layer (using *MailPriorityHandler*). This is a 
> problem as we can not re-prioritise outgoing emails, for instance in remote 
> delivery queues.
> I would thus propose the following mailet:
> {code:xml}
> 
> 8
> 
> {code}
> Furthermore, we might want to customize processing logic depending on the 
> priority (might it just be for debugging purpose).
> To do so, I propose to introduce the following matchers:
> {code:xml}
> 
> 
> 
> {code}
> *How to do this?*
> In the `server/mailet/mailets` project, in the mailet package create the 
> WithPriority mailet which sets the MAIL_PRIORITY attribute. 
> Create the matchers in  `server/mailet/mailets` in the matcher package.
> Write unit tests for these mailets / matchers.
> Use MailetUtil content to parse the integer conditions/value. You can reuse 
> https://github.com/linagora/james-project/pull/1215 to ease your work.



--
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-2279) Write a WithPriority mailet and HasPriority matchers

2019-06-07 Thread Tellier Benoit (JIRA)


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

Tellier Benoit resolved JAMES-2279.
---
   Resolution: Fixed
Fix Version/s: 3.4.0

> Write a WithPriority mailet and HasPriority matchers
> 
>
> Key: JAMES-2279
> URL: https://issues.apache.org/jira/browse/JAMES-2279
> Project: James Server
>  Issue Type: New Feature
>  Components: Mailet Contributions
>Affects Versions: master
>Reporter: Tellier Benoit
>Priority: Major
>  Labels: easyfix, feature, newbie
> Fix For: 3.4.0
>
>
> James mail queues is handling mail priorities. See the *MailPrioritySupport* 
> interface.
> This is done using the MAIL_PRIORITY mail attribute. It is an integer 
> property ranging from 0 (low) to 9 (high) and mail queue component will 
> default to 5.
> Today, the mail processing unit akka mailetContainer can not change the 
> priority set by the SMTP layer (using *MailPriorityHandler*). This is a 
> problem as we can not re-prioritise outgoing emails, for instance in remote 
> delivery queues.
> I would thus propose the following mailet:
> {code:xml}
> 
> 8
> 
> {code}
> Furthermore, we might want to customize processing logic depending on the 
> priority (might it just be for debugging purpose).
> To do so, I propose to introduce the following matchers:
> {code:xml}
> 
> 
> 
> {code}
> *How to do this?*
> In the `server/mailet/mailets` project, in the mailet package create the 
> WithPriority mailet which sets the MAIL_PRIORITY attribute. 
> Create the matchers in  `server/mailet/mailets` in the matcher package.
> Write unit tests for these mailets / matchers.
> Use MailetUtil content to parse the integer conditions/value. You can reuse 
> https://github.com/linagora/james-project/pull/1215 to ease your work.



--
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-2526) Implement health check endpoint

2019-06-07 Thread Tellier Benoit (JIRA)


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

Tellier Benoit commented on JAMES-2526:
---

https://github.com/linagora/james-project/pull/2432 plays all the authorization 
tests for webAdmin on the same endpoints to limit build time

> Implement health check endpoint
> ---
>
> Key: JAMES-2526
> URL: https://issues.apache.org/jira/browse/JAMES-2526
> Project: James Server
>  Issue Type: New Feature
>  Components: utils
>Reporter: Antoine Duprat
>Priority: Major
> Fix For: 3.2.0
>
>
> Define a HealthCheck API in james-core
> Then write a webadmin endpoint performing the checks and returning a 200 
> status code if all checks are allright or a 500 status if some checks are 
> failing.
> Authentication bypass is needed for that route.
> Finally, implement a IsStartedHealthCheck. 
> You can base yourself on the IsStartedProbe defined here: 
> https://github.com/linagora/james-project/pull/1646/commits/febb9f17cc0915f245e7a7f0fa9fcf8ed1750816



--
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] 04/07: JAMES-2774 Solve some intelliJ warnings in RabbitMQ EventBus tests

2019-06-07 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 9d61daf2c7f8bef209c727a0fdc8a43d31706722
Author: Benoit Tellier 
AuthorDate: Thu Jun 6 11:00:08 2019 +0700

JAMES-2774 Solve some intelliJ warnings in RabbitMQ EventBus tests
---
 .../james/mailbox/events/RabbitMQEventBusTest.java | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git 
a/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
 
b/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
index 525b16d..b7b2da9 100644
--- 
a/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
+++ 
b/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
@@ -317,7 +317,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 }
 
 @Test
-void dispatchShouldWorkAfterNetworkIssuesForOldRegistration() 
throws Exception {
+void dispatchShouldWorkAfterNetworkIssuesForOldRegistration() {
 rabbitMQEventBusWithNetWorkIssue.start();
 MailboxListener listener = newListener();
 rabbitMQEventBusWithNetWorkIssue.register(listener, 
GROUP_A);
@@ -346,7 +346,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 }
 
 @Test
-void dispatchShouldWorkAfterRestartForOldRegistration() throws 
Exception {
+void dispatchShouldWorkAfterRestartForOldRegistration() {
 eventBus.start();
 MailboxListener listener = newListener();
 eventBus.register(listener, GROUP_A);
@@ -358,7 +358,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 }
 
 @Test
-void dispatchShouldWorkAfterRestartForNewRegistration() throws 
Exception {
+void dispatchShouldWorkAfterRestartForNewRegistration() {
 eventBus.start();
 MailboxListener listener = newListener();
 
@@ -373,7 +373,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 }
 
 @Test
-void redeliverShouldWorkAfterRestartForOldRegistration() throws 
Exception {
+void redeliverShouldWorkAfterRestartForOldRegistration() {
 eventBus.start();
 MailboxListener listener = newListener();
 eventBus.register(listener, GROUP_A);
@@ -385,7 +385,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 }
 
 @Test
-void redeliverShouldWorkAfterRestartForNewRegistration() throws 
Exception {
+void redeliverShouldWorkAfterRestartForNewRegistration() {
 eventBus.start();
 MailboxListener listener = newListener();
 
@@ -398,7 +398,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 }
 
 @Test
-void dispatchShouldWorkAfterRestartForOldKeyRegistration() throws 
Exception {
+void dispatchShouldWorkAfterRestartForOldKeyRegistration() {
 eventBus.start();
 MailboxListener listener = newListener();
 eventBus.register(listener, KEY_1);
@@ -410,7 +410,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 }
 
 @Test
-void dispatchShouldWorkAfterRestartForNewKeyRegistration() throws 
Exception {
+void dispatchShouldWorkAfterRestartForNewKeyRegistration() {
 eventBus.start();
 MailboxListener listener = newListener();
 
@@ -423,7 +423,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 }
 
 @Test
-void dispatchShouldWorkAfterNetworkIssuesForNewRegistration() 
throws Exception {
+void dispatchShouldWorkAfterNetworkIssuesForNewRegistration() {
 eventBus.start();
 MailboxListener listener = newListener();
 
@@ -440,7 +440,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 }
 
 @Test
-void redeliverShouldWorkAfterNetworkIssuesForNewRegistration() 
throws Exception {
+void redeliverShouldWorkAfterNetworkIssuesForNewRegistration() {
 eventBus.start();
 MailboxListener listener = newListener();
 
@@ -457,7 +457,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 }
 
 @Test
- 

[james-project] 03/07: JAMES-2777 James should close ElasticSearch scroll context

2019-06-07 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 5bf49a7c57210a929203a4da28b2211cb4f36faf
Author: Benoit Tellier 
AuthorDate: Wed May 22 13:12:19 2019 +0700

JAMES-2777 James should close ElasticSearch scroll context
---
 .../james/backends/es/DeleteByQueryPerformer.java  |   4 +-
 .../{ScrollIterable.java => ScrolledSearch.java}   |  59 
 ...llIterableTest.java => ScrolledSearchTest.java} |  24 ++---
 .../org/apache/james/mailbox/MessageManager.java   |   3 +-
 .../ElasticSearchListeningMessageSearchIndex.java  |  27 +++---
 .../search/ElasticSearchSearcher.java  |  24 ++---
 .../lucene/search/LuceneMessageSearchIndex.java|   6 +-
 .../LuceneMailboxMessageSearchIndexTest.java   | 102 ++---
 .../james/vault/DeletedMessageVaultHookTest.java   |  13 +--
 .../elasticsearch/ElasticSearchQuotaSearcher.java  |  17 ++--
 .../james/mailbox/store/StoreMessageManager.java   |   7 +-
 .../store/search/LazyMessageSearchIndex.java   |   3 +-
 .../mailbox/store/search/MessageSearchIndex.java   |   4 +-
 .../store/search/SimpleMessageSearchIndex.java |   5 +-
 .../search/AbstractMessageSearchIndexTest.java |   3 +-
 .../imap/processor/AbstractMailboxProcessor.java   |   6 +-
 .../james/imap/processor/SearchProcessor.java  |  51 ++-
 .../imap/processor/base/SelectedMailboxImpl.java   |   8 +-
 .../james/imap/processor/SearchProcessorTest.java  |   3 +-
 .../processor/base/MailboxEventAnalyserTest.java   |   5 +-
 .../processor/base/SelectedMailboxImplTest.java|   7 +-
 .../org/apache/james/FakeMessageSearchIndex.java   |   4 +-
 22 files changed, 198 insertions(+), 187 deletions(-)

diff --git 
a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/DeleteByQueryPerformer.java
 
b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/DeleteByQueryPerformer.java
index c84c9fc..26376c6 100644
--- 
a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/DeleteByQueryPerformer.java
+++ 
b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/DeleteByQueryPerformer.java
@@ -19,7 +19,7 @@
 
 package org.apache.james.backends.es;
 
-import org.apache.james.backends.es.search.ScrollIterable;
+import org.apache.james.backends.es.search.ScrolledSearch;
 import org.elasticsearch.action.bulk.BulkRequest;
 import org.elasticsearch.action.bulk.BulkResponse;
 import org.elasticsearch.action.delete.DeleteRequest;
@@ -51,7 +51,7 @@ public class DeleteByQueryPerformer {
 }
 
 public Mono perform(QueryBuilder queryBuilder) {
-return Flux.fromStream(new ScrollIterable(client, 
prepareSearch(queryBuilder)).stream())
+return Flux.fromStream(new ScrolledSearch(client, 
prepareSearch(queryBuilder)).searchResponses())
 .flatMap(searchResponse -> deleteRetrievedIds(client, 
searchResponse))
 .thenEmpty(Mono.empty());
 }
diff --git 
a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/search/ScrollIterable.java
 
b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/search/ScrolledSearch.java
similarity index 73%
rename from 
backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/search/ScrollIterable.java
rename to 
backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/search/ScrolledSearch.java
index 1a8d693..bf015f6 100644
--- 
a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/search/ScrollIterable.java
+++ 
b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/search/ScrolledSearch.java
@@ -19,39 +19,27 @@
 
 package org.apache.james.backends.es.search;
 
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.concurrent.CompletableFuture;
 import java.util.stream.Stream;
 
 import org.apache.james.backends.es.ListenerToFuture;
 import org.apache.james.util.streams.Iterators;
+import org.elasticsearch.action.search.ClearScrollRequest;
 import org.elasticsearch.action.search.SearchRequest;
 import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.action.search.SearchScrollRequest;
 import org.elasticsearch.client.RestHighLevelClient;
 import org.elasticsearch.common.unit.TimeValue;
+import org.elasticsearch.search.SearchHit;
 
-public class ScrollIterable implements Iterable {
-private static final TimeValue TIMEOUT = TimeValue.timeValueMinutes(1);
-
-private final RestHighLevelClient client;
-private final SearchRequest searchRequest;
-
-public ScrollIterable(RestHighLevelClient client, SearchRequest 
searchRequest) {
-this.client = client;
-this.searchRequest = searchRequest;
-}
+import com.github.fge.lambdas.Throwing;
 
-@Override
-public 

[james-project] branch master updated (26131bc -> f9fe42c)

2019-06-07 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 26131bc  JAMES-2783 use the updated ES extension for ES reporter tests
 new 201dd2d  JAMES-2726 Fake (Listening) MessageSearchIndex should not be 
processing events
 new a633935  JAMES-2774 remove duplicated test (rebase issue)
 new 5bf49a7  JAMES-2777 James should close ElasticSearch scroll context
 new 9d61daf  JAMES-2774 Solve some intelliJ warnings in RabbitMQ EventBus 
tests
 new 97f0ed7  JAMES-2774 Some assertions where not played in RabbitMQ 
EventBus tests
 new 1038a90  JAMES-2526 UnauthorizedEndpoint can be performed on a single 
James server
 new f9fe42c  JAMES-2279 Write a WithPriority mailet and HasPriority 
matchers

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:
 .../james/backends/es/DeleteByQueryPerformer.java  |   4 +-
 .../{ScrollIterable.java => ScrolledSearch.java}   |  59 
 ...llIterableTest.java => ScrolledSearchTest.java} |  24 ++---
 .../org/apache/james/mailbox/MessageManager.java   |   3 +-
 .../ElasticSearchListeningMessageSearchIndex.java  |  27 +++---
 .../search/ElasticSearchSearcher.java  |  24 ++---
 .../james/mailbox/events/RabbitMQEventBusTest.java |  47 +++---
 .../lucene/search/LuceneMessageSearchIndex.java|   6 +-
 .../LuceneMailboxMessageSearchIndexTest.java   | 102 ++--
 .../james/vault/DeletedMessageVaultHookTest.java   |  13 +--
 .../elasticsearch/ElasticSearchQuotaSearcher.java  |  17 ++--
 .../james/mailbox/store/StoreMessageManager.java   |   7 +-
 .../store/search/LazyMessageSearchIndex.java   |   3 +-
 .../mailbox/store/search/MessageSearchIndex.java   |   4 +-
 .../store/search/SimpleMessageSearchIndex.java |   5 +-
 .../search/AbstractMessageSearchIndexTest.java |   3 +-
 .../imap/processor/AbstractMailboxProcessor.java   |   6 +-
 .../james/imap/processor/SearchProcessor.java  |  51 +-
 .../imap/processor/base/SelectedMailboxImpl.java   |   8 +-
 .../james/imap/processor/SearchProcessorTest.java  |   3 +-
 .../processor/base/MailboxEventAnalyserTest.java   |   5 +-
 .../processor/base/SelectedMailboxImplTest.java|   7 +-
 server/app/src/main/resources/mailetcontainer.xml  |  11 ++-
 .../org/apache/james/FakeMessageSearchIndex.java   |   4 +-
 .../org/apache/james/FakeSearchMailboxModule.java  |   6 --
 .../james/transport/mailets/WithPriority.java  |  16 ++--
 .../matchers/AbstractPriorityMatcher.java  |  50 +-
 .../james/transport/matchers/AtLeastPriority.java} |  14 ++-
 .../james/transport/matchers/AtMostPriority.java}  |  14 ++-
 .../james/transport/matchers/HasPriority.java} |  14 ++-
 ...InNetworkTest.java => AtLeastPriorityTest.java} |  93 +++
 ...rInNetworkTest.java => AtMostPriorityTest.java} |  88 ++
 .../james/transport/matchers/HasPriorityTest.java  |  66 +++--
 .../integration/CassandraJmapExtension.java| 103 -
 .../integration/UnauthorizedEndpointsTest.java |  10 +-
 35 files changed, 486 insertions(+), 431 deletions(-)
 rename 
backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/search/{ScrollIterable.java
 => ScrolledSearch.java} (73%)
 rename 
backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/search/{ScrollIterableTest.java
 => ScrolledSearchTest.java} (91%)
 copy 
mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyLines.java
 => 
server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/AbstractPriorityMatcher.java
 (62%)
 copy 
server/{protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CucumberCassandraSingleton.java
 => 
mailet/mailets/src/main/java/org/apache/james/transport/matchers/AtLeastPriority.java}
 (83%)
 copy 
server/{protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CucumberCassandraSingleton.java
 => 
mailet/mailets/src/main/java/org/apache/james/transport/matchers/AtMostPriority.java}
 (83%)
 copy 
server/{protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CucumberCassandraSingleton.java
 => 
mailet/mailets/src/main/java/org/apache/james/transport/matchers/HasPriority.java}
 (83%)
 copy 
server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/{RemoteAddrInNetworkTest.java
 => AtLeastPriorityTest.java} (51%)
 copy 
server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/{RemoteAddrInNetworkTest.java
 => 

[james-project] 02/07: JAMES-2774 remove duplicated test (rebase issue)

2019-06-07 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 a633935ccf7c789794b1a8a259a270cd2f2e51a1
Author: Tran Tien Duc 
AuthorDate: Thu Jun 6 11:15:09 2019 +0700

JAMES-2774 remove duplicated test (rebase issue)
---
 .../james/mailbox/events/RabbitMQEventBusTest.java  | 17 -
 1 file changed, 17 deletions(-)

diff --git 
a/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
 
b/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
index 220f8c5..525b16d 100644
--- 
a/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
+++ 
b/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
@@ -346,23 +346,6 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 }
 
 @Test
-void dispatchShouldWorkAfterNetworkIssuesForOldRegistration() 
throws Exception {
-eventBus.start();
-MailboxListener listener = newListener();
-eventBus.register(listener, GROUP_A);
-
-rabbitMQExtension.getRabbitMQ().pause();
-
-assertThatThrownBy(() -> eventBus.dispatch(EVENT, 
NO_KEYS).block())
-.isInstanceOf(RabbitFluxException.class);
-
-rabbitMQExtension.getRabbitMQ().unpause();
-
-eventBus.dispatch(EVENT, NO_KEYS).block();
-assertThatListenerReceiveOneEvent(listener);
-}
-
-@Test
 void dispatchShouldWorkAfterRestartForOldRegistration() throws 
Exception {
 eventBus.start();
 MailboxListener listener = newListener();


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



[james-project] 05/07: JAMES-2774 Some assertions where not played in RabbitMQ EventBus tests

2019-06-07 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 97f0ed75ad7776d99fd3a5783f3f7f7e8e37bed8
Author: Benoit Tellier 
AuthorDate: Thu Jun 6 11:04:19 2019 +0700

JAMES-2774 Some assertions where not played in RabbitMQ EventBus tests
---
 .../org/apache/james/mailbox/events/RabbitMQEventBusTest.java | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
 
b/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
index b7b2da9..49f0f15 100644
--- 
a/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
+++ 
b/mailbox/event/event-rabbitmq/src/test/java/org/apache/james/mailbox/events/RabbitMQEventBusTest.java
@@ -498,7 +498,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 eventBus.stop();
 
 assertThat(rabbitManagementAPI.listExchanges())
-.anySatisfy(exchange -> 
exchange.getName().equals(MAILBOX_EVENT_EXCHANGE_NAME));
+.anySatisfy(exchange -> 
assertThat(exchange.getName()).isEqualTo(MAILBOX_EVENT_EXCHANGE_NAME));
 }
 
 @Test
@@ -508,7 +508,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 eventBus.stop();
 
 assertThat(rabbitManagementAPI.listQueues())
-.anySatisfy(queue -> 
queue.getName().contains(GroupA.class.getName()));
+.anySatisfy(queue -> 
assertThat(queue.getName()).contains(GroupA.class.getName()));
 }
 
 @Test
@@ -590,7 +590,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 eventBus3.stop();
 
 assertThat(rabbitManagementAPI.listExchanges())
-.anySatisfy(exchange -> 
exchange.getName().equals(MAILBOX_EVENT_EXCHANGE_NAME));
+.anySatisfy(exchange -> 
assertThat(exchange.getName()).isEqualTo(MAILBOX_EVENT_EXCHANGE_NAME));
 }
 
 @Test
@@ -602,7 +602,7 @@ class RabbitMQEventBusTest implements 
GroupContract.SingleEventBusGroupContract,
 eventBus3.stop();
 
 assertThat(rabbitManagementAPI.listQueues())
-.anySatisfy(queue -> 
queue.getName().contains(GroupA.class.getName()));
+.anySatisfy(queue -> 
assertThat(queue.getName()).contains(GroupA.class.getName()));
 }
 
 @Test


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



[james-project] 06/07: JAMES-2526 UnauthorizedEndpoint can be performed on a single James server

2019-06-07 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 1038a909adb3129c9059100d4f54e8d91d8a29e6
Author: Benoit Tellier 
AuthorDate: Thu Jun 6 15:25:04 2019 +0700

JAMES-2526 UnauthorizedEndpoint can be performed on a single James server

As all the endpoints are rejected with a 401 unauthorized we can clearly
play all 89 the tests on the same James instance, saving 88 restarts
---
 .../integration/CassandraJmapExtension.java| 103 -
 .../integration/UnauthorizedEndpointsTest.java |  10 +-
 2 files changed, 103 insertions(+), 10 deletions(-)

diff --git 
a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/CassandraJmapExtension.java
 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/CassandraJmapExtension.java
index 5d7c8b2..90a8dec 100644
--- 
a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/CassandraJmapExtension.java
+++ 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/CassandraJmapExtension.java
@@ -21,6 +21,9 @@ package org.apache.james.webadmin.integration;
 import static 
org.apache.james.CassandraJamesServerMain.ALL_BUT_JMX_CASSANDRA_MODULE;
 
 import java.io.IOException;
+import java.util.Optional;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
 
 import org.apache.james.CleanupTasksPerformer;
 import org.apache.james.DockerCassandraRule;
@@ -31,6 +34,7 @@ import org.apache.james.mailbox.store.search.PDFTextExtractor;
 import org.apache.james.modules.TestDockerESMetricReporterModule;
 import org.apache.james.modules.TestJMAPServerModule;
 import org.apache.james.server.core.configuration.Configuration;
+import org.apache.james.util.FunctionalUtils;
 import org.apache.james.util.Runnables;
 import org.apache.james.webadmin.WebAdminConfiguration;
 import org.junit.jupiter.api.extension.AfterAllCallback;
@@ -43,19 +47,100 @@ import 
org.junit.jupiter.api.extension.ParameterResolutionException;
 import org.junit.jupiter.api.extension.ParameterResolver;
 import org.junit.rules.TemporaryFolder;
 
+import com.github.fge.lambdas.Throwing;
+
 public class CassandraJmapExtension implements BeforeAllCallback, 
AfterAllCallback, BeforeEachCallback, AfterEachCallback, ParameterResolver {
+public interface JamesLifeCyclePolicy {
+JamesLifeCyclePolicy FOR_EACH_TEST = serverSupplier -> 
JamesLifecycleHandler.builder()
+.beforeAll(Optional::empty)
+.beforeEach(() -> Optional.of(serverSupplier.get()))
+.afterEach(GuiceJamesServer::stop)
+.afterAll(guiceJamesServer -> { });
+JamesLifeCyclePolicy COMMON_TO_ALL_TESTS = serverSupplier -> 
JamesLifecycleHandler.builder()
+.beforeAll(() -> Optional.of(serverSupplier.get()))
+.beforeEach(Optional::empty)
+.afterEach(guiceJamesServer -> { })
+.afterAll(GuiceJamesServer::stop);
+
+JamesLifecycleHandler createHandler(Supplier 
serverSupplier);
+}
+
+public static class JamesLifecycleHandler {
+public interface Builder {
+@FunctionalInterface
+interface RequiresBeforeAll {
+RequiresBeforeEach 
beforeAll(Supplier> beforeAll);
+
+}
+
+@FunctionalInterface
+interface RequiresBeforeEach {
+RequiresAfterEach 
beforeEach(Supplier> beforeEach);
+}
+
+@FunctionalInterface
+interface RequiresAfterEach {
+RequiresAfterAll afterEach(Consumer 
afterAll);
+}
+
+@FunctionalInterface
+interface RequiresAfterAll {
+JamesLifecycleHandler afterAll(Consumer 
afterAll);
+}
+}
+
+public static Builder.RequiresBeforeAll builder() {
+return beforeAll -> beforeEach -> afterEach -> afterAll -> new 
JamesLifecycleHandler(beforeAll, beforeEach, afterEach, afterAll);
+}
+
+private final Supplier> beforeAll;
+private final Supplier> beforeEach;
+private final Consumer afterEach;
+private final Consumer  afterAll;
+
+JamesLifecycleHandler(Supplier> beforeAll, 
Supplier> beforeEach, Consumer 
afterEach, Consumer afterAll) {
+this.beforeAll = beforeAll;
+this.beforeEach = beforeEach;
+this.afterEach = afterEach;
+this.afterAll = afterAll;
+}
+
+Optional beforeAll() {
+return beforeAll.get()
+
.map(FunctionalUtils.toFunction(Throwing.consumer(GuiceJamesServer::start)));
+}
+
+Optional beforeEach() {
+return beforeEach.get()
+

[james-project] 01/07: JAMES-2726 Fake (Listening) MessageSearchIndex should not be processing events

2019-06-07 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 201dd2da88080be8bdc24cc5e67ffddb576a4707
Author: Benoit Tellier 
AuthorDate: Thu Jun 6 17:47:14 2019 +0700

JAMES-2726 Fake (Listening) MessageSearchIndex should not be processing 
events

Obviously, this will fail, generating uselessLogs output, and filling 
EventDeadLetters.
---
 .../src/main/java/org/apache/james/FakeSearchMailboxModule.java | 6 --
 1 file changed, 6 deletions(-)

diff --git 
a/server/container/guice/memory-guice/src/main/java/org/apache/james/FakeSearchMailboxModule.java
 
b/server/container/guice/memory-guice/src/main/java/org/apache/james/FakeSearchMailboxModule.java
index ec25c30..4862c6c 100644
--- 
a/server/container/guice/memory-guice/src/main/java/org/apache/james/FakeSearchMailboxModule.java
+++ 
b/server/container/guice/memory-guice/src/main/java/org/apache/james/FakeSearchMailboxModule.java
@@ -19,12 +19,10 @@
 
 package org.apache.james;
 
-import org.apache.james.mailbox.events.MailboxListener;
 import org.apache.james.mailbox.store.search.ListeningMessageSearchIndex;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Scopes;
-import com.google.inject.multibindings.Multibinder;
 
 public class FakeSearchMailboxModule extends AbstractModule {
 
@@ -32,9 +30,5 @@ public class FakeSearchMailboxModule extends AbstractModule {
 protected void configure() {
 bind(FakeMessageSearchIndex.class).in(Scopes.SINGLETON);
 
bind(ListeningMessageSearchIndex.class).to(FakeMessageSearchIndex.class);
-
-Multibinder.newSetBinder(binder(), 
MailboxListener.GroupMailboxListener.class)
-.addBinding()
-.to(FakeMessageSearchIndex.class);
 }
 }


-
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-2279 Write a WithPriority mailet and HasPriority matchers

2019-06-07 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 f9fe42c18456c31810d2827b7a3270762af40135
Author: ilker yıldırım 
AuthorDate: Sun Feb 3 03:22:45 2019 +0300

JAMES-2279 Write a WithPriority mailet and HasPriority matchers

Many thanks to ilker yıldırım for this nice contribution!
---
 server/app/src/main/resources/mailetcontainer.xml  | 11 ++-
 .../james/transport/mailets/WithPriority.java  | 16 ++--
 .../AbstractPriorityMatcher.java}  | 65 
 .../james/transport/matchers/AtLeastPriority.java  | 31 
 .../james/transport/matchers/AtMostPriority.java   | 31 
 .../james/transport/matchers/HasPriority.java  | 31 
 .../transport/matchers/AtLeastPriorityTest.java| 86 ++
 .../transport/matchers/AtMostPriorityTest.java | 85 +
 .../james/transport/matchers/HasPriorityTest.java  | 77 +++
 9 files changed, 393 insertions(+), 40 deletions(-)

diff --git a/server/app/src/main/resources/mailetcontainer.xml 
b/server/app/src/main/resources/mailetcontainer.xml
index ae84957..b193bfc 100644
--- a/server/app/src/main/resources/mailetcontainer.xml
+++ b/server/app/src/main/resources/mailetcontainer.xml
@@ -56,7 +56,16 @@


 
-   
+
+8
+
+
+
+
+
+
+
+