james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [21/24] james-project git commit: JAMES-2366 Factorize some common constants in JMAP integration tests
Date Fri, 06 Apr 2018 13:20:40 GMT
http://git-wip-us.apache.org/repos/asf/james-project/blob/686a75e1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
index 6213e1a..dacb73d 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
@@ -22,7 +22,10 @@ package org.apache.james.jmap.methods.integration;
 import static com.jayway.restassured.RestAssured.given;
 import static org.apache.james.jmap.HttpJmapAuthentication.authenticateJamesUser;
 import static org.apache.james.jmap.JmapURIBuilder.baseUri;
+import static org.apache.james.jmap.TestingConstants.ALICE;
+import static org.apache.james.jmap.TestingConstants.ALICE_PASSWORD;
 import static org.apache.james.jmap.TestingConstants.ARGUMENTS;
+import static org.apache.james.jmap.TestingConstants.DOMAIN;
 import static org.apache.james.jmap.TestingConstants.NAME;
 import static org.apache.james.jmap.TestingConstants.jmapRequestSpecBuilder;
 import static org.hamcrest.Matchers.equalTo;
@@ -48,9 +51,6 @@ import com.jayway.restassured.RestAssured;
 import com.jayway.restassured.http.ContentType;
 
 public abstract class GetVacationResponseTest {
-    private static final String USERS_DOMAIN = "domain.tld";
-    public static final String USER = "username@" + USERS_DOMAIN;
-    public static final String PASSWORD = "password";
     public static final String SUBJECT = "subject";
     public static final ZonedDateTime DATE_2015 = ZonedDateTime.parse("2015-10-15T14:10:00Z");
     public static final ZonedDateTime DATE_2014 = ZonedDateTime.parse("2014-09-30T14:10:00+02:00");
@@ -79,9 +79,9 @@ public abstract class GetVacationResponseTest {
                 .build();
 
         DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class);
-        dataProbe.addDomain(USERS_DOMAIN);
-        dataProbe.addUser(USER, PASSWORD);
-        accessToken = authenticateJamesUser(baseUri(jmapServer), USER, PASSWORD);
+        dataProbe.addDomain(DOMAIN);
+        dataProbe.addUser(ALICE, ALICE_PASSWORD);
+        accessToken = authenticateJamesUser(baseUri(jmapServer), ALICE, ALICE_PASSWORD);
 
         await();
     }
