You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/07/20 22:29:46 UTC
[1/4] olingo-odata2 git commit: [OLINGO-733] Fix test
Repository: olingo-odata2
Updated Branches:
refs/heads/master 4ef73c4b4 -> 07b2e6441
[OLINGO-733] Fix test
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/03858a15
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/03858a15
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/03858a15
Branch: refs/heads/master
Commit: 03858a15dc4ecd956cb2ab7cb6dcbb5082798de7
Parents: a9af400
Author: Michael Bolz <mi...@sap.com>
Authored: Mon Jul 20 07:44:42 2015 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Mon Jul 20 07:44:42 2015 +0200
----------------------------------------------------------------------
.../odata2/core/batch/BatchRequestWriterITTest.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/03858a15/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java
index e2aa353..229603d 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java
@@ -24,6 +24,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -126,6 +127,12 @@ public class BatchRequestWriterITTest {
assertEquals("application/json", oDataRequestPost.getRequestHeaderValue(HttpHeaders.CONTENT_TYPE));
}
+ /**
+ * BatchChangeSetPart can only handle utf-8 (DEFAULT_CHARSET for Olingo [BatchHelper.DEFAULT_ENCODING]).
+ * Hence it is not relevant which charset is set in changeSetHeader
+ *
+ * @throws Exception
+ */
@Test
public void testChangeSetIso() throws Exception {
List<BatchPart> batch = new ArrayList<BatchPart>();
@@ -168,7 +175,8 @@ public class BatchRequestWriterITTest {
final ODataRequest oDataRequestPost = partChangeSet.getRequests().get(0);
assertEquals("Employees", oDataRequestGet.getPathInfo().getODataSegments().get(0).getPath());
assertEquals("111", oDataRequestPost.getRequestHeaderValue(BatchHelper.MIME_HEADER_CONTENT_ID));
- assertEquals(body, streamToString(oDataRequestPost.getBody()));
+ StringHelper.Stream st = StringHelper.toStream(oDataRequestPost.getBody());
+ assertEquals(body, st.asString("utf-8"));
assertEquals("application/json; charset=" + charset,
oDataRequestPost.getRequestHeaderValue(HttpHeaders.CONTENT_TYPE));
}
[4/4] olingo-odata2 git commit: [OLINGO-733] Improved BatchParser and
add more test cases
Posted by mi...@apache.org.
[OLINGO-733] Improved BatchParser and add more test cases
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/07b2e644
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/07b2e644
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/07b2e644
Branch: refs/heads/master
Commit: 07b2e644195ac73c107b7d385420cf9098eae353
Parents: e0311e1
Author: mibo <mi...@mirb.de>
Authored: Mon Jul 20 22:27:12 2015 +0200
Committer: mibo <mi...@mirb.de>
Committed: Mon Jul 20 22:27:12 2015 +0200
----------------------------------------------------------------------
.../olingo/odata2/core/batch/BatchHelper.java | 4 ----
.../odata2/core/batch/BatchRequestWriter.java | 8 +++----
.../odata2/core/batch/v2/BatchParserCommon.java | 22 ++++++++++----------
.../batch/v2/BatchRequestTransformator.java | 7 ++++---
.../core/batch/BatchRequestWriterITTest.java | 20 +++++++++---------
5 files changed, 29 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/07b2e644/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java
index 2f73216..835f47b 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java
@@ -90,10 +90,6 @@ public class BatchHelper {
return DEFAULT_CHARSET;
}
- private static String convertByteArray(byte[] entity, Charset charset) {
- return new String(entity, charset);
- }
-
/**
* Builder class to create the body and the header.
*/
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/07b2e644/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestWriter.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestWriter.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestWriter.java
index 3e7a1da..c050a1d 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestWriter.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchRequestWriter.java
@@ -80,18 +80,18 @@ public class BatchRequestWriter {
writer.append(CRLF).append("--").append(boundary).append("--").append(CRLF);
}
- private void appendRequestBodyPart(BatchQueryPart request) {
+ private void appendRequestBodyPart(final BatchQueryPart request) {
appendRequestBodyPart(request.getMethod(), request.getUri(), request.getHeaders(),
new BatchHelper.Body(), request.getContentId());
}
- private void appendRequestBodyPart(BatchChangeSetPart request) {
+ private void appendRequestBodyPart(final BatchChangeSetPart request) {
appendRequestBodyPart(request.getMethod(), request.getUri(), request.getHeaders(),
new BatchHelper.Body(request), request.getContentId());
}
- private void appendRequestBodyPart(String method, String uri,
- Map<String, String> headers, BatchHelper.Body body, String contentId) {
+ private void appendRequestBodyPart(final String method, final String uri, final Map<String, String> headers,
+ final BatchHelper.Body body, final String contentId) {
boolean isContentLengthPresent = false;
writer.append(HttpHeaders.CONTENT_TYPE).append(COLON).append(SP).append(HttpContentType.APPLICATION_HTTP)
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/07b2e644/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
index 2aa9311..66d4a2c 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
@@ -72,28 +72,28 @@ public class BatchParserCommon {
}
/**
- * Convert body of BatchQueryOperation into a InputStream.
- * The body will get via the charset set in ContentType and
+ * Convert body in form of List of Line items into a InputStream.
+ * The body is transformed with the charset set in ContentType and
* if no charset is set with Olingo default charset (see <code>BatchHelper.DEFAULT_CHARSET</code>).
*
* If content length is a positive value the content is trimmed to according length.
* Otherwise the whole content is written into the InputStream.
*
- * @param operation from which the content is written into the InputStream
+ * @param contentType content type value
+ * @param body content which is written into the InputStream
* @param contentLength if it is a positive value the content is trimmed to according length.
* Otherwise the whole content is written into the InputStream.
* @return Content of BatchQueryOperation as InputStream in according charset and length
* @throws BatchException if something goes wrong
*/
- public static InputStream convertToInputStream(BatchQueryOperation operation, int contentLength)
+ public static InputStream convertToInputStream(final String contentType, final List<Line> body, final int contentLength)
throws BatchException {
- String contentType = operation.getHeaders().getHeader(HttpHeaders.CONTENT_TYPE);
Charset charset = BatchHelper.extractCharset(contentType);
final String message;
if(contentLength <= -1) {
- message = lineListToString(operation.getBody());
+ message = lineListToString(body);
} else {
- message = trimLineListToLength(operation.getBody(), contentLength);
+ message = trimLineListToLength(body, contentLength);
}
return new ByteArrayInputStream(message.getBytes(charset));
}
@@ -126,21 +126,21 @@ public class BatchParserCommon {
}
}
- final int lineNumer = (message.size() > 0) ? message.get(0).getLineNumber() : 0;
+ final int lineNumber = (message.size() > 0) ? message.get(0).getLineNumber() : 0;
// Remove preamble
if (messageParts.size() > 0) {
messageParts.remove(0);
} else {
- throw new BatchException(BatchException.MISSING_BOUNDARY_DELIMITER.addContent(lineNumer));
+ throw new BatchException(BatchException.MISSING_BOUNDARY_DELIMITER.addContent(lineNumber));
}
if (!isEndReached) {
- throw new BatchException(BatchException.MISSING_CLOSE_DELIMITER.addContent(lineNumer));
+ throw new BatchException(BatchException.MISSING_CLOSE_DELIMITER.addContent(lineNumber));
}
if (messageParts.size() == 0) {
- throw new BatchException(BatchException.NO_MATCH_WITH_BOUNDARY_STRING.addContent(boundary).addContent(lineNumer));
+ throw new BatchException(BatchException.NO_MATCH_WITH_BOUNDARY_STRING.addContent(boundary).addContent(lineNumber));
}
return messageParts;
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/07b2e644/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java
index a3b376b..dbe349d 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java
@@ -88,13 +88,13 @@ public class BatchRequestTransformator implements BatchTransformator {
statusLine.validateHttpMethod(isChangeSet);
validateBody(statusLine, operation);
- InputStream bodyStrean = getBodyStream(operation, headers, statusLine);
+ InputStream bodyStream = getBodyStream(operation, headers, statusLine);
ODataRequestBuilder requestBuilder = ODataRequest.method(statusLine.getMethod())
.acceptableLanguages(getAcceptLanguageHeaders(headers))
.acceptHeaders(headers.getHeaders(HttpHeaders.ACCEPT))
.allQueryParameters(BatchParserCommon.parseQueryParameter(operation.getHttpStatusLine()))
- .body(bodyStrean)
+ .body(bodyStream)
.requestHeaders(headers.toMultiMap())
.pathInfo(statusLine.getPathInfo());
@@ -127,7 +127,8 @@ public class BatchRequestTransformator implements BatchTransformator {
return new ByteArrayInputStream(new byte[0]);
} else {
int contentLength = BatchTransformatorCommon.getContentLength(headers);
- return BatchParserCommon.convertToInputStream(operation, contentLength);
+ String contentType = headers.getHeader(HttpHeaders.CONTENT_TYPE);
+ return BatchParserCommon.convertToInputStream(contentType, operation.getBody(), contentLength);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/07b2e644/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java
index 6e1626e..49ea7ce 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java
@@ -24,7 +24,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -43,7 +42,6 @@ import org.apache.olingo.odata2.core.PathInfoImpl;
import org.apache.olingo.odata2.core.batch.v2.BatchParser;
import org.apache.olingo.odata2.testutil.helper.StringHelper;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
public class BatchRequestWriterITTest {
@@ -128,14 +126,17 @@ public class BatchRequestWriterITTest {
assertEquals("application/json", oDataRequestPost.getRequestHeaderValue(HttpHeaders.CONTENT_TYPE));
}
- /**
- * BatchChangeSetPart can only handle utf-8 (DEFAULT_CHARSET for Olingo [BatchHelper.DEFAULT_ENCODING]).
- * Hence it is not relevant which charset is set in changeSetHeader
- *
- * @throws Exception
- */
@Test
public void testChangeSetIso() throws Exception {
+ testChangeSetWithCharset("iso-8859-1");
+ }
+
+ @Test
+ public void testChangeSetUtf8() throws Exception {
+ testChangeSetWithCharset("utf-8");
+ }
+
+ private void testChangeSetWithCharset(final String charset) throws Exception {
List<BatchPart> batch = new ArrayList<BatchPart>();
Map<String, String> headers = new HashMap<String, String>();
headers.put("Accept", "application/json");
@@ -143,7 +144,6 @@ public class BatchRequestWriterITTest {
batch.add(request);
Map<String, String> changeSetHeaders = new HashMap<String, String>();
- String charset = "iso-8859-1";
changeSetHeaders.put("content-type", "application/json; charset=" + charset);
String body = "äöü/9j/4AAQSkZJRgABAQEBLAEsAAD/4RM0RXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEA";
StringHelper.Stream stBody = StringHelper.toStream(body, charset);
@@ -178,7 +178,7 @@ public class BatchRequestWriterITTest {
assertEquals("Employees", oDataRequestGet.getPathInfo().getODataSegments().get(0).getPath());
assertEquals("111", oDataRequestPost.getRequestHeaderValue(BatchHelper.MIME_HEADER_CONTENT_ID));
StringHelper.Stream st = StringHelper.toStream(oDataRequestPost.getBody());
- assertEquals(body, st.asString("utf-8"));
+ assertEquals(body, st.asString(charset));
assertEquals("application/json; charset=" + charset,
oDataRequestPost.getRequestHeaderValue(HttpHeaders.CONTENT_TYPE));
}
[3/4] olingo-odata2 git commit: [OLINGO-733] Fix missing
BatchParserCommon
Posted by mi...@apache.org.
[OLINGO-733] Fix missing BatchParserCommon
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/e0311e19
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/e0311e19
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/e0311e19
Branch: refs/heads/master
Commit: e0311e19f13a91d227eeb36f8c2474bbfd4c7515
Parents: 13b7b48
Author: mibo <mi...@mirb.de>
Authored: Mon Jul 20 20:15:37 2015 +0200
Committer: mibo <mi...@mirb.de>
Committed: Mon Jul 20 20:34:56 2015 +0200
----------------------------------------------------------------------
.../olingo/odata2/core/batch/BatchHelper.java | 7 ++++
.../odata2/core/batch/v2/BatchParserCommon.java | 37 ++++++++++++++------
.../batch/v2/BatchRequestTransformator.java | 7 +---
.../core/batch/BatchRequestWriterITTest.java | 6 ++--
4 files changed, 37 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/e0311e19/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java
index 41ad0be..2f73216 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/BatchHelper.java
@@ -72,6 +72,13 @@ public class BatchHelper {
return getCharset(contentType);
}
+ public static Charset extractCharset(String contentType) {
+ if(contentType == null) {
+ return DEFAULT_CHARSET;
+ }
+ return getCharset(contentType);
+ }
+
private static Charset getCharset(String contentType) {
ContentType ct = ContentType.parse(contentType);
if(ct != null) {
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/e0311e19/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
index dcf878c..2aa9311 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchParserCommon.java
@@ -20,6 +20,7 @@ package org.apache.olingo.odata2.core.batch.v2;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -34,6 +35,7 @@ import org.apache.olingo.odata2.api.batch.BatchException;
import org.apache.olingo.odata2.api.commons.HttpContentType;
import org.apache.olingo.odata2.api.commons.HttpHeaders;
import org.apache.olingo.odata2.core.batch.AcceptParser;
+import org.apache.olingo.odata2.core.batch.BatchHelper;
import org.apache.olingo.odata2.core.commons.Decoder;
public class BatchParserCommon {
@@ -69,18 +71,31 @@ public class BatchParserCommon {
return builder.toString();
}
- public static InputStream convertLineListToInputStream(final List<Line> messageList, final int contentLength)
+ /**
+ * Convert body of BatchQueryOperation into a InputStream.
+ * The body will get via the charset set in ContentType and
+ * if no charset is set with Olingo default charset (see <code>BatchHelper.DEFAULT_CHARSET</code>).
+ *
+ * If content length is a positive value the content is trimmed to according length.
+ * Otherwise the whole content is written into the InputStream.
+ *
+ * @param operation from which the content is written into the InputStream
+ * @param contentLength if it is a positive value the content is trimmed to according length.
+ * Otherwise the whole content is written into the InputStream.
+ * @return Content of BatchQueryOperation as InputStream in according charset and length
+ * @throws BatchException if something goes wrong
+ */
+ public static InputStream convertToInputStream(BatchQueryOperation operation, int contentLength)
throws BatchException {
- final String message = trimLineListToLength(messageList, contentLength);
-
- return new ByteArrayInputStream(message.getBytes());
- }
-
- public static InputStream convertLineListToInputStream(final List<Line> messageList)
- throws BatchException {
- final String message = lineListToString(messageList);
-
- return new ByteArrayInputStream(message.getBytes());
+ String contentType = operation.getHeaders().getHeader(HttpHeaders.CONTENT_TYPE);
+ Charset charset = BatchHelper.extractCharset(contentType);
+ final String message;
+ if(contentLength <= -1) {
+ message = lineListToString(operation.getBody());
+ } else {
+ message = trimLineListToLength(operation.getBody(), contentLength);
+ }
+ return new ByteArrayInputStream(message.getBytes(charset));
}
static List<List<Line>> splitMessageByBoundary(final List<Line> message, final String boundary)
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/e0311e19/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java
index 66600b5..a3b376b 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/batch/v2/BatchRequestTransformator.java
@@ -127,12 +127,7 @@ public class BatchRequestTransformator implements BatchTransformator {
return new ByteArrayInputStream(new byte[0]);
} else {
int contentLength = BatchTransformatorCommon.getContentLength(headers);
-
- if (contentLength == -1) {
- return BatchParserCommon.convertLineListToInputStream(operation.getBody());
- } else {
- return BatchParserCommon.convertLineListToInputStream(operation.getBody(), contentLength);
- }
+ return BatchParserCommon.convertToInputStream(operation, contentLength);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/e0311e19/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java
index b66f5b1..6e1626e 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java
@@ -135,7 +135,6 @@ public class BatchRequestWriterITTest {
* @throws Exception
*/
@Test
- @Ignore("Rework for test necessary")
public void testChangeSetIso() throws Exception {
List<BatchPart> batch = new ArrayList<BatchPart>();
Map<String, String> headers = new HashMap<String, String>();
@@ -147,9 +146,10 @@ public class BatchRequestWriterITTest {
String charset = "iso-8859-1";
changeSetHeaders.put("content-type", "application/json; charset=" + charset);
String body = "äöü/9j/4AAQSkZJRgABAQEBLAEsAAD/4RM0RXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEA";
+ StringHelper.Stream stBody = StringHelper.toStream(body, charset);
BatchChangeSetPart changeRequest = BatchChangeSetPart.method(POST)
.uri("Employees")
- .body(body)
+ .body(stBody.asString(charset))
.headers(changeSetHeaders)
.contentId("111")
.build();
@@ -178,7 +178,7 @@ public class BatchRequestWriterITTest {
assertEquals("Employees", oDataRequestGet.getPathInfo().getODataSegments().get(0).getPath());
assertEquals("111", oDataRequestPost.getRequestHeaderValue(BatchHelper.MIME_HEADER_CONTENT_ID));
StringHelper.Stream st = StringHelper.toStream(oDataRequestPost.getBody());
- assertEquals(body, st.asString("utf-8"));
+ assertEquals(body, st.asString("utf-8"));
assertEquals("application/json; charset=" + charset,
oDataRequestPost.getRequestHeaderValue(HttpHeaders.CONTENT_TYPE));
}
[2/4] olingo-odata2 git commit: [OLINGO-733] Merge branch 'master'
into OLINGO-733_BatchFix
Posted by mi...@apache.org.
[OLINGO-733] Merge branch 'master' into OLINGO-733_BatchFix
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/13b7b489
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/13b7b489
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/13b7b489
Branch: refs/heads/master
Commit: 13b7b4897e7a1e67852853e2dbefbdd1dc69d484
Parents: 03858a1 4ef73c4
Author: mibo <mi...@mirb.de>
Authored: Mon Jul 20 20:16:48 2015 +0200
Committer: mibo <mi...@mirb.de>
Committed: Mon Jul 20 20:16:48 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/olingo/odata2/core/servlet/ODataServlet.java | 2 ++
.../apache/olingo/odata2/core/batch/BatchRequestWriterITTest.java | 2 ++
2 files changed, 4 insertions(+)
----------------------------------------------------------------------