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 2019/12/19 10:38:47 UTC

[james-project] 13/14: JAMES-3012 Strong type for JMAP port

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 8f8ab3a91f339f39390dc01c3836b092850ad50b
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Dec 18 11:20:10 2019 +0700

    JAMES-3012 Strong type for JMAP port
---
 .../src/test/java/org/apache/james/ESReporterTest.java               | 2 +-
 .../src/main/java/org/apache/james/jmap/draft/JmapGuiceProbe.java    | 3 ++-
 .../java/org/apache/james/jmap/draft/JmapJamesServerContract.java    | 2 +-
 .../org/apache/james/jmap/cassandra/CassandraBulkOperationTest.java  | 2 +-
 .../java/org/apache/james/jmap/cassandra/CassandraImapErrorTest.java | 2 +-
 .../src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java  | 2 +-
 .../src/test/java/org/apache/james/jmap/JmapURIBuilder.java          | 2 +-
 .../src/test/java/org/apache/james/jmap/ProvisioningTest.java        | 2 +-
 .../src/test/java/org/apache/james/jmap/VacationIntegrationTest.java | 2 +-
 .../org/apache/james/jmap/draft/methods/integration/FilterTest.java  | 2 +-
 .../james/jmap/draft/methods/integration/GetMailboxesMethodTest.java | 2 +-
 .../jmap/draft/methods/integration/GetMessageListMethodTest.java     | 2 +-
 .../jmap/draft/methods/integration/GetVacationResponseTest.java      | 2 +-
 .../james/jmap/draft/methods/integration/QuotaMailingTest.java       | 2 +-
 .../james/jmap/draft/methods/integration/SendMDNMethodTest.java      | 2 +-
 .../james/jmap/draft/methods/integration/SetMailboxesMethodTest.java | 2 +-
 .../draft/methods/integration/SetMessagesMethodReRoutingTest.java    | 2 +-
 .../james/jmap/draft/methods/integration/SetMessagesMethodTest.java  | 2 +-
 .../draft/methods/integration/SetMessagesOutboxFlagUpdateTest.java   | 2 +-
 .../jmap/draft/methods/integration/SetVacationResponseTest.java      | 2 +-
 .../james/jmap/draft/methods/integration/SpamAssassinContract.java   | 2 +-
 .../src/main/java/org/apache/james/jmap/draft/JMAPServer.java        | 5 +++--
 .../rabbitmq/RabbitMQReindexingWithEventDeadLettersTest.java         | 2 +-
 .../apache/james/webadmin/integration/ForwardIntegrationTest.java    | 5 ++---
 .../integration/vault/DeletedMessageVaultIntegrationTest.java        | 5 ++---
 .../vault/LinshareBlobExportMechanismIntegrationTest.java            | 5 ++---
 26 files changed, 32 insertions(+), 33 deletions(-)

diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
index f854203..8c63961 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/ESReporterTest.java
@@ -97,7 +97,7 @@ class ESReporterTest {
                 .setContentType(ContentType.JSON)
                 .setAccept(ContentType.JSON)
                 .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.UTF_8)))
-                .setPort(server.getProbe(JmapGuiceProbe.class).getJmapPort())
+                .setPort(server.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
                 .build();
         accessToken = authenticateJamesUser(baseUri(server), Username.of(USERNAME), PASSWORD);
 
diff --git a/server/container/guice/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/JmapGuiceProbe.java b/server/container/guice/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/JmapGuiceProbe.java
index 434b41b..38ca47c 100644
--- a/server/container/guice/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/JmapGuiceProbe.java
+++ b/server/container/guice/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/JmapGuiceProbe.java
@@ -36,6 +36,7 @@ import org.apache.james.mailbox.events.MailboxListener;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MessageId;
+import org.apache.james.util.Port;
 import org.apache.james.utils.GuiceProbe;
 
 public class JmapGuiceProbe implements GuiceProbe {
@@ -55,7 +56,7 @@ public class JmapGuiceProbe implements GuiceProbe {
         this.eventBus = eventBus;
     }
 
-    public int getJmapPort() {
+    public Port getJmapPort() {
         return jmapServer.getPort();
     }
 
diff --git a/server/container/guice/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/JmapJamesServerContract.java b/server/container/guice/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/JmapJamesServerContract.java
index c7f07ac..6f965f7 100644
--- a/server/container/guice/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/JmapJamesServerContract.java
+++ b/server/container/guice/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/JmapJamesServerContract.java
@@ -51,7 +51,7 @@ public interface JmapJamesServerContract {
             .setContentType(ContentType.JSON)
             .setAccept(ContentType.JSON)
             .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.UTF_8)))
-            .setPort(server.getProbe(JmapGuiceProbe.class).getJmapPort())
+            .setPort(server.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
             .build();
     }
 
diff --git a/server/protocols/jmap-draft-integration-testing/cassandra-jmap-draft-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraBulkOperationTest.java b/server/protocols/jmap-draft-integration-testing/cassandra-jmap-draft-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraBulkOperationTest.java
index ac02f49..97974f6 100644
--- a/server/protocols/jmap-draft-integration-testing/cassandra-jmap-draft-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraBulkOperationTest.java
+++ b/server/protocols/jmap-draft-integration-testing/cassandra-jmap-draft-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraBulkOperationTest.java
@@ -138,7 +138,7 @@ public class CassandraBulkOperationTest {
                         .build()));
         jmapServer.start();
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-            .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+            .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
             .build();
 
         jmapServer.getProbe(DataProbeImpl.class)
