james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [1/7] james-project git commit: JAMES-2545 Test equality of RabbitMQConfiguration generated from properties
Date Wed, 12 Sep 2018 08:03:23 GMT
Repository: james-project
Updated Branches:
  refs/heads/master bf95a1474 -> 74114e936


JAMES-2545 Test equality of RabbitMQConfiguration generated from properties


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

Branch: refs/heads/master
Commit: a112f57e5111cc6abfa9c4a40a4bec9599753310
Parents: f783adf
Author: Benoit Tellier <btellier@linagora.com>
Authored: Mon Sep 10 11:39:31 2018 +0700
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Wed Sep 12 10:01:12 2018 +0200

----------------------------------------------------------------------
 .../mailqueue/RabbitMQConfigurationTest.java    | 39 ++++++++++++--------
 1 file changed, 24 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a112f57e/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java
b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java
index 10109cb..4da2a91 100644
--- a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java
+++ b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java
@@ -18,22 +18,25 @@
  ****************************************************************/
 package org.apache.james.backend.mailqueue;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import java.net.URI;
+
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class RabbitMQConfigurationTest {
+class RabbitMQConfigurationTest {
 
     @Test
-    public void shouldRespectBeanContract() {
+    void shouldRespectBeanContract() {
         EqualsVerifier.forClass(RabbitMQConfiguration.class).verify();
     }
 
     @Test
-    public void fromShouldThrowWhenURIIsNotInTheConfiguration() {
+    void fromShouldThrowWhenURIIsNotInTheConfiguration() {
         PropertiesConfiguration configuration = new PropertiesConfiguration();
 
         assertThatThrownBy(() -> RabbitMQConfiguration.from(configuration))
@@ -42,7 +45,7 @@ public class RabbitMQConfigurationTest {
     }
 
     @Test
-    public void fromShouldThrowWhenURIIsNull() {
+    void fromShouldThrowWhenURIIsNull() {
         PropertiesConfiguration configuration = new PropertiesConfiguration();
         configuration.addProperty("uri", null);
 
@@ -52,7 +55,7 @@ public class RabbitMQConfigurationTest {
     }
 
     @Test
-    public void fromShouldThrowWhenURIIsEmpty() {
+    void fromShouldThrowWhenURIIsEmpty() {
         PropertiesConfiguration configuration = new PropertiesConfiguration();
         configuration.addProperty("uri", "");
 
@@ -62,7 +65,7 @@ public class RabbitMQConfigurationTest {
     }
 
     @Test
-    public void fromShouldThrowWhenURIIsInvalid() {
+    void fromShouldThrowWhenURIIsInvalid() {
         PropertiesConfiguration configuration = new PropertiesConfiguration();
         configuration.addProperty("uri", ":invalid");
 
@@ -72,7 +75,7 @@ public class RabbitMQConfigurationTest {
     }
 
     @Test
-    public void fromShouldThrowWhenManagementURIIsNotInTheConfiguration() {
+    void fromShouldThrowWhenManagementURIIsNotInTheConfiguration() {
         PropertiesConfiguration configuration = new PropertiesConfiguration();
         configuration.addProperty("uri", "amqp://james:james@rabbitmq_host:5672");
 
@@ -82,7 +85,7 @@ public class RabbitMQConfigurationTest {
     }
 
     @Test
-    public void fromShouldThrowWhenManagementURIIsNull() {
+    void fromShouldThrowWhenManagementURIIsNull() {
         PropertiesConfiguration configuration = new PropertiesConfiguration();
         configuration.addProperty("uri", "amqp://james:james@rabbitmq_host:5672");
         configuration.addProperty("management.uri", null);
@@ -93,7 +96,7 @@ public class RabbitMQConfigurationTest {
     }
 
     @Test
-    public void fromShouldThrowWhenManagementURIIsEmpty() {
+    void fromShouldThrowWhenManagementURIIsEmpty() {
         PropertiesConfiguration configuration = new PropertiesConfiguration();
         configuration.addProperty("uri", "amqp://james:james@rabbitmq_host:5672");
         configuration.addProperty("management.uri", "");
@@ -104,7 +107,7 @@ public class RabbitMQConfigurationTest {
     }
 
     @Test
-    public void fromShouldThrowWhenManagementURIIsInvalid() {
+    void fromShouldThrowWhenManagementURIIsInvalid() {
         PropertiesConfiguration configuration = new PropertiesConfiguration();
         configuration.addProperty("uri", "amqp://james:james@rabbitmq_host:5672");
         configuration.addProperty("management.uri", ":invalid");
@@ -115,11 +118,17 @@ public class RabbitMQConfigurationTest {
     }
 
     @Test
-    public void fromShouldNotThrowWhenRequiredParametersAreGiven() {
+    void fromShouldReturnTheConfigurationWhenRequiredParametersAreGiven() {
         PropertiesConfiguration configuration = new PropertiesConfiguration();
-        configuration.addProperty("uri", "amqp://james:james@rabbitmq_host:5672");
-        configuration.addProperty("management.uri", "http://james:james@rabbitmq_host:15672/api/");
-
-        RabbitMQConfiguration.from(configuration);
+        String amqpUri = "amqp://james:james@rabbitmq_host:5672";
+        configuration.addProperty("uri", amqpUri);
+        String managementUri = "http://james:james@rabbitmq_host:15672/api/";
+        configuration.addProperty("management.uri", managementUri);
+
+        assertThat(RabbitMQConfiguration.from(configuration))
+            .isEqualTo(RabbitMQConfiguration.builder()
+                .amqpUri(URI.create(amqpUri))
+                .managementUri(URI.create(managementUri))
+                .build());
     }
 }


---------------------------------------------------------------------
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