[OLINGO-436] Additional 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/52df755a
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/52df755a
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/52df755a

Branch: refs/heads/Olingo-129_PocJpaDataStore
Commit: 52df755adee82d1b9fed0d5955f9e36333fd779f
Parents: 997f0da
Author: Michael Bolz <[email protected]>
Authored: Wed Oct 29 12:51:32 2014 +0100
Committer: Michael Bolz <[email protected]>
Committed: Wed Oct 29 12:51:32 2014 +0100

----------------------------------------------------------------------
 .../core/batch/BatchResponseParserTest.java     | 30 ++++++++++++++++++++
 1 file changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/52df755a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchResponseParserTest.java
----------------------------------------------------------------------
diff --git 
a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchResponseParserTest.java
 
b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchResponseParserTest.java
index aa9143a..feaa50d 100644
--- 
a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchResponseParserTest.java
+++ 
b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/batch/BatchResponseParserTest.java
@@ -116,6 +116,36 @@ public class BatchResponseParserTest {
     }
   }
 
+  @Test
+  public void testResponseToChangeSetNoContentButContentLength() throws 
BatchException {
+    String putResponse =
+            "--batch_123" + CRLF
+            + "Content-Type: " + HttpContentType.MULTIPART_MIXED + 
";boundary=changeset_12ks93js84d" + CRLF
+            + CRLF
+            + "--changeset_12ks93js84d" + CRLF
+            + "Content-Type: application/http" + CRLF
+            + "Content-Transfer-Encoding: binary" + CRLF
+            + "Content-ID: 1" + CRLF
+            + CRLF
+            + "HTTP/1.1 204 No Content" + CRLF
+            + "Content-Length: 0" + CRLF
+            + "DataServiceVersion: 2.0" + CRLF
+            + CRLF
+            + CRLF
+            + "--changeset_12ks93js84d--" + CRLF
+            + CRLF
+            + "--batch_123--";
+
+    InputStream in = new ByteArrayInputStream(putResponse.getBytes());
+    BatchParser parser = new BatchParser("multipart/mixed;boundary=batch_123", 
true);
+    List<BatchSingleResponse> responses = parser.parseBatchResponse(in);
+    for (BatchSingleResponse response : responses) {
+      assertEquals("204", response.getStatusCode());
+      assertEquals("No Content", response.getStatusInfo());
+      assertEquals("1", response.getContentId());
+    }
+  }
+
   @Test(expected = BatchException.class)
   public void testInvalidMimeHeader() throws BatchException {
     String putResponse = "--batch_123" + CRLF

Reply via email to