Skip to content

Use default size for ListObjectsRequest and ListObjectsRequestV2#456

Open
larsj-blip wants to merge 5 commits intoBIBSYSDEV:mainfrom
larsj-blip:accept-only-required-list-objects-args
Open

Use default size for ListObjectsRequest and ListObjectsRequestV2#456
larsj-blip wants to merge 5 commits intoBIBSYSDEV:mainfrom
larsj-blip:accept-only-required-list-objects-args

Conversation

@larsj-blip
Copy link

only supplying the bucket now results in an unhandled null pointer exception

@brinxmat brinxmat self-requested a review August 22, 2023 09:59
@larsj-blip larsj-blip marked this pull request as draft August 22, 2023 10:13
@larsj-blip
Copy link
Author

forgot to build first :P

Copy link
Contributor

@brinxmat brinxmat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, it's polite to include a project's owner in the PR — we haven't restricted who can approve things, but it doesn't mean we want to accept all and any changes :) [Edit: I see this is a draft]

The naming for the PR, probably "Use default size for ListObjectsRequest and ListObjectsRequestV2"

Comment on lines +181 to +191
private static List<String> FetchAllExpectedFilesWithOnlyRequiredArguments(FakeS3Client s3Client, String bucket) {
var listingRequestWithOnlyTheRequiredArguments = ListObjectsRequest.builder().bucket(bucket).build();
var listedFiles = s3Client.listObjects(listingRequestWithOnlyTheRequiredArguments);
return extractListedKeys(listedFiles);
}
private static List<String> FetchAllExpectedFilesWithOnlyRequiredArgumentsUsingV2Request(FakeS3Client s3Client,
String bucket) {
var listingRequestWithOnlyTheRequiredArguments = ListObjectsV2Request.builder().bucket(bucket).build();
var listedFiles = s3Client.listObjectsV2(listingRequestWithOnlyTheRequiredArguments);
return extractListedKeysForV2Request(listedFiles);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method names should begin with lowercase letter.

}

@Test
void shouldAcceptListObjectsRequestWithOnlyRequiredArguments() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming is a bit weird…possibly shouldReturnDefaultSizeListObjectResponseWhenRequestDoesNotSpecifySize, which seems to be the point.

}

@Test
void shouldAcceptListObjectsV2RequestWithOnlyRequiredArguments(){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, but with V2 in there…

var listedFiles = s3Client.listObjects(listingRequestWithOnlyTheRequiredArguments);
return extractListedKeys(listedFiles);
}
private static List<String> FetchAllExpectedFilesWithOnlyRequiredArgumentsUsingV2Request(FakeS3Client s3Client,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lack of space indicates that Orestis didn't write this (joke, but fix the formatting in the file).

insertRandomFileToS3(s3Client, bucket).toString());
}

private static List<String> FetchAllExpectedFilesWithOnlyRequiredArguments(FakeS3Client s3Client, String bucket) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd name this: fetchDefaultSizeFilesListUsingBucketNameOnlyV1

var listedFiles = s3Client.listObjects(listingRequestWithOnlyTheRequiredArguments);
return extractListedKeys(listedFiles);
}
private static List<String> FetchAllExpectedFilesWithOnlyRequiredArgumentsUsingV2Request(FakeS3Client s3Client,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd name this: fetchDefaultSizeFilesListUsingBucketNameOnlyV2

@brinxmat
Copy link
Contributor

You'll want to pull main before the next review too :)

@larsj-blip larsj-blip changed the title allow only supplying the bucket as an argument for s3 listing requests Use default size for ListObjectsRequest and ListObjectsRequestV2 Aug 23, 2023
@larsj-blip larsj-blip marked this pull request as ready for review August 24, 2023 08:20
@larsj-blip
Copy link
Author

Hi, sorry about not adding a reviewer! Not very experienced in contributing to open source projects. Got the formatter working now :P

@brinxmat
Copy link
Contributor

Hi, sorry about not adding a reviewer! Not very experienced in contributing to open source projects. Got the formatter working now :P

No stress :) If you want a review, you'll need to re-request a review :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants