diff --git a/liberty-maven-plugin/src/it/alt-outputdir-it/pom.xml b/liberty-maven-plugin/src/it/alt-outputdir-it/pom.xml index 894d242b4..339e47349 100644 --- a/liberty-maven-plugin/src/it/alt-outputdir-it/pom.xml +++ b/liberty-maven-plugin/src/it/alt-outputdir-it/pom.xml @@ -27,9 +27,9 @@ provided - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/binary-scanner-it/pom.xml b/liberty-maven-plugin/src/it/binary-scanner-it/pom.xml index a79578f04..f11b8b08f 100755 --- a/liberty-maven-plugin/src/it/binary-scanner-it/pom.xml +++ b/liberty-maven-plugin/src/it/binary-scanner-it/pom.xml @@ -29,9 +29,9 @@ @pom.version@ - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/config-packagefile-multi-module-runnable-it/deploy-app/pom.xml b/liberty-maven-plugin/src/it/config-packagefile-multi-module-runnable-it/deploy-app/pom.xml index 0f95019d8..fed329df7 100644 --- a/liberty-maven-plugin/src/it/config-packagefile-multi-module-runnable-it/deploy-app/pom.xml +++ b/liberty-maven-plugin/src/it/config-packagefile-multi-module-runnable-it/deploy-app/pom.xml @@ -21,9 +21,9 @@ provided - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/config-packagefile-multi-module-runnable-it/deploy-app/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java b/liberty-maven-plugin/src/it/config-packagefile-multi-module-runnable-it/deploy-app/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java index 5bad671e8..b4218536a 100644 --- a/liberty-maven-plugin/src/it/config-packagefile-multi-module-runnable-it/deploy-app/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java +++ b/liberty-maven-plugin/src/it/config-packagefile-multi-module-runnable-it/deploy-app/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java @@ -3,9 +3,12 @@ import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; public class EndpointTest { private static String URL; @@ -17,20 +20,18 @@ public static void init() { @Test public void testServlet() throws Exception { - HttpClient client = new HttpClient(); + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet method = new HttpGet(URL); - GetMethod method = new GetMethod(URL); + try (CloseableHttpResponse response = client.execute(method)) { + int statusCode = response.getStatusLine().getStatusCode(); - try { - int statusCode = client.executeMethod(method); + assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); - assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); + String responseBody = EntityUtils.toString(response.getEntity()); - String response = method.getResponseBodyAsString(); - - assertTrue("Unexpected response body", response.contains("Hello! How are you today?")); - } finally { - method.releaseConnection(); - } + assertTrue("Unexpected response body", responseBody.contains("Hello! How are you today?")); + } + } } } diff --git a/liberty-maven-plugin/src/it/deploy-loose-config-apps-it/pom.xml b/liberty-maven-plugin/src/it/deploy-loose-config-apps-it/pom.xml index db5964ed0..b315be829 100644 --- a/liberty-maven-plugin/src/it/deploy-loose-config-apps-it/pom.xml +++ b/liberty-maven-plugin/src/it/deploy-loose-config-apps-it/pom.xml @@ -27,9 +27,9 @@ provided - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/deploy-loose-config-apps-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java b/liberty-maven-plugin/src/it/deploy-loose-config-apps-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java index a25248eb4..feb0c72c7 100644 --- a/liberty-maven-plugin/src/it/deploy-loose-config-apps-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java +++ b/liberty-maven-plugin/src/it/deploy-loose-config-apps-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java @@ -18,9 +18,12 @@ import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; public class EndpointTest { private static String URL; @@ -32,20 +35,18 @@ public static void init() { @Test public void testServlet() throws Exception { - HttpClient client = new HttpClient(); + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet method = new HttpGet(URL); - GetMethod method = new GetMethod(URL); + try (CloseableHttpResponse response = client.execute(method)) { + int statusCode = response.getStatusLine().getStatusCode(); - try { - int statusCode = client.executeMethod(method); + assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); - assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); + String responseBody = EntityUtils.toString(response.getEntity()); - String response = method.getResponseBodyAsString(); - - assertTrue("Unexpected response body", response.contains("Hello! How are you today?")); - } finally { - method.releaseConnection(); - } + assertTrue("Unexpected response body", responseBody.contains("Hello! How are you today?")); + } + } } } diff --git a/liberty-maven-plugin/src/it/deploy-loose-config-apps-with-toolchain-it/pom.xml b/liberty-maven-plugin/src/it/deploy-loose-config-apps-with-toolchain-it/pom.xml index 556e6d95d..008998753 100644 --- a/liberty-maven-plugin/src/it/deploy-loose-config-apps-with-toolchain-it/pom.xml +++ b/liberty-maven-plugin/src/it/deploy-loose-config-apps-with-toolchain-it/pom.xml @@ -27,9 +27,9 @@ provided - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/deploy-loose-config-apps-with-toolchain-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java b/liberty-maven-plugin/src/it/deploy-loose-config-apps-with-toolchain-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java index a25248eb4..feb0c72c7 100644 --- a/liberty-maven-plugin/src/it/deploy-loose-config-apps-with-toolchain-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java +++ b/liberty-maven-plugin/src/it/deploy-loose-config-apps-with-toolchain-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java @@ -18,9 +18,12 @@ import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; public class EndpointTest { private static String URL; @@ -32,20 +35,18 @@ public static void init() { @Test public void testServlet() throws Exception { - HttpClient client = new HttpClient(); + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet method = new HttpGet(URL); - GetMethod method = new GetMethod(URL); + try (CloseableHttpResponse response = client.execute(method)) { + int statusCode = response.getStatusLine().getStatusCode(); - try { - int statusCode = client.executeMethod(method); + assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); - assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); + String responseBody = EntityUtils.toString(response.getEntity()); - String response = method.getResponseBodyAsString(); - - assertTrue("Unexpected response body", response.contains("Hello! How are you today?")); - } finally { - method.releaseConnection(); - } + assertTrue("Unexpected response body", responseBody.contains("Hello! How are you today?")); + } + } } } diff --git a/liberty-maven-plugin/src/it/deploy-loose-config-it/pom.xml b/liberty-maven-plugin/src/it/deploy-loose-config-it/pom.xml index ee9e6fd16..d97fd4530 100644 --- a/liberty-maven-plugin/src/it/deploy-loose-config-it/pom.xml +++ b/liberty-maven-plugin/src/it/deploy-loose-config-it/pom.xml @@ -27,9 +27,9 @@ provided - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/deploy-loose-config-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java b/liberty-maven-plugin/src/it/deploy-loose-config-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java index 916e81fdc..3a491dde5 100644 --- a/liberty-maven-plugin/src/it/deploy-loose-config-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java +++ b/liberty-maven-plugin/src/it/deploy-loose-config-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java @@ -18,9 +18,12 @@ import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; public class EndpointTest { private static String URL; @@ -32,20 +35,18 @@ public static void init() { @Test public void testServlet() throws Exception { - HttpClient client = new HttpClient(); + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet method = new HttpGet(URL); - GetMethod method = new GetMethod(URL); + try (CloseableHttpResponse response = client.execute(method)) { + int statusCode = response.getStatusLine().getStatusCode(); - try { - int statusCode = client.executeMethod(method); + assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); - assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); + String responseBody = EntityUtils.toString(response.getEntity()); - String response = method.getResponseBodyAsString(); - - assertTrue("Unexpected response body", response.contains("Hello! How are you today?")); - } finally { - method.releaseConnection(); - } + assertTrue("Unexpected response body", responseBody.contains("Hello! How are you today?")); + } + } } } diff --git a/liberty-maven-plugin/src/it/dev-container-it/pom.xml b/liberty-maven-plugin/src/it/dev-container-it/pom.xml index 8272b1e68..fff91891b 100755 --- a/liberty-maven-plugin/src/it/dev-container-it/pom.xml +++ b/liberty-maven-plugin/src/it/dev-container-it/pom.xml @@ -27,9 +27,9 @@ @pom.version@ - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/dev-it/pom.xml b/liberty-maven-plugin/src/it/dev-it/pom.xml index 792f26826..9c03ad359 100755 --- a/liberty-maven-plugin/src/it/dev-it/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/pom.xml @@ -27,9 +27,9 @@ @pom.version@ - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/dev-it/resources/multi-module-projects/sample.ejb/ejb-ear/pom.xml b/liberty-maven-plugin/src/it/dev-it/resources/multi-module-projects/sample.ejb/ejb-ear/pom.xml index 674fd5494..d26b1fd60 100644 --- a/liberty-maven-plugin/src/it/dev-it/resources/multi-module-projects/sample.ejb/ejb-ear/pom.xml +++ b/liberty-maven-plugin/src/it/dev-it/resources/multi-module-projects/sample.ejb/ejb-ear/pom.xml @@ -28,9 +28,9 @@ war - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/dev-it/resources/multi-module-projects/sample.ejb/ejb-ear/src/test/java/wasdev/ejb/it/EndpointIT.java b/liberty-maven-plugin/src/it/dev-it/resources/multi-module-projects/sample.ejb/ejb-ear/src/test/java/wasdev/ejb/it/EndpointIT.java index 2e9dd0b82..5e14050ef 100644 --- a/liberty-maven-plugin/src/it/dev-it/resources/multi-module-projects/sample.ejb/ejb-ear/src/test/java/wasdev/ejb/it/EndpointIT.java +++ b/liberty-maven-plugin/src/it/dev-it/resources/multi-module-projects/sample.ejb/ejb-ear/src/test/java/wasdev/ejb/it/EndpointIT.java @@ -18,9 +18,12 @@ import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; public class EndpointIT { private static String URL; @@ -32,20 +35,18 @@ public static void init() { @Test public void testServlet() throws Exception { - HttpClient client = new HttpClient(); + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet method = new HttpGet(URL); - GetMethod method = new GetMethod(URL); + try (CloseableHttpResponse response = client.execute(method)) { + int statusCode = response.getStatusLine().getStatusCode(); - try { - int statusCode = client.executeMethod(method); + assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); - assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); + String responseBody = EntityUtils.toString(response.getEntity()); - String response = method.getResponseBodyAsString(1000); - - assertTrue("Unexpected response body", response.contains("Hello EJB World.")); - } finally { - method.releaseConnection(); - } + assertTrue("Unexpected response body", responseBody.contains("Hello EJB World.")); + } + } } } diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseMultiModuleTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseMultiModuleTest.java index 6a9d24f83..e24b4172d 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseMultiModuleTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseMultiModuleTest.java @@ -26,10 +26,12 @@ import java.nio.file.Files; import java.util.concurrent.TimeUnit; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; import org.apache.commons.io.FileUtils; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -115,24 +117,23 @@ public void verifyTestsDidNotRun(String... moduleArtifactIds) throws Exception { } } - public void assertEndpointContent(String url, String assertResponseContains) throws IOException, HttpException { - assertEndpointContent(url, assertResponseContains, logFile); + public void assertEndpointContent(String url, String assertResponseContains) throws IOException { + assertEndpointContent(url, assertResponseContains, logFile); } - public void assertEndpointContent(String url, String assertResponseContains, File log) throws IOException, HttpException { - HttpClient client = new HttpClient(); + public void assertEndpointContent(String url, String assertResponseContains, File log) throws IOException { + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet method = new HttpGet(url); + + try (CloseableHttpResponse response = client.execute(method)) { + int statusCode = response.getStatusLine().getStatusCode(); - GetMethod method = new GetMethod(url); - try { - int statusCode = client.executeMethod(method); - - assertEquals("HTTP GET failed. " + getLogTail(log), HttpStatus.SC_OK, statusCode); + assertEquals("HTTP GET failed. " + getLogTail(log), HttpStatus.SC_OK, statusCode); - String response = method.getResponseBodyAsString(); + String responseBody = EntityUtils.toString(response.getEntity()); - assertTrue("Unexpected response body: " + response + ". " + getLogTail(), response.contains(assertResponseContains)); - } finally { - method.releaseConnection(); + assertTrue("Unexpected response body: " + responseBody + ". " + getLogTail(), responseBody.contains(assertResponseContains)); + } } } diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleRunInstallEarTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleRunInstallEarTest.java index 3ab9b641f..92b13017a 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleRunInstallEarTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleRunInstallEarTest.java @@ -20,10 +20,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; import java.io.BufferedWriter; import java.io.File; diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleRunTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleRunTest.java index cdb637aeb..f771d8dbe 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleRunTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleRunTest.java @@ -19,10 +19,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; import java.io.BufferedWriter; import java.io.File; diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleSkipFlagsIntegrationTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleSkipFlagsIntegrationTest.java index bc1cf55b8..859a88552 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleSkipFlagsIntegrationTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleSkipFlagsIntegrationTest.java @@ -19,10 +19,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; import java.io.BufferedWriter; import java.io.File; diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleSkipFlagsUnitTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleSkipFlagsUnitTest.java index 739a0de41..3b53641c8 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleSkipFlagsUnitTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultiModuleSkipFlagsUnitTest.java @@ -19,10 +19,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; import java.io.BufferedWriter; import java.io.File; diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleConcurrentLibertyModulesPlTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleConcurrentLibertyModulesPlTest.java index 1c2a0bd68..78bf838a3 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleConcurrentLibertyModulesPlTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleConcurrentLibertyModulesPlTest.java @@ -19,10 +19,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; import java.io.BufferedWriter; import java.io.File; diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesPlTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesPlTest.java index e185adf49..a6c2ed002 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesPlTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesPlTest.java @@ -19,10 +19,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; import java.io.BufferedWriter; import java.io.File; diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesSkinnyModulesTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesSkinnyModulesTest.java index 770404829..5229f3447 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesSkinnyModulesTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesSkinnyModulesTest.java @@ -19,10 +19,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; import java.io.BufferedWriter; import java.io.File; diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesSkipConflictsTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesSkipConflictsTest.java index 8d628c0db..b63eb6fd1 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesSkipConflictsTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesSkipConflictsTest.java @@ -19,10 +19,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; import java.io.BufferedWriter; import java.io.File; diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesTest.java index ccecdc1b1..d10585380 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/MultipleLibertyModulesTest.java @@ -19,10 +19,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; import java.io.BufferedWriter; import java.io.File; diff --git a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/RunTest.java b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/RunTest.java index 15cf0e56c..7e6dbe197 100644 --- a/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/RunTest.java +++ b/liberty-maven-plugin/src/it/dev-it/src/test/java/net/wasdev/wlp/test/dev/it/RunTest.java @@ -24,9 +24,12 @@ import java.io.FileWriter; import java.nio.file.Files; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; import org.apache.commons.io.FileUtils; import org.junit.AfterClass; @@ -45,21 +48,20 @@ public static void setUpBeforeClass() throws Exception { @Test public void endpointTest() throws Exception { - HttpClient client = new HttpClient(); + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet method = new HttpGet(URL); + + try (CloseableHttpResponse response = client.execute(method)) { + int statusCode = response.getStatusLine().getStatusCode(); - GetMethod method = new GetMethod(URL); - try { - int statusCode = client.executeMethod(method); + assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); - assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); + String responseBody = EntityUtils.toString(response.getEntity()); - String response = method.getResponseBodyAsString(); - - assertTrue("Unexpected response body", response.contains("hello world")); - assertFalse(verifyLogMessageExists("SLF4J: Failed to load class", 2000)); - assertTrue(verifyLogMessageExists("SLF4J Logger is ready for messages.", 2000)); - } finally { - method.releaseConnection(); + assertTrue("Unexpected response body", responseBody.contains("hello world")); + assertFalse(verifyLogMessageExists("SLF4J: Failed to load class", 2000)); + assertTrue(verifyLogMessageExists("SLF4J Logger is ready for messages.", 2000)); + } } } diff --git a/liberty-maven-plugin/src/it/dev-skip-install-feature-it/pom.xml b/liberty-maven-plugin/src/it/dev-skip-install-feature-it/pom.xml index d55545e04..0d6b9aaf3 100755 --- a/liberty-maven-plugin/src/it/dev-skip-install-feature-it/pom.xml +++ b/liberty-maven-plugin/src/it/dev-skip-install-feature-it/pom.xml @@ -27,9 +27,9 @@ @pom.version@ - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/ear-project-it/AppXmlEAR/pom.xml b/liberty-maven-plugin/src/it/ear-project-it/AppXmlEAR/pom.xml index 98d9c8c52..35874f31d 100644 --- a/liberty-maven-plugin/src/it/ear-project-it/AppXmlEAR/pom.xml +++ b/liberty-maven-plugin/src/it/ear-project-it/AppXmlEAR/pom.xml @@ -29,9 +29,9 @@ war - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/ear-project-it/SampleEAR-classifier-app/pom.xml b/liberty-maven-plugin/src/it/ear-project-it/SampleEAR-classifier-app/pom.xml index 3474044fc..73eaae330 100644 --- a/liberty-maven-plugin/src/it/ear-project-it/SampleEAR-classifier-app/pom.xml +++ b/liberty-maven-plugin/src/it/ear-project-it/SampleEAR-classifier-app/pom.xml @@ -30,9 +30,9 @@ war - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/ear-project-it/SampleEAR-classifier-app/src/test/java/net/wasdev/wlp/maven/test/it/EndpointIT.java b/liberty-maven-plugin/src/it/ear-project-it/SampleEAR-classifier-app/src/test/java/net/wasdev/wlp/maven/test/it/EndpointIT.java index b0fa4f6b7..8a49a323a 100644 --- a/liberty-maven-plugin/src/it/ear-project-it/SampleEAR-classifier-app/src/test/java/net/wasdev/wlp/maven/test/it/EndpointIT.java +++ b/liberty-maven-plugin/src/it/ear-project-it/SampleEAR-classifier-app/src/test/java/net/wasdev/wlp/maven/test/it/EndpointIT.java @@ -18,9 +18,12 @@ import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; public class EndpointIT { private static String URL; @@ -32,20 +35,18 @@ public static void init() { @Test public void testServlet() throws Exception { - HttpClient client = new HttpClient(); - - GetMethod method = new GetMethod(URL); - - try { - int statusCode = client.executeMethod(method); + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet method = new HttpGet(URL); - assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); - - String response = method.getResponseBodyAsString(1000); - - assertTrue("Unexpected response body", response.contains("Hello classifier test World.")); - } finally { - method.releaseConnection(); + try (CloseableHttpResponse response = client.execute(method)) { + int statusCode = response.getStatusLine().getStatusCode(); + + assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); + + String responseBody = EntityUtils.toString(response.getEntity()); + + assertTrue("Unexpected response body", responseBody.contains("Hello classifier test World.")); + } } } } diff --git a/liberty-maven-plugin/src/it/ear-project-it/SampleEAR/pom.xml b/liberty-maven-plugin/src/it/ear-project-it/SampleEAR/pom.xml index 3adfaf0ae..9be98672c 100644 --- a/liberty-maven-plugin/src/it/ear-project-it/SampleEAR/pom.xml +++ b/liberty-maven-plugin/src/it/ear-project-it/SampleEAR/pom.xml @@ -35,9 +35,9 @@ war - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/ear-project-it/SampleEAR/src/test/java/net/wasdev/wlp/maven/test/it/EndpointIT.java b/liberty-maven-plugin/src/it/ear-project-it/SampleEAR/src/test/java/net/wasdev/wlp/maven/test/it/EndpointIT.java index 037790ef3..d9c30034a 100644 --- a/liberty-maven-plugin/src/it/ear-project-it/SampleEAR/src/test/java/net/wasdev/wlp/maven/test/it/EndpointIT.java +++ b/liberty-maven-plugin/src/it/ear-project-it/SampleEAR/src/test/java/net/wasdev/wlp/maven/test/it/EndpointIT.java @@ -18,9 +18,12 @@ import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; public class EndpointIT { private static String URL; @@ -32,20 +35,18 @@ public static void init() { @Test public void testServlet() throws Exception { - HttpClient client = new HttpClient(); - - GetMethod method = new GetMethod(URL); - - try { - int statusCode = client.executeMethod(method); + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet method = new HttpGet(URL); - assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); - - String response = method.getResponseBodyAsString(1000); - - assertTrue("Unexpected response body", response.contains("Hello EJB World.")); - } finally { - method.releaseConnection(); + try (CloseableHttpResponse response = client.execute(method)) { + int statusCode = response.getStatusLine().getStatusCode(); + + assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); + + String responseBody = EntityUtils.toString(response.getEntity()); + + assertTrue("Unexpected response body", responseBody.contains("Hello EJB World.")); + } } } } diff --git a/liberty-maven-plugin/src/it/ear-project-it/SampleEar_NonLooseApp/pom.xml b/liberty-maven-plugin/src/it/ear-project-it/SampleEar_NonLooseApp/pom.xml index d82dcddd1..19afa1868 100644 --- a/liberty-maven-plugin/src/it/ear-project-it/SampleEar_NonLooseApp/pom.xml +++ b/liberty-maven-plugin/src/it/ear-project-it/SampleEar_NonLooseApp/pom.xml @@ -35,9 +35,9 @@ war - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/ear-project-it/SampleWLP/pom.xml b/liberty-maven-plugin/src/it/ear-project-it/SampleWLP/pom.xml index 5e3cd8002..7235dfcfb 100644 --- a/liberty-maven-plugin/src/it/ear-project-it/SampleWLP/pom.xml +++ b/liberty-maven-plugin/src/it/ear-project-it/SampleWLP/pom.xml @@ -27,9 +27,9 @@ junit - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/ear-project-it/SampleWLP/src/test/java/net/wasdev/wlp/maven/test/it/EndpointIT.java b/liberty-maven-plugin/src/it/ear-project-it/SampleWLP/src/test/java/net/wasdev/wlp/maven/test/it/EndpointIT.java index 037790ef3..d9c30034a 100644 --- a/liberty-maven-plugin/src/it/ear-project-it/SampleWLP/src/test/java/net/wasdev/wlp/maven/test/it/EndpointIT.java +++ b/liberty-maven-plugin/src/it/ear-project-it/SampleWLP/src/test/java/net/wasdev/wlp/maven/test/it/EndpointIT.java @@ -18,9 +18,12 @@ import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; public class EndpointIT { private static String URL; @@ -32,20 +35,18 @@ public static void init() { @Test public void testServlet() throws Exception { - HttpClient client = new HttpClient(); - - GetMethod method = new GetMethod(URL); - - try { - int statusCode = client.executeMethod(method); + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet method = new HttpGet(URL); - assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); - - String response = method.getResponseBodyAsString(1000); - - assertTrue("Unexpected response body", response.contains("Hello EJB World.")); - } finally { - method.releaseConnection(); + try (CloseableHttpResponse response = client.execute(method)) { + int statusCode = response.getStatusLine().getStatusCode(); + + assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); + + String responseBody = EntityUtils.toString(response.getEntity()); + + assertTrue("Unexpected response body", responseBody.contains("Hello EJB World.")); + } } } } diff --git a/liberty-maven-plugin/src/it/ear-project-it/skinnywar-ear/pom.xml b/liberty-maven-plugin/src/it/ear-project-it/skinnywar-ear/pom.xml index 0720cb034..dce772c81 100644 --- a/liberty-maven-plugin/src/it/ear-project-it/skinnywar-ear/pom.xml +++ b/liberty-maven-plugin/src/it/ear-project-it/skinnywar-ear/pom.xml @@ -33,9 +33,9 @@ commons-io - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/ear-project-it/skinnywar-wlp/pom.xml b/liberty-maven-plugin/src/it/ear-project-it/skinnywar-wlp/pom.xml index a7abe880a..4229bc75f 100644 --- a/liberty-maven-plugin/src/it/ear-project-it/skinnywar-wlp/pom.xml +++ b/liberty-maven-plugin/src/it/ear-project-it/skinnywar-wlp/pom.xml @@ -27,9 +27,9 @@ junit - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/generate-features-it/pom.xml b/liberty-maven-plugin/src/it/generate-features-it/pom.xml index 9a8614ab9..e04064b37 100755 --- a/liberty-maven-plugin/src/it/generate-features-it/pom.xml +++ b/liberty-maven-plugin/src/it/generate-features-it/pom.xml @@ -31,9 +31,9 @@ @pom.version@ - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/loose-config-it/pom.xml b/liberty-maven-plugin/src/it/loose-config-it/pom.xml index a3e696cb0..cf5317c7f 100644 --- a/liberty-maven-plugin/src/it/loose-config-it/pom.xml +++ b/liberty-maven-plugin/src/it/loose-config-it/pom.xml @@ -27,9 +27,9 @@ provided - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/loose-config-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java b/liberty-maven-plugin/src/it/loose-config-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java index 1dc09562b..f777bf172 100644 --- a/liberty-maven-plugin/src/it/loose-config-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java +++ b/liberty-maven-plugin/src/it/loose-config-it/src/test/java/net/wasdev/wlp/test/servlet/it/EndpointTest.java @@ -18,9 +18,12 @@ import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; public class EndpointTest { private static String URL; @@ -32,20 +35,18 @@ public static void init() { @Test public void testServlet() throws Exception { - HttpClient client = new HttpClient(); + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpGet method = new HttpGet(URL); - GetMethod method = new GetMethod(URL); + try (CloseableHttpResponse response = client.execute(method)) { + int statusCode = response.getStatusLine().getStatusCode(); - try { - int statusCode = client.executeMethod(method); + assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); - assertEquals("HTTP GET failed", HttpStatus.SC_OK, statusCode); + String responseBody = EntityUtils.toString(response.getEntity()); - String response = method.getResponseBodyAsString(); - - assertTrue("Unexpected response body", response.contains("Hello! How are you today?")); - } finally { - method.releaseConnection(); - } + assertTrue("Unexpected response body", responseBody.contains("Hello! How are you today?")); + } + } } } diff --git a/liberty-maven-plugin/src/it/package-type-config-it/pom.xml b/liberty-maven-plugin/src/it/package-type-config-it/pom.xml index ea47e4e04..fdf78dba9 100644 --- a/liberty-maven-plugin/src/it/package-type-config-it/pom.xml +++ b/liberty-maven-plugin/src/it/package-type-config-it/pom.xml @@ -25,9 +25,9 @@ provided - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/package-type-config-new-posix-it/pom.xml b/liberty-maven-plugin/src/it/package-type-config-new-posix-it/pom.xml index 00e1ba6e1..736dab792 100644 --- a/liberty-maven-plugin/src/it/package-type-config-new-posix-it/pom.xml +++ b/liberty-maven-plugin/src/it/package-type-config-new-posix-it/pom.xml @@ -25,9 +25,9 @@ provided - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/server-config-props-it/pom.xml b/liberty-maven-plugin/src/it/server-config-props-it/pom.xml index 637c0e9ed..f933e77c7 100644 --- a/liberty-maven-plugin/src/it/server-config-props-it/pom.xml +++ b/liberty-maven-plugin/src/it/server-config-props-it/pom.xml @@ -30,9 +30,9 @@ provided - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test diff --git a/liberty-maven-plugin/src/it/toolchain-run-it/pom.xml b/liberty-maven-plugin/src/it/toolchain-run-it/pom.xml index 92f9b2ab6..b7fd715e5 100755 --- a/liberty-maven-plugin/src/it/toolchain-run-it/pom.xml +++ b/liberty-maven-plugin/src/it/toolchain-run-it/pom.xml @@ -27,9 +27,9 @@ @pom.version@ - commons-httpclient - commons-httpclient - 3.1 + org.apache.httpcomponents + httpclient + 4.5.14 test