You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2017/04/20 00:48:36 UTC

[1/3] james-project git commit: MPT-37 Correct maven error about reserved names

Repository: james-project
Updated Branches:
  refs/heads/master abfce0e5f -> b0d35b70b


MPT-37 Correct maven error about reserved names


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/06b6e480
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/06b6e480
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/06b6e480

Branch: refs/heads/master
Commit: 06b6e48022f3a982fccba6f9cf5c99252981fcaa
Parents: abfce0e
Author: benwa <bt...@linagora.com>
Authored: Tue Apr 18 11:18:55 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Thu Apr 20 07:46:52 2017 +0700

----------------------------------------------------------------------
 mpt/mavenplugin/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/06b6e480/mpt/mavenplugin/pom.xml
----------------------------------------------------------------------
diff --git a/mpt/mavenplugin/pom.xml b/mpt/mavenplugin/pom.xml
index 52f29c4..7b71879 100644
--- a/mpt/mavenplugin/pom.xml
+++ b/mpt/mavenplugin/pom.xml
@@ -27,7 +27,7 @@
         <relativePath>../pom.xml</relativePath>
     </parent>
 
-    <artifactId>maven-mpt-plugin</artifactId>
+    <artifactId>mpt-maven-plugin</artifactId>
     <packaging>maven-plugin</packaging>
 
     <name>Apache James MPT Maven2 Plugin</name>


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


[2/3] james-project git commit: JAMES-1904 Increase test coverage on XMLDomainList

Posted by bt...@apache.org.
JAMES-1904 Increase test coverage on XMLDomainList


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/3e5a16d4
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/3e5a16d4
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/3e5a16d4

Branch: refs/heads/master
Commit: 3e5a16d405c0ee4dbd353fb7c91698f33cf9528a
Parents: 06b6e48
Author: Antoine Duprat <ad...@linagora.com>
Authored: Wed Apr 19 13:47:49 2017 +0200
Committer: benwa <bt...@linagora.com>
Committed: Thu Apr 20 07:47:38 2017 +0700

----------------------------------------------------------------------
 .../james/domainlist/xml/XMLDomainListTest.java | 34 ++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/3e5a16d4/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java b/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