diff --git a/server/protocols/jmap-draft-integration-testing/cassandra-jmap-draft-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraImapErrorTest.java b/server/protocols/jmap-draft-integration-testing/cassandra-jmap-draft-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraImapErrorTest.java
index b3e69d7..a184d9c 100644
--- a/server/protocols/jmap-draft-integration-testing/cassandra-jmap-draft-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraImapErrorTest.java
+++ b/server/protocols/jmap-draft-integration-testing/cassandra-jmap-draft-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraImapErrorTest.java
@@ -62,7 +62,7 @@ class CassandraImapErrorTest {
     @BeforeEach
     void setup(GuiceJamesServer server) throws Exception {
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-            .setPort(server.getProbe(JmapGuiceProbe.class).getJmapPort())
+            .setPort(server.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
             .build();
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
 
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java
index 8368792..d978e66 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JMAPAuthenticationTest.java
@@ -64,7 +64,7 @@ public abstract class JMAPAuthenticationTest {
         jmapServer = createJmapServer(zonedDateTimeProvider);
         jmapServer.start();
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
                 .build();
         
         userCredentials = UserCredentials.builder()
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JmapURIBuilder.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JmapURIBuilder.java
index 64de331..4e4b962 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JmapURIBuilder.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/JmapURIBuilder.java
@@ -27,6 +27,6 @@ public class JmapURIBuilder {
 
     public static URIBuilder baseUri(GuiceJamesServer jamesServer) {
         return LocalHostURIBuilder.baseUri(
-            Port.of(jamesServer.getProbe(JmapGuiceProbe.class).getJmapPort()));
+            Port.of(jamesServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue()));
     }
 }
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
index 37795e1..b5ba1ed 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
@@ -64,7 +64,7 @@ public abstract class ProvisioningTest {
         jmapServer = createJmapServer();
         jmapServer.start();
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-            .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+            .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
             .build();
 
         jmapServer.getProbe(DataProbeImpl.class)
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
index 5f5df91..3f2e3a1 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
@@ -94,7 +94,7 @@ public abstract class VacationIntegrationTest {
 
         jmapGuiceProbe = guiceJamesServer.getProbe(JmapGuiceProbe.class);
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-            .setPort(jmapGuiceProbe.getJmapPort())
+            .setPort(jmapGuiceProbe.getJmapPort().getValue())
             .build();
 
         user1AccessToken = authenticateJamesUser(baseUri(guiceJamesServer), USER_1, PASSWORD);
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/FilterTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/FilterTest.java
index a99995a..1eef429 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/FilterTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/FilterTest.java
@@ -79,7 +79,7 @@ public abstract class FilterTest {
         jmapServer.start();
 
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-            .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+            .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
             .build();
 
         DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class);
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMailboxesMethodTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMailboxesMethodTest.java
index 41d14b3..3465065 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMailboxesMethodTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMailboxesMethodTest.java
@@ -112,7 +112,7 @@ public abstract class GetMailboxesMethodTest {
         quotaProbe = jmapServer.getProbe(QuotaProbesImpl.class);
 
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
                 .build();
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
 
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMessageListMethodTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMessageListMethodTest.java
index 88f792e..28c454a 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMessageListMethodTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMessageListMethodTest.java
@@ -127,7 +127,7 @@ public abstract class GetMessageListMethodTest {
         aclProbe = jmapServer.getProbe(ACLProbeImpl.class);
 
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
                 .build();
 
         dataProbe.addDomain(DOMAIN);
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetVacationResponseTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetVacationResponseTest.java
index c8399ab..ed0c530 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetVacationResponseTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetVacationResponseTest.java
@@ -78,7 +78,7 @@ public abstract class GetVacationResponseTest {
 
         jmapGuiceProbe = jmapServer.getProbe(JmapGuiceProbe.class);
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-                .setPort(jmapGuiceProbe.getJmapPort())
+                .setPort(jmapGuiceProbe.getJmapPort().getValue())
                 .build();
 
         DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class);
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/QuotaMailingTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/QuotaMailingTest.java
index 47acc19..1b9289d 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/QuotaMailingTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/QuotaMailingTest.java
@@ -83,7 +83,7 @@ public abstract class QuotaMailingTest {
         DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class);
 
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-            .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+            .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
             .build();
         RestAssured.defaultParser = Parser.JSON;
 
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SendMDNMethodTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SendMDNMethodTest.java
index bc85911..5321469 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SendMDNMethodTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SendMDNMethodTest.java
@@ -90,7 +90,7 @@ public abstract class SendMDNMethodTest {
         DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class);
 
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
                 .build();
         RestAssured.defaultParser = Parser.JSON;
 
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMailboxesMethodTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMailboxesMethodTest.java
index ac6bb8c..2d9e3d0 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMailboxesMethodTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMailboxesMethodTest.java
@@ -101,7 +101,7 @@ public abstract class SetMailboxesMethodTest {
         DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class);
         
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
                 .build();
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
 
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMessagesMethodReRoutingTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMessagesMethodReRoutingTest.java
index 49fa832..fca8b50 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMessagesMethodReRoutingTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMessagesMethodReRoutingTest.java
@@ -89,7 +89,7 @@ public abstract class SetMessagesMethodReRoutingTest {
                 .setContentType(ContentType.JSON)
                 .setAccept(ContentType.JSON)
                 .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.UTF_8)))
-                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
                 .build();
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
         RestAssured.defaultParser = Parser.JSON;
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMessagesMethodTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMessagesMethodTest.java
index 4c9bf25..c584864 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMessagesMethodTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMessagesMethodTest.java
@@ -172,7 +172,7 @@ public abstract class SetMessagesMethodTest {
                 .setContentType(ContentType.JSON)
                 .setAccept(ContentType.JSON)
                 .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.UTF_8)))
-                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
                 .build();
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
         RestAssured.defaultParser = Parser.JSON;
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMessagesOutboxFlagUpdateTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMessagesOutboxFlagUpdateTest.java
index dbf9b0b..e9141ea 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMessagesOutboxFlagUpdateTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetMessagesOutboxFlagUpdateTest.java
@@ -117,7 +117,7 @@ public abstract class SetMessagesOutboxFlagUpdateTest {
                 .setContentType(ContentType.JSON)
                 .setAccept(ContentType.JSON)
                 .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.UTF_8)))
-                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
                 .build();
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
         RestAssured.defaultParser = Parser.JSON;
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetVacationResponseTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetVacationResponseTest.java
index 3db1858..03bba0f 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetVacationResponseTest.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SetVacationResponseTest.java
@@ -71,7 +71,7 @@ public abstract class SetVacationResponseTest {
         jmapServer.start();
         jmapGuiceProbe = jmapServer.getProbe(JmapGuiceProbe.class);
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-                .setPort(jmapGuiceProbe.getJmapPort())
+                .setPort(jmapGuiceProbe.getJmapPort().getValue())
                 .build();
 
         jmapServer.getProbe(DataProbeImpl.class)
diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SpamAssassinContract.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SpamAssassinContract.java
index f7f7531..aafccfc 100644
--- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SpamAssassinContract.java
+++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/SpamAssassinContract.java
@@ -74,7 +74,7 @@ public interface SpamAssassinContract {
                 .setContentType(ContentType.JSON)
                 .setAccept(ContentType.JSON)
                 .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.UTF_8)))
