You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by rs...@apache.org on 2020/01/07 18:08:18 UTC

[httpcomponents-core] branch master updated: Add infrastructure for Docker-enabled integration tests

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

rschmitt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


The following commit(s) were added to refs/heads/master by this push:
     new d479821  Add infrastructure for Docker-enabled integration tests
d479821 is described below

commit d4798217e817dfcb7e42f00513ee16315e3076f8
Author: Ryan Schmitt <rs...@apache.org>
AuthorDate: Thu Jan 2 10:38:49 2020 -0800

    Add infrastructure for Docker-enabled integration tests
---
 .travis.yml                                        | 11 +++-
 httpcore5-testing/pom.xml                          | 63 ++++++++++++++++++++++
 .../testing/compatibility/http2/HttpBinIT.java     | 53 ++++++++++++++++++
 3 files changed, 126 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index f1d4e4a..bf7a0cf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,8 +17,12 @@ language: java
 dist: trusty
 sudo: false
 
+services:
+  - docker
+
+script: mvn verify -B -P docker
+
 jdk:
-  - openjdk7
   - oraclejdk8
   - openjdk11
   - oraclejdk11
@@ -28,5 +32,10 @@ matrix:
   allow_failures:
     - jdk: openjdk-ea
 
+jobs:
+  include:
+    - jdk: openjdk7
+      script: mvn verify -B
+
 after_success:
   - mvn clean cobertura:cobertura coveralls:report
diff --git a/httpcore5-testing/pom.xml b/httpcore5-testing/pom.xml
index db4ed29..2fa3c8b 100644
--- a/httpcore5-testing/pom.xml
+++ b/httpcore5-testing/pom.xml
@@ -99,6 +99,69 @@
     </dependency>
   </dependencies>
 
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <plugins>
+
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-failsafe-plugin</artifactId>
+            <version>2.22.2</version>
+            <executions>
+              <execution>
+                <goals>
+                  <goal>integration-test</goal>
+                  <goal>verify</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+
+          <plugin>
+            <groupId>io.fabric8</groupId>
+            <artifactId>docker-maven-plugin</artifactId>
+            <version>0.31.0</version>
+            <executions>
+              <execution>
+                <id>start-httpbin</id>
+                <phase>pre-integration-test</phase>
+                <goals>
+                  <goal>start</goal>
+                </goals>
+                <configuration>
+                  <images>
+                    <image>
+                      <name>kennethreitz/httpbin</name>
+                      <alias>httpbin</alias>
+                      <run>
+                        <log>
+                          <color>MAGENTA</color>
+                        </log>
+                        <ports>
+                          <port>8082:80</port>
+                        </ports>
+                      </run>
+                    </image>
+                  </images>
+                </configuration>
+              </execution>
+              <execution>
+                <id>stop-test-servers</id>
+                <phase>post-integration-test</phase>
+                <goals>
+                  <goal>stop</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
   <reporting>
     <plugins>
 
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/compatibility/http2/HttpBinIT.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/compatibility/http2/HttpBinIT.java
new file mode 100644
index 0000000..1588b0c
--- /dev/null
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/compatibility/http2/HttpBinIT.java
@@ -0,0 +1,53 @@
+/*
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.testing.compatibility.http2;
+
+import org.apache.hc.core5.http.HttpHost;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class HttpBinIT {
+    private H2CompatibilityTest h2CompatibilityTest;
+
+    @Before
+    public void start() throws Exception {
+        h2CompatibilityTest = new H2CompatibilityTest();
+        h2CompatibilityTest.start();
+    }
+
+    @After
+    public void shutdown() throws Exception {
+        h2CompatibilityTest.shutdown();
+    }
+
+    @Test
+    public void executeHttpBin() throws Exception {
+        h2CompatibilityTest.executeHttpBin(new HttpHost("http", "localhost", 8082));
+    }
+}