[james-project] branch master updated: [JAMES-3301] Removed antlib references, fixed formatting issue in markdown

2020-07-10 Thread ieugen
This is an automated email from the ASF dual-hosted git repository.

ieugen 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 9ecfcaa  [JAMES-3301] Removed antlib references, fixed formatting 
issue in markdown
9ecfcaa is described below

commit 9ecfcaaf3b22da1a8f8da452d42bfed9b66704dc
Author: Eugen Stan 
AuthorDate: Fri Jul 10 00:52:31 2020 +0300

[JAMES-3301] Removed antlib references, fixed formatting issue in markdown
---
 dockerfiles/site/website/compile.sh | 4 ++--
 mpt/all/src/assemble/bin.xml| 7 ---
 src/site/markdown/server/manage-webadmin.md | 2 +-
 src/site/site.xml   | 1 -
 4 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/dockerfiles/site/website/compile.sh 
b/dockerfiles/site/website/compile.sh
index bae1ded..7190c23 100755
--- a/dockerfiles/site/website/compile.sh
+++ b/dockerfiles/site/website/compile.sh
@@ -42,8 +42,8 @@ git checkout $SHA1
 export MAVEN_OPTS="-Xmx7168m -Xms2048m -XX:+UseConcMarkSweepGC 
-XX:-UseGCOverheadLimit"
 
 mvn clean install -DskipTests
-mvn site:site -Dmaven.javadoc.skip=true -DskipTests -pl .,mpt/antlib,mpt/core
+mvn site:site -Dmaven.javadoc.skip=true -DskipTests -pl .,mpt/core
 mkdir /tmp/website-generation