-                .setPort(jamesServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+                .setPort(jamesServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue())
                 .build();
         RestAssured.defaultParser = Parser.JSON;
 
diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/JMAPServer.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/JMAPServer.java
index 6d428f9..c3aabf9 100644
--- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/JMAPServer.java
+++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/JMAPServer.java
@@ -31,6 +31,7 @@ import org.apache.james.http.jetty.Configuration;
 import org.apache.james.http.jetty.Configuration.Builder;
 import org.apache.james.http.jetty.JettyHttpServer;
 import org.apache.james.lifecycle.api.Startable;
+import org.apache.james.util.Port;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.zalando.logbook.DefaultHttpLogWriter;
@@ -111,7 +112,7 @@ public class JMAPServer implements Startable {
         server.ifPresent(Throwing.consumer(JettyHttpServer::stop).sneakyThrow());
     }
 
-    public int getPort() {
-        return server.map(JettyHttpServer::getPort).orElseThrow(() -> new RuntimeException("JMAP server was disabled. No port bound"));
+    public Port getPort() {
+        return Port.of(server.map(JettyHttpServer::getPort).orElseThrow(() -> new RuntimeException("JMAP server was disabled. No port bound")));
     }
 }
diff --git a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQReindexingWithEventDeadLettersTest.java b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQReindexingWithEventDeadLettersTest.java
index 18ac7fb..26fbfac 100644
--- a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQReindexingWithEventDeadLettersTest.java
+++ b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/RabbitMQReindexingWithEventDeadLettersTest.java
@@ -108,7 +108,7 @@ class RabbitMQReindexingWithEventDeadLettersTest {
             .addDomain(DOMAIN)
             .addUser(ALICE.asString(), ALICE_PASSWORD);
 
-        Port jmapPort = Port.of(jamesServer.getProbe(JmapGuiceProbe.class).getJmapPort());
+        Port jmapPort = jamesServer.getProbe(JmapGuiceProbe.class).getJmapPort();
         RestAssured.requestSpecification = jmapRequestSpecBuilder
             .setPort(jmapPort.getValue())
             .build();
diff --git a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/ForwardIntegrationTest.java b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/ForwardIntegrationTest.java
index 15e6683..d3c1f47 100644
--- a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/ForwardIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/ForwardIntegrationTest.java
@@ -82,14 +82,13 @@ public abstract class ForwardIntegrationTest {
         dataProbe.addUser(ALICE.asString(), ALICE_PASSWORD);
         dataProbe.addUser(CEDRIC.asString(), CEDRIC_PASSWORD);
 
+        jmapPort = jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort();
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-                .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+                .setPort(jmapPort.getValue())
                 .build();
 
         webAdminApi = WebAdminUtils.spec(jmapServer.getProbe(WebAdminGuiceProbe.class).getWebAdminPort());
 
-        jmapPort = new Port(jmapServer.getProbe(JmapGuiceProbe.class)
-            .getJmapPort());
     }
 
     protected abstract GuiceJamesServer createJmapServer() throws IOException;
diff --git a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/vault/DeletedMessageVaultIntegrationTest.java b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/vault/DeletedMessageVaultIntegrationTest.java
index 3299aaa..0de220c 100644
--- a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/vault/DeletedMessageVaultIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/vault/DeletedMessageVaultIntegrationTest.java
@@ -138,8 +138,9 @@ public abstract class DeletedMessageVaultIntegrationTest {
         MailboxProbe mailboxProbe = jmapServer.getProbe(MailboxProbeImpl.class);
         DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class);
 
+        Port jmapPort = jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort();
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-            .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+            .setPort(jmapPort.getValue())
             .build();
         RestAssured.defaultParser = Parser.JSON;
 
@@ -149,8 +150,6 @@ public abstract class DeletedMessageVaultIntegrationTest {
         dataProbe.addUser(JACK, PASSWORD);
         mailboxProbe.createMailbox("#private", HOMER, DefaultMailboxes.INBOX);
         otherMailboxId = mailboxProbe.createMailbox("#private", HOMER, MAILBOX_NAME);
-        Port jmapPort = Port.of(jmapServer.getProbe(JmapGuiceProbe.class)
-            .getJmapPort());
         homerAccessToken = authenticateJamesUser(baseUri(jmapPort), Username.of(HOMER), PASSWORD);
         bartAccessToken = authenticateJamesUser(baseUri(jmapPort), Username.of(BART), BOB_PASSWORD);
         jackAccessToken = authenticateJamesUser(baseUri(jmapPort), Username.of(JACK), PASSWORD);
diff --git a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/vault/LinshareBlobExportMechanismIntegrationTest.java b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/vault/LinshareBlobExportMechanismIntegrationTest.java
index 1bcfdec..c55f60c 100644
--- a/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/vault/LinshareBlobExportMechanismIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/webadmin-integration-test-common/src/main/java/org/apache/james/webadmin/integration/vault/LinshareBlobExportMechanismIntegrationTest.java
@@ -106,8 +106,9 @@ public abstract class LinshareBlobExportMechanismIntegrationTest {
             .addUser(HOMER, HOMER_PASSWORD)
             .addUser(BART, BART_PASSWORD);
 
+        Port jmapPort = jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort();
         RestAssured.requestSpecification = jmapRequestSpecBuilder
-            .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort())
+            .setPort(jmapPort.getValue())
             .build();
         RestAssured.defaultParser = Parser.JSON;
 
@@ -116,8 +117,6 @@ public abstract class LinshareBlobExportMechanismIntegrationTest {
         MailboxProbe mailboxProbe = jmapServer.getProbe(MailboxProbeImpl.class);
         mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, HOMER, DefaultMailboxes.INBOX);
 
-        Port jmapPort = Port.of(jmapServer.getProbe(JmapGuiceProbe.class)
-            .getJmapPort());
         homerAccessToken = authenticateJamesUser(baseUri(jmapPort), Username.of(HOMER), HOMER_PASSWORD);
         bartAccessToken = authenticateJamesUser(baseUri(jmapPort), Username.of(BART), BART_PASSWORD);
         user1LinshareAPI = linshareGuiceExtension.getLinshareJunitExtension().getAPIFor(USER_1);


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