hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1696143 - /httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
Date Sun, 16 Aug 2015 14:19:04 GMT
Author: olegk
Date: Sun Aug 16 14:19:04 2015
New Revision: 1696143

URL: http://svn.apache.org/r1696143
Log:
HTTPCLIENT-1673: make the test case a bit more substantial.

Modified:
    httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java

Modified: httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java?rev=1696143&r1=1696142&r2=1696143&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
(original)
+++ httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
Sun Aug 16 14:19:04 2015
@@ -27,7 +27,12 @@
 
 package org.apache.http.osgi.impl;
 
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
 import org.apache.http.entity.mime.content.ByteArrayBody;
+import org.apache.http.entity.mime.content.StringBody;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
@@ -88,6 +93,17 @@ public class MimeExportedIT {
 
     @Test
     public void useContentBody() {
-       new ByteArrayBody(new byte[0], "filename.txt");
+        final HttpPost httppost = new HttpPost("http://localhost:8181/cxf/annotator/annotate");
+        httppost.addHeader("Accept", "application/json");
+        final StringBody options = new StringBody("{}", ContentType.APPLICATION_JSON);
+        final byte[] atData = new byte[] { 1 };
+        final ByteArrayBody bab = new ByteArrayBody(atData, ContentType.APPLICATION_JSON,
"at.json");
+
+        final HttpEntity reqEntity = MultipartEntityBuilder.create()
+                .setContentType(ContentType.create("multipart/mixed"))
+                .addPart("options", options)
+                .addPart("text", bab)
+                .build();
+        httppost.setEntity(reqEntity);
     }
 }



Mime
View raw message