JAMES-2511 Introduce DockerRabbitMQ TestRule

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

Branch: refs/heads/master
Commit: 51922f092a9808d2268bc026bac9cddf9138b756
Parents: 7273a4a
Author: Antoine Duprat <[email protected]>
Authored: Wed Oct 3 15:04:16 2018 +0200
Committer: Antoine Duprat <[email protected]>
Committed: Wed Oct 31 17:56:16 2018 +0100

----------------------------------------------------------------------
 .../rabbitmq/DockerRabbitMQTestRule.java        | 44 ++++++++++++++++++++
 1 file changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/51922f09/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQTestRule.java
----------------------------------------------------------------------
diff --git 
a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQTestRule.java
 
b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQTestRule.java
new file mode 100644
index 0000000..0814049
--- /dev/null
+++ 
b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQTestRule.java
@@ -0,0 +1,44 @@
+/****************************************************************
+ * 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.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+public class DockerRabbitMQTestRule implements TestRule {
+
+    private DockerRabbitMQ dockerRabbitMQ;
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                dockerRabbitMQ = DockerRabbitMQ.withoutCookie();
+                dockerRabbitMQ.start();
+                base.evaluate();
+            }
+        };
+    }
+
+    public DockerRabbitMQ getDockerRabbitMQ() {
+        return dockerRabbitMQ;
+    }
+}


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

Reply via email to