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 ma...@apache.org on 2015/11/02 14:41:14 UTC

svn commit: r1711967 - in /james/project/trunk/server/data/data-library/src/test: java/org/apache/james/rrt/lib/RewriteTablesStepdefs.java resources/cucumber/rewrite_tables.feature

Author: matthieu
Date: Mon Nov  2 13:41:13 2015
New Revision: 1711967

URL: http://svn.apache.org/viewvc?rev=1711967&view=rev
Log:
JAMES-1594 add tests on address mappings

Modified:
    james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/RewriteTablesStepdefs.java
    james/project/trunk/server/data/data-library/src/test/resources/cucumber/rewrite_tables.feature

Modified: james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/RewriteTablesStepdefs.java
URL: http://svn.apache.org/viewvc/james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/RewriteTablesStepdefs.java?rev=1711967&r1=1711966&r2=1711967&view=diff
==============================================================================
--- james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/RewriteTablesStepdefs.java (original)
+++ james/project/trunk/server/data/data-library/src/test/java/org/apache/james/rrt/lib/RewriteTablesStepdefs.java Mon Nov  2 13:41:13 2015
@@ -48,11 +48,21 @@ public class RewriteTablesStepdefs {
         }
     }
 
+    @Given("store \"([^\"]*)\" address mapping for user \"([^\"]*)\" at domain \"([^\"]*)\"")
+    public void storeAddressMappingForUserAtDomain(String address, String user, String domain) throws Throwable {
+        rewriteTable.addAddressMapping(user, domain, address);
+    }
+
     @When("user \"([^\"]*)\" at domain \"([^\"]*)\" removes a regexp mapping \"([^\"]*)\"")
     public void userAtDomainRemovesRegexpMapping(String user, String domain, String regexp) throws Throwable {
         rewriteTable.removeRegexMapping(user, domain, regexp);
     }
 
+    @When("user \"([^\"]*)\" at domain \"([^\"]*)\" removes a address mapping \"([^\"]*)\"")
+    public void userAtDomainRemovesAddressMapping(String user, String domain, String address) throws Throwable {
+        rewriteTable.removeAddressMapping(user, domain, address);
+    }
+
     @Then("mappings should be empty")
     public void assertMappingsIsEmpty() throws Throwable {
         assertThat(rewriteTable.getAllMappings()).isNullOrEmpty();

Modified: james/project/trunk/server/data/data-library/src/test/resources/cucumber/rewrite_tables.feature
URL: http://svn.apache.org/viewvc/james/project/trunk/server/data/data-library/src/test/resources/cucumber/rewrite_tables.feature?rev=1711967&r1=1711966&r2=1711967&view=diff
==============================================================================
--- james/project/trunk/server/data/data-library/src/test/resources/cucumber/rewrite_tables.feature (original)
+++ james/project/trunk/server/data/data-library/src/test/resources/cucumber/rewrite_tables.feature Mon Nov  2 13:41:13 2015
@@ -28,3 +28,25 @@ Feature: Rewrite Tables tests
   Scenario: storing an invalid regexp mapping should not work
     When store an invalid ".*):" regexp mapping for user "test" at domain "localhost"
     Then a "RecipientRewriteTableException" exception should have been thrown
+
+# Address mapping
+
+  Scenario: stored address mapping should be retrieved when one mapping matching
+    Given store "test@localhost2" address mapping for user "test" at domain "localhost"
+    Then mappings for user "test" at domain "localhost" should contains only "test@localhost2"
+
+  Scenario: stored address mapping should be retrieved when two mappings matching
+    Given store "test@localhost2" address mapping for user "test" at domain "localhost"
+    And store "test@james" address mapping for user "test" at domain "localhost"
+    Then mappings for user "test" at domain "localhost" should contains only "test@localhost2, test@james"
+
+  Scenario: stored address mapping should not be retrieved by another user
+    Given store "test@localhost2" address mapping for user "test" at domain "localhost"
+    And store "test@james" address mapping for user "test" at domain "localhost"
+    Then mappings for user "test2" at domain "localhost" should be empty
+
+  Scenario: removing a stored address mapping should work
+    Given store "test@localhost2" address mapping for user "test" at domain "localhost"
+    And store "test@james" address mapping for user "test" at domain "localhost"
+    When user "test" at domain "localhost" removes a address mapping "test@james"
+    Then mappings for user "test" at domain "localhost" should contains only "test@localhost2"
\ No newline at end of file



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