HTTPCLIENT-1673: make the test case a bit more substantial.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1696145 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2015-08-16 14:19:41 +00:00
parent 0b108f8b2f
commit c959fd3967
1 changed files with 17 additions and 1 deletions

View File

@ -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);
}
}