Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3157011AF5 for ; Thu, 21 Aug 2014 09:35:24 +0000 (UTC) Received: (qmail 8566 invoked by uid 500); 21 Aug 2014 09:35:23 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 8459 invoked by uid 500); 21 Aug 2014 09:35:23 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 8394 invoked by uid 99); 21 Aug 2014 09:35:23 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Aug 2014 09:35:23 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9481D9BAE15; Thu, 21 Aug 2014 09:35:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ningjiang@apache.org To: commits@camel.apache.org Date: Thu, 21 Aug 2014 09:35:24 -0000 Message-Id: <99c3e398e6074b32967e1e139da255ae@git.apache.org> In-Reply-To: <693c60a12b63496697da79721ca8324c@git.apache.org> References: <693c60a12b63496697da79721ca8324c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] git commit: Using http4.3 API when running the osgi test of CXF Using http4.3 API when running the osgi test of CXF Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7c62ca9c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7c62ca9c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7c62ca9c Branch: refs/heads/master Commit: 7c62ca9c5c48dacd9b046e3a007f58567d649335 Parents: 56fe28a Author: Willem Jiang Authored: Thu Aug 21 17:13:30 2014 +0800 Committer: Willem Jiang Committed: Thu Aug 21 17:13:30 2014 +0800 ---------------------------------------------------------------------- .../itest/osgi/cxf/CxfBeanSpringRouteTest.java | 6 +++-- .../blueprint/CxfBeanBlueprintRouterTest.java | 10 +++++--- .../cxf/blueprint/CxfRsBlueprintRouterTest.java | 26 +++++++++++--------- 3 files changed, 24 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/7c62ca9c/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfBeanSpringRouteTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfBeanSpringRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfBeanSpringRouteTest.java index 5b01dc4..ebf2366 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfBeanSpringRouteTest.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/CxfBeanSpringRouteTest.java @@ -20,7 +20,9 @@ import org.apache.camel.itest.osgi.OSGiIntegrationSpringTestSupport; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.junit.Test; import org.junit.runner.RunWith; @@ -41,7 +43,7 @@ public class CxfBeanSpringRouteTest extends OSGiIntegrationSpringTestSupport { public void testGetCustomer() throws Exception { HttpGet get = new HttpGet("http://localhost:9000/route/customerservice/customers/123"); get.addHeader("Accept" , "application/json"); - HttpClient httpclient = new DefaultHttpClient(); + CloseableHttpClient httpclient = HttpClientBuilder.create().build(); try { HttpResponse response = httpclient.execute(get); @@ -49,7 +51,7 @@ public class CxfBeanSpringRouteTest extends OSGiIntegrationSpringTestSupport { assertEquals("{\"Customer\":{\"id\":123,\"name\":\"John\"}}", EntityUtils.toString(response.getEntity())); } finally { - httpclient.getConnectionManager().shutdown(); + httpclient.close(); } } http://git-wip-us.apache.org/repos/asf/camel/blob/7c62ca9c/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBeanBlueprintRouterTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBeanBlueprintRouterTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBeanBlueprintRouterTest.java index 462a98a..490eb94 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBeanBlueprintRouterTest.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBeanBlueprintRouterTest.java @@ -21,7 +21,9 @@ import org.apache.camel.itest.osgi.blueprint.OSGiBlueprintTestSupport; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.junit.Test; import org.junit.runner.RunWith; @@ -45,7 +47,7 @@ public class CxfBeanBlueprintRouterTest extends OSGiBlueprintTestSupport { public void testGetCustomer() throws Exception { HttpGet get = new HttpGet("http://localhost:9000/route/customerservice/customers/123"); get.addHeader("Accept" , "application/json"); - HttpClient httpclient = new DefaultHttpClient(); + CloseableHttpClient httpclient = HttpClientBuilder.create().build(); try { HttpResponse response = httpclient.execute(get); @@ -53,7 +55,7 @@ public class CxfBeanBlueprintRouterTest extends OSGiBlueprintTestSupport { assertEquals("{\"Customer\":{\"id\":123,\"name\":\"John\"}}", EntityUtils.toString(response.getEntity())); } finally { - httpclient.getConnectionManager().shutdown(); + httpclient.close(); } } @@ -62,7 +64,7 @@ public class CxfBeanBlueprintRouterTest extends OSGiBlueprintTestSupport { public void testGetCustomerWithQuery() throws Exception { HttpGet get = new HttpGet("http://localhost:9000/route/customerservice/customers?id=123"); get.addHeader("Accept" , "application/json"); - HttpClient httpclient = new DefaultHttpClient(); + CloseableHttpClient httpclient = HttpClientBuilder.create().build(); try { HttpResponse response = httpclient.execute(get); @@ -70,7 +72,7 @@ public class CxfBeanBlueprintRouterTest extends OSGiBlueprintTestSupport { assertEquals("{\"Customer\":{\"id\":123,\"name\":\"John\"}}", EntityUtils.toString(response.getEntity())); } finally { - httpclient.getConnectionManager().shutdown(); + httpclient.close(); } } http://git-wip-us.apache.org/repos/asf/camel/blob/7c62ca9c/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouterTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouterTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouterTest.java index 65eee47..f456e27 100644 --- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouterTest.java +++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouterTest.java @@ -28,7 +28,9 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -73,7 +75,7 @@ public class CxfRsBlueprintRouterTest extends OSGiBlueprintTestSupport { public void testGetCustomer() throws Exception { HttpGet get = new HttpGet("http://localhost:9000/route/customerservice/customers/123"); get.addHeader("Accept" , "application/json"); - HttpClient httpclient = new DefaultHttpClient(); + CloseableHttpClient httpclient = HttpClientBuilder.create().build(); try { HttpResponse response = httpclient.execute(get); @@ -85,7 +87,7 @@ public class CxfRsBlueprintRouterTest extends OSGiBlueprintTestSupport { boolean isMary = "{\"Customer\":{\"id\":123,\"name\":\"Mary\"}}".equals(s); assertTrue("Should be John or Mary", isJohn || isMary); } finally { - httpclient.getConnectionManager().shutdown(); + httpclient.close(); } } @@ -94,7 +96,7 @@ public class CxfRsBlueprintRouterTest extends OSGiBlueprintTestSupport { public void testGetCustomerWithQuery() throws Exception { HttpGet get = new HttpGet("http://localhost:9000/route/customerservice/customers?id=123"); get.addHeader("Accept" , "application/json"); - HttpClient httpclient = new DefaultHttpClient(); + CloseableHttpClient httpclient = HttpClientBuilder.create().build(); try { HttpResponse response = httpclient.execute(get); @@ -102,7 +104,7 @@ public class CxfRsBlueprintRouterTest extends OSGiBlueprintTestSupport { assertEquals("{\"Customer\":{\"id\":123,\"name\":\"John\"}}", EntityUtils.toString(response.getEntity())); } finally { - httpclient.getConnectionManager().shutdown(); + httpclient.close(); } } @@ -110,7 +112,7 @@ public class CxfRsBlueprintRouterTest extends OSGiBlueprintTestSupport { public void testGetCustomers() throws Exception { HttpGet get = new HttpGet("http://localhost:9000/route/customerservice/customers/"); get.addHeader("Accept" , "application/xml"); - HttpClient httpclient = new DefaultHttpClient(); + CloseableHttpClient httpclient = HttpClientBuilder.create().build(); try { HttpResponse response = httpclient.execute(get); @@ -125,7 +127,7 @@ public class CxfRsBlueprintRouterTest extends OSGiBlueprintTestSupport { fail("Not expected body returned: " + s); } } finally { - httpclient.getConnectionManager().shutdown(); + httpclient.close(); } } @@ -133,7 +135,7 @@ public class CxfRsBlueprintRouterTest extends OSGiBlueprintTestSupport { public void testGetSubResource() throws Exception { HttpGet get = new HttpGet("http://localhost:9000/route/customerservice/orders/223/products/323"); get.addHeader("Accept" , "application/json"); - HttpClient httpclient = new DefaultHttpClient(); + CloseableHttpClient httpclient = HttpClientBuilder.create().build(); try { HttpResponse response = httpclient.execute(get); @@ -141,7 +143,7 @@ public class CxfRsBlueprintRouterTest extends OSGiBlueprintTestSupport { assertEquals("{\"Product\":{\"description\":\"product 323\",\"id\":323}}", EntityUtils.toString(response.getEntity())); } finally { - httpclient.getConnectionManager().shutdown(); + httpclient.close(); } } @@ -151,14 +153,14 @@ public class CxfRsBlueprintRouterTest extends OSGiBlueprintTestSupport { StringEntity entity = new StringEntity(PUT_REQUEST, "ISO-8859-1"); entity.setContentType("text/xml; charset=ISO-8859-1"); put.setEntity(entity); - HttpClient httpclient = new DefaultHttpClient(); + CloseableHttpClient httpclient = HttpClientBuilder.create().build(); try { HttpResponse response = httpclient.execute(put); assertEquals(200, response.getStatusLine().getStatusCode()); assertEquals("", EntityUtils.toString(response.getEntity())); } finally { - httpclient.getConnectionManager().shutdown(); + httpclient.close(); } } @@ -169,7 +171,7 @@ public class CxfRsBlueprintRouterTest extends OSGiBlueprintTestSupport { StringEntity entity = new StringEntity(POST_REQUEST, "ISO-8859-1"); entity.setContentType("text/xml; charset=ISO-8859-1"); post.setEntity(entity); - HttpClient httpclient = new DefaultHttpClient(); + CloseableHttpClient httpclient = HttpClientBuilder.create().build(); try { HttpResponse response = httpclient.execute(post); @@ -177,7 +179,7 @@ public class CxfRsBlueprintRouterTest extends OSGiBlueprintTestSupport { assertEquals("124Jack", EntityUtils.toString(response.getEntity())); } finally { - httpclient.getConnectionManager().shutdown(); + httpclient.close(); } }