index 5d14c11..15a07ff 100644
--- a/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
+++ b/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
@@ -29,11 +29,17 @@ import org.apache.commons.configuration.DefaultConfigurationBuilder;
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.mock.MockDNSService;
+import org.apache.james.domainlist.api.DomainListException;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 import org.slf4j.LoggerFactory;
 
 public class XMLDomainListTest {
 
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
+    
     private HierarchicalConfiguration setUpConfiguration(boolean auto, boolean autoIP, List<String> names) {
         DefaultConfigurationBuilder configuration = new DefaultConfigurationBuilder();
 
@@ -117,4 +123,32 @@ public class XMLDomainListTest {
 
         assertThat(dom.getDomains()).describedAs("One domain found").hasSize(1);
     }
+
+    @Test
+    public void addDomainShouldFailWhenAlreadyConfigured() throws Exception {
+        expectedException.expect(DomainListException.class);
+
+        List<String> domains = new ArrayList<String>();
+        domains.add("domain1");
+
+        XMLDomainList testee = new XMLDomainList();
+        testee.setLog(LoggerFactory.getLogger("MockLog"));
+        testee.configure(setUpConfiguration(true, false, domains));
+
+        testee.addDomain("newDomain");
+    }
+
+    @Test
+    public void removeDomainShouldFailWhenAlreadyConfigured() throws Exception {
+        expectedException.expect(DomainListException.class);
+
+        List<String> domains = new ArrayList<String>();
+        domains.add("domain1");
+
+        XMLDomainList testee = new XMLDomainList();
+        testee.setLog(LoggerFactory.getLogger("MockLog"));
+        testee.configure(setUpConfiguration(true, false, domains));
+
+        testee.removeDomain("newDomain");
+    }
 }


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


[3/3] james-project git commit: JAMES-1904 Default domain should be created with XMLDomainList

Posted by bt...@apache.org.
JAMES-1904 Default domain should be created with XMLDomainList


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/b0d35b70
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/b0d35b70
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/b0d35b70

Branch: refs/heads/master
Commit: b0d35b70bcefd27ba7f46627183a7758bdc20408
Parents: 3e5a16d
Author: Antoine Duprat <ad...@linagora.com>
Authored: Wed Apr 19 14:17:14 2017 +0200
Committer: benwa <bt...@linagora.com>
Committed: Thu Apr 20 07:47:38 2017 +0700

----------------------------------------------------------------------
 .../james/domainlist/xml/XMLDomainList.java     | 24 +++++++++++++-------
 .../james/domainlist/xml/XMLDomainListTest.java | 17 ++++++++++++++
 2 files changed, 33 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/b0d35b70/server/data/data-file/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java b/server/data/data-file/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java
index 1fd705a..34376a9 100644
--- a/server/data/data-file/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java
+++ b/server/data/data-file/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java
@@ -19,18 +19,18 @@
 
 package org.apache.james.domainlist.xml;
 
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.james.domainlist.api.DomainListException;
-import org.apache.james.domainlist.lib.AbstractDomainList;
-import org.apache.james.lifecycle.api.Configurable;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 
 import javax.inject.Singleton;
 
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.james.domainlist.api.DomainListException;
+import org.apache.james.domainlist.lib.AbstractDomainList;
+import org.apache.james.lifecycle.api.Configurable;
+
 /**
  * Mimic the old behavior of JAMES
  */
@@ -38,6 +38,7 @@ import javax.inject.Singleton;
 public class XMLDomainList extends AbstractDomainList implements Configurable {
 
     private final List<String> domainNames = new ArrayList<String>();
+    private boolean isConfigured = false;
 
     @Override
     public void configure(HierarchicalConfiguration config) throws ConfigurationException {
@@ -49,6 +50,7 @@ public class XMLDomainList extends AbstractDomainList implements Configurable {
                 throw new ConfigurationException("Unable to add domain to memory", e);
             }
         }
+        isConfigured = true;
     }
 
     @Override
@@ -63,12 +65,18 @@ public class XMLDomainList extends AbstractDomainList implements Configurable {
 
     @Override
     public void addDomain(String domain) throws DomainListException {
-        throw new DomainListException("Read-Only DomainList implementation");
+        if (isConfigured) {
+            throw new DomainListException("Read-Only DomainList implementation");
+        }
+        domainNames.add(domain);
     }
 
     @Override
     public void removeDomain(String domain) throws DomainListException {
-        throw new DomainListException("Read-Only DomainList implementation");
+        if (isConfigured) {
+            throw new DomainListException("Read-Only DomainList implementation");
+        }
+        domainNames.remove(domain);
     }
 
     private void addToServedDomains(String domain) throws DomainListException {

http://git-wip-us.apache.org/repos/asf/james-project/blob/b0d35b70/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java b/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
index 15a07ff..d8412a8 100644
--- a/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
+++ b/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
@@ -48,6 +48,7 @@ public class XMLDomainListTest {
         for (String name : names) {
             configuration.addProperty("domainnames.domainname", name);
         }
+        configuration.addProperty("defaultDomain", "default.domain");
         return configuration;
     }
 
@@ -151,4 +152,20 @@ public class XMLDomainListTest {
 
         testee.removeDomain("newDomain");
     }
+
+    @Test
+    public void configureShouldNotFailWhenConfiguringDefaultDomain() throws Exception {
+        DefaultConfigurationBuilder configuration = new DefaultConfigurationBuilder();
+
+        configuration.addProperty("autodetect", true);
+        configuration.addProperty("autodetectIP", false);
+        configuration.addProperty("domainnames.domainname", "domain1");
+        configuration.addProperty("defaultDomain", "localhost");
+
+        XMLDomainList testee = new XMLDomainList();
+        testee.setLog(LoggerFactory.getLogger("MockLog"));
+        testee.configure(configuration);
+
+        assertThat(testee.getDomainListInternal()).hasSize(2);
+    }
 }


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