[ https://issues.apache.org/jira/browse/JAMES-2279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16518868#comment-16518868 ]
ASF GitHub Bot commented on JAMES-2279: --------------------------------------- Github user chibenwa commented on a diff in the pull request: https://github.com/apache/james-project/pull/121#discussion_r197000717 --- Diff: server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithPriorityTest.java --- @@ -0,0 +1,133 @@ +/**************************************************************** + * 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.mailets; + +import org.apache.james.queue.api.MailPrioritySupport; +import org.apache.mailet.Mail; +import org.apache.mailet.MailetConfig; +import org.apache.mailet.base.test.FakeMail; +import org.apache.mailet.base.test.FakeMailContext; +import org.apache.mailet.base.test.FakeMailetConfig; +import org.junit.Before; +import org.junit.Test; + +import static org.assertj.core.api.Assertions.*; --- End diff -- We do not use wildcard import, but do import all statements, one by one. Also there is some import ordering issues in this class too. It should be: ``` import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; import org.apache.james.queue.api.MailPrioritySupport; import org.apache.mailet.Mail; import org.apache.mailet.MailetConfig; import org.apache.mailet.base.test.FakeMail; import org.apache.mailet.base.test.FakeMailContext; import org.apache.mailet.base.test.FakeMailetConfig; import org.junit.Before; import org.junit.Test; ``` > 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} > <mailet matcher="All" class="WithPriority"> > <value>8</value> > </mailet> > {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} > <mailet matcher="HasPriority=8" class="Any"/> > <mailet matcher="AtLeastPriority=8" class="Any"/> > <mailet matcher="AtMostPriority=8" class="Any"/> > {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