JAMES-1759 Integration tests for user mailboxes CRUD operations

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

Branch: refs/heads/master
Commit: a1b8aea9b11630f6164dc090aa4a6eb9442915c9
Parents: abdd0a9
Author: Benoit Tellier <[email protected]>
Authored: Wed Jun 22 12:01:47 2016 +0700
Committer: Benoit Tellier <[email protected]>
Committed: Thu Jun 23 16:31:27 2016 +0700

----------------------------------------------------------------------
 .../WebAdminServerIntegrationTest.java          | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a1b8aea9/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
index d720623..f168704 100644
--- 
a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
+++ 
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
@@ -33,6 +33,7 @@ import org.apache.james.backends.cassandra.EmbeddedCassandra;
 import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
 import org.apache.james.modules.CassandraJmapServerModule;
 import org.apache.james.webadmin.routes.DomainRoutes;
+import org.apache.james.webadmin.routes.UserMailboxesRoutes;
 import org.apache.james.webadmin.routes.UserRoutes;
 import org.junit.After;
 import org.junit.Before;
@@ -51,6 +52,8 @@ public class WebAdminServerIntegrationTest {
     public static final String USERNAME = "username@" + DOMAIN;
     public static final String SPECIFIC_DOMAIN = DomainRoutes.DOMAINS + 
SEPARATOR + DOMAIN;
     public static final String SPECIFIC_USER = UserRoutes.USERS + SEPARATOR + 
USERNAME;
+    public static final String MAILBOX = "mailbox";
+    public static final String SPECIFIC_MAILBOX = SPECIFIC_USER + SEPARATOR + 
UserMailboxesRoutes.MAILBOXES + SEPARATOR + MAILBOX;
 
     private TemporaryFolder temporaryFolder = new TemporaryFolder();
     private EmbeddedElasticSearch embeddedElasticSearch = new 
EmbeddedElasticSearch(temporaryFolder);
@@ -146,4 +149,33 @@ public class WebAdminServerIntegrationTest {
             .body(is("[{\"username\":\"username@domain\"}]"));
     }
 
+    @Test
+    public void putMailboxShouldAddAMailbox() throws Exception {
+        guiceJamesServer.serverProbe().addDomain(DOMAIN);
+        guiceJamesServer.serverProbe().addUser(USERNAME, "anyPassword");
+
+        when()
+            .put(SPECIFIC_MAILBOX)
+        .then()
+            .statusCode(204);
+
+        
assertThat(guiceJamesServer.serverProbe().listUserMailboxes(USERNAME)).containsExactly(MAILBOX);
+    }
+
+
+
+    @Test
+    public void deleteMailboxShouldRemoveAMailbox() throws Exception {
+        guiceJamesServer.serverProbe().addDomain(DOMAIN);
+        guiceJamesServer.serverProbe().addUser(USERNAME, "anyPassword");
+        guiceJamesServer.serverProbe().createMailbox("#private", USERNAME, 
MAILBOX);
+
+        when()
+            .delete(SPECIFIC_MAILBOX)
+        .then()
+            .statusCode(204);
+
+        
assertThat(guiceJamesServer.serverProbe().listUserMailboxes(USERNAME)).isEmpty();
+    }
+
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to