Skip to content

Commit

Permalink
Merge branch 'interface-changes-for-s3-plugin' of https://github.com/…
Browse files Browse the repository at this point in the history
…skumawat2025/OpenSearch into interface-changes-for-s3-plugin
  • Loading branch information
Sandeep Kumawat committed Apr 7, 2024
2 parents 743c788 + d568ac3 commit 9e12d1f
Showing 1 changed file with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,17 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -420,10 +430,6 @@ public void testExecuteSingleUpload() throws IOException {
final String bucketName = randomAlphaOfLengthBetween(1, 10);
final String blobName = randomAlphaOfLengthBetween(1, 10);

final Map<String, String> metadata = new HashMap<>();
metadata.put("key1", "value1");
metadata.put("key2", "value2");

final BlobPath blobPath = new BlobPath();
if (randomBoolean()) {
IntStream.of(randomIntBetween(1, 5)).forEach(value -> blobPath.add("path_" + value));
Expand Down Expand Up @@ -461,7 +467,7 @@ public void testExecuteSingleUpload() throws IOException {
);

final ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[blobSize]);
blobContainer.executeSingleUpload(blobStore, blobName, inputStream, blobSize, metadata);
blobContainer.executeSingleUpload(blobStore, blobName, inputStream, blobSize, null);

final PutObjectRequest request = putObjectRequestArgumentCaptor.getValue();
final RequestBody requestBody = requestBodyArgumentCaptor.getValue();
Expand All @@ -474,7 +480,6 @@ public void testExecuteSingleUpload() throws IOException {
assertEquals(blobSize, request.contentLength().longValue());
assertEquals(storageClass, request.storageClass());
assertEquals(cannedAccessControlList, request.acl());
assertEquals(metadata, request.metadata());
if (serverSideEncryption) {
assertEquals(ServerSideEncryption.AES256, request.serverSideEncryption());
}
Expand Down Expand Up @@ -508,10 +513,6 @@ public void testExecuteMultipartUpload() throws IOException {
final String bucketName = randomAlphaOfLengthBetween(1, 10);
final String blobName = randomAlphaOfLengthBetween(1, 10);

final Map<String, String> metadata = new HashMap<>();
metadata.put("key1", "value1");
metadata.put("key2", "value2");

final BlobPath blobPath = new BlobPath();
if (randomBoolean()) {
IntStream.of(randomIntBetween(1, 5)).forEach(value -> blobPath.add("path_" + value));
Expand Down Expand Up @@ -576,15 +577,13 @@ public void testExecuteMultipartUpload() throws IOException {

final ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[0]);
final S3BlobContainer blobContainer = new S3BlobContainer(blobPath, blobStore);
blobContainer.executeMultipartUpload(blobStore, blobName, inputStream, blobSize, metadata);
blobContainer.executeMultipartUpload(blobStore, blobName, inputStream, blobSize, null);

final CreateMultipartUploadRequest initRequest = createMultipartUploadRequestArgumentCaptor.getValue();
assertEquals(bucketName, initRequest.bucket());
assertEquals(blobPath.buildAsString() + blobName, initRequest.key());
assertEquals(storageClass, initRequest.storageClass());
assertEquals(cannedAccessControlList, initRequest.acl());
assertEquals(metadata, initRequest.metadata());

if (serverSideEncryption) {
assertEquals(ServerSideEncryption.AES256, initRequest.serverSideEncryption());
}
Expand Down

0 comments on commit 9e12d1f

Please sign in to comment.