camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [1/6] git commit: CAMEL-7633 Reenable the unit test
Date Wed, 17 Sep 2014 03:04:50 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.13.x 6df202851 -> ee02b82d6
  refs/heads/camel-2.14.x 4d2b14c25 -> 547cee013


CAMEL-7633 Reenable the unit test


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

Branch: refs/heads/camel-2.14.x
Commit: 70523ac8f847fa2e488c28ab8881c0e13b3e1c0b
Parents: 4d2b14c
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:52:52 2014 +0800

----------------------------------------------------------------------
 .../camel/component/restlet/RestletSetBodyTest.java | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/70523ac8/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 bd7d9c0..63eadd8 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,10 +21,9 @@ 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.junit.Ignore;
+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;
@@ -41,24 +40,23 @@ public class RestletSetBodyTest extends RestletTestSupport {
     }
     
     @Test
-    @Ignore
     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();
             }
@@ -81,7 +79,7 @@ public class RestletSetBodyTest extends RestletTestSupport {
                 }
                 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