@@ -105,7 +105,7 @@ public abstract class GetVacationResponseTest {
         .then()
             .statusCode(200)
             .body(NAME, equalTo("vacationResponse"))
-            .body(ARGUMENTS + ".accountId", equalTo(USER))
+            .body(ARGUMENTS + ".accountId", equalTo(ALICE))
             .body(ARGUMENTS + ".list", hasSize(1))
             .body(ARGUMENTS + ".list[0].id", equalTo("singleton"))
             .body(ARGUMENTS + ".list[0].fromDate", nullValue())
@@ -118,7 +118,7 @@ public abstract class GetVacationResponseTest {
 
     @Test
     public void getVacationResponseShouldReturnStoredValue() {
-        jmapGuiceProbe.modifyVacation(AccountId.fromString(USER),
+        jmapGuiceProbe.modifyVacation(AccountId.fromString(ALICE),
             VacationPatch.builder()
                 .isEnabled(true)
                 .fromDate(ZonedDateTime.parse("2014-09-30T14:10:00Z"))
@@ -140,7 +140,7 @@ public abstract class GetVacationResponseTest {
         .then()
             .statusCode(200)
             .body(NAME, equalTo("vacationResponse"))
-            .body(ARGUMENTS + ".accountId", equalTo(USER))
+            .body(ARGUMENTS + ".accountId", equalTo(ALICE))
             .body(ARGUMENTS + ".list", hasSize(1))
             .body(ARGUMENTS + ".list[0].id", equalTo("singleton"))
             .body(ARGUMENTS + ".list[0].fromDate", equalTo("2014-09-30T14:10:00Z"))
@@ -153,7 +153,7 @@ public abstract class GetVacationResponseTest {
 
     @Test
     public void getVacationResponseShouldReturnStoredValueWithNonDefaultTimezone() {
-        jmapGuiceProbe.modifyVacation(AccountId.fromString(USER),
+        jmapGuiceProbe.modifyVacation(AccountId.fromString(ALICE),
             VacationPatch.builder()
                 .isEnabled(true)
                 .fromDate(ZonedDateTime.parse("2014-09-30T14:10:00+02:00"))
@@ -173,7 +173,7 @@ public abstract class GetVacationResponseTest {
         .then()
             .statusCode(200)
             .body(NAME, equalTo("vacationResponse"))
-            .body(ARGUMENTS + ".accountId", equalTo(USER))
+            .body(ARGUMENTS + ".accountId", equalTo(ALICE))
             .body(ARGUMENTS + ".list", hasSize(1))
             .body(ARGUMENTS + ".list[0].id", equalTo("singleton"))
             .body(ARGUMENTS + ".list[0].fromDate", equalTo("2014-09-30T14:10:00+02:00"))
@@ -184,7 +184,7 @@ public abstract class GetVacationResponseTest {
 
     @Test
     public void getVacationResponseShouldReturnIsActivatedWhenInRange() {
-        jmapGuiceProbe.modifyVacation(AccountId.fromString(USER),
+        jmapGuiceProbe.modifyVacation(AccountId.fromString(ALICE),
             VacationPatch.builder()
                 .isEnabled(true)
                 .fromDate(DATE_2014)
@@ -213,7 +213,7 @@ public abstract class GetVacationResponseTest {
     public void getVacationResponseShouldNotReturnIsActivatedWhenOutOfRange() {
         fixedDateZonedDateTimeProvider.setFixedDateTime(DATE_2014);
 
-        jmapGuiceProbe.modifyVacation(AccountId.fromString(USER),
+        jmapGuiceProbe.modifyVacation(AccountId.fromString(ALICE),
             VacationPatch.builder()
                 .isEnabled(true)
                 .fromDate(DATE_2015)
@@ -240,7 +240,7 @@ public abstract class GetVacationResponseTest {
 
     @Test
     public void accountIdIsNotSupported() {
-        jmapGuiceProbe.modifyVacation(AccountId.fromString(USER),
+        jmapGuiceProbe.modifyVacation(AccountId.fromString(ALICE),
             VacationPatch.builder()
                 .isEnabled(true)
                 .fromDate(ZonedDateTime.parse("2014-09-30T14:10:00+02:00"))

http://git-wip-us.apache.org/repos/asf/james-project/blob/686a75e1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SendMDNMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SendMDNMethodTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SendMDNMethodTest.java
index 14da500..e283bd4 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SendMDNMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SendMDNMethodTest.java
@@ -28,6 +28,7 @@ import static org.apache.james.jmap.JmapCommonRequests.listMessageIdsForAccount;
 import static org.apache.james.jmap.JmapCommonRequests.listMessageIdsInMailbox;
 import static org.apache.james.jmap.JmapURIBuilder.baseUri;
 import static org.apache.james.jmap.TestingConstants.ARGUMENTS;
+import static org.apache.james.jmap.TestingConstants.DOMAIN;
 import static org.apache.james.jmap.TestingConstants.NAME;
 import static org.apache.james.jmap.TestingConstants.calmlyAwait;
 import static org.apache.james.jmap.TestingConstants.jmapRequestSpecBuilder;
@@ -66,9 +67,8 @@ import com.jayway.restassured.RestAssured;
 import com.jayway.restassured.parsing.Parser;
 
 public abstract class SendMDNMethodTest {
-    private static final String USERS_DOMAIN = "domain.tld";
-    private static final String HOMER = "homer@" + USERS_DOMAIN;
-    private static final String BART = "bart@" + USERS_DOMAIN;
+    private static final String HOMER = "homer@" + DOMAIN;
+    private static final String BART = "bart@" + DOMAIN;
     private static final String PASSWORD = "password";
     private static final String BOB_PASSWORD = "bobPassword";
 
@@ -92,7 +92,7 @@ public abstract class SendMDNMethodTest {
                 .build();
         RestAssured.defaultParser = Parser.JSON;
 
-        dataProbe.addDomain(USERS_DOMAIN);
+        dataProbe.addDomain(DOMAIN);
         dataProbe.addUser(HOMER, PASSWORD);
         dataProbe.addUser(BART, BOB_PASSWORD);
         mailboxProbe.createMailbox("#private", HOMER, DefaultMailboxes.INBOX);

http://git-wip-us.apache.org/repos/asf/james-project/blob/686a75e1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
index 151707e..e874467 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
@@ -24,6 +24,7 @@ import static com.jayway.restassured.RestAssured.with;
 import static org.apache.james.jmap.HttpJmapAuthentication.authenticateJamesUser;
 import static org.apache.james.jmap.JmapURIBuilder.baseUri;
 import static org.apache.james.jmap.TestingConstants.ARGUMENTS;
+import static org.apache.james.jmap.TestingConstants.DOMAIN;
 import static org.apache.james.jmap.TestingConstants.FIRST_MAILBOX;
 import static org.apache.james.jmap.TestingConstants.NAME;
 import static org.apache.james.jmap.TestingConstants.jmapRequestSpecBuilder;
@@ -69,8 +70,6 @@ import com.jayway.restassured.RestAssured;
 
 public abstract class SetMailboxesMethodTest {
 
-    private static final String USERS_DOMAIN = "domain.tld";
-
     private static final String ADMINISTER = String.valueOf(Right.Administer.asCharacter());
     private static final String WRITE = String.valueOf(Right.Write.asCharacter());
     private static final String DELETE_MESSAGES = String.valueOf(Right.DeleteMessages.asCharacter());
@@ -99,9 +98,9 @@ public abstract class SetMailboxesMethodTest {
                 .build();
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
 
-        username = "username@" + USERS_DOMAIN;
+        username = "username@" + DOMAIN;
         String password = "password";
-        dataProbe.addDomain(USERS_DOMAIN);
+        dataProbe.addDomain(DOMAIN);
         dataProbe.addUser(username, password);
         inboxId = mailboxProbe.createMailbox("#private", username, DefaultMailboxes.INBOX);
         accessToken = authenticateJamesUser(baseUri(jmapServer), username, password);
@@ -1177,7 +1176,7 @@ public abstract class SetMailboxesMethodTest {
                 "    {" +
                 "      \"update\": {" +
                 "        \"" + mailboxId.serialize() + "\" : {" +
-                "          \"sharedWith\" : {\"user@" + USERS_DOMAIN + "\": [\"a\", \"w\"]}"
+
+                "          \"sharedWith\" : {\"user@" + DOMAIN + "\": [\"a\", \"w\"]}" +
                 "        }" +
                 "      }" +
                 "    }," +
@@ -1286,7 +1285,7 @@ public abstract class SetMailboxesMethodTest {
     @Test
     public void updateShouldApplyWhenSettingNewACL() {
         String myBox = "myBox";
-        String user = "user@" + USERS_DOMAIN;
+        String user = "user@" + DOMAIN;
         MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
username, myBox);
         String requestBody =
             "[" +
@@ -1322,7 +1321,7 @@ public abstract class SetMailboxesMethodTest {
     @Test
     public void updateShouldModifyStoredDataWhenUpdatingACL() {
         String myBox = "myBox";
-        String user = "user@" + USERS_DOMAIN;
+        String user = "user@" + DOMAIN;
         MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
username, myBox);
 
         with()
@@ -1422,8 +1421,8 @@ public abstract class SetMailboxesMethodTest {
     @Test
     public void updateShouldModifyStoredDataWhenSwitchingACLUser() {
         String myBox = "myBox";
-        String user1 = "user1@" + USERS_DOMAIN;
-        String user2 = "user2@" + USERS_DOMAIN;
+        String user1 = "user1@" + DOMAIN;
+        String user2 = "user2@" + DOMAIN;
         MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
username, myBox);
 
         with()
@@ -2122,7 +2121,7 @@ public abstract class SetMailboxesMethodTest {
                 "    {" +
                 "      \"update\": {" +
                 "        \"" + inboxId.serialize() + "\" : {" +
-                "          \"sharedWith\" : {\"user@" + USERS_DOMAIN + "\": [\"a\", \"w\"]}"
+
+                "          \"sharedWith\" : {\"user@" + DOMAIN + "\": [\"a\", \"w\"]}" +
                 "        }" +
                 "      }" +
                 "    }," +
@@ -2150,7 +2149,7 @@ public abstract class SetMailboxesMethodTest {
                 "    {" +
                 "      \"update\": {" +
                 "        \"" + outboxId.serialize() + "\" : {" +
-                "          \"sharedWith\" : {\"user@" + USERS_DOMAIN + "\": [\"a\", \"w\"]}"
+
+                "          \"sharedWith\" : {\"user@" + DOMAIN + "\": [\"a\", \"w\"]}" +
                 "        }" +
                 "      }" +
                 "    }," +
@@ -2181,7 +2180,7 @@ public abstract class SetMailboxesMethodTest {
                 "    {" +
                 "      \"update\": {" +
                 "        \"" + draftId.serialize() + "\" : {" +
-                "          \"sharedWith\" : {\"user@" + USERS_DOMAIN + "\": [\"a\", \"w\"]}"
+
+                "          \"sharedWith\" : {\"user@" + DOMAIN + "\": [\"a\", \"w\"]}" +
                 "        }" +
                 "      }" +
                 "    }," +

http://git-wip-us.apache.org/repos/asf/james-project/blob/686a75e1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
index 074a820..0c2a08c 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
@@ -23,10 +23,18 @@ import static com.jayway.restassured.RestAssured.given;
 import static com.jayway.restassured.RestAssured.with;
 import static com.jayway.restassured.config.EncoderConfig.encoderConfig;
 import static com.jayway.restassured.config.RestAssuredConfig.newConfig;
+import static org.apache.james.jmap.TestingConstants.ALICE;
+import static org.apache.james.jmap.TestingConstants.ALICE_PASSWORD;
 import static org.apache.james.jmap.TestingConstants.ARGUMENTS;
+import static org.apache.james.jmap.TestingConstants.BOB;
+import static org.apache.james.jmap.TestingConstants.BOB_PASSWORD;
+import static org.apache.james.jmap.TestingConstants.DOMAIN;
+import static org.apache.james.jmap.TestingConstants.IMAP_PORT;
+import static org.apache.james.jmap.TestingConstants.LOCALHOST_IP;
 import static org.apache.james.jmap.TestingConstants.NAME;
 import static org.apache.james.jmap.TestingConstants.SECOND_ARGUMENTS;
 import static org.apache.james.jmap.TestingConstants.SECOND_NAME;
+import static org.apache.james.jmap.TestingConstants.SMTP_PORT;
 import static org.apache.james.jmap.TestingConstants.calmlyAwait;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.hamcrest.Matchers.contains;
@@ -118,16 +126,10 @@ import com.jayway.restassured.parsing.Parser;
 import com.jayway.restassured.specification.ResponseSpecification;
 
 public abstract class SetMessagesMethodTest {
-    private static final String LOCALHOST_IP = "127.0.0.1";
-    private static final int SMTP_PORT = 1025;
-    private static final int IMAP_PORT = 1143;
     private static final String FORWARDED = "$Forwarded";
     private static final int _1MB = 1024 * 1024;
-    private static final String USERS_DOMAIN = "domain.tld";
-    private static final String USERNAME = "username@" + USERS_DOMAIN;
-    private static final String BOB = "bob@" + USERS_DOMAIN;
+    private static final String USERNAME = "username@" + DOMAIN;
     private static final String PASSWORD = "password";
-    private static final String BOB_PASSWORD = "bobPassword";
     private static final MailboxPath USER_MAILBOX = MailboxPath.forUser(USERNAME, "mailbox");
     private static final String NOT_UPDATED = ARGUMENTS + ".notUpdated";
 
@@ -164,7 +166,7 @@ public abstract class SetMessagesMethodTest {
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
         RestAssured.defaultParser = Parser.JSON;
 
-        dataProbe.addDomain(USERS_DOMAIN);
+        dataProbe.addDomain(DOMAIN);
         dataProbe.addUser(USERNAME, PASSWORD);
         dataProbe.addUser(BOB, BOB_PASSWORD);
         mailboxProbe.createMailbox("#private", USERNAME, DefaultMailboxes.INBOX);
@@ -1218,11 +1220,10 @@ public abstract class SetMessagesMethodTest {
 
     @Test
     public void setMessagesShouldReturnErrorWhenUserIsNotTheOwnerOfOneOfTheMailboxes() throws
Exception {
-        String alice = "alice@" + USERS_DOMAIN;
-        dataProbe.addUser(alice, "alicepassword");
-        MailboxId aliceOutbox = mailboxProbe.createMailbox("#private", alice, DefaultMailboxes.OUTBOX);
+        dataProbe.addUser(ALICE, ALICE_PASSWORD);
+        MailboxId aliceOutbox = mailboxProbe.createMailbox("#private", ALICE, DefaultMailboxes.OUTBOX);
 
-        aclProbe.replaceRights(MailboxPath.forUser(alice, DefaultMailboxes.OUTBOX), USERNAME,
MailboxACL.FULL_RIGHTS);
+        aclProbe.replaceRights(MailboxPath.forUser(ALICE, DefaultMailboxes.OUTBOX), USERNAME,
MailboxACL.FULL_RIGHTS);
 
         String messageCreationId = "creationId1337";
         String fromAddress = USERNAME;
@@ -2712,7 +2713,7 @@ public abstract class SetMessagesMethodTest {
     public void setMessagesShouldDeliverMessageToRecipient() throws Exception {
         // Sender
         // Recipient
-        String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
+        String recipientAddress = "recipient" + "@" + DOMAIN;
         String password = "password";
         dataProbe.addUser(recipientAddress, password);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
@@ -2758,7 +2759,7 @@ public abstract class SetMessagesMethodTest {
 
         MessageAppender.fillMailbox(mailboxProbe, USERNAME, MailboxConstants.INBOX);
 
-        String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
+        String recipientAddress = "recipient" + "@" + DOMAIN;
         String password = "password";
         dataProbe.addUser(recipientAddress, password);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
@@ -2803,7 +2804,7 @@ public abstract class SetMessagesMethodTest {
     @Test
     public void setMessagesShouldStripBccFromDeliveredEmail() throws Exception {
         // Recipient
-        String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
+        String recipientAddress = "recipient" + "@" + DOMAIN;
         String bccRecipient = BOB;
         String password = "password";
         dataProbe.addUser(recipientAddress, password);
@@ -2860,7 +2861,7 @@ public abstract class SetMessagesMethodTest {
         String sentMailboxId = getMailboxId(accessToken, Role.SENT);
 
         // Recipient
-        String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
+        String recipientAddress = "recipient" + "@" + DOMAIN;
         String password = "password";
         dataProbe.addUser(recipientAddress, password);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
@@ -2875,7 +2876,7 @@ public abstract class SetMessagesMethodTest {
             "      \"create\": { \"" + messageCreationId  + "\" : {" +
             "        \"from\": { \"email\": \"" + fromAddress + "\"}," +
             "        \"to\": [{ \"name\": \"recipient\", \"email\": \"" + recipientAddress
+ "\"}]," +
-            "        \"bcc\": [{ \"name\": \"BOB\", \"email\": \"bob@" + USERS_DOMAIN + "\"
}]," +
+            "        \"bcc\": [{ \"name\": \"BOB\", \"email\": \"bob@" + DOMAIN + "\" }],"
+
             "        \"cc\": [{ \"name\": \"ALICE\"}]," +
             "        \"subject\": \"Thank you for joining example.com!\"," +
             "        \"textBody\": \"Hello someone, and thank you for joining example.com!\","
+
@@ -2914,7 +2915,7 @@ public abstract class SetMessagesMethodTest {
         // Sender
 
         // Recipient
-        String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
+        String recipientAddress = "recipient" + "@" + DOMAIN;
         String password = "password";
         dataProbe.addUser(recipientAddress, password);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
@@ -2988,7 +2989,7 @@ public abstract class SetMessagesMethodTest {
     @Test
     public void setMessagesShouldSendAReadableHtmlMessage() throws Exception {
         // Recipient
-        String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
+        String recipientAddress = "recipient" + "@" + DOMAIN;
         String password = "password";
         dataProbe.addUser(recipientAddress, password);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
@@ -3028,7 +3029,7 @@ public abstract class SetMessagesMethodTest {
 
     @Test
     public void setMessagesWhenSavingToDraftsShouldNotSendMessage() throws Exception {
-        String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
+        String recipientAddress = "recipient" + "@" + DOMAIN;
         String recipientPassword = "password";
         dataProbe.addUser(recipientAddress, recipientPassword);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
@@ -3075,7 +3076,7 @@ public abstract class SetMessagesMethodTest {
     public void setMessagesWhenSavingToRegularMailboxShouldNotSendMessage() throws Exception
{
         String sender = USERNAME;
         MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
sender, "regular");
-        String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
+        String recipientAddress = "recipient" + "@" + DOMAIN;
         String recipientPassword = "password";
         dataProbe.addUser(recipientAddress, recipientPassword);
         await();
@@ -3135,7 +3136,7 @@ public abstract class SetMessagesMethodTest {
     @Test
     public void setMessagesShouldSendAReadableTextPlusHtmlMessage() throws Exception {
         // Recipient
-        String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
+        String recipientAddress = "recipient" + "@" + DOMAIN;
         String password = "password";
         dataProbe.addUser(recipientAddress, password);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);
@@ -4370,7 +4371,7 @@ public abstract class SetMessagesMethodTest {
     
     @Test
     public void setMessagesShouldVerifyHeaderOfMessageInInbox() throws Exception {
-        String toUsername = "username1@" + USERS_DOMAIN;
+        String toUsername = "username1@" + DOMAIN;
         String password = "password";
         dataProbe.addUser(toUsername, password);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, toUsername, DefaultMailboxes.INBOX);
@@ -4407,7 +4408,7 @@ public abstract class SetMessagesMethodTest {
 
     @Test
     public void setMessagesShouldVerifyHeaderOfMessageInSent() throws Exception {
-        String toUsername = "username1@" + USERS_DOMAIN;
+        String toUsername = "username1@" + DOMAIN;
         String password = "password";
         dataProbe.addUser(toUsername, password);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, toUsername, DefaultMailboxes.INBOX);
@@ -4870,7 +4871,7 @@ public abstract class SetMessagesMethodTest {
 
     @Test
     public void setMessagesShouldSetUserAddedHeadersInSent() throws Exception {
-        String toUsername = "username1@" + USERS_DOMAIN;
+        String toUsername = "username1@" + DOMAIN;
         String password = "password";
         dataProbe.addUser(toUsername, password);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, toUsername, DefaultMailboxes.INBOX);
@@ -5387,7 +5388,7 @@ public abstract class SetMessagesMethodTest {
             .sender(fromAddress)
             .recipient(fromAddress)
             .build();
-        try (SMTPMessageSender messageSender = SMTPMessageSender.noAuthentication(LOCALHOST_IP,
SMTP_PORT, USERS_DOMAIN)) {
+        try (SMTPMessageSender messageSender = SMTPMessageSender.noAuthentication(LOCALHOST_IP,
SMTP_PORT, DOMAIN)) {
             messageSender.sendMessage(mail);
             calmlyAwait.atMost(Duration.ONE_MINUTE).until(messageSender::messageHasBeenSent);
         }
@@ -5428,7 +5429,7 @@ public abstract class SetMessagesMethodTest {
         String sentMailboxId = getMailboxId(accessToken, Role.SENT);
 
         // Recipient
-        String recipientAddress = "recipient" + "@" + USERS_DOMAIN;
+        String recipientAddress = "recipient" + "@" + DOMAIN;
         String password = "password";
         dataProbe.addUser(recipientAddress, password);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, recipientAddress, DefaultMailboxes.INBOX);

http://git-wip-us.apache.org/repos/asf/james-project/blob/686a75e1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
index a0bd93e..22eacc8 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
@@ -23,6 +23,7 @@ import static com.jayway.restassured.RestAssured.given;
 import static org.apache.james.jmap.HttpJmapAuthentication.authenticateJamesUser;
 import static org.apache.james.jmap.JmapURIBuilder.baseUri;
 import static org.apache.james.jmap.TestingConstants.ARGUMENTS;
+import static org.apache.james.jmap.TestingConstants.DOMAIN;
 import static org.apache.james.jmap.TestingConstants.NAME;
 import static org.apache.james.jmap.TestingConstants.jmapRequestSpecBuilder;
 import static org.assertj.core.api.Assertions.assertThat;
@@ -48,8 +49,7 @@ import com.jayway.restassured.http.ContentType;
 
 public abstract class SetVacationResponseTest {
 
-    private static final String USERS_DOMAIN = "domain.tld";
-    public static final String USER = "username@" + USERS_DOMAIN;
+    public static final String USER = "username@" + DOMAIN;
     public static final String PASSWORD = "password";
     public static final String SUBJECT = "subject";
     private JmapGuiceProbe jmapGuiceProbe;
@@ -70,7 +70,7 @@ public abstract class SetVacationResponseTest {
                 .setPort(jmapGuiceProbe.getJmapPort())
                 .build();
 
-        jmapServer.getProbe(DataProbeImpl.class).addDomain(USERS_DOMAIN);
+        jmapServer.getProbe(DataProbeImpl.class).addDomain(DOMAIN);
         jmapServer.getProbe(DataProbeImpl.class).addUser(USER, PASSWORD);
         accessToken = authenticateJamesUser(baseUri(jmapServer), USER, PASSWORD);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/686a75e1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SpamAssassinContract.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SpamAssassinContract.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SpamAssassinContract.java
index fc1222b..5326b43 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SpamAssassinContract.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SpamAssassinContract.java
@@ -26,6 +26,8 @@ import static com.jayway.restassured.config.RestAssuredConfig.newConfig;
 import static org.apache.james.jmap.HttpJmapAuthentication.authenticateJamesUser;
 import static org.apache.james.jmap.JmapURIBuilder.baseUri;
 import static org.apache.james.jmap.TestingConstants.ARGUMENTS;
+import static org.apache.james.jmap.TestingConstants.IMAP_PORT;
+import static org.apache.james.jmap.TestingConstants.LOCALHOST_IP;
 import static org.apache.james.jmap.TestingConstants.NAME;
 import static org.apache.james.jmap.TestingConstants.calmlyAwait;
 import static org.hamcrest.Matchers.equalTo;
@@ -60,8 +62,6 @@ public interface SpamAssassinContract {
     String ALICE_PASSWORD = "alicePassword";
     String PAUL = "paul@" + RECIPIENTS_DOMAIN;
     String PAUL_PASSWORD = "paulPassword";
-    String LOCALHOST = "127.0.0.1";
-    int IMAP_PORT = 1143;
 
     @BeforeEach
     default void setup(JamesWithSpamAssassin james) throws Throwable {
@@ -162,7 +162,7 @@ public interface SpamAssassinContract {
             .path(ARGUMENTS + ".messageIds");
 
         try (IMAPMessageReader imapMessageReader = new IMAPMessageReader()) {
-            imapMessageReader.connect(LOCALHOST, IMAP_PORT)
+            imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
                 .login(ALICE, ALICE_PASSWORD)
                 .select(IMAPMessageReader.INBOX);
 
@@ -209,7 +209,7 @@ public interface SpamAssassinContract {
             .path(ARGUMENTS + ".messageIds");
 
         try (IMAPMessageReader imapMessageReader = new IMAPMessageReader()) {
-            imapMessageReader.connect(LOCALHOST, IMAP_PORT)
+            imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
                 .login(ALICE, ALICE_PASSWORD)
                 .select(IMAPMessageReader.INBOX);
 
@@ -395,7 +395,7 @@ public interface SpamAssassinContract {
 
         // Alice is moving this message out of Spam -> forgetting in SpamAssassin
         try (IMAPMessageReader imapMessageReader = new IMAPMessageReader()) {
-            imapMessageReader.connect(LOCALHOST, IMAP_PORT)
+            imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
                 .login(ALICE, ALICE_PASSWORD)
                 .select("Spam");
 
@@ -455,7 +455,7 @@ public interface SpamAssassinContract {
 
         // Alice is deleting this message
         try (IMAPMessageReader imapMessageReader = new IMAPMessageReader()) {
-            imapMessageReader.connect(LOCALHOST, IMAP_PORT)
+            imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
                 .login(ALICE, ALICE_PASSWORD)
                 .select("Spam");
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/686a75e1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ImapStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ImapStepdefs.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ImapStepdefs.java
index 0b28b97..15ac827 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ImapStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/ImapStepdefs.java
@@ -19,6 +19,8 @@
 
 package org.apache.james.jmap.methods.integration.cucumber;
 
+import static org.apache.james.jmap.TestingConstants.IMAP_PORT;
+import static org.apache.james.transport.mailets.remote.delivery.HeloNameProvider.LOCALHOST;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import java.util.Map;
@@ -37,10 +39,6 @@ import cucumber.runtime.java.guice.ScenarioScoped;
 
 @ScenarioScoped
 public class ImapStepdefs {
-
-    private static final int IMAP_PORT = 1143;
-    private static final String LOCALHOST = "127.0.0.1";
-
     private final UserStepdefs userStepdefs;
     private final MainStepdefs mainStepdefs;
     private final Map<String, IMAPMessageReader> imapConnections;


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


Mime
View raw message