james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [1/5] james-project git commit: JAMES-2544 Drop one RabbitMQ JUnit 5 extension
Date Fri, 28 Sep 2018 02:10:42 GMT
Repository: james-project
Updated Branches:
  refs/heads/master e3bdf9b6a -> e4f13e47f


JAMES-2544 Drop one RabbitMQ JUnit 5 extension


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

Branch: refs/heads/master
Commit: fb30577b3e36356a927c6501895635024e126f5a
Parents: e3bdf9b
Author: Antoine Duprat <aduprat@linagora.com>
Authored: Thu Sep 27 09:51:29 2018 +0200
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Fri Sep 28 09:01:39 2018 +0700

----------------------------------------------------------------------
 .../rabbitmq/DockerRabbitMQExtension.java       | 53 ------------------
 .../rabbitmq/DockerRabbitMQExtensionTest.java   | 50 -----------------
 .../backend/rabbitmq/RabbitMQExtension.java     | 59 ++++++++++++++++++++
 .../rabbitmq/RabbitMQHealthCheckTest.java       |  2 +-
 .../james/backend/rabbitmq/RabbitMQTest.java    |  2 +-
 .../ReusableDockerRabbitMQExtension.java        | 59 --------------------
 .../queue/rabbitmq/RabbitMQMailQueueTest.java   |  4 +-
 .../rabbitmq/RabbitMqMailQueueFactoryTest.java  |  4 +-
 8 files changed, 65 insertions(+), 168 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/fb30577b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQExtension.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQExtension.java
