[jira] [Resolved] (JAMES-1980) Improve UseHeaderRecipients
[ https://issues.apache.org/jira/browse/JAMES-1980?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tellier Benoit resolved JAMES-1980. --- Resolution: Fixed https://github.com/linagora/james-project/pull/717 solves the issue > Improve UseHeaderRecipients > --- > > Key: JAMES-1980 > URL: https://issues.apache.org/jira/browse/JAMES-1980 > Project: James Server > Issue Type: Bug >Reporter: Tellier Benoit > > It includes: > - We should unfold and decode headers > - We should parse correctly mail addresses using mime4j > - We should upgrade a bit code quality inside the class > - PNV students will propose a test for this class -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Updated] (JAMES-1608) Spool manager getting deadlocked
[ https://issues.apache.org/jira/browse/JAMES-1608?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tellier Benoit updated JAMES-1608: -- Labels: performance (was: easyfix performance) > Spool manager getting deadlocked > > > Key: JAMES-1608 > URL: https://issues.apache.org/jira/browse/JAMES-1608 > Project: James Server > Issue Type: Bug > Components: James Core, SpoolManager & Processors, UsersStore & > UsersRepository >Affects Versions: 2.3.2 > Environment: Windows 2012 Server R2, SQL Server 2014 and Tomcat 7.0 >Reporter: manasi > Labels: performance > Original Estimate: 120h > Remaining Estimate: 120h > > I am using the Jdbc Repository for the James mail server and it gets > deadlocked. Have noticed that one of the update statement which is executed > on a primary key field of "Varchar" locks the key in SQL 2014. When traced > the SQL statements executed in SQL Server 2014, noticed that the column's > data type is implicitly converted to nvarchar. So the update statement is > trying to update the key in nvarchar format, though the data type is varchar. -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[07/15] james-project git commit: JAMES-1982 Add a quota probe
JAMES-1982 Add a quota probe Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/f41a3cf5 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/f41a3cf5 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/f41a3cf5 Branch: refs/heads/master Commit: f41a3cf550af35f35856dc2641dfb4f818cc75d4 Parents: 336d02e Author: benwaAuthored: Fri Mar 31 19:09:40 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:32 2017 +0700 -- .../org/apache/james/modules/MailboxModule.java | 4 +- .../apache/james/modules/QuotaProbesImpl.java | 102 +++ 2 files changed, 105 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/f41a3cf5/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxModule.java -- diff --git a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxModule.java b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxModule.java index b342aac..48a9077 100644 --- a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxModule.java +++ b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxModule.java @@ -27,7 +27,9 @@ public class MailboxModule extends AbstractModule { @Override protected void configure() { -Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(MailboxProbeImpl.class); +Multibinder probeMultiBinder = Multibinder.newSetBinder(binder(), GuiceProbe.class); +probeMultiBinder.addBinding().to(MailboxProbeImpl.class); +probeMultiBinder.addBinding().to(QuotaProbesImpl.class); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/f41a3cf5/server/container/guice/mailbox/src/main/java/org/apache/james/modules/QuotaProbesImpl.java -- diff --git a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/QuotaProbesImpl.java b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/QuotaProbesImpl.java new file mode 100644 index 000..2277f1a --- /dev/null +++ b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/QuotaProbesImpl.java @@ -0,0 +1,102 @@ +/ + * 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.modules; + +import javax.inject.Inject; + +import org.apache.james.mailbox.exception.MailboxException; +import org.apache.james.mailbox.model.MailboxPath; +import org.apache.james.mailbox.quota.MaxQuotaManager; +import org.apache.james.mailbox.quota.QuotaManager; +import org.apache.james.mailbox.quota.QuotaRootResolver; +import org.apache.james.mailbox.store.mail.model.SerializableQuota; +import org.apache.james.mailbox.store.probe.QuotaProbe; +import org.apache.james.utils.GuiceProbe; + +public class QuotaProbesImpl implements QuotaProbe, GuiceProbe { + +private final MaxQuotaManager maxQuotaManager; +private final QuotaRootResolver quotaRootResolver; +private final QuotaManager quotaManager; + +@Inject +public QuotaProbesImpl(MaxQuotaManager maxQuotaManager, QuotaRootResolver quotaRootResolver, QuotaManager quotaManager) { +this.maxQuotaManager = maxQuotaManager; +this.quotaRootResolver = quotaRootResolver; +this.quotaManager = quotaManager; +} + +@Override +public String getQuotaRoot(String namespace, String user, String name) throws MailboxException { +return
[14/15] james-project git commit: JAMES-1983 CLI test for re-indexing
JAMES-1983 CLI test for re-indexing Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/f1e4b343 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/f1e4b343 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/f1e4b343 Branch: refs/heads/master Commit: f1e4b343d1ba334cbe7e9c93e78650ab7f4d8ed8 Parents: b052f86 Author: benwaAuthored: Sat Apr 1 18:02:48 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:33 2017 +0700 -- .../james/cli/DataCommandsIntegrationTest.java | 13 +--- .../cli/MailboxCommandsIntegrationTest.java | 13 +--- .../james/cli/QuotaCommandsIntegrationTest.java | 5 +- .../cli/ReindexCommandIntegrationTest.java | 77 .../cli/SieveQuotaCommandsIntegrationTest.java | 13 +--- .../modules/mailbox/MemoryMailboxModule.java| 15 6 files changed, 96 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/f1e4b343/server/container/cli-integration/src/test/java/org/apache/james/cli/DataCommandsIntegrationTest.java -- diff --git a/server/container/cli-integration/src/test/java/org/apache/james/cli/DataCommandsIntegrationTest.java b/server/container/cli-integration/src/test/java/org/apache/james/cli/DataCommandsIntegrationTest.java index d1e4ee9..1e3a6d3 100644 --- a/server/container/cli-integration/src/test/java/org/apache/james/cli/DataCommandsIntegrationTest.java +++ b/server/container/cli-integration/src/test/java/org/apache/james/cli/DataCommandsIntegrationTest.java @@ -51,14 +51,6 @@ public class DataCommandsIntegrationTest { public static final String MAIL_ADDRESS = USER + "@" + DOMAIN_COM; public static final String PASSWORD = "12345"; -@Singleton -private static class MemoryMailboxManagerDefinition extends MailboxManagerDefinition { -@Inject -private MemoryMailboxManagerDefinition(InMemoryMailboxManager manager) { -super("memory-mailboxmanager", manager); -} -} - @Rule public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule(); private GuiceJamesServer guiceJamesServer; @@ -67,10 +59,7 @@ public class DataCommandsIntegrationTest { @Before public void setUp() throws Exception { guiceJamesServer = memoryJmap.jmapServer(new JMXServerModule(), -binder -> binder.bind(ListeningMessageSearchIndex.class).toInstance(mock(ListeningMessageSearchIndex.class)), -binder -> Multibinder.newSetBinder(binder, MailboxManagerDefinition.class) -.addBinding() -.to(MemoryMailboxManagerDefinition.class)); +binder -> binder.bind(ListeningMessageSearchIndex.class).toInstance(mock(ListeningMessageSearchIndex.class))); guiceJamesServer.start(); dataProbe = guiceJamesServer.getProbe(DataProbeImpl.class); } http://git-wip-us.apache.org/repos/asf/james-project/blob/f1e4b343/server/container/cli-integration/src/test/java/org/apache/james/cli/MailboxCommandsIntegrationTest.java -- diff --git a/server/container/cli-integration/src/test/java/org/apache/james/cli/MailboxCommandsIntegrationTest.java b/server/container/cli-integration/src/test/java/org/apache/james/cli/MailboxCommandsIntegrationTest.java index 4aabb44..074a22a 100644 --- a/server/container/cli-integration/src/test/java/org/apache/james/cli/MailboxCommandsIntegrationTest.java +++ b/server/container/cli-integration/src/test/java/org/apache/james/cli/MailboxCommandsIntegrationTest.java @@ -46,14 +46,6 @@ public class MailboxCommandsIntegrationTest { public static final String USER = "user"; public static final String MAILBOX = "mailbox"; -@Singleton -private static class MemoryMailboxManagerDefinition extends MailboxManagerDefinition { -@Inject -private MemoryMailboxManagerDefinition(InMemoryMailboxManager manager) { -super("memory-mailboxmanager", manager); -} -} - @Rule public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule(); private GuiceJamesServer guiceJamesServer; @@ -62,10 +54,7 @@ public class MailboxCommandsIntegrationTest { @Before public void setUp() throws Exception { guiceJamesServer = memoryJmap.jmapServer(new JMXServerModule(), -binder -> binder.bind(ListeningMessageSearchIndex.class).toInstance(mock(ListeningMessageSearchIndex.class)), -binder -> Multibinder.newSetBinder(binder, MailboxManagerDefinition.class) -.addBinding() -.to(MemoryMailboxManagerDefinition.class)); +
[06/15] james-project git commit: JAMES-1982 Allow Quota and Sieve administration threw JMX
JAMES-1982 Allow Quota and Sieve administration threw JMX Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/336d02e7 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/336d02e7 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/336d02e7 Branch: refs/heads/master Commit: 336d02e7a70b5947b4c236ef74b9e85906c7f013 Parents: 604a9da Author: benwaAuthored: Fri Mar 31 19:03:37 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:32 2017 +0700 -- .../james/modules/server/JMXServerModule.java | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/336d02e7/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java -- diff --git a/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java b/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java index 9d66b8a..fc97468 100644 --- a/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java +++ b/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java @@ -26,6 +26,8 @@ import org.apache.james.adapter.mailbox.MailboxCopierManagementMBean; import org.apache.james.adapter.mailbox.MailboxManagerManagement; import org.apache.james.adapter.mailbox.MailboxManagerManagementMBean; import org.apache.james.adapter.mailbox.MailboxManagerResolver; +import org.apache.james.adapter.mailbox.QuotaManagement; +import org.apache.james.adapter.mailbox.QuotaManagementMBean; import org.apache.james.adapter.mailbox.ReIndexerManagement; import org.apache.james.adapter.mailbox.ReIndexerManagementMBean; import org.apache.james.domainlist.api.DomainListManagementMBean; @@ -39,6 +41,8 @@ import org.apache.james.mailetcontainer.api.jmx.MailSpoolerMBean; import org.apache.james.mailetcontainer.impl.JamesMailSpooler; import org.apache.james.rrt.api.RecipientRewriteTableManagementMBean; import org.apache.james.rrt.lib.RecipientRewriteTableManagement; +import org.apache.james.sieverepository.api.SieveRepositoryManagementMBean; +import org.apache.james.sieverepository.lib.SieveRepositoryManagement; import org.apache.james.user.api.UsersRepositoryManagementMBean; import org.apache.james.user.lib.UsersRepositoryManagement; import org.apache.james.utils.ConfigurationPerformer; @@ -60,6 +64,8 @@ public class JMXServerModule extends AbstractModule { private static final String JMX_COMPONENT_NAME_MAILBOXMANAGERBEAN = "org.apache.james:type=component,name=mailboxmanagerbean"; private static final String JMX_COMPONENT_MAILBOXCOPIER = "org.apache.james:type=component,name=mailboxcopier"; private static final String JMX_COMPONENT_REINDEXER = "org.apache.james:type=component,name=reindexerbean"; +private final static String JMX_COMPONENT_QUOTA = "org.apache.james:type=component,name=quotamanagerbean"; +private final static String JMX_COMPONENT_SIEVE = "org.apache.james:type=component,name=sievemanagerbean"; @Override protected void configure() { @@ -73,6 +79,8 @@ public class JMXServerModule extends AbstractModule { bind(MailSpoolerMBean.class).to(JamesMailSpooler.class); bind(ReIndexer.class).annotatedWith(Names.named("reindexer")).to(ReIndexerImpl.class); bind(ReIndexerManagementMBean.class).to(ReIndexerManagement.class); +bind(QuotaManagementMBean.class).to(QuotaManagement.class); + bind(SieveRepositoryManagementMBean.class).to(SieveRepositoryManagement.class); Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JMXModuleConfigurationPerformer.class); } @@ -86,6 +94,8 @@ public class JMXServerModule extends AbstractModule { private final MailboxManagerManagementMBean mailboxManagerManagementMBean; private final MailboxCopierManagementMBean mailboxCopierManagementMBean; private final ReIndexerManagementMBean reIndexerManagementMBean; +private final QuotaManagementMBean quotaManagementMBean; +private final SieveRepositoryManagementMBean sieveRepositoryManagementMBean; @Inject public JMXModuleConfigurationPerformer(JMXServer jmxServer, @@ -94,7 +104,9 @@ public class JMXServerModule extends AbstractModule { RecipientRewriteTableManagementMBean recipientRewriteTableManagementMBean, MailboxManagerManagementMBean mailboxManagerManagementMBean,
[02/15] james-project git commit: JAMES-1980 Improves for UseHeaderRecipients
JAMES-1980 Improves for UseHeaderRecipients Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/604a9dae Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/604a9dae Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/604a9dae Branch: refs/heads/master Commit: 604a9dae7c12bb9eb55ea7b7093deaa55b95558e Parents: 398663e Author: Benoit TellierAuthored: Wed Dec 28 09:31:54 2016 +0700 Committer: benwa Committed: Mon Apr 3 18:09:28 2017 +0700 -- .../mailet/base/test/FakeMailContext.java | 5 + mailet/standard/pom.xml | 5 + .../transport/mailets/UseHeaderRecipients.java | 131 + .../mailets/UseHeaderRecipientsTest.java| 184 +++ 4 files changed, 292 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/604a9dae/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailContext.java -- diff --git a/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailContext.java b/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailContext.java index 4617a94..1b22e44 100644 --- a/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailContext.java +++ b/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailContext.java @@ -122,6 +122,11 @@ public class FakeMailContext implements MailetContext { return this; } +public Builder recipients(MailAddress... recipients) { +this.recipients = Optional. of(ImmutableList.copyOf(recipients)); +return this; +} + public Builder recipient(MailAddress recipient) { Preconditions.checkNotNull(recipient); return recipients(ImmutableList.of(recipient)); http://git-wip-us.apache.org/repos/asf/james-project/blob/604a9dae/mailet/standard/pom.xml -- diff --git a/mailet/standard/pom.xml b/mailet/standard/pom.xml index 04ba9e5..45048ac 100644 --- a/mailet/standard/pom.xml +++ b/mailet/standard/pom.xml @@ -50,6 +50,11 @@ test +org.apache.james +apache-mime4j-dom +${mime4j.version} + + com.google.guava guava http://git-wip-us.apache.org/repos/asf/james-project/blob/604a9dae/mailet/standard/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java -- diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java index 603a617..b802d5d 100644 --- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java +++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java @@ -20,16 +20,29 @@ package org.apache.james.transport.mailets; +import java.io.UnsupportedEncodingException; +import java.util.Collection; + +import javax.mail.MessagingException; +import javax.mail.internet.AddressException; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeUtility; + +import org.apache.james.mime4j.dom.address.Address; +import org.apache.james.mime4j.dom.address.AddressList; +import org.apache.james.mime4j.dom.address.Group; +import org.apache.james.mime4j.dom.address.Mailbox; +import org.apache.james.mime4j.field.address.LenientAddressParser; +import org.apache.james.mime4j.util.MimeUtil; import org.apache.mailet.Mail; import org.apache.mailet.MailAddress; import org.apache.mailet.base.GenericMailet; -import javax.mail.MessagingException; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; -import java.util.Collection; -import java.util.StringTokenizer; -import java.util.Vector; +import com.google.common.base.Function; +import com.google.common.base.Splitter; +import com.google.common.base.Throwables; +import com.google.common.collect.FluentIterable; +import com.google.common.collect.ImmutableList; /** * Mailet designed to process the recipients from the mail headers rather @@ -55,6 +68,17 @@ import java.util.Vector; */ public class UseHeaderRecipients extends GenericMailet { +public static final Function TO_MAIL_ADDRESS = new Function () { +@Override +public MailAddress apply(Mailbox input) { +try { +return new MailAddress(input.getAddress());
[12/15] james-project git commit: JAMES-1982 getAllMapping result was not serializable
JAMES-1982 getAllMapping result was not serializable Guava ImmutableList copy solves the issue Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/e8542113 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/e8542113 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/e8542113 Branch: refs/heads/master Commit: e854211397d22104c9dfa7c591edae47505be8f4 Parents: f1e4b34 Author: benwaAuthored: Sat Apr 1 18:37:06 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:33 2017 +0700 -- .../apache/james/rrt/lib/RecipientRewriteTableManagement.java| 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/e8542113/server/data/data-library/src/main/java/org/apache/james/rrt/lib/RecipientRewriteTableManagement.java -- diff --git a/server/data/data-library/src/main/java/org/apache/james/rrt/lib/RecipientRewriteTableManagement.java b/server/data/data-library/src/main/java/org/apache/james/rrt/lib/RecipientRewriteTableManagement.java index e3d2b6c..879ccfb 100644 --- a/server/data/data-library/src/main/java/org/apache/james/rrt/lib/RecipientRewriteTableManagement.java +++ b/server/data/data-library/src/main/java/org/apache/james/rrt/lib/RecipientRewriteTableManagement.java @@ -28,6 +28,8 @@ import org.apache.james.rrt.api.RecipientRewriteTable; import org.apache.james.rrt.api.RecipientRewriteTableException; import org.apache.james.rrt.api.RecipientRewriteTableManagementMBean; +import com.google.common.collect.ImmutableMap; + /** * Management for RecipientRewriteTables */ @@ -182,7 +184,7 @@ public class RecipientRewriteTableManagement extends StandardMBean implements Re */ public Map getAllMappings() throws Exception { try { -return rrt.getAllMappings(); +return ImmutableMap.copyOf(rrt.getAllMappings()); } catch (RecipientRewriteTableException e) { throw new Exception(e.getMessage()); } - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[13/15] james-project git commit: JAMES-1983 Write CLI integration tests on the printed output
JAMES-1983 Write CLI integration tests on the printed output Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/c994be04 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/c994be04 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/c994be04 Branch: refs/heads/master Commit: c994be049e91bb3e9a6ca0fa31dec94fb2d23860 Parents: e854211 Author: benwaAuthored: Sat Apr 1 18:24:01 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:33 2017 +0700 -- .../james/cli/DataCommandsIntegrationTest.java | 97 +++- .../cli/MailboxCommandsIntegrationTest.java | 25 +++-- .../james/cli/QuotaCommandsIntegrationTest.java | 83 ++--- .../cli/SieveQuotaCommandsIntegrationTest.java | 31 +-- .../apache/james/cli/util/OutputCapture.java| 39 .../james/cli/util/OutputCaptureTest.java | 58 .../java/org/apache/james/cli/ServerCmd.java| 63 +++-- 7 files changed, 315 insertions(+), 81 deletions(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/c994be04/server/container/cli-integration/src/test/java/org/apache/james/cli/DataCommandsIntegrationTest.java -- diff --git a/server/container/cli-integration/src/test/java/org/apache/james/cli/DataCommandsIntegrationTest.java b/server/container/cli-integration/src/test/java/org/apache/james/cli/DataCommandsIntegrationTest.java index 1e3a6d3..9c46c2a 100644 --- a/server/container/cli-integration/src/test/java/org/apache/james/cli/DataCommandsIntegrationTest.java +++ b/server/container/cli-integration/src/test/java/org/apache/james/cli/DataCommandsIntegrationTest.java @@ -24,32 +24,27 @@ import static org.mockito.Mockito.mock; import java.util.AbstractMap; -import javax.inject.Singleton; - import org.apache.james.GuiceJamesServer; import org.apache.james.MemoryJmapTestRule; -import org.apache.james.mailbox.inmemory.InMemoryMailboxManager; +import org.apache.james.cli.util.OutputCapture; import org.apache.james.mailbox.store.search.ListeningMessageSearchIndex; import org.apache.james.modules.server.JMXServerModule; import org.apache.james.rrt.lib.MappingImpl; import org.apache.james.rrt.lib.Mappings; import org.apache.james.rrt.lib.MappingsImpl; import org.apache.james.utils.DataProbeImpl; -import org.apache.james.utils.MailboxManagerDefinition; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import com.google.inject.Inject; -import com.google.inject.multibindings.Multibinder; - public class DataCommandsIntegrationTest { -public static final String DOMAIN_COM = "domain.com"; -public static final String USER = "user"; -public static final String MAIL_ADDRESS = USER + "@" + DOMAIN_COM; +public static final String DOMAIN = "domain.com"; +public static final String USER = "chibenwa"; +public static final String MAIL_ADDRESS = USER + "@" + DOMAIN; public static final String PASSWORD = "12345"; +private OutputCapture outputCapture; @Rule public MemoryJmapTestRule memoryJmap = new MemoryJmapTestRule(); @@ -62,6 +57,7 @@ public class DataCommandsIntegrationTest { binder -> binder.bind(ListeningMessageSearchIndex.class).toInstance(mock(ListeningMessageSearchIndex.class))); guiceJamesServer.start(); dataProbe = guiceJamesServer.getProbe(DataProbeImpl.class); +outputCapture = new OutputCapture(); } @After @@ -71,23 +67,43 @@ public class DataCommandsIntegrationTest { @Test public void addDomainShouldWork() throws Exception { -ServerCmd.doMain(new String[] {"-h", "127.0.0.1", "-p", "", "ADDDOMAIN", DOMAIN_COM}); +ServerCmd.doMain(new String[] {"-h", "127.0.0.1", "-p", "", "ADDDOMAIN", DOMAIN}); -assertThat(dataProbe.containsDomain(DOMAIN_COM)).isTrue(); +assertThat(dataProbe.containsDomain(DOMAIN)).isTrue(); } @Test public void removeDomainShouldWork() throws Exception { -dataProbe.addDomain(DOMAIN_COM); +dataProbe.addDomain(DOMAIN); + +ServerCmd.doMain(new String[] {"-h", "127.0.0.1", "-p", "", "REMOVEDOMAIN", DOMAIN}); + +assertThat(dataProbe.containsDomain(DOMAIN)).isFalse(); +} + +@Test +public void listDomainsShouldWork() throws Exception { +dataProbe.addDomain(DOMAIN); -ServerCmd.doMain(new String[] {"-h", "127.0.0.1", "-p", "", "REMOVEDOMAIN", DOMAIN_COM}); +ServerCmd.executeAndOutputToStream(new String[] {"-h", "127.0.0.1", "-p", "", "listdomains"}, outputCapture.getPrintStream()); -
[08/15] james-project git commit: JAMES-1982 Provides default values for JMX & unbound sockets
JAMES-1982 Provides default values for JMX & unbound sockets Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/4321bcc5 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/4321bcc5 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/4321bcc5 Branch: refs/heads/master Commit: 4321bcc58781d57e065da8ea87617bcf2e123160 Parents: f41a3cf Author: benwaAuthored: Sat Apr 1 10:19:00 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:32 2017 +0700 -- server/container/guice/jmx/pom.xml | 4 .../org/apache/james/modules/server/JMXServer.java | 15 ++- 2 files changed, 14 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/4321bcc5/server/container/guice/jmx/pom.xml -- diff --git a/server/container/guice/jmx/pom.xml b/server/container/guice/jmx/pom.xml index 397d0bb..abf5f41 100644 --- a/server/container/guice/jmx/pom.xml +++ b/server/container/guice/jmx/pom.xml @@ -190,6 +190,10 @@ guice-multibindings +com.github.fge +throwing-lambdas + + org.slf4j slf4j-api http://git-wip-us.apache.org/repos/asf/james-project/blob/4321bcc5/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServer.java -- diff --git a/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServer.java b/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServer.java index 4b4e63d..5078629 100644 --- a/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServer.java +++ b/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServer.java @@ -19,8 +19,8 @@ package org.apache.james.modules.server; -import java.io.IOException; import java.lang.management.ManagementFactory; +import java.net.ServerSocket; import java.rmi.registry.LocateRegistry; import java.util.HashSet; import java.util.Map; @@ -38,6 +38,7 @@ import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.james.filesystem.api.FileSystem; import org.apache.james.util.RestrictingRMISocketFactory; +import com.github.fge.lambdas.Throwing; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableMap; @@ -48,6 +49,7 @@ public class JMXServer { private final Object lock; private JMXConnectorServer jmxConnectorServer; private boolean isStarted; +private RestrictingRMISocketFactory restrictingRMISocketFactory; @Inject public JMXServer(FileSystem fileSystem) { @@ -88,10 +90,10 @@ public class JMXServer { private void doStart() { try { PropertiesConfiguration configuration = new PropertiesConfiguration(fileSystem.getFile(FileSystem.FILE_PROTOCOL_AND_CONF + "jmx.properties")); -String address = configuration.getString("jmx.address"); -int port = configuration.getInt("jmx.port"); +String address = configuration.getString("jmx.address", "localhost"); +int port = configuration.getInt("jmx.port", ); String serviceURL = "service:jmx:rmi://" + address + "/jndi/rmi://" + address+ ":" + port +"/jmxrmi"; -RestrictingRMISocketFactory restrictingRMISocketFactory = new RestrictingRMISocketFactory(address); +restrictingRMISocketFactory = new RestrictingRMISocketFactory(address); LocateRegistry.createRegistry(port, restrictingRMISocketFactory, restrictingRMISocketFactory); Map environment = ImmutableMap.of(); @@ -117,7 +119,10 @@ public class JMXServer { }); registeredKeys.clear(); jmxConnectorServer.stop(); -} catch (IOException e) { +restrictingRMISocketFactory.getSockets() +.forEach(Throwing.consumer(ServerSocket::close) +.sneakyThrow()); +} catch (Exception e) { throw Throwables.propagate(e); } } - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[15/15] james-project git commit: JAMES-1982 Correct punctuation spacing for CLI output
JAMES-1982 Correct punctuation spacing for CLI output Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/a281f59f Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/a281f59f Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/a281f59f Branch: refs/heads/master Commit: a281f59fdc4630b6c67a69fe8b3455d42cce543f Parents: c994be0 Author: benwaAuthored: Sun Apr 2 10:58:37 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:33 2017 +0700 -- .../main/java/org/apache/james/cli/ServerCmd.java | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/a281f59f/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java -- diff --git a/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java b/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java index edf86fa..a9f6e69 100644 --- a/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java +++ b/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java @@ -266,16 +266,16 @@ public class ServerCmd { printMessageQuota(arguments[1], quotaProbe.getMessageCountQuota(arguments[1]), printStream); break; case GETQUOTAROOT: -printStream.println("Quota Root : " + quotaProbe.getQuotaRoot(arguments[1], arguments[2], arguments[3])); +printStream.println("Quota Root: " + quotaProbe.getQuotaRoot(arguments[1], arguments[2], arguments[3])); break; case GETMAXSTORAGEQUOTA: printStream.println("Storage space allowed for Quota Root " + arguments[1] -+ " : " ++ ": " + formatStorageValue(quotaProbe.getMaxStorage(arguments[1]))); break; case GETMAXMESSAGECOUNTQUOTA: -printStream.println("MailboxMessage count allowed for Quota Root " + arguments[1] + " : " + formatMessageValue(quotaProbe.getMaxMessageCount(arguments[1]))); +printStream.println("MailboxMessage count allowed for Quota Root " + arguments[1] + ": " + formatMessageValue(quotaProbe.getMaxMessageCount(arguments[1]))); break; case SETMAXSTORAGEQUOTA: quotaProbe.setMaxStorage(arguments[1], ValueWithUnit.parse(arguments[2]).getConvertedValue()); @@ -290,10 +290,10 @@ public class ServerCmd { quotaProbe.setDefaultMaxMessageCount(Long.parseLong(arguments[1])); break; case GETDEFAULTMAXSTORAGEQUOTA: -printStream.println("Default Maximum Storage Quota : " + formatStorageValue(quotaProbe.getDefaultMaxStorage())); +printStream.println("Default Maximum Storage Quota: " + formatStorageValue(quotaProbe.getDefaultMaxStorage())); break; case GETDEFAULTMAXMESSAGECOUNTQUOTA: -printStream.println("Default Maximum message count Quota : " + formatMessageValue(quotaProbe.getDefaultMaxMessageCount())); +printStream.println("Default Maximum message count Quota: " + formatMessageValue(quotaProbe.getDefaultMaxMessageCount())); break; case REINDEXMAILBOX: mailboxProbe.reIndexMailbox(arguments[1], arguments[2], arguments[3]); @@ -308,13 +308,13 @@ public class ServerCmd { sieveProbe.setSieveQuota(arguments[1], ValueWithUnit.parse(arguments[2]).getConvertedValue()); break; case GETSIEVEQUOTA: -printStream.println("Storage space allowed for Sieve scripts by default : " +printStream.println("Storage space allowed for Sieve scripts by default: " + formatStorageValue(sieveProbe.getSieveQuota())); break; case GETSIEVEUSERQUOTA: printStream.println("Storage space allowed for " + arguments[1] -+ " Sieve scripts : " ++ " Sieve scripts: " + formatStorageValue(sieveProbe.getSieveQuota(arguments[1]))); break; case REMOVESIEVEQUOTA: @@ -339,14 +339,14 @@ public class ServerCmd { } private void printStorageQuota(String quotaRootString, SerializableQuota quota, PrintStream printStream) { -printStream.println(String.format("Storage quota for %s is : %s / %s", +printStream.println(String.format("Storage quota for %s is: %s / %s", quotaRootString, formatStorageValue(quota.getUsed()), formatStorageValue(quota.getMax(; } private void printMessageQuota(String quotaRootString, SerializableQuota quota,
[03/15] james-project git commit: JAMES-1982 Add integration test for some CLI commands
JAMES-1982 Add integration test for some CLI commands Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/b052f86a Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/b052f86a Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/b052f86a Branch: refs/heads/master Commit: b052f86a7a1919f2eabcae7c687e024b431b9522 Parents: 8942eaf Author: benwaAuthored: Sat Apr 1 12:11:14 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:32 2017 +0700 -- server/container/cli-integration/pom.xml| 237 +++ .../james/cli/DataCommandsIntegrationTest.java | 168 + .../cli/MailboxCommandsIntegrationTest.java | 102 .../james/cli/QuotaCommandsIntegrationTest.java | 105 .../cli/SieveQuotaCommandsIntegrationTest.java | 118 + .../src/test/resources/conf/jmx.properties | 22 ++ .../src/test/resources/dnsservice.xml | 29 +++ .../src/test/resources/imapserver.xml | 54 + .../src/test/resources/jmap.properties | 11 + .../src/test/resources/jwt_publickey| 9 + .../src/test/resources/lmtpserver.xml | 41 .../src/test/resources/logback-test.xml | 15 ++ .../src/test/resources/mailetcontainer.xml | 105 .../src/test/resources/mailrepositorystore.xml | 31 +++ .../src/test/resources/managesieveserver.xml| 65 + .../src/test/resources/pop3server.xml | 42 .../src/test/resources/smtpserver.xml | 105 .../org/apache/james/MemoryJmapTestRule.java| 13 +- .../james/util/RestrictingRMISocketFactory.java | 8 + server/pom.xml | 1 + 20 files changed, 1276 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/b052f86a/server/container/cli-integration/pom.xml -- diff --git a/server/container/cli-integration/pom.xml b/server/container/cli-integration/pom.xml new file mode 100644 index 000..dbe8f0a --- /dev/null +++ b/server/container/cli-integration/pom.xml @@ -0,0 +1,237 @@ + + +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd;> +4.0.0 + + +james-server +org.apache.james +3.0.0-beta6-SNAPSHOT +../../pom.xml + + +james-server-cli-integration +Apache James :: Server :: Cli :: Integretion + + + +disable-build-for-older-jdk + +(,1.8) + + + + +maven-jar-plugin + + +default-jar +none + + +jar +none + + +test-jar +none + + + + +maven-compiler-plugin + + +default-compile +none + + +default-testCompile +none + + + + +maven-surefire-plugin + + +default-test +none + + + + +maven-source-plugin + + +attach-sources +none + + + + +maven-install-plugin + + +default-install +none + + + + +maven-resources-plugin + + +
[09/15] james-project git commit: JAMES-1982 Create Sieve file folder in constructor
JAMES-1982 Create Sieve file folder in constructor Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/184c2b5c Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/184c2b5c Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/184c2b5c Branch: refs/heads/master Commit: 184c2b5c9015ad977309becf9d4ed42bf72de971 Parents: fe92e8b Author: benwaAuthored: Sat Apr 1 11:35:37 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:32 2017 +0700 -- .../managesieve/file/host/FileHostSystem.java | 2 - .../file/SieveFileRepository.java | 55 .../file/SieveFileRepositoryTest.java | 2 - 3 files changed, 21 insertions(+), 38 deletions(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/184c2b5c/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/host/FileHostSystem.java -- diff --git a/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/host/FileHostSystem.java b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/host/FileHostSystem.java index 389209c..7bd28dc 100644 --- a/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/host/FileHostSystem.java +++ b/mpt/impl/managesieve/file/src/test/java/org/apache/james/mpt/managesieve/file/host/FileHostSystem.java @@ -52,8 +52,6 @@ public class FileHostSystem extends JamesManageSieveHostSystem { } protected static SieveRepository createSieveRepository() throws Exception { -File root = getFileSystem().getFile(SIEVE_ROOT); -FileUtils.forceMkdir(root); return new SieveFileRepository(fileSystem); } http://git-wip-us.apache.org/repos/asf/james-project/blob/184c2b5c/server/data/data-file/src/main/java/org/apache/james/sieverepository/file/SieveFileRepository.java -- diff --git a/server/data/data-file/src/main/java/org/apache/james/sieverepository/file/SieveFileRepository.java b/server/data/data-file/src/main/java/org/apache/james/sieverepository/file/SieveFileRepository.java index af9b2ba..221320e 100644 --- a/server/data/data-file/src/main/java/org/apache/james/sieverepository/file/SieveFileRepository.java +++ b/server/data/data-file/src/main/java/org/apache/james/sieverepository/file/SieveFileRepository.java @@ -20,20 +20,6 @@ package org.apache.james.sieverepository.file; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.james.filesystem.api.FileSystem; -import org.apache.james.sieverepository.api.ScriptSummary; -import org.apache.james.sieverepository.api.SieveRepository; -import org.apache.james.sieverepository.api.exception.DuplicateException; -import org.apache.james.sieverepository.api.exception.IsActiveException; -import org.apache.james.sieverepository.api.exception.QuotaExceededException; -import org.apache.james.sieverepository.api.exception.QuotaNotFoundException; -import org.apache.james.sieverepository.api.exception.ScriptNotFoundException; -import org.apache.james.sieverepository.api.exception.StorageException; -import org.joda.time.DateTime; - -import javax.inject.Inject; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; @@ -49,6 +35,21 @@ import java.util.List; import java.util.NoSuchElementException; import java.util.Scanner; +import javax.inject.Inject; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.apache.james.filesystem.api.FileSystem; +import org.apache.james.sieverepository.api.ScriptSummary; +import org.apache.james.sieverepository.api.SieveRepository; +import org.apache.james.sieverepository.api.exception.DuplicateException; +import org.apache.james.sieverepository.api.exception.IsActiveException; +import org.apache.james.sieverepository.api.exception.QuotaExceededException; +import org.apache.james.sieverepository.api.exception.QuotaNotFoundException; +import org.apache.james.sieverepository.api.exception.ScriptNotFoundException; +import org.apache.james.sieverepository.api.exception.StorageException; +import org.joda.time.DateTime; + /** * SieveFileRepository manages sieve scripts stored on the file system. * The sieve root directory is a sub-directory of the application base directory named "sieve". @@ -65,7 +66,7 @@ public class SieveFileRepository implements SieveRepository { private static final int MAX_BUFF_SIZE = 32768; public static final String SIEVE_EXTENSION = ".sieve"; -private FileSystem _fileSystem = null; +private final
[01/15] james-project git commit: MAILET-152 Add instructions for implementing TooMuchRecipients
Repository: james-project Updated Branches: refs/heads/master 5d3bedee1 -> a281f59fd MAILET-152 Add instructions for implementing TooMuchRecipients Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/398663e7 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/398663e7 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/398663e7 Branch: refs/heads/master Commit: 398663e7bc575c5e95fb6f470a81b49a27394717 Parents: 5d3bede Author: benwaAuthored: Tue Mar 21 09:16:03 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:24 2017 +0700 -- .../transport/matchers/TooManyRecipients.java | 62 +++ .../matchers/TooManyRecipientsTest.java | 172 +++ 2 files changed, 234 insertions(+) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/398663e7/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyRecipients.java -- diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyRecipients.java b/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyRecipients.java new file mode 100644 index 000..51895a3 --- /dev/null +++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyRecipients.java @@ -0,0 +1,62 @@ +/ + * 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 java.util.Collection; + +import javax.mail.MessagingException; + +import org.apache.mailet.Mail; +import org.apache.mailet.MailAddress; +import org.apache.mailet.base.GenericMatcher; + +import com.google.common.collect.ImmutableList; + +public class TooManyRecipients extends GenericMatcher { + +private int maximumRecipientCount; + +@Override +public void init() throws MessagingException { +String condition = getCondition(); + +if (condition == null) { +throw new MessagingException("it should have a condition"); +} + +try { +maximumRecipientCount = Integer.parseInt(condition); +} catch (Exception e) { +throw new MessagingException("Condition should be a number"); +} + +if (maximumRecipientCount < 1) { +throw new MessagingException("it should be positive condition"); +} +} + +@Override +public Collection match(Mail mail) throws MessagingException { +if (mail.getRecipients().size() > maximumRecipientCount) { +return mail.getRecipients(); +} +return ImmutableList.of(); +} +} http://git-wip-us.apache.org/repos/asf/james-project/blob/398663e7/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyRecipientsTest.java -- diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyRecipientsTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyRecipientsTest.java new file mode 100644 index 000..d399d11 --- /dev/null +++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyRecipientsTest.java @@ -0,0 +1,172 @@ +/ + * 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
[04/15] james-project git commit: JAMES-1982 Correct JMX Sieve probe
JAMES-1982 Correct JMX Sieve probe Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/95d241de Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/95d241de Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/95d241de Branch: refs/heads/master Commit: 95d241de993bd78baec2958d65b59ed9f4a5fda9 Parents: 184c2b5 Author: benwaAuthored: Sat Apr 1 11:36:05 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:32 2017 +0700 -- .../main/java/org/apache/james/cli/probe/impl/JmxSieveProbe.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/95d241de/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxSieveProbe.java -- diff --git a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxSieveProbe.java b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxSieveProbe.java index acfcf7d..2e5529d 100644 --- a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxSieveProbe.java +++ b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxSieveProbe.java @@ -34,7 +34,7 @@ public class JmxSieveProbe implements SieveProbe, JmxProbe { public JmxSieveProbe connect(JmxConnection jmxc) throws IOException { try { -jmxc.retrieveBean(SieveRepositoryManagementMBean.class, SIEVEMANAGER_OBJECT_NAME); +sieveRepositoryManagement = jmxc.retrieveBean(SieveRepositoryManagementMBean.class, SIEVEMANAGER_OBJECT_NAME); } catch (MalformedObjectNameException e) { throw new RuntimeException("Invalid ObjectName? Please report this as a bug.", e); } - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[11/15] james-project git commit: JAMES-1982 Correct injects on QuotaManagement
JAMES-1982 Correct injects on QuotaManagement Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/fe92e8bc Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/fe92e8bc Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/fe92e8bc Branch: refs/heads/master Commit: fe92e8bceb6c31f584c5c48bbbcb1753066622ce Parents: b547e70 Author: benwaAuthored: Sat Apr 1 11:11:56 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:32 2017 +0700 -- .../james/adapter/mailbox/QuotaManagement.java | 17 +++-- .../META-INF/org/apache/james/spring-server.xml| 6 +- 2 files changed, 8 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/fe92e8bc/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagement.java -- diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagement.java b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagement.java index dd779a3..9083ab4 100644 --- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagement.java +++ b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/QuotaManagement.java @@ -19,6 +19,8 @@ package org.apache.james.adapter.mailbox; +import javax.inject.Inject; + import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.quota.MaxQuotaManager; @@ -28,19 +30,14 @@ import org.apache.james.mailbox.store.mail.model.SerializableQuota; public class QuotaManagement implements QuotaManagementMBean { -private QuotaManager quotaManager; -private MaxQuotaManager maxQuotaManager; -private QuotaRootResolver quotaRootResolver; +private final QuotaManager quotaManager; +private final MaxQuotaManager maxQuotaManager; +private final QuotaRootResolver quotaRootResolver; -public void setQuotaManager(QuotaManager quotaManager) { +@Inject +public QuotaManagement(QuotaManager quotaManager, MaxQuotaManager maxQuotaManager, QuotaRootResolver quotaRootResolver) { this.quotaManager = quotaManager; -} - -public void setMaxQuotaManager(MaxQuotaManager maxQuotaManager) { this.maxQuotaManager = maxQuotaManager; -} - -public void setQuotaRootResolver(QuotaRootResolver quotaRootResolver) { this.quotaRootResolver = quotaRootResolver; } http://git-wip-us.apache.org/repos/asf/james-project/blob/fe92e8bc/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-server.xml -- diff --git a/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-server.xml b/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-server.xml index a08cedc..322c4c6 100644 --- a/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-server.xml +++ b/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-server.xml @@ -280,11 +280,7 @@ - - - - - +
[05/15] james-project git commit: JAMES-1982 Set logger on MailboxManagement to avoid NPE
JAMES-1982 Set logger on MailboxManagement to avoid NPE Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/8942eaff Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/8942eaff Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/8942eaff Branch: refs/heads/master Commit: 8942eaff850265defa6c9c6e629350067d65a1f9 Parents: 95d241d Author: benwaAuthored: Sat Apr 1 12:08:11 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:32 2017 +0700 -- .../james/modules/server/JMXServerModule.java | 36 +++- 1 file changed, 35 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/8942eaff/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java -- diff --git a/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java b/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java index fc97468..626ef3a 100644 --- a/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java +++ b/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java @@ -47,11 +47,13 @@ import org.apache.james.user.api.UsersRepositoryManagementMBean; import org.apache.james.user.lib.UsersRepositoryManagement; import org.apache.james.utils.ConfigurationPerformer; import org.apache.james.utils.GuiceMailboxManagerResolver; +import org.slf4j.LoggerFactory; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; import com.google.inject.AbstractModule; import com.google.inject.Inject; +import com.google.inject.Scopes; import com.google.inject.Singleton; import com.google.inject.multibindings.Multibinder; import com.google.inject.name.Names; @@ -69,6 +71,15 @@ public class JMXServerModule extends AbstractModule { @Override protected void configure() { +bind(ReIndexerManagement.class).in(Scopes.SINGLETON); +bind(QuotaManagement.class).in(Scopes.SINGLETON); +bind(RecipientRewriteTableManagement.class).in(Scopes.SINGLETON); +bind(MailboxManagerManagement.class).in(Scopes.SINGLETON); +bind(UsersRepositoryManagement.class).in(Scopes.SINGLETON); +bind(DomainListManagement.class).in(Scopes.SINGLETON); +bind(MailboxCopierManagement.class).in(Scopes.SINGLETON); +bind(SieveRepositoryManagement.class).in(Scopes.SINGLETON); + bind(MailboxCopier.class).annotatedWith(Names.named("mailboxcopier")).to(MailboxCopierImpl.class); bind(MailboxCopierManagementMBean.class).to(MailboxCopierManagement.class); bind(MailboxManagerResolver.class).to(GuiceMailboxManagerResolver.class); @@ -81,7 +92,9 @@ public class JMXServerModule extends AbstractModule { bind(ReIndexerManagementMBean.class).to(ReIndexerManagement.class); bind(QuotaManagementMBean.class).to(QuotaManagement.class); bind(SieveRepositoryManagementMBean.class).to(SieveRepositoryManagement.class); -Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JMXModuleConfigurationPerformer.class); +Multibinder configurationMultibinder = Multibinder.newSetBinder(binder(), ConfigurationPerformer.class); + configurationMultibinder.addBinding().to(JMXModuleConfigurationPerformer.class); + configurationMultibinder.addBinding().to(MailboxManagementLogSetter.class); } @Singleton @@ -141,4 +154,25 @@ public class JMXServerModule extends AbstractModule { } } +@Singleton +public static class MailboxManagementLogSetter implements ConfigurationPerformer { + +private final MailboxManagerManagement mailboxManagerManagement; + +@Inject +public MailboxManagementLogSetter(MailboxManagerManagement mailboxManagerManagement) { +this.mailboxManagerManagement = mailboxManagerManagement; +} + +@Override +public void initModule() { + mailboxManagerManagement.setLog(LoggerFactory.getLogger(MailboxManagerManagement.class)); +} + +@Override +public List forClasses() { +return ImmutableList.of(); +} +} + } - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[10/15] james-project git commit: JAMES-1982 Cli should not double output
JAMES-1982 Cli should not double output Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/b547e70f Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/b547e70f Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/b547e70f Branch: refs/heads/master Commit: b547e70f38390b8e865470348089771a87716984 Parents: 4321bcc Author: benwaAuthored: Sat Apr 1 10:25:45 2017 +0700 Committer: benwa Committed: Mon Apr 3 18:09:32 2017 +0700 -- .../java/org/apache/james/cli/ServerCmd.java| 39 ++-- 1 file changed, 19 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/b547e70f/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java -- diff --git a/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java b/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java index 402b0d2..af882ed 100644 --- a/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java +++ b/server/container/cli/src/main/java/org/apache/james/cli/ServerCmd.java @@ -86,24 +86,8 @@ public class ServerCmd { * @param args Command-line arguments. */ public static void main(String[] args) { - try { -StopWatch stopWatch = new StopWatch(); -stopWatch.start(); -CommandLine cmd = parseCommandLine(args); -JmxConnection jmxConnection = new JmxConnection(cmd.getOptionValue(HOST_OPT_LONG), getPort(cmd)); -CmdType cmdType = new ServerCmd( -new JmxDataProbe().connect(jmxConnection), -new JmxMailboxProbe().connect(jmxConnection), -new JmxQuotaProbe().connect(jmxConnection), -new JmxSieveProbe().connect(jmxConnection) -) -.executeCommandLine(cmd); -stopWatch.split(); -print(new String[] { Joiner.on(' ') -.join(cmdType.getCommand(), "command executed sucessfully in", stopWatch.getSplitTime(), "ms.")}, -System.out); -stopWatch.stop(); +doMain(args); System.exit(0); } catch (JamesCliException e) { failWithMessage(e.getMessage()); @@ -115,7 +99,25 @@ public class ServerCmd { LOG.error("Error on command: {}", e); failWithMessage("Error " + e.getClass() + " while executing command:" + e.getMessage()); } +} +public static void doMain(String[] args) throws Exception { +StopWatch stopWatch = new StopWatch(); +stopWatch.start(); +CommandLine cmd = parseCommandLine(args); +JmxConnection jmxConnection = new JmxConnection(cmd.getOptionValue(HOST_OPT_LONG), getPort(cmd)); +CmdType cmdType = new ServerCmd( +new JmxDataProbe().connect(jmxConnection), +new JmxMailboxProbe().connect(jmxConnection), +new JmxQuotaProbe().connect(jmxConnection), +new JmxSieveProbe().connect(jmxConnection) +) +.executeCommandLine(cmd); +stopWatch.split(); +print(new String[] { Joiner.on(' ') +.join(cmdType.getCommand(), "command executed sucessfully in", stopWatch.getSplitTime(), "ms.")}, +System.out); +stopWatch.stop(); } private final DataProbe probe; @@ -321,9 +323,6 @@ public class ServerCmd { private static void print(Iterable data, PrintStream out) { if (data != null) { -for (String u : data) { -out.println(u); -} out.println(Joiner.on('\n').join(data)); } } - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Closed] (JAMES-1685) Update site & maven files to git
[ https://issues.apache.org/jira/browse/JAMES-1685?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Antoine Duprat closed JAMES-1685. - > Update site & maven files to git > > > Key: JAMES-1685 > URL: https://issues.apache.org/jira/browse/JAMES-1685 > Project: James Server > Issue Type: Bug >Reporter: Antoine Duprat > > Update site & maven files to git > As we have migrated from svn to git, we have to update the site and the > pom.xml files. -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Resolved] (JAMES-1685) Update site & maven files to git
[ https://issues.apache.org/jira/browse/JAMES-1685?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Antoine Duprat resolved JAMES-1685. --- Resolution: Fixed > Update site & maven files to git > > > Key: JAMES-1685 > URL: https://issues.apache.org/jira/browse/JAMES-1685 > Project: James Server > Issue Type: Bug >Reporter: Antoine Duprat > > Update site & maven files to git > As we have migrated from svn to git, we have to update the site and the > pom.xml files. -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Commented] (JAMES-1950) Statistics About perfs
[ https://issues.apache.org/jira/browse/JAMES-1950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15953132#comment-15953132 ] Tellier Benoit commented on JAMES-1950: --- https://github.com/linagora/james-project/pull/724 Added metrics on DNS server > Statistics About perfs > -- > > Key: JAMES-1950 > URL: https://issues.apache.org/jira/browse/JAMES-1950 > Project: James Server > Issue Type: Improvement >Reporter: Antoine Duprat > > Log duration of IMAP processors and JMAP methods. -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Closed] (JAMES-1980) Improve UseHeaderRecipients
[ https://issues.apache.org/jira/browse/JAMES-1980?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tellier Benoit closed JAMES-1980. - > Improve UseHeaderRecipients > --- > > Key: JAMES-1980 > URL: https://issues.apache.org/jira/browse/JAMES-1980 > Project: James Server > Issue Type: Bug >Reporter: Tellier Benoit > > It includes: > - We should unfold and decode headers > - We should parse correctly mail addresses using mime4j > - We should upgrade a bit code quality inside the class > - PNV students will propose a test for this class -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Closed] (JAMES-1982) Missing MBEAN on guice JMX admin
[ https://issues.apache.org/jira/browse/JAMES-1982?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tellier Benoit closed JAMES-1982. - > Missing MBEAN on guice JMX admin > > > Key: JAMES-1982 > URL: https://issues.apache.org/jira/browse/JAMES-1982 > Project: James Server > Issue Type: Bug >Reporter: Tellier Benoit > > Caused by: javax.management.InstanceNotFoundException: > org.apache.james:type=component,name=quotamanagerbean > This avoids us from administrating quota fron CLI -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Resolved] (JAMES-1982) Missing MBEAN on guice JMX admin
[ https://issues.apache.org/jira/browse/JAMES-1982?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tellier Benoit resolved JAMES-1982. --- Resolution: Fixed https://github.com/linagora/james-project/pull/723 solved the issue > Missing MBEAN on guice JMX admin > > > Key: JAMES-1982 > URL: https://issues.apache.org/jira/browse/JAMES-1982 > Project: James Server > Issue Type: Bug >Reporter: Tellier Benoit > > Caused by: javax.management.InstanceNotFoundException: > org.apache.james:type=component,name=quotamanagerbean > This avoids us from administrating quota fron CLI -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[3/7] james-project git commit: JAMES-1983 Split WebAdmin to match orthogonal Guice architecture
http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/webadmin-core/pom.xml -- diff --git a/server/protocols/webadmin/webadmin-core/pom.xml b/server/protocols/webadmin/webadmin-core/pom.xml new file mode 100644 index 000..151bbca --- /dev/null +++ b/server/protocols/webadmin/webadmin-core/pom.xml @@ -0,0 +1,281 @@ + + +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd;> +4.0.0 + + +james-server +org.apache.james +3.0.0-beta6-SNAPSHOT +../../../pom.xml + + +james-server-webadmin-core +jar + +Apache James :: Server :: Web Admin :: Core + + + +noTest + + +windows + + + + + +org.apache.maven.plugins +maven-surefire-plugin + +true + + + + + + +disable-build-for-older-jdk + +(,1.8) + + + + +maven-jar-plugin + + +default-jar +none + + +jar +none + + +test-jar +none + + + + +maven-compiler-plugin + + +default-compile +none + + +default-testCompile +none + + + + +maven-surefire-plugin + + +default-test +none + + + + +maven-source-plugin + + +attach-sources +none + + + + +maven-install-plugin + + +default-install +none + + + + +maven-resources-plugin + + +default-resources +none + + +default-testResources +none + + + + +maven-site-plugin + + +attach-descriptor +none + + + + + + + +build-for-jdk-8 + +[1.8,) + + + +org.apache.james +james-server-util-java8 + + +org.apache.james +james-server-lifecycle-api + + +org.apache.james +james-server-jwt + + +org.apache.james +metrics-api + + +org.apache.james +metrics-logger +test + + +com.fasterxml.jackson.core +jackson-databind + + +com.github.fge +throwing-lambdas + +
[4/7] james-project git commit: JAMES-1983 Split WebAdmin to match orthogonal Guice architecture
http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/RandomPortTest.java -- diff --git a/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/RandomPortTest.java b/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/RandomPortTest.java deleted file mode 100644 index 07d1996..000 --- a/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/RandomPortTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/ - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information* - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the* - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the* - * specific language governing permissions and limitations * - * under the License. * - / - -package org.apache.james.webadmin; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.Test; - -public class RandomPortTest { - -@Test -public void toIntShouldReturnTwoTimeTheSameResult() { -RandomPort testee = new RandomPort(); -assertThat(testee.toInt()).isEqualTo(testee.toInt()); -} - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/TlsConfigurationTest.java -- diff --git a/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/TlsConfigurationTest.java b/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/TlsConfigurationTest.java deleted file mode 100644 index 2d93282..000 --- a/server/protocols/webadmin/src/test/java/org/apache/james/webadmin/TlsConfigurationTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/ - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information* - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the* - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the* - * specific language governing permissions and limitations * - * under the License. * - / - -package org.apache.james.webadmin; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import nl.jqno.equalsverifier.EqualsVerifier; - -public class TlsConfigurationTest { - -@Rule -public ExpectedException expectedException = ExpectedException.none(); - -@Test -public void buildShouldThrowWhenNotEnabled() { -expectedException.expect(IllegalStateException.class); - -TlsConfiguration.builder().build(); -} - -@Test -public void buildShouldThrowWhenEnableWithoutKeystore() { -expectedException.expect(IllegalStateException.class); - -TlsConfiguration.builder().build(); -} - -@Test -public void selfSignedShouldThrowOnNullKeyStorePath() { -expectedException.expect(NullPointerException.class); - -TlsConfiguration.builder() -.selfSigned(null, "abc"); -} - -@Test -public void
[5/7] james-project git commit: JAMES-1983 Split WebAdmin to match orthogonal Guice architecture
http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java -- diff --git a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java deleted file mode 100644 index 716645c..000 --- a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/WebAdminConfiguration.java +++ /dev/null @@ -1,169 +0,0 @@ -/ - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information* - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the* - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the* - * specific language governing permissions and limitations * - * under the License. * - / - - -package org.apache.james.webadmin; - -import java.util.Objects; -import java.util.Optional; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Preconditions; - -public class WebAdminConfiguration { - -public static final boolean DEFAULT_CORS_DISABLED = false; -public static final String CORS_ALL_ORIGINS = "*"; - -public static WebAdminConfiguration testingConfiguration() { -return WebAdminConfiguration.builder() -.enabled() -.port(new RandomPort()) -.build(); -} - -public static final WebAdminConfiguration DISABLED_CONFIGURATION = WebAdminConfiguration.builder() -.disabled() -.build(); - -public static Builder builder() { -return new Builder(); -} - -public static class Builder { -private Optional enabled = Optional.empty(); -private Optional port = Optional.empty(); -private Optional enableCORS = Optional.empty(); -private Optional tlsConfiguration = Optional.empty(); -private Optional urlCORSOrigin = Optional.empty(); - -public Builder tls(TlsConfiguration tlsConfiguration) { -this.tlsConfiguration = Optional.of(tlsConfiguration); -return this; -} - -public Builder tls(Optional tlsConfiguration) { -this.tlsConfiguration = tlsConfiguration; -return this; -} - -public Builder port(Port port) { -this.port = Optional.of(port); -return this; -} - -public Builder enable(boolean isEnabled) { -this.enabled = Optional.of(isEnabled); -return this; -} -public Builder enabled() { -return enable(true); -} - -public Builder disabled() { -return enable(false); -} - -public Builder urlCORSOrigin(String origin) { -this.urlCORSOrigin = Optional.ofNullable(origin); -return this; -} - -public Builder enableCORS(boolean isEnabled) { -this.enableCORS = Optional.of(isEnabled); -return this; -} - -public Builder CORSenabled() { -return enableCORS(true); -} - -public Builder CORSdisabled() { -return enableCORS(false); -} - -public WebAdminConfiguration build() { -Preconditions.checkState(enabled.isPresent(), "You need to explicitly enable or disable WebAdmin server"); -Preconditions.checkState(!enabled.get() || port.isPresent(), "You need to specify a port for WebAdminConfiguration"); -return new WebAdminConfiguration(enabled.get(), -port, -tlsConfiguration, -enableCORS.orElse(DEFAULT_CORS_DISABLED), -urlCORSOrigin.orElse(CORS_ALL_ORIGINS)); -} -} - -private final boolean enabled; -private final Optional port; -private final Optional tlsConfiguration; -private final boolean enableCORS; -private final String urlCORSOrigin; - -@VisibleForTesting -
[2/7] james-project git commit: JAMES-1983 Split WebAdmin to match orthogonal Guice architecture
http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/utils/JsonExtractorTest.java -- diff --git a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/utils/JsonExtractorTest.java b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/utils/JsonExtractorTest.java new file mode 100644 index 000..ff5f2cb --- /dev/null +++ b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/utils/JsonExtractorTest.java @@ -0,0 +1,114 @@ +/ + * 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.utils; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.Preconditions; + +public class JsonExtractorTest { + +private JsonExtractor jsonExtractor; + +@Before +public void setUp() { +jsonExtractor = new JsonExtractor<>(Request.class); +} + +@Test +public void parseShouldThrowOnNullInput() throws Exception { +assertThatThrownBy(() -> jsonExtractor.parse(null)).isInstanceOf(NullPointerException.class); +} + +@Test +public void parseShouldThrowOnEmptyInput() throws Exception { +assertThatThrownBy(() -> jsonExtractor.parse("")).isInstanceOf(JsonExtractException.class); +} + +@Test +public void parseShouldThrowOnBrokenJson() throws Exception { +assertThatThrownBy(() -> jsonExtractor.parse("{\"field1\":\"broken")).isInstanceOf(JsonExtractException.class); +} + +@Test +public void parseShouldThrowOnEmptyJson() throws Exception { +assertThatThrownBy(() -> jsonExtractor.parse("{}")).isInstanceOf(JsonExtractException.class); +} + +@Test +public void parseShouldThrowOnMissingMandatoryField() throws Exception { +assertThatThrownBy(() -> jsonExtractor.parse("{\"field1\":\"any\"}")).isInstanceOf(JsonExtractException.class); +} + +@Test +public void parseShouldThrowOnValidationProblemIllegalArgumentException() throws Exception { +assertThatThrownBy(() -> jsonExtractor.parse("{\"field1\":\"\",\"field2\":\"any\"}")).isInstanceOf(JsonExtractException.class); +} + +@Test +public void parseShouldThrowOnValidationProblemNPE() throws Exception { +assertThatThrownBy(() -> jsonExtractor.parse("{\"field1\":null,\"field2\":\"any\"}")).isInstanceOf(JsonExtractException.class); +} + +@Test +public void parseShouldThrowOnExtraFiled() throws Exception { +assertThatThrownBy(() -> jsonExtractor.parse("{\"field1\":\"value\",\"field2\":\"any\",\"extra\":\"extra\"}")).isInstanceOf(JsonExtractException.class); +} + +@Test +public void parseShouldInstantiateDestinationClass() throws Exception { +String field1 = "value1"; +String field2 = "value2"; +Request request = jsonExtractor.parse("{\"field1\":\"" + field1 + "\",\"field2\":\"" + field2 + "\"}"); + +assertThat(request.getField1()).isEqualTo(field1); +assertThat(request.getField2()).isEqualTo(field2); +} + +static class Request { +private final String field1; +private final String field2; + +@JsonCreator +public Request(@JsonProperty("field1") String field1, + @JsonProperty("field2") String field2) { +Preconditions.checkNotNull(field1); +Preconditions.checkNotNull(field2); +
[1/7] james-project git commit: JAMES-1983 Split WebAdmin to match orthogonal Guice architecture
Repository: james-project Updated Branches: refs/heads/master 6a8b56bf0 -> 5d3bedee1 http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java -- diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java new file mode 100644 index 000..79a6915 --- /dev/null +++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java @@ -0,0 +1,129 @@ +/ + * 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.routes; + +import javax.inject.Inject; + +import org.apache.james.webadmin.Constants; +import org.apache.james.webadmin.Routes; +import org.apache.james.webadmin.service.UserMailboxesService; +import org.apache.james.webadmin.utils.JsonTransformer; +import org.apache.james.webadmin.utils.MailboxHaveChildrenException; +import org.apache.james.webadmin.validation.MailboxName; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import spark.Service; + +public class UserMailboxesRoutes implements Routes { + +private static final Logger LOGGER = LoggerFactory.getLogger(UserMailboxesRoutes.class); + +public static final String MAILBOX_NAME = ":mailboxName"; +public static final String MAILBOXES = "mailboxes"; +private static final String USER_NAME = ":userName"; +public static final String USERS_BASE = "/users"; +public static final String USER_MAILBOXES_BASE = USERS_BASE + Constants.SEPARATOR + USER_NAME + Constants.SEPARATOR + MAILBOXES; +public static final String SPECIFIC_MAILBOX = USER_MAILBOXES_BASE + Constants.SEPARATOR + MAILBOX_NAME; + +private final UserMailboxesService userMailboxesService; +private final JsonTransformer jsonTransformer; + +@Inject +public UserMailboxesRoutes(UserMailboxesService userMailboxesService, JsonTransformer jsonTransformer) { +this.userMailboxesService = userMailboxesService; +this.jsonTransformer = jsonTransformer; +} + +@Override +public void define(Service service) { + +service.put(SPECIFIC_MAILBOX, (request, response) -> { +try { +userMailboxesService.createMailbox(request.params(USER_NAME), new MailboxName(request.params(MAILBOX_NAME))); +response.status(204); +} catch (IllegalStateException e) { +LOGGER.info("Invalid put on user mailbox", e); +response.status(404); +} catch (IllegalArgumentException e) { +LOGGER.info("Attempt to create an invalid mailbox"); +response.status(400); +} +return Constants.EMPTY_BODY; +}); + +service.delete(SPECIFIC_MAILBOX, (request, response) -> { +try { +userMailboxesService.deleteMailbox(request.params(USER_NAME), new MailboxName(request.params(MAILBOX_NAME))); +response.status(204); +} catch (IllegalStateException e) { +LOGGER.info("Invalid delete on user mailbox", e); +response.status(404); +} catch (MailboxHaveChildrenException e) { +LOGGER.info("Attempt to delete a mailbox with children"); +response.status(409); +} catch (IllegalArgumentException e) { +LOGGER.info("Attempt to create an invalid mailbox"); +response.status(400); +} +return Constants.EMPTY_BODY; +}); + +
[6/7] james-project git commit: JAMES-1983 Split WebAdmin to match orthogonal Guice architecture
JAMES-1983 Split WebAdmin to match orthogonal Guice architecture Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/cca0f398 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/cca0f398 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/cca0f398 Branch: refs/heads/master Commit: cca0f39895d526cdf33a76987ecaafb8facc0d03 Parents: 6a8b56b Author: benwaAuthored: Sat Apr 1 00:22:32 2017 +0700 Committer: benwa Committed: Sat Apr 1 15:24:29 2017 +0700 -- server/container/guice/cassandra-guice/pom.xml | 8 + .../apache/james/CassandraJamesServerMain.java | 6 +- server/container/guice/jpa-guice/pom.xml| 8 + .../org/apache/james/JPAJamesServerMain.java| 6 +- .../james/modules/server/NoJwtModule.java | 34 - server/container/guice/jpa-smtp/pom.xml | 8 + .../org/apache/james/JPAJamesServerMain.java| 8 +- server/container/guice/memory-guice/pom.xml | 8 + .../org/apache/james/MemoryJamesServerMain.java | 4 + server/container/guice/pom.xml | 12 + .../guice/protocols/webadmin-data/pom.xml | 206 + .../james/modules/server/DataRoutesModules.java | 37 + .../guice/protocols/webadmin-mailbox/pom.xml| 206 + .../modules/server/MailboxRoutesModule.java | 37 + .../container/guice/protocols/webadmin/pom.xml | 2 +- .../james/modules/server/NoJwtModule.java | 34 + .../modules/server/WebAdminServerModule.java| 11 - server/pom.xml | 20 +- .../protocols/webadmin-integration-test/pom.xml | 12 +- server/protocols/webadmin/pom.xml | 314 .../org/apache/james/webadmin/CORSFilter.java | 40 - .../org/apache/james/webadmin/Constants.java| 27 - .../org/apache/james/webadmin/FixedPort.java| 54 -- .../java/org/apache/james/webadmin/Port.java| 26 - .../org/apache/james/webadmin/RandomPort.java | 50 -- .../java/org/apache/james/webadmin/Routes.java | 28 - .../apache/james/webadmin/TlsConfiguration.java | 124 --- .../james/webadmin/WebAdminConfiguration.java | 169 .../apache/james/webadmin/WebAdminServer.java | 129 --- .../authentication/AuthenticationFilter.java| 25 - .../webadmin/authentication/JwtFilter.java | 76 -- .../authentication/NoAuthenticationFilter.java | 31 - .../james/webadmin/dto/AddUserRequest.java | 39 - .../james/webadmin/dto/MailboxResponse.java | 33 - .../org/apache/james/webadmin/dto/QuotaDTO.java | 73 -- .../apache/james/webadmin/dto/QuotaRequest.java | 39 - .../apache/james/webadmin/dto/UserResponse.java | 33 - .../james/webadmin/metric/MetricPostFilter.java | 37 - .../james/webadmin/metric/MetricPreFilter.java | 41 - .../apache/james/webadmin/routes/CORSRoute.java | 42 - .../james/webadmin/routes/DomainRoutes.java | 118 --- .../webadmin/routes/GlobalQuotaRoutes.java | 130 .../webadmin/routes/UserMailboxesRoutes.java| 128 --- .../james/webadmin/routes/UserRoutes.java | 104 --- .../webadmin/service/UserMailboxesService.java | 143 .../james/webadmin/service/UserService.java | 94 --- .../webadmin/utils/JsonExtractException.java| 27 - .../james/webadmin/utils/JsonExtractor.java | 44 -- .../james/webadmin/utils/JsonTransformer.java | 41 - .../utils/MailboxHaveChildrenException.java | 27 - .../james/webadmin/validation/MailboxName.java | 40 - .../apache/james/webadmin/FixedPortTest.java| 57 -- .../apache/james/webadmin/RandomPortTest.java | 34 - .../james/webadmin/TlsConfigurationTest.java| 88 --- .../webadmin/WebAdminConfigurationTest.java | 181 - .../webadmin/authentication/JwtFilterTest.java | 124 --- .../james/webadmin/dto/QuotaRequestTest.java| 59 -- .../james/webadmin/routes/DomainRoutesTest.java | 326 .../webadmin/routes/GlobalQuotaRoutesTest.java | 261 --- .../routes/UserMailboxesRoutesTest.java | 779 -- .../james/webadmin/routes/UsersRoutesTest.java | 422 -- .../james/webadmin/utils/JsonExtractorTest.java | 114 --- server/protocols/webadmin/webadmin-core/pom.xml | 281 +++ .../org/apache/james/webadmin/CORSFilter.java | 40 + .../org/apache/james/webadmin/Constants.java| 27 + .../org/apache/james/webadmin/FixedPort.java| 54 ++ .../java/org/apache/james/webadmin/Port.java| 26 + .../org/apache/james/webadmin/RandomPort.java | 50 ++ .../java/org/apache/james/webadmin/Routes.java | 28 + .../apache/james/webadmin/TlsConfiguration.java | 124 +++ .../james/webadmin/WebAdminConfiguration.java | 169 .../apache/james/webadmin/WebAdminServer.java | 129 +++ .../authentication/AuthenticationFilter.java| 25 +
[7/7] james-project git commit: JAMES-1950 Enable metrics reporting with DNS service
JAMES-1950 Enable metrics reporting with DNS service Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/5d3bedee Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/5d3bedee Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/5d3bedee Branch: refs/heads/master Commit: 5d3bedee1898ea446650a794beaba4e60f7988d5 Parents: cca0f39 Author: benwaAuthored: Fri Mar 31 19:41:04 2017 +0700 Committer: benwa Committed: Mon Apr 3 15:33:38 2017 +0700 -- server/dns-service/dnsservice-dnsjava/pom.xml | 4 ++ .../dnsservice/dnsjava/DNSJavaService.java | 53 +++- .../dnsservice/dnsjava/DNSJavaServiceTest.java | 6 +++ 3 files changed, 51 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/5d3bedee/server/dns-service/dnsservice-dnsjava/pom.xml -- diff --git a/server/dns-service/dnsservice-dnsjava/pom.xml b/server/dns-service/dnsservice-dnsjava/pom.xml index b15d23e..6a27d3f 100644 --- a/server/dns-service/dnsservice-dnsjava/pom.xml +++ b/server/dns-service/dnsservice-dnsjava/pom.xml @@ -42,6 +42,10 @@ james-server-lifecycle-api +org.apache.james +metrics-api + + commons-configuration commons-configuration http://git-wip-us.apache.org/repos/asf/james-project/blob/5d3bedee/server/dns-service/dnsservice-dnsjava/src/main/java/org/apache/james/dnsservice/dnsjava/DNSJavaService.java -- diff --git a/server/dns-service/dnsservice-dnsjava/src/main/java/org/apache/james/dnsservice/dnsjava/DNSJavaService.java b/server/dns-service/dnsservice-dnsjava/src/main/java/org/apache/james/dnsservice/dnsjava/DNSJavaService.java index fbb44f0..80b4703 100644 --- a/server/dns-service/dnsservice-dnsjava/src/main/java/org/apache/james/dnsservice/dnsjava/DNSJavaService.java +++ b/server/dns-service/dnsservice-dnsjava/src/main/java/org/apache/james/dnsservice/dnsjava/DNSJavaService.java @@ -25,6 +25,8 @@ import org.apache.james.dnsservice.api.DNSServiceMBean; import org.apache.james.dnsservice.api.TemporaryResolutionException; import org.apache.james.lifecycle.api.Configurable; import org.apache.james.lifecycle.api.LogEnabled; +import org.apache.james.metrics.api.MetricFactory; +import org.apache.james.metrics.api.TimeMetric; import org.slf4j.Logger; import org.xbill.DNS.ARecord; import org.xbill.DNS.Cache; @@ -44,6 +46,8 @@ import org.xbill.DNS.TextParseException; import org.xbill.DNS.Type; import javax.annotation.PostConstruct; +import javax.inject.Inject; + import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; @@ -85,6 +89,8 @@ public class DNSJavaService implements DNSService, DNSServiceMBean, LogEnabled, */ private final List dnsServers = new ArrayList(); +private final MetricFactory metricFactory; + /** * The search paths to be used */ @@ -113,6 +119,11 @@ public class DNSJavaService implements DNSService, DNSServiceMBean, LogEnabled, this.logger = logger; } +@Inject +public DNSJavaService(MetricFactory metricFactory) { +this.metricFactory = metricFactory; +} + @Override public void configure(HierarchicalConfiguration configuration) throws ConfigurationException { @@ -306,6 +317,7 @@ public class DNSJavaService implements DNSService, DNSServiceMBean, LogEnabled, @Override public Collection findMXRecords(String hostname) throws TemporaryResolutionException { +TimeMetric timeMetric = metricFactory.timer("findMXRecords"); List servers = new ArrayList(); try { servers = findMXRecordsRaw(hostname); @@ -327,6 +339,7 @@ public class DNSJavaService implements DNSService, DNSServiceMBean, LogEnabled, logger.error(logBuffer.toString()); } } +timeMetric.stopAndPublish(); } } @@ -424,6 +437,7 @@ public class DNSJavaService implements DNSService, DNSServiceMBean, LogEnabled, @Override public InetAddress getByName(String host) throws UnknownHostException { +TimeMetric timeMetric = metricFactory.timer("getByName"); String name = allowIPLiteral(host); try { @@ -441,11 +455,14 @@ public class DNSJavaService implements DNSService, DNSServiceMBean, LogEnabled, return InetAddress.getByAddress(name, a.getAddress().getAddress()); } else throw e; +} finally { +timeMetric.stopAndPublish();
[jira] [Resolved] (JAMES-1983) Orthogonal guice architeture for Webadmin
[ https://issues.apache.org/jira/browse/JAMES-1983?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tellier Benoit resolved JAMES-1983. --- Resolution: Fixed https://github.com/linagora/james-project/pull/725 solved the issue > Orthogonal guice architeture for Webadmin > - > > Key: JAMES-1983 > URL: https://issues.apache.org/jira/browse/JAMES-1983 > Project: James Server > Issue Type: Improvement >Reporter: Tellier Benoit > > This would enable specifying in Guice which routes you do want to expose. > This enables fine grained routes definition without: > - Binding not needed components > - Having many big JARs in classpath > This allows enabling webadmin on jpa-smtp for data configuration. -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Created] (JAMES-1986) JMAP should handle messages with content disposition "attachment"
Tellier Benoit created JAMES-1986: - Summary: JMAP should handle messages with content disposition "attachment" Key: JAMES-1986 URL: https://issues.apache.org/jira/browse/JAMES-1986 Project: James Server Issue Type: Bug Reporter: Tellier Benoit Currently attachments are only parsed in multipart messages MessageParser should take content disposition of the email into account. -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Resolved] (JAMES-1984) Accent problem in preview
[ https://issues.apache.org/jira/browse/JAMES-1984?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tellier Benoit resolved JAMES-1984. --- Resolution: Fixed Merged with https://github.com/linagora/james-project/pull/726 > Accent problem in preview > - > > Key: JAMES-1984 > URL: https://issues.apache.org/jira/browse/JAMES-1984 > Project: James Server > Issue Type: Bug > Components: JMAP >Reporter: Antoine Duprat >Assignee: Antoine Duprat > > The text preview of the mail shows strange characters in place of accents for > both *GetMessageList* & *GetMessages* methods > (ex.: _é_ instead of _é_) -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Closed] (JAMES-1984) Accent problem in preview
[ https://issues.apache.org/jira/browse/JAMES-1984?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tellier Benoit closed JAMES-1984. - > Accent problem in preview > - > > Key: JAMES-1984 > URL: https://issues.apache.org/jira/browse/JAMES-1984 > Project: James Server > Issue Type: Bug > Components: JMAP >Reporter: Antoine Duprat >Assignee: Antoine Duprat > > The text preview of the mail shows strange characters in place of accents for > both *GetMessageList* & *GetMessages* methods > (ex.: _é_ instead of _é_) -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Created] (JAMES-1985) JMAP do not display messages with only inlined text well
Tellier Benoit created JAMES-1985: - Summary: JMAP do not display messages with only inlined text well Key: JAMES-1985 URL: https://issues.apache.org/jira/browse/JAMES-1985 Project: James Server Issue Type: Bug Reporter: Tellier Benoit MessageContentExtractor should back up to inlined text without CID when failed to locate a text part. This non-invasive way will allow us to display emails that we could not view before. -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
james-project git commit: JAMES-1984 Charset decoding is done in Mime4j TextBody.getInputStream method
Repository: james-project Updated Branches: refs/heads/master a281f59fd -> 1994df528 JAMES-1984 Charset decoding is done in Mime4j TextBody.getInputStream method Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/1994df52 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/1994df52 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/1994df52 Branch: refs/heads/master Commit: 1994df52883ecef96d701b30fbdf31bbd4fc4f1e Parents: a281f59 Author: Antoine DupratAuthored: Mon Apr 3 13:02:37 2017 +0200 Committer: Antoine Duprat Committed: Mon Apr 3 15:01:42 2017 +0200 -- .../cucumber/GetMessagesMethodStepdefs.java | 5 +++ .../test/resources/cucumber/GetMessages.feature | 9 .../test/resources/eml/windows1252charset.eml | 43 .../jmap/model/MessageContentExtractor.java | 3 +- 4 files changed, 59 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/james-project/blob/1994df52/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java -- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java index c88b52e..a88c824 100644 --- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java +++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java @@ -223,6 +223,11 @@ public class GetMessagesMethodStepdefs { appendMessage(messageName, "eml/sameInlinedImages.eml"); } +@Given("^the user has a message \"([^\"]*)\" in \"([^\"]*)\" mailbox with specific charset$") +public void appendMessageWithSpecificCharset(String messageName, String mailbox) throws Throwable { +appendMessage(messageName, "eml/windows1252charset.eml"); +} + private void appendMessage(String messageName, String emlFileName) throws Exception { ZonedDateTime dateTime = ZonedDateTime.parse("2014-10-30T14:12:00Z"); MessageId id = mainStepdefs.jmapServer.getProbe(MailboxProbeImpl.class).appendMessage(userStepdefs.lastConnectedUser, http://git-wip-us.apache.org/repos/asf/james-project/blob/1994df52/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature -- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature index 0018491..7d35ac4 100644 --- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature +++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature @@ -276,3 +276,12 @@ Feature: GetMessages method And the list should contain 1 message And the hasAttachment of the message is "false" And the list of attachments of the message contains only one attachment with cid "1482981567586480bfca67b793175...@linagora.com" + + Scenario: Preview and bodies should respect given charset +Given the user has a message "m1" in "INBOX" mailbox with specific charset +When the user ask for messages "m1" +Then no error is returned +And the list should contain 1 message +And the preview of the message is "à à à à éééé èèèè" +And the textBody of the message is "à à à à \r\n\r\néééé\r\n\r\nèèèè\r\n" +And the htmlBody of the message is "\r\n à à à à \r\n éééé\r\n èèèè\r\n\r\n" http://git-wip-us.apache.org/repos/asf/james-project/blob/1994df52/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/windows1252charset.eml -- diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/eml/windows1252charset.eml
[jira] [Created] (JAMES-1984) Accent problem in preview
Antoine Duprat created JAMES-1984: - Summary: Accent problem in preview Key: JAMES-1984 URL: https://issues.apache.org/jira/browse/JAMES-1984 Project: James Server Issue Type: Bug Components: JMAP Reporter: Antoine Duprat Assignee: Antoine Duprat The text preview of the mail shows strange characters in place of accents for both *GetMessageList* & *GetMessages* methods (ex.: _é_ instead of _é_) -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
Re: Google Summer of Code Draft Proposal
Hi Shrumit, Sorry to give you feedback so late. You proposal is really excellent. I wouldn't have made "testing" a separated activity (because, you know, TDD, etc) but that looks good and I don't think it needs much details. Keep in mind that the deadline for final Proposal is today, 4 PM UTC. Regards, -- Matthieu Baechler On 04/01/2017 12:44 AM, Shrumit Mehta wrote: Hi All, I've made a SoC Project Proposal for improvements to the security protocols. I would certainly appreciate some feedback. The description and subsequent discussion on this project can be found at https://issues.apache.org/jira/browse/JAMES-1933. The Draft project proposal has been submitted through GSoC's internal system but in ASF's spirit of transparent discussion here's a link to it: https://docs.google.com/document/d/1VXlWxBNN78p6mpQK3C_UbgNfkQ8aeHqCjbVK3gA1vhw/edit?usp=sharing I'd appreciate pointers on anything that I need to include or expand upon. I have read about and understood the general notions behind SPF, DKIM and DMARC protocols. I've also browsed through the code for the first two libraries (jspf and jdkim). My timeline estimates are based on that research. Thanks, Shrumit - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
Re: SoC student application period
Hi all, That's just a follow up of my previous email : final proposal are due for today 4 PM UTC. I know that Shrumit and Shravan already submitted Proposals (either as draft or as final), thank you to them, that's great news. In order to show us your involvement in James project and community, you are supposed to start working with us as soon as possible. The team tagged some easy tickets as "easyfix", it's probably the best way to start with james code and have your contributions merged, so don't hesitate to take some of them. We'll also try to have a chat up and running soon to exchange more easily with you, James is not an easy project, it deserves good communication for successful collaboration. Regards -- Matthieu Baechler On 03/28/2017 09:22 AM, Matthieu Baechler wrote: Hi, I just finished the mentorship registration process for Google Summer of Code. I created earlier 3 JIRAs with a gsoc2017 label : JAMES-1931, JAMES-1932 and JAMES-1933. Some students started looking at these tickets and that's great news. I got help from Benoit on mentoring their James discovery and that's a great thing too. Now, we have to ask students to subscribe to this list and more urgently ask them to apply to GSoC as the application period ends on April 3. I will ask already interested students via JIRA to follow this path but please help me for new people as they are not always in my timezone. Thanks for your help, Any comment appreciated. Cheers, - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org