camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmoulli...@apache.org
Subject [10/50] git commit: CAMEL-7633 Reenable the unit test
Date Fri, 17 Oct 2014 08:40:03 GMT
CAMEL-7633 Reenable the unit test

Conflicts:
	components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java


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

Branch: refs/remotes/origin/camel-2.13.x
Commit: aca61d12eba3c908cea3e89446c104abdf870a52
Parents: 6df2028
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Tue Sep 16 23:07:38 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Wed Sep 17 10:55:34 2014 +0800

----------------------------------------------------------------------
 .../component/restlet/RestletSetBodyTest.java   | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/aca61d12/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
index a436ec5..74906ff 100644
--- a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
+++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java
@@ -21,15 +21,15 @@ import java.io.InputStream;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
 import org.junit.Test;
 import org.restlet.data.MediaType;
 import org.restlet.representation.InputRepresentation;
 
 /**
- * @version 
+ * @version
  */
 public class RestletSetBodyTest extends RestletTestSupport {
 
@@ -38,31 +38,31 @@ public class RestletSetBodyTest extends RestletTestSupport {
         String response = template.requestBody("restlet:http://0.0.0.0:" + portNum + "/stock/ORCL?restletMethod=get",
null, String.class);
         assertEquals("110", response);
     }
-    
+
     @Test
     public void testSetBodyRepresentation() throws Exception {
-        HttpGet get = new HttpGet("http://0.0.0.0:" + portNum + "/images/123");
-        HttpClient httpclient = new DefaultHttpClient();
+        HttpGet get = new HttpGet("http://0.0.0.0:" + "1234" + "/images/123");
+        CloseableHttpClient httpclient = HttpClientBuilder.create().build();
         InputStream is = null;
         try {
             HttpResponse response = httpclient.execute(get);
             assertEquals(200, response.getStatusLine().getStatusCode());
             assertEquals("image/png", response.getEntity().getContentType().getValue());
             is = response.getEntity().getContent();
-            assertEquals("Get wrong available size", 10, is.available());
+            assertEquals("Get wrong available size", 10, response.getEntity().getContentLength());
             byte[] buffer = new byte[10];
             is.read(buffer);
             for (int i = 0; i < 10; i++) {
                 assertEquals(i + 1, buffer[i]);
             }
         } finally {
-            httpclient.getConnectionManager().shutdown();
+            httpclient.close();
             if (is != null) {
                 is.close();
             }
         }
     }
-    
+
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
@@ -77,7 +77,8 @@ public class RestletSetBodyTest extends RestletTestSupport {
                     image[i] = (byte)(i + 1);
                 }
                 ByteArrayInputStream inputStream = new ByteArrayInputStream(image);
-                from("restlet:http://0.0.0.0:" + portNum + "/images/{symbol}?restletMethods=get")
+
+                from("restlet:http://0.0.0.0:" + "1234" + "/images/{symbol}?restletMethods=get")
                     .setBody().constant(new InputRepresentation(inputStream, MediaType.IMAGE_PNG,
10));
             }
         };


Mime
View raw message