b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQExtension.java
deleted file mode 100644
index 9c0a00e..0000000
--- a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQExtension.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-package org.apache.james.backend.rabbitmq;
-
-import org.junit.jupiter.api.extension.AfterEachCallback;
-import org.junit.jupiter.api.extension.BeforeEachCallback;
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.api.extension.ParameterContext;
-import org.junit.jupiter.api.extension.ParameterResolutionException;
-import org.junit.jupiter.api.extension.ParameterResolver;
-
-public class DockerRabbitMQExtension implements BeforeEachCallback, AfterEachCallback, ParameterResolver
{
-
-    private DockerRabbitMQ rabbitMQ;
-
-    @Override
-    public void beforeEach(ExtensionContext context) {
-        rabbitMQ = DockerRabbitMQ.withoutCookie();
-        rabbitMQ.start();
-    }
-
-    @Override
-    public void afterEach(ExtensionContext context) {
-        rabbitMQ.stop();
-    }
-
-    @Override
-    public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext
extensionContext) throws ParameterResolutionException {
-        return (parameterContext.getParameter().getType() == DockerRabbitMQ.class);
-    }
-
-    @Override
-    public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
throws ParameterResolutionException {
-        return rabbitMQ;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb30577b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQExtensionTest.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQExtensionTest.java
b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQExtensionTest.java
deleted file mode 100644
index 687ac31..0000000
--- a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQExtensionTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-package org.apache.james.backend.rabbitmq;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-
-import com.rabbitmq.client.Connection;
-import com.rabbitmq.client.ConnectionFactory;
-
-@ExtendWith(DockerRabbitMQExtension.class)
-public class DockerRabbitMQExtensionTest {
-
-    private ConnectionFactory connectionFactory;
-
-    @BeforeEach
-    public void setup(DockerRabbitMQ rabbitMQ) {
-        connectionFactory = new ConnectionFactory();
-        connectionFactory.setHost(rabbitMQ.getHostIp());
-        connectionFactory.setPort(rabbitMQ.getPort());
-        connectionFactory.setUsername(rabbitMQ.getUsername());
-        connectionFactory.setPassword(rabbitMQ.getPassword());
-    }
-
-    @Test
-    public void containerShouldBeUp() throws Exception {
-        try (Connection connection = connectionFactory.newConnection()) {
-            assertThat(connection.isOpen()).isTrue();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb30577b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQExtension.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQExtension.java
b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQExtension.java
new file mode 100644
index 0000000..4596763
--- /dev/null
+++ b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQExtension.java
@@ -0,0 +1,59 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.backend.rabbitmq;
+
+import org.junit.jupiter.api.extension.AfterAllCallback;
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.ParameterContext;
+import org.junit.jupiter.api.extension.ParameterResolutionException;
+import org.junit.jupiter.api.extension.ParameterResolver;
+
+public class RabbitMQExtension implements BeforeAllCallback, AfterAllCallback, AfterEachCallback,
ParameterResolver {
+
+    private DockerRabbitMQ rabbitMQ;
+
+    @Override
+    public void beforeAll(ExtensionContext context) {
+        rabbitMQ = DockerRabbitMQ.withoutCookie();
+        rabbitMQ.start();
+    }
+
+    @Override
+    public void afterEach(ExtensionContext context) throws Exception {
+        rabbitMQ.reset();
+    }
+
+    @Override
+    public void afterAll(ExtensionContext extensionContext) {
+        rabbitMQ.stop();
+    }
+
+    @Override
+    public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext
extensionContext) throws ParameterResolutionException {
+        return (parameterContext.getParameter().getType() == DockerRabbitMQ.class);
+    }
+
+    @Override
+    public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
throws ParameterResolutionException {
+        return rabbitMQ;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb30577b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQHealthCheckTest.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQHealthCheckTest.java
b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQHealthCheckTest.java
index ec50384..43cd63e 100644
--- a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQHealthCheckTest.java
+++ b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQHealthCheckTest.java
@@ -31,7 +31,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
 
 import com.nurkiewicz.asyncretry.AsyncRetryExecutor;
 
-@ExtendWith(DockerRabbitMQExtension.class)
+@ExtendWith(RabbitMQExtension.class)
 class RabbitMQHealthCheckTest {
     private RabbitMQHealthCheck healthCheck;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb30577b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQTest.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQTest.java
b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQTest.java
index b2fb28e..c77bb50 100644
--- a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQTest.java
+++ b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQTest.java
@@ -52,7 +52,7 @@ import com.rabbitmq.client.Channel;
 import com.rabbitmq.client.Connection;
 import com.rabbitmq.client.ConnectionFactory;
 
-@ExtendWith(DockerRabbitMQExtension.class)
+@ExtendWith(RabbitMQExtension.class)
 class RabbitMQTest {
 
     @Nested

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb30577b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/ReusableDockerRabbitMQExtension.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/ReusableDockerRabbitMQExtension.java
b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/ReusableDockerRabbitMQExtension.java
deleted file mode 100644
index fb98c2a..0000000
--- a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/ReusableDockerRabbitMQExtension.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-package org.apache.james.backend.rabbitmq;
-
-import org.junit.jupiter.api.extension.AfterAllCallback;
-import org.junit.jupiter.api.extension.AfterEachCallback;
-import org.junit.jupiter.api.extension.BeforeAllCallback;
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.api.extension.ParameterContext;
-import org.junit.jupiter.api.extension.ParameterResolutionException;
-import org.junit.jupiter.api.extension.ParameterResolver;
-
-public class ReusableDockerRabbitMQExtension implements BeforeAllCallback, AfterAllCallback,
AfterEachCallback, ParameterResolver {
-
-    private DockerRabbitMQ rabbitMQ;
-
-    @Override
-    public void beforeAll(ExtensionContext context) {
-        rabbitMQ = DockerRabbitMQ.withoutCookie();
-        rabbitMQ.start();
-    }
-
-    @Override
-    public void afterEach(ExtensionContext context) throws Exception {
-        rabbitMQ.reset();
-    }
-
-    @Override
-    public void afterAll(ExtensionContext extensionContext) {
-        rabbitMQ.stop();
-    }
-
-    @Override
-    public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext
extensionContext) throws ParameterResolutionException {
-        return (parameterContext.getParameter().getType() == DockerRabbitMQ.class);
-    }
-
-    @Override
-    public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext)
throws ParameterResolutionException {
-        return rabbitMQ;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb30577b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueTest.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueTest.java
b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueTest.java
index 8e495b4..61d0695 100644
--- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueTest.java
+++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueTest.java
@@ -44,7 +44,7 @@ import org.apache.james.backend.rabbitmq.DockerRabbitMQ;
 import org.apache.james.backend.rabbitmq.RabbitChannelPool;
 import org.apache.james.backend.rabbitmq.RabbitMQConfiguration;
 import org.apache.james.backend.rabbitmq.RabbitMQConnectionFactory;
-import org.apache.james.backend.rabbitmq.ReusableDockerRabbitMQExtension;
+import org.apache.james.backend.rabbitmq.RabbitMQExtension;
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.CassandraClusterExtension;
 import org.apache.james.backends.cassandra.components.CassandraModule;
@@ -75,7 +75,7 @@ import org.junit.jupiter.api.extension.RegisterExtension;
 import com.github.fge.lambdas.Throwing;
 import com.nurkiewicz.asyncretry.AsyncRetryExecutor;
 
-@ExtendWith(ReusableDockerRabbitMQExtension.class)
+@ExtendWith(RabbitMQExtension.class)
 public class RabbitMQMailQueueTest implements ManageableMailQueueContract, MailQueueMetricContract
{
     private static final HashBlobId.Factory BLOB_ID_FACTORY = new HashBlobId.Factory();
     private static final int THREE_BUCKET_COUNT = 3;

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb30577b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMqMailQueueFactoryTest.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMqMailQueueFactoryTest.java
b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMqMailQueueFactoryTest.java
index 99587dd..365e9f9 100644
--- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMqMailQueueFactoryTest.java
+++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMqMailQueueFactoryTest.java
@@ -35,7 +35,7 @@ import org.apache.james.backend.rabbitmq.DockerRabbitMQ;
 import org.apache.james.backend.rabbitmq.RabbitChannelPool;
 import org.apache.james.backend.rabbitmq.RabbitMQConfiguration;
 import org.apache.james.backend.rabbitmq.RabbitMQConnectionFactory;
-import org.apache.james.backend.rabbitmq.ReusableDockerRabbitMQExtension;
+import org.apache.james.backend.rabbitmq.RabbitMQExtension;
 import org.apache.james.blob.api.HashBlobId;
 import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.blob.api.Store;
@@ -48,7 +48,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
 
 import com.nurkiewicz.asyncretry.AsyncRetryExecutor;
 
-@ExtendWith(ReusableDockerRabbitMQExtension.class)
+@ExtendWith(RabbitMQExtension.class)
 class RabbitMqMailQueueFactoryTest implements MailQueueFactoryContract<RabbitMQMailQueue>
{
     private static final HashBlobId.Factory BLOB_ID_FACTORY = new HashBlobId.Factory();
 


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