Skip to content

Commit d0ce793

Browse files
author
Anirav Kareddy
committed
same approach of byte array input stream
1 parent bf0a94a commit d0ce793

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/test/java/software/amazon/encryption/s3/S3EncryptionClientStreamTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,11 @@ public void customSetBufferSizeWithLargeObjectAsyncClient() throws IOException {
393393

394394
// Tight bound on the custom buffer size limit of 32MiB
395395
final long fileSizeExceedingDefaultLimit = 1024 * 1024 * 32 + 1;
396-
final InputStream largeObjectStream = new BufferedInputStream(
397-
new BoundedInputStream(fileSizeExceedingDefaultLimit)
398-
);
396+
byte[] data = new byte[(int) fileSizeExceedingDefaultLimit];
397+
for(int j=0; j < data.length; j++) {
398+
data[i] = (byte) (j % 256);
399+
}
400+
final InputStream largeObjectStream = new ByteArrayInputStream(data);
399401
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
400402
CompletableFuture<PutObjectResponse> futurePut = v3ClientWithBuffer32MiB.putObject(PutObjectRequest.builder()
401403
.bucket(BUCKET)
@@ -422,7 +424,9 @@ public void customSetBufferSizeWithLargeObjectAsyncClient() throws IOException {
422424
.key(objectKey), AsyncResponseTransformer.toBlockingInputStream());
423425
ResponseInputStream<GetObjectResponse> output = futureGet.join();
424426

425-
assertTrue(IOUtils.contentEquals(new BoundedInputStream(fileSizeExceedingDefaultLimit), output));
427+
ByteArrayInputStream expectedStream = new ByteArrayInputStream(data);
428+
assertTrue(IOUtils.contentEquals(expectedStream, output));
429+
426430
output.close();
427431

428432
// Cleanup

0 commit comments

Comments
 (0)