-mvn site:stage -DstagingDirectory=/tmp/website-generation -pl 
.,mpt/antlib,mpt/core
+mvn site:stage -DstagingDirectory=/tmp/website-generation -pl .,mpt/core
 
 cp -r /tmp/website-generation/* $DESTINATION/
diff --git a/mpt/all/src/assemble/bin.xml b/mpt/all/src/assemble/bin.xml
index e22bdcf..46c16d0 100644
--- a/mpt/all/src/assemble/bin.xml
+++ b/mpt/all/src/assemble/bin.xml
@@ -37,13 +37,6 @@
   
 
 
-  ${project.basedir}/../antlib/target
-  /
-  
-apache-james-mpt*.jar
-  
-
-
   ${project.basedir}/../app/target
   /
   
diff --git a/src/site/markdown/server/manage-webadmin.md 
b/src/site/markdown/server/manage-webadmin.md
index 7606c09..707417d 100644
--- a/src/site/markdown/server/manage-webadmin.md
+++ b/src/site/markdown/server/manage-webadmin.md
@@ -603,7 +603,7 @@ stored messages to compare them with the ones in the index, 
a failed `expunged`
 
 Example:
 
-curl -XPOST 
http://ip:port/mailboxes?task=reIndex=200=rebuildAll
+`curl -XPOST 
http://ip:port/mailboxes?task=reIndex=200=rebuildAll`
 
 The scheduled task will have the following type `full-reindexing` and the 
following `additionalInformation`:
 
diff --git a/src/site/site.xml b/src/site/site.xml
index 36ff240..3f85fae 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -228,7 +228,6 @@
 
 https://issues.apache.org/jira/browse/MPT; />
 
-
 
 http://james.apache.org/download.cgi#Apache_MPT; />
 


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



[jira] [Created] (JAMES-3306) Event Bus: about back-pressure

2020-07-10 Thread Benoit Tellier (Jira)
Benoit Tellier created JAMES-3306:
-

 Summary: Event Bus: about back-pressure
 Key: JAMES-3306
 URL: https://issues.apache.org/jira/browse/JAMES-3306
 Project: James Server
  Issue Type: New Feature
  Components: eventbus, mailbox, rabbitmq
Affects Versions: master
Reporter: Benoit Tellier


== Why

On UPN we prove thatwe were processing events too fast compared to the 
downstream ElasticSearch

In a perfect world, we should handle backpressure in order to adapt event 
consumption to the downstream components.

In the short term an admin should be able to define the paralelism expected for 
a given group, in order to reduce overhead.

== How

QOS is currently hard coded via the EventBus::EXECUTION_RATE variable. Allow to 
configure it in listeners.xml on a per listener basis.

== DOD

Enable to configure QOS on a per listener basis.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Commented] (JAMES-3301) Create old site inventory

2020-07-10 Thread Ioan Eugen Stan (Jira)


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

Ioan Eugen Stan commented on JAMES-3301:


I'm focusing on migrating them now and we can decide later how to structure and 
what to keep.

My main concern right now is to make the list and not have documents slip 
through the cracks.

All documentation should be under docs/ and we should reference it in other 
places via link.

Even the README should be slimmed down and each section should be a link to the 
relevant docs section.

> Create old site inventory 
> --
>
> Key: JAMES-3301
> URL: https://issues.apache.org/jira/browse/JAMES-3301
> Project: James Server
>  Issue Type: Sub-task
>Reporter: Ioan Eugen Stan
>Assignee: Ioan Eugen Stan
>Priority: Major
>
> Before we move forward with the site we need to build an inventory of what we 
> have.
>  
> We seem to have, in james-project the following:
>  
> {noformat}
> tree -d src/ 
> src/
> ├── adr
> ├── homepage
> │   ├── assets
> │   │   ├── css
> │   │   │   └── images
> │   │   ├── fonts
> │   │   ├── images
> │   │   └── js
> │   │   └── ie
> │   ├── howTo
> │   ├── images
> │   ├── _includes
> │   ├── _layouts
> │   └── _posts
> ├── reporting-site
> └── site
> ├── apt
> │   ├── mailet
> │   │   └── examples
> │   └── mpt
> ├── custom
> ├── markdown
> │   ├── mailet
> │   └── server
> │   └── install
> ├── resources
> │   ├── css
> │   ├── downloads
> │   ├── images
> │   ├── js
> │   │   └── james
> │   ├── mailbox
> │   │   └── images
> │   │   └── uml
> │   ├── mailet
> │   │   └── css
> │   ├── model-eclipse-modeler
> │   ├── protocols
> │   │   └── images
> │   │   └── uml
> │   └── server
> │   ├── css
> │   ├── images
> │   │   ├── conf
> │   │   ├── database
> │   │   ├── dns-mx
> │   │   ├── eclipse
> │   │   ├── intellij-idea
> │   │   ├── jmx-management
> │   │   ├── jmx-monitoring
> │   │   ├── netbeans
> │   │   ├── performances
> │   │   └── uml
> │   ├── js
> │   └── rfclist
> │   ├── basic
> │   ├── imap4
> │   ├── ldap
> │   ├── lmtp
> │   ├── pop3
> │   └── smtp
> └── xdoc
> ├── mailbox
> ├── mailet
> │   ├── ai
> │   ├── api
> │   ├── base
> │   ├── crypto
> │   ├── mailetdocs-maven-plugin
> │   ├── standard
> │   └── stylesheets
> ├── mpt
> ├── protocols
> └── server
> └── archive75 directories
> {noformat}
>  
>  
> The content is in the following formats:
>  * markdown
>  * xdoc
>  * apt ?!
> *We also have javadocs*
> Gradle has out of the box support for Javadoc.
> It's a matter of configuration and also aggregating them for publication.
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Commented] (JAMES-3295) Integration tests : SMTP out - retry back off leveraging MailRepositrories and reprocessing

2020-07-10 Thread Jira


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

René Cordier commented on JAMES-3295:
-

[https://github.com/linagora/james-project/pull/3564] added the above mentioned 
matcher for matching RemoteDelivery temporary failure

[https://github.com/linagora/james-project/pull/3558] added some enhancements 
for the generic AtMost matcher

> Integration tests : SMTP out - retry back off leveraging MailRepositrories 
> and reprocessing
> ---
>
> Key: JAMES-3295
> URL: https://issues.apache.org/jira/browse/JAMES-3295
> Project: James Server
>  Issue Type: New Feature
>  Components: Queue, rabbitmq, Remote Delivery, tests
>Reporter: Benoit Tellier
>Priority: Major
> Attachments: aca6e77b-c720-42a2-b78e-0e74d77aa424.png
>
>
> *Context*
> Distributed James do not support MailQueue delays making it unusable as a MX 
> server.
> However given a fixed network of suppliers to work with, delays are not an 
> issues, SMTP error just need to be correctly handled.
> retrying without delay could enhance the situation by working around some 
> transient remote server errors. It’s better than not retrying at all (or 
> doing all the retries without delays).
> Given manual intervention, it is possible to correctly 
> *Requirements*
> Such a solution should:
>  - Attempt delivery a single time
>  - Store transient and permanent failure in different mail repository
>  - After a given number of tries, transient failures should be considered 
> permanent
> *Definition of done*
> Write potentially failing mailet integration tests demonstrating the above 
> proposed RemoteDelivery error handling.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Closed] (JAMES-3295) Integration tests : SMTP out - retry back off leveraging MailRepositrories and reprocessing

2020-07-10 Thread Jira


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

René Cordier closed JAMES-3295.
---
Fix Version/s: 3.6.0
   Resolution: Fixed

> Integration tests : SMTP out - retry back off leveraging MailRepositrories 
> and reprocessing
> ---
>
> Key: JAMES-3295
> URL: https://issues.apache.org/jira/browse/JAMES-3295
> Project: James Server
>  Issue Type: New Feature
>  Components: Queue, rabbitmq, Remote Delivery, tests
>Reporter: Benoit Tellier
>Priority: Major
> Fix For: 3.6.0
>
> Attachments: aca6e77b-c720-42a2-b78e-0e74d77aa424.png
>
>
> *Context*
> Distributed James do not support MailQueue delays making it unusable as a MX 
> server.
> However given a fixed network of suppliers to work with, delays are not an 
> issues, SMTP error just need to be correctly handled.
> retrying without delay could enhance the situation by working around some 
> transient remote server errors. It’s better than not retrying at all (or 
> doing all the retries without delays).
> Given manual intervention, it is possible to correctly 
> *Requirements*
> Such a solution should:
>  - Attempt delivery a single time
>  - Store transient and permanent failure in different mail repository
>  - After a given number of tries, transient failures should be considered 
> permanent
> *Definition of done*
> Write potentially failing mailet integration tests demonstrating the above 
> proposed RemoteDelivery error handling.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[james-project] 03/05: JAMES-3295 Temporary delivery error matcher implementation/test

2020-07-10 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

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

commit 9711f9046cce9c4e2486d35e64109d5961ecc962
Author: Rene Cordier 
AuthorDate: Thu Jul 9 10:49:25 2020 +0700

JAMES-3295 Temporary delivery error matcher implementation/test
---
 .../james/transport/mailets/RemoteDeliveryErrorHandlingTest.java   | 3 ++-
 .../james/transport/mailets/remote/delivery/DeliveryRunnable.java  | 1 +
 .../transport/mailets/remote/delivery/DeliveryRunnableTest.java| 7 +++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git 
a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
 
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
index 991d0f7..d7519e7 100644
--- 
a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
+++ 
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
@@ -48,6 +48,7 @@ import org.apache.james.queue.api.MailQueueFactory;
 import org.apache.james.transport.matchers.All;
 import org.apache.james.transport.matchers.AtMost;
 import org.apache.james.transport.matchers.IsRemoteDeliveryPermanentError;
+import org.apache.james.transport.matchers.IsRemoteDeliveryTemporaryError;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.MailRepositoryProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
@@ -114,7 +115,7 @@ public class RemoteDeliveryErrorHandlingTest {
 .matcher(IsRemoteDeliveryPermanentError.class)
 .addProperty("repositoryPath", 
REMOTE_DELIVERY_PERMANENT_ERROR_REPOSITORY.asString()))
 .addMailet(MailetConfiguration.builder()
-.matcher(All.class)
+.matcher(IsRemoteDeliveryTemporaryError.class)
 .mailet(ToRepository.class)
 .addProperty("repositoryPath", 
REMOTE_DELIVERY_TEMPORARY_ERROR_REPOSITORY.asString()
 .build(tempDir);
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnable.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnable.java
index 36e65e2..d16d502 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnable.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnable.java
@@ -150,6 +150,7 @@ public class DeliveryRunnable implements Disposable {
 DeliveryRetriesHelper.initRetries(mail);
 mail.setLastUpdated(dateSupplier.get());
 }
+mail.setAttribute(new Attribute(IS_DELIVERY_PERMANENT_ERROR, 
AttributeValue.of(false)));
 int retries = DeliveryRetriesHelper.retrieveRetries(mail);
 
 if (retries < configuration.getMaxRetries()) {
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnableTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnableTest.java
index ece78d0..671ce3a 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnableTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnableTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.james.transport.mailets.remote.delivery;
 
+import static 
org.apache.james.transport.mailets.remote.delivery.Bouncer.IS_DELIVERY_PERMANENT_ERROR;
 import static 
org.apache.james.transport.mailets.remote.delivery.DeliveryRunnable.OUTGOING_MAILS;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.ArgumentMatchers.any;
@@ -35,6 +36,8 @@ import java.util.function.Supplier;
 import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.metrics.tests.RecordingMetricFactory;
 import org.apache.james.queue.api.MailQueue;
+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;
@@ -141,6 +144,7 @@ public class DeliveryRunnableTest {
 verify(mailQueue).enQueue(FakeMail.builder()
 .name("name")
 .attribute(DeliveryRetriesHelper.makeAttribute(1))
+.attribute(new Attribute(IS_DELIVERY_PERMANENT_ERROR, 
AttributeValue.of(false)))
 .state(Mail.ERROR)
 .lastUpdated(FIXED_DATE)
 .build(),
@@ -163,6 +167,7 @@ public class 

[james-project] 04/05: JAMES-3295 add a test remoteDeliveryErrorHandlingShouldIgnoreMailsNotTransitingByRemoteDelivery in RemoteDeliveryErrorHandlingTest

2020-07-10 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

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

commit 5ef6acc9764d40b009796a48a829a687931ec8cf
Author: Rene Cordier 
AuthorDate: Thu Jul 9 11:53:32 2020 +0700

JAMES-3295 add a test 
remoteDeliveryErrorHandlingShouldIgnoreMailsNotTransitingByRemoteDelivery in 
RemoteDeliveryErrorHandlingTest
---
 .../mailets/RemoteDeliveryErrorHandlingTest.java  | 19 +++
 1 file changed, 19 insertions(+)

diff --git 
a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
 
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
index d7519e7..690e359 100644
--- 
a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
+++ 
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
@@ -57,6 +57,7 @@ import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.io.TempDir;
@@ -69,9 +70,11 @@ public class RemoteDeliveryErrorHandlingTest {
 private static final String FROM = "from@" + DEFAULT_DOMAIN;
 private static final String RECIPIENT_DOMAIN = "test.com";
 private static final String RECIPIENT = "touser@" + RECIPIENT_DOMAIN;
+private static final String RECIPIENT2 = "accident@" + RECIPIENT_DOMAIN;
 private static final String LOCALHOST = "localhost";
 private static final MailRepositoryUrl 
REMOTE_DELIVERY_TEMPORARY_ERROR_REPOSITORY = 
MailRepositoryUrl.from("memory://var/mail/error/remote-delivery/temporary");
 private static final MailRepositoryUrl 
REMOTE_DELIVERY_PERMANENT_ERROR_REPOSITORY = 
MailRepositoryUrl.from("memory://var/mail/error/remote-delivery/permanent");
+private static final MailRepositoryUrl ERROR_REPOSITORY = 
MailRepositoryUrl.from("memory://var/mail/error/");
 private static final Integer MAX_EXECUTIONS = 2;
 
 @RegisterExtension
@@ -257,4 +260,20 @@ public class RemoteDeliveryErrorHandlingTest {
 
.getRepositoryMailCount(REMOTE_DELIVERY_PERMANENT_ERROR_REPOSITORY))
 .isEqualTo(1));
 }
+
+@Test
+@Disabled("JAMES-3295 we need to add some more mailets to prove that if a 
mail has no temporary and permanent"
++ "failure, it can be treated differently")
+void 
remoteDeliveryErrorHandlingShouldIgnoreMailsNotTransitingByRemoteDelivery(SMTPMessageSender
 smtpMessageSender) throws Exception {
+// When we relay a mail where some unexpected accident happens
+smtpMessageSender.connect(LOCALHOST, 
jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
+.authenticate(FROM, PASSWORD)
+.sendMessage(FROM, RECIPIENT2);
+
+// Then mail should be stored in error repository
+awaitAtMostOneMinute
+.untilAsserted(() -> 
assertThat(jamesServer.getProbe(MailRepositoryProbeImpl.class)
+.getRepositoryMailCount(ERROR_REPOSITORY))
+.isEqualTo(1));
+}
 }


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



[james-project] 01/05: JAMES-3295 handle configuration AtMostMatcher with differents config

2020-07-10 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

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

commit 3c786721dff6fa9ecc61e2fb141f84369eafda27
Author: duc91 
AuthorDate: Wed Jul 8 15:57:50 2020 +0700

JAMES-3295 handle configuration AtMostMatcher with differents config
---
 .../apache/james/transport/matchers/AtMost.java|  57 +-
 .../james/transport/matchers/AtMostTest.java   | 221 ++---
 2 files changed, 196 insertions(+), 82 deletions(-)

diff --git 
a/mailet/standard/src/main/java/org/apache/james/transport/matchers/AtMost.java 
b/mailet/standard/src/main/java/org/apache/james/transport/matchers/AtMost.java
index f3fee35..6f5b72a 100644
--- 
a/mailet/standard/src/main/java/org/apache/james/transport/matchers/AtMost.java
+++ 
b/mailet/standard/src/main/java/org/apache/james/transport/matchers/AtMost.java
@@ -20,10 +20,12 @@
 package org.apache.james.transport.matchers;
 
 import java.util.Collection;
+import java.util.List;
 import java.util.Optional;
 
 import javax.mail.MessagingException;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.james.core.MailAddress;
 import org.apache.mailet.Attribute;
 import org.apache.mailet.AttributeName;
@@ -33,39 +35,80 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMatcher;
 import org.apache.mailet.base.MailetUtil;
 
+import com.google.common.base.Preconditions;
+import com.google.common.base.Splitter;
 import com.google.common.collect.ImmutableList;
 
 /**
  * Checks that a mail did at most X executions on a specific operation.
  *
- * If no executions have been performed previously, it sets up an attribute 
`AT_MOST_EXECUTIONS`
- * in the mail that will be incremented every time the check succeeds.
+ *  If no executions have been performed previously for Y attribute, it 
will be set up.
+ *  In the mail, every time the check succeeds, its counter will be 
incremented by one.
+ * The check fails when the defined X limit is reached.
  *
- * The check fails when the defined X limit is reached.
+ * 
+ * X - count of how many times a specific operation is performed
+ * Y - name of attribute represented for specific operation executions, 
default value is: AT_MOST_EXECUTIONS
+ * 
  *
  * The example below will match a mail with at most 3 executions on the 
mailet
+ * with attribute name AT_MOST_EXECUTIONS
  *
  * 
- * mailet match=AtMost=3 
class=any-class
+ * mailet match=AtMost=AT_MOST_EXECUTIONS:3 
class=any-class
  * /mailet
  * 
  */
 public class AtMost extends GenericMatcher {
 static final AttributeName AT_MOST_EXECUTIONS = 
AttributeName.of("AT_MOST_EXECUTIONS");
+private static final String CONDITION_SEPARATOR = ":";
+private static final int ONLY_CONDITION_VALUE = 1;
+private static final int CONDITION_NAME_AND_VALUE = 2;
+
+private AttributeName attributeName;
 private Integer atMostExecutions;
 
 @Override
 public void init() throws MessagingException {
-this.atMostExecutions = 
MailetUtil.getInitParameterAsStrictlyPositiveInteger(getCondition());
+String conditionConfig = getMatcherConfig().getCondition();
+Preconditions.checkArgument(StringUtils.isNotBlank(conditionConfig), 
"MatcherConfiguration is mandatory!");
+
Preconditions.checkArgument(!conditionConfig.startsWith(CONDITION_SEPARATOR),
+"MatcherConfiguration can not start with '%s'", 
CONDITION_SEPARATOR);
+
+List conditions = 
Splitter.on(CONDITION_SEPARATOR).splitToList(conditionConfig);
+attributeName = parseAttribute(conditions);
+atMostExecutions = parseAttributeValue(conditions);
+}
+
+private AttributeName parseAttribute(List conditions) {
+switch (conditions.size()) {
+case ONLY_CONDITION_VALUE:
+return AT_MOST_EXECUTIONS;
+case CONDITION_NAME_AND_VALUE:
+return AttributeName.of(conditions.get(0));
+default:
+throw new IllegalArgumentException("MatcherConfiguration 
format should follow: 'name:value' or 'value'");
+}
+}
+
+private Integer parseAttributeValue(List conditions) throws 
MessagingException {
+switch (conditions.size()) {
+case ONLY_CONDITION_VALUE:
+return 
MailetUtil.getInitParameterAsStrictlyPositiveInteger(conditions.get(0));
+case CONDITION_NAME_AND_VALUE:
+return 
MailetUtil.getInitParameterAsStrictlyPositiveInteger(conditions.get(1));
+default:
+throw new IllegalArgumentException("MatcherConfiguration 
format should follow: 'name:value' or 'value'");
+}
 }
 
 @Override
 public Collection match(Mail mail) throws MessagingException {
-return AttributeUtils.getValueAndCastFromMail(mail, 
AT_MOST_EXECUTIONS, Integer.class)
+return AttributeUtils.getValueAndCastFromMail(mail, 

[james-project] 02/05: JAMES-3295 Matcher for temporary delivery failure

2020-07-10 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

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

commit c312298fc9f21fd80cf065f0d07aedbb11fe
Author: Rene Cordier 
AuthorDate: Thu Jul 9 10:31:13 2020 +0700

JAMES-3295 Matcher for temporary delivery failure
---
 .../matchers/IsRemoteDeliveryTemporaryError.java   |  53 +++
 .../IsRemoteDeliveryTemporaryErrorTest.java| 101 +
 2 files changed, 154 insertions(+)

diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/IsRemoteDeliveryTemporaryError.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/IsRemoteDeliveryTemporaryError.java
new file mode 100644
index 000..17ea992
--- /dev/null
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/IsRemoteDeliveryTemporaryError.java
@@ -0,0 +1,53 @@
+/
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information*
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the*
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *  *
+ *   http://www.apache.org/licenses/LICENSE-2.0 *
+ *  *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY   *
+ * KIND, either express or implied.  See the License for the*
+ * specific language governing permissions and limitations  *
+ * under the License.   *
+ /
+
+package org.apache.james.transport.matchers;
+
+import static 
org.apache.james.transport.mailets.remote.delivery.Bouncer.IS_DELIVERY_PERMANENT_ERROR;
+
+import java.util.Collection;
+import java.util.function.Predicate;
+
+import org.apache.james.core.MailAddress;
+import org.apache.mailet.AttributeUtils;
+import org.apache.mailet.Mail;
+import org.apache.mailet.base.GenericMatcher;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * 
+ * Checks if the mail has a temporary remote delivery failure attribute set to 
false (meaning it's a temporary error)
+ * 
+ *
+ * Example:
+ *
+ * 
+ * mailet match=IsRemoteDeliveryTemporaryError 
class=any-class/
+ * 
+ */
+public class IsRemoteDeliveryTemporaryError extends GenericMatcher {
+@Override
+public Collection match(Mail mail) {
+return AttributeUtils.getValueAndCastFromMail(mail, 
IS_DELIVERY_PERMANENT_ERROR, Boolean.class)
+.filter(Predicate.isEqual(false))
+.map(any -> mail.getRecipients())
+.orElse(ImmutableList.of());
+}
+}
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsRemoteDeliveryTemporaryErrorTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsRemoteDeliveryTemporaryErrorTest.java
new file mode 100644
index 000..4a078d9
--- /dev/null
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsRemoteDeliveryTemporaryErrorTest.java
@@ -0,0 +1,101 @@
+/
+ * 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.transport.matchers;
+
+import static 

[james-project] branch master updated (5331338 -> e461a3a)

2020-07-10 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

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


from 5331338  Fix anchor links
 new 3c78672  JAMES-3295 handle configuration AtMostMatcher with differents 
config
 new c312298  JAMES-3295 Matcher for temporary delivery failure
 new 9711f90  JAMES-3295 Temporary delivery error matcher 
implementation/test
 new 5ef6acc  JAMES-3295 add a test 
remoteDeliveryErrorHandlingShouldIgnoreMailsNotTransitingByRemoteDelivery in 
RemoteDeliveryErrorHandlingTest
 new e461a3a  JAMES-3295 proof for the test 
remoteDeliveryErrorHandlingShouldIgnoreMailsNotTransitingByRemoteDelivery

The 5 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/transport/matchers/AtMost.java|  57 +-
 .../james/transport/matchers/AtMostTest.java   | 221 ++---
 .../mailets/RemoteDeliveryErrorHandlingTest.java   |  29 ++-
 .../mailets/remote/delivery/DeliveryRunnable.java  |   1 +
 ...or.java => IsRemoteDeliveryTemporaryError.java} |  10 +-
 .../remote/delivery/DeliveryRunnableTest.java  |   7 +
 ...ava => IsRemoteDeliveryTemporaryErrorTest.java} |  19 +-
 7 files changed, 246 insertions(+), 98 deletions(-)
 copy 
server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/{IsRemoteDeliveryPermanentError.java
 => IsRemoteDeliveryTemporaryError.java} (85%)
 copy 
server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/{IsRemoteDeliveryPermanentErrorTest.java
 => IsRemoteDeliveryTemporaryErrorTest.java} (90%)


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



[james-project] 05/05: JAMES-3295 proof for the test remoteDeliveryErrorHandlingShouldIgnoreMailsNotTransitingByRemoteDelivery

2020-07-10 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

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

commit e461a3acc5cc7822375019b0efd5b2eabaec71ff
Author: Rene Cordier 
AuthorDate: Thu Jul 9 11:54:50 2020 +0700

JAMES-3295 proof for the test 
remoteDeliveryErrorHandlingShouldIgnoreMailsNotTransitingByRemoteDelivery
---
 .../mailets/RemoteDeliveryErrorHandlingTest.java  | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git 
a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
 
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
index 690e359..a818426 100644
--- 
a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
+++ 
b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RemoteDeliveryErrorHandlingTest.java
@@ -49,6 +49,7 @@ import org.apache.james.transport.matchers.All;
 import org.apache.james.transport.matchers.AtMost;
 import org.apache.james.transport.matchers.IsRemoteDeliveryPermanentError;
 import org.apache.james.transport.matchers.IsRemoteDeliveryTemporaryError;
+import org.apache.james.transport.matchers.RecipientIs;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.MailRepositoryProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
@@ -57,7 +58,6 @@ import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.io.TempDir;
@@ -101,6 +101,11 @@ public class RemoteDeliveryErrorHandlingTest {
 .putProcessor(ProcessorConfiguration.transport()
 .addMailet(BCC_STRIPPER)
 .addMailet(MailetConfiguration.builder()
+.mailet(ToProcessor.class)
+.addProperty("processor", "remote-delivery-error")
+.matcher(RecipientIs.class)
+.matcherCondition(RECIPIENT2))
+.addMailet(MailetConfiguration.builder()
 .mailet(RemoteDelivery.class)
 .addProperty("maxRetries", "1")
 .addProperty("delayTime", "0")
@@ -120,7 +125,11 @@ public class RemoteDeliveryErrorHandlingTest {
 .addMailet(MailetConfiguration.builder()
 .matcher(IsRemoteDeliveryTemporaryError.class)
 .mailet(ToRepository.class)
-.addProperty("repositoryPath", 
REMOTE_DELIVERY_TEMPORARY_ERROR_REPOSITORY.asString()
+.addProperty("repositoryPath", 
REMOTE_DELIVERY_TEMPORARY_ERROR_REPOSITORY.asString()))
+.addMailet(MailetConfiguration.builder()
+.matcher(All.class)
+.mailet(ToRepository.class)
+.addProperty("repositoryPath", 
ERROR_REPOSITORY.asString()
 .build(tempDir);
 
 jamesServer.start();
@@ -262,8 +271,6 @@ public class RemoteDeliveryErrorHandlingTest {
 }
 
 @Test
-@Disabled("JAMES-3295 we need to add some more mailets to prove that if a 
mail has no temporary and permanent"
-+ "failure, it can be treated differently")
 void 
remoteDeliveryErrorHandlingShouldIgnoreMailsNotTransitingByRemoteDelivery(SMTPMessageSender
 smtpMessageSender) throws Exception {
 // When we relay a mail where some unexpected accident happens
 smtpMessageSender.connect(LOCALHOST, 
jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())


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



[jira] [Created] (JAMES-3305) RabbitMQ EventBus deserialization error handling

2020-07-10 Thread Jira
René Cordier created JAMES-3305:
---

 Summary: RabbitMQ EventBus deserialization error handling
 Key: JAMES-3305
 URL: https://issues.apache.org/jira/browse/JAMES-3305
 Project: James Server
  Issue Type: Bug
Reporter: René Cordier


h2. Why ?

https://issues.apache.org/jira/browse/JAMES-3290 proved a non deserializable 
message caused the entire MailQueue processing to crash.

[https://github.com/linagora/james-project/pull/3532] solved this by doing an 
explicit nack on such messages, relying on RabbitMQ dead-letter exchanges to 
not loose data. The message is thus effectively ignored.

Following this, we need to further investigate RabbitMQ related code and 
evaluate if there is similar issues.

A quick study proved the EventBus is subject to the same class of bugs.
h2. Acceptance criteria
 * If a message cannot be deserialized, following legitimate events can still 
be processed.
 * Discarded messages are stored in a dead-letter queue and not lost

Note that both group registration and key registration needs to be tested: 
Regarding key registration, dropping events is OK.
h2. Definition of done
 * Write tests to reproduce the issue and the expected behaviour
 * Implement the fix leveraging dead-letter and nack



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Created] (JAMES-3304) No diagnostics for failed authorization

2020-07-10 Thread David Leangen (Jira)
David Leangen created JAMES-3304:


 Summary: No diagnostics for failed authorization
 Key: JAMES-3304
 URL: https://issues.apache.org/jira/browse/JAMES-3304
 Project: James Server
  Issue Type: Bug
Reporter: David Leangen


When attempting to test a running James server, I attempted to manually 
authenticate a user.

I received an error in the SMTP session: 
{code:java}
535 Authentication Failed{code}
This is fine within the session, but there is no diagnostic information 
anywhere in James to help me figure out what is going wrong.

Is there a simple way to log, or something, so I can diagnose what is happening 
during the SMTP session?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Created] (JAMES-3303) Can add domain even when virtualhosting disabled

2020-07-10 Thread David Leangen (Jira)
David Leangen created JAMES-3303:


 Summary: Can add domain even when virtualhosting disabled
 Key: JAMES-3303
 URL: https://issues.apache.org/jira/browse/JAMES-3303
 Project: James Server
  Issue Type: Bug
Reporter: David Leangen


I happened to notice that it is possible to add a domain even if virtual 
hosting is not enabled.

 

Steps:
 # Add a domain
 # Attempt to add a user
 # Receive an error:

 
{code:java}
Error class java.lang.Exception while executing command:Given Username contains 
a @domainpart but virtualhosting support is disabled{code}
 

Is there a purpose for allowing the addition (or even the management) of 
domains if virtual hosting is not enabled?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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