Repository: james-project
Updated Branches:
  refs/heads/master dbbc58ee9 -> 7460ce879


These simple tests ensure the docker rule allow to run a container for a test

        It checks HTTP reachability on container IP and exposed port on host


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

Branch: refs/heads/master
Commit: d1a370c68e817eff5e334a73c844c69129a4a588
Parents: dbbc58e
Author: Matthieu Baechler <[email protected]>
Authored: Thu Feb 11 17:49:23 2016 +0100
Committer: Antoine Duprat <[email protected]>
Committed: Wed Mar 2 16:03:26 2016 +0100

----------------------------------------------------------------------
 .../protocols/jmap-integration-testing/pom.xml  | 11 +++++
 .../org/apache/james/jmap/ContainerTest.java    | 46 ++++++++++++++++++++
 2 files changed, 57 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/d1a370c6/server/protocols/jmap-integration-testing/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/pom.xml 
b/server/protocols/jmap-integration-testing/pom.xml
index b3ada4c..9afcc41 100644
--- a/server/protocols/jmap-integration-testing/pom.xml
+++ b/server/protocols/jmap-integration-testing/pom.xml
@@ -172,6 +172,12 @@
                     <type>test-jar</type>
                 </dependency>
                 <dependency>
+                    <groupId>com.google.guava</groupId>
+                    <artifactId>guava</artifactId>
+                    <version>18.0</version> <!--$NO-MVN-MAN-VER$-->
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
                     <groupId>com.google.inject</groupId>
                     <artifactId>guice</artifactId>
                 </dependency>
@@ -207,6 +213,11 @@
                     <version>2.0.0.0</version>
                     <scope>test</scope>
                 </dependency>
+                <dependency>
+                    <groupId>org.testcontainers</groupId>
+                    <artifactId>testcontainers</artifactId>
+                    <version>1.0.2</version>
+                </dependency>
             </dependencies>
             <build>
                 <plugins>

http://git-wip-us.apache.org/repos/asf/james-project/blob/d1a370c6/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/ContainerTest.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/ContainerTest.java
 
b/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/ContainerTest.java
new file mode 100644
index 0000000..7a8c488
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/ContainerTest.java
@@ -0,0 +1,46 @@
+/****************************************************************
+ * 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.jmap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.fluent.Request;
+import org.apache.http.client.fluent.Response;
+import org.apache.http.client.utils.URIBuilder;
+import org.junit.Rule;
+import org.junit.Test;
+import org.testcontainers.containers.GenericContainer;
+
+public class ContainerTest {
+
+    @Rule public GenericContainer container = new 
GenericContainer("nginx:1.7.1")
+            .withExposedPorts(80);
+
+    @Test
+    public void containerShouldBeReachableOnExposedPort() throws 
ClientProtocolException, IOException, URISyntaxException {
+        String containerIpAddress = container.getContainerIpAddress();
+        Integer containerPort = container.getMappedPort(80);
+        Response response = Request.Get(new 
URIBuilder().setScheme("http").setHost(containerIpAddress).setPort(containerPort).build()).execute();
+        
assertThat(response.returnResponse().getStatusLine().getStatusCode()).isEqualTo(200);
+    }
+}


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

Reply via email to