Skip to content

Commit 6b28db5

Browse files
committed
Merge pull request #145 from shabtaisharon/full_payload_test
add a test to verify we recived the full payload on Gets
2 parents d9f524a + 406535d commit 6b28db5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

ds3-sdk/src/test/java/com/spectralogic/ds3client/Ds3Client_Test.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.common.collect.Multimap;
2020
import com.google.common.collect.TreeMultimap;
2121
import com.spectralogic.ds3client.commands.*;
22+
import com.spectralogic.ds3client.exceptions.ContentLengthNotMatchException;
2223
import com.spectralogic.ds3client.models.*;
2324
import com.spectralogic.ds3client.models.bulk.*;
2425
import com.spectralogic.ds3client.models.bulk.Objects;
@@ -919,4 +920,24 @@ public void getTape() throws IOException, SignatureException {
919920
assertThat(tape.getId(), is(notNullValue()));
920921
assertThat(tape.getId(), is(UUID.fromString("c7c431df-f95d-4533-b350-ffd7a8a5caac")));
921922
}
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+
}
922943
}

0 commit comments

Comments
 (0)