use of org.apache.beam.sdk.io.aws2.options.S3Options in project beam by apache.
the class S3FileSystemTest method matchNonGlobForbiddenWithS3Options.
@Test
public void matchNonGlobForbiddenWithS3Options() {
S3FileSystem s3FileSystem = buildMockedS3FileSystem(s3Options());
SdkServiceException exception = S3Exception.builder().message("mock exception").statusCode(403).build();
S3ResourceId path = S3ResourceId.fromUri("s3://testbucket/testdirectory/keyname");
when(s3FileSystem.getS3Client().headObject(argThat(new GetHeadObjectRequestMatcher(HeadObjectRequest.builder().bucket(path.getBucket()).key(path.getKey()).build())))).thenThrow(exception);
assertThat(s3FileSystem.matchNonGlobPath(path), MatchResultMatcher.create(MatchResult.Status.ERROR, new IOException(exception)));
}
Aggregations