|
19 | 19 | import com.google.common.collect.Multimap; |
20 | 20 | import com.google.common.collect.TreeMultimap; |
21 | 21 | import com.spectralogic.ds3client.commands.*; |
| 22 | +import com.spectralogic.ds3client.exceptions.ContentLengthNotMatchException; |
22 | 23 | import com.spectralogic.ds3client.models.*; |
23 | 24 | import com.spectralogic.ds3client.models.bulk.*; |
24 | 25 | import com.spectralogic.ds3client.models.bulk.Objects; |
@@ -919,4 +920,24 @@ public void getTape() throws IOException, SignatureException { |
919 | 920 | assertThat(tape.getId(), is(notNullValue())); |
920 | 921 | assertThat(tape.getId(), is(UUID.fromString("c7c431df-f95d-4533-b350-ffd7a8a5caac"))); |
921 | 922 | } |
| 923 | + |
| 924 | + @Test(expected = ContentLengthNotMatchException.class) |
| 925 | + public void getObjectVerifyFullPayload() throws IOException, SignatureException { |
| 926 | + final String jobIdString = "a4a586a1-cb80-4441-84e2-48974e982d51"; |
| 927 | + final Map<String, String> queryParams = new HashMap<>(); |
| 928 | + queryParams.put("job", jobIdString); |
| 929 | + queryParams.put("offset", Long.toString(0)); |
| 930 | + |
| 931 | + final Map<String, String> responseHeaders = new HashMap<>(); |
| 932 | + responseHeaders.put("Content-Length", "4"); |
| 933 | + |
| 934 | + final ByteArraySeekableByteChannel resultChannel = new ByteArraySeekableByteChannel(); |
| 935 | + final String stringResponse = "Response"; |
| 936 | + |
| 937 | + MockNetwork |
| 938 | + .expecting(HttpVerb.GET, "/bucketName/object", queryParams, null) |
| 939 | + .returning(200, stringResponse, responseHeaders) |
| 940 | + .asClient() |
| 941 | + .getObject(new GetObjectRequest("bucketName", "object", 0, UUID.fromString(jobIdString), resultChannel)); |
| 942 | + } |
922 | 943 | } |
0 commit comments