embulk-input-s3 0.3.0 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/classpath/aws-java-sdk-sts-1.11.466.jar +0 -0
- data/classpath/embulk-input-s3-0.3.5.jar +0 -0
- data/classpath/embulk-util-aws-credentials-0.3.5.jar +0 -0
- data/src/main/java/org/embulk/input/s3/AbstractS3FileInputPlugin.java +78 -117
- data/src/main/java/org/embulk/input/s3/DefaultRetryable.java +1 -1
- data/src/main/java/org/embulk/input/s3/RetrySupportPluginTask.java +1 -1
- data/src/main/java/org/embulk/input/s3/explorer/S3FileExplorer.java +21 -0
- data/src/main/java/org/embulk/input/s3/explorer/S3NameOrderPrefixFileExplorer.java +45 -0
- data/src/main/java/org/embulk/input/s3/explorer/S3PrefixFileExplorer.java +57 -0
- data/src/main/java/org/embulk/input/s3/explorer/S3SingleFileExplorer.java +35 -0
- data/src/main/java/org/embulk/input/s3/explorer/S3TimeOrderPrefixFileExplorer.java +70 -0
- data/src/main/java/org/embulk/input/s3/utils/DateUtils.java +28 -0
- data/src/test/java/org/embulk/input/s3/TestS3FileInputPlugin.java +0 -53
- data/src/test/java/org/embulk/input/s3/explorer/TestS3NameOrderPrefixFileExplorer.java +67 -0
- data/src/test/java/org/embulk/input/s3/explorer/TestS3PrefixFileExplorer.java +128 -0
- data/src/test/java/org/embulk/input/s3/explorer/TestS3SingleFileExplorer.java +56 -0
- data/src/test/java/org/embulk/input/s3/explorer/TestS3TimeOrderPrefixFileExplorer.java +112 -0
- metadata +15 -5
- data/classpath/embulk-input-s3-0.3.0.jar +0 -0
- data/classpath/embulk-util-aws-credentials-0.3.0.jar +0 -0
- data/src/test/java/org/embulk/input/s3/TestAbstractS3FileInputPlugin.java +0 -164
@@ -0,0 +1,56 @@
|
|
1
|
+
package org.embulk.input.s3.explorer;
|
2
|
+
|
3
|
+
import com.amazonaws.services.s3.AmazonS3;
|
4
|
+
import com.amazonaws.services.s3.model.GetObjectMetadataRequest;
|
5
|
+
import com.amazonaws.services.s3.model.ObjectMetadata;
|
6
|
+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
7
|
+
import org.embulk.EmbulkTestRuntime;
|
8
|
+
import org.embulk.input.s3.FileList;
|
9
|
+
import org.junit.Before;
|
10
|
+
import org.junit.Rule;
|
11
|
+
import org.junit.Test;
|
12
|
+
import org.junit.runner.RunWith;
|
13
|
+
import org.mockito.Mock;
|
14
|
+
import org.mockito.runners.MockitoJUnitRunner;
|
15
|
+
|
16
|
+
import static org.mockito.Matchers.any;
|
17
|
+
import static org.mockito.Mockito.verify;
|
18
|
+
import static org.mockito.Mockito.when;
|
19
|
+
|
20
|
+
@RunWith(MockitoJUnitRunner.class)
|
21
|
+
public class TestS3SingleFileExplorer
|
22
|
+
{
|
23
|
+
private static final String PATH = "path";
|
24
|
+
private static final String BUCKET_NAME = "bucket_name";
|
25
|
+
|
26
|
+
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
27
|
+
@Rule
|
28
|
+
public EmbulkTestRuntime embulkTestRuntime = new EmbulkTestRuntime();
|
29
|
+
|
30
|
+
@Mock
|
31
|
+
private AmazonS3 s3Client;
|
32
|
+
|
33
|
+
@Mock
|
34
|
+
private FileList.Builder builder;
|
35
|
+
|
36
|
+
@Mock
|
37
|
+
private ObjectMetadata metadata;
|
38
|
+
|
39
|
+
private S3SingleFileExplorer s3SingleFileExplorer;
|
40
|
+
|
41
|
+
@Before
|
42
|
+
public void setUp()
|
43
|
+
{
|
44
|
+
s3SingleFileExplorer = new S3SingleFileExplorer(BUCKET_NAME, s3Client, null, PATH);
|
45
|
+
}
|
46
|
+
|
47
|
+
@Test
|
48
|
+
public void addToBuilder_should_request_single_object_metadata()
|
49
|
+
{
|
50
|
+
when(s3Client.getObjectMetadata(any(GetObjectMetadataRequest.class))).thenReturn(metadata);
|
51
|
+
when(metadata.getContentLength()).thenReturn(1L);
|
52
|
+
s3SingleFileExplorer.addToBuilder(builder);
|
53
|
+
|
54
|
+
verify(builder).add(PATH, 1);
|
55
|
+
}
|
56
|
+
}
|
@@ -0,0 +1,112 @@
|
|
1
|
+
package org.embulk.input.s3.explorer;
|
2
|
+
|
3
|
+
import com.amazonaws.services.s3.AmazonS3;
|
4
|
+
import com.amazonaws.services.s3.model.ListObjectsRequest;
|
5
|
+
import com.amazonaws.services.s3.model.ObjectListing;
|
6
|
+
import com.amazonaws.services.s3.model.S3ObjectSummary;
|
7
|
+
import org.embulk.EmbulkTestRuntime;
|
8
|
+
import org.junit.Before;
|
9
|
+
import org.junit.Rule;
|
10
|
+
import org.junit.Test;
|
11
|
+
import org.junit.runner.RunWith;
|
12
|
+
import org.mockito.Mock;
|
13
|
+
import org.mockito.internal.util.reflection.FieldSetter;
|
14
|
+
import org.mockito.runners.MockitoJUnitRunner;
|
15
|
+
|
16
|
+
import java.util.Arrays;
|
17
|
+
import java.util.Calendar;
|
18
|
+
import java.util.List;
|
19
|
+
import java.util.Optional;
|
20
|
+
|
21
|
+
import static org.junit.Assert.assertEquals;
|
22
|
+
import static org.junit.Assert.assertFalse;
|
23
|
+
import static org.mockito.Matchers.any;
|
24
|
+
import static org.mockito.Mockito.mock;
|
25
|
+
import static org.mockito.Mockito.when;
|
26
|
+
|
27
|
+
@RunWith(MockitoJUnitRunner.class)
|
28
|
+
public class TestS3TimeOrderPrefixFileExplorer
|
29
|
+
{
|
30
|
+
private static final String BUCKET_NAME = "bucket_name";
|
31
|
+
private static final String PATH_PREFIX = "path_prefix";
|
32
|
+
|
33
|
+
@Rule
|
34
|
+
public EmbulkTestRuntime runtime = new EmbulkTestRuntime();
|
35
|
+
|
36
|
+
@Mock
|
37
|
+
private AmazonS3 s3Client;
|
38
|
+
|
39
|
+
private S3TimeOrderPrefixFileExplorer s3TimeOrderPrefixFileExplorer;
|
40
|
+
|
41
|
+
@Before
|
42
|
+
public void setUp()
|
43
|
+
{
|
44
|
+
final Calendar cal = Calendar.getInstance();
|
45
|
+
cal.set(2019, Calendar.MAY, 25, 10, 0);
|
46
|
+
s3TimeOrderPrefixFileExplorer = new S3TimeOrderPrefixFileExplorer(BUCKET_NAME, s3Client, null, PATH_PREFIX,
|
47
|
+
false, Optional.empty(), cal.getTime());
|
48
|
+
}
|
49
|
+
|
50
|
+
@Test
|
51
|
+
public void fetch_should_return_filtered_objects_before_end_time()
|
52
|
+
{
|
53
|
+
final S3ObjectSummary s3ObjectBefore = mock(S3ObjectSummary.class);
|
54
|
+
final Calendar cal = Calendar.getInstance();
|
55
|
+
cal.set(2019, Calendar.MAY, 24, 10, 0);
|
56
|
+
when(s3ObjectBefore.getLastModified()).thenReturn(cal.getTime());
|
57
|
+
|
58
|
+
final S3ObjectSummary s3ObjectAfter = mock(S3ObjectSummary.class);
|
59
|
+
cal.set(2019, Calendar.MAY, 26, 10, 0);
|
60
|
+
when(s3ObjectAfter.getLastModified()).thenReturn(cal.getTime());
|
61
|
+
|
62
|
+
final ObjectListing ol = mock(ObjectListing.class);
|
63
|
+
when(s3Client.listObjects(any(ListObjectsRequest.class))).thenReturn(ol);
|
64
|
+
when(ol.getObjectSummaries()).thenReturn(Arrays.asList(s3ObjectBefore, s3ObjectAfter));
|
65
|
+
|
66
|
+
final List<S3ObjectSummary> result = s3TimeOrderPrefixFileExplorer.fetch();
|
67
|
+
assertEquals(1, result.size());
|
68
|
+
assertEquals(s3ObjectBefore, result.get(0));
|
69
|
+
}
|
70
|
+
|
71
|
+
@Test
|
72
|
+
public void fetch_should_return_filtered_objects_after_or_equals_begin_time()
|
73
|
+
{
|
74
|
+
final Calendar to = Calendar.getInstance();
|
75
|
+
to.set(2019, Calendar.MAY, 25, 10, 0);
|
76
|
+
final Calendar from = Calendar.getInstance();
|
77
|
+
from.set(2019, Calendar.MAY, 24, 10, 0);
|
78
|
+
s3TimeOrderPrefixFileExplorer = new S3TimeOrderPrefixFileExplorer(BUCKET_NAME, s3Client, null, PATH_PREFIX,
|
79
|
+
false, Optional.of(from.getTime()), to.getTime());
|
80
|
+
|
81
|
+
final S3ObjectSummary s3ObjectEqual = mock(S3ObjectSummary.class);
|
82
|
+
final Calendar equalCal = Calendar.getInstance();
|
83
|
+
equalCal.set(2019, Calendar.MAY, 24, 10, 0);
|
84
|
+
when(s3ObjectEqual.getLastModified()).thenReturn(equalCal.getTime());
|
85
|
+
|
86
|
+
final S3ObjectSummary s3ObjectBefore = mock(S3ObjectSummary.class);
|
87
|
+
final Calendar beforeCal = Calendar.getInstance();
|
88
|
+
beforeCal.set(2019, Calendar.MAY, 24, 20, 0);
|
89
|
+
when(s3ObjectBefore.getLastModified()).thenReturn(beforeCal.getTime());
|
90
|
+
|
91
|
+
final S3ObjectSummary s3ObjectAfter = mock(S3ObjectSummary.class);
|
92
|
+
final Calendar afterCal = Calendar.getInstance();
|
93
|
+
afterCal.set(2019, Calendar.MAY, 26, 10, 0);
|
94
|
+
when(s3ObjectAfter.getLastModified()).thenReturn(afterCal.getTime());
|
95
|
+
|
96
|
+
final ObjectListing ol = mock(ObjectListing.class);
|
97
|
+
when(s3Client.listObjects(any(ListObjectsRequest.class))).thenReturn(ol);
|
98
|
+
when(ol.getObjectSummaries()).thenReturn(Arrays.asList(s3ObjectEqual, s3ObjectBefore, s3ObjectAfter));
|
99
|
+
|
100
|
+
final List<S3ObjectSummary> result = s3TimeOrderPrefixFileExplorer.fetch();
|
101
|
+
assertEquals(2, result.size());
|
102
|
+
assertEquals(s3ObjectEqual, result.get(0));
|
103
|
+
assertEquals(s3ObjectBefore, result.get(1));
|
104
|
+
}
|
105
|
+
|
106
|
+
@Test
|
107
|
+
public void hasNext_should_return_false_if_no_lastpath() throws NoSuchFieldException
|
108
|
+
{
|
109
|
+
new FieldSetter(s3TimeOrderPrefixFileExplorer, s3TimeOrderPrefixFileExplorer.getClass().getDeclaredField("lastPath")).set(null);
|
110
|
+
assertFalse(s3TimeOrderPrefixFileExplorer.hasNext());
|
111
|
+
}
|
112
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,19 +53,28 @@ files:
|
|
53
53
|
- src/main/java/org/embulk/input/s3/HttpProxy.java
|
54
54
|
- src/main/java/org/embulk/input/s3/RetrySupportPluginTask.java
|
55
55
|
- src/main/java/org/embulk/input/s3/S3FileInputPlugin.java
|
56
|
-
- src/
|
56
|
+
- src/main/java/org/embulk/input/s3/explorer/S3FileExplorer.java
|
57
|
+
- src/main/java/org/embulk/input/s3/explorer/S3NameOrderPrefixFileExplorer.java
|
58
|
+
- src/main/java/org/embulk/input/s3/explorer/S3PrefixFileExplorer.java
|
59
|
+
- src/main/java/org/embulk/input/s3/explorer/S3SingleFileExplorer.java
|
60
|
+
- src/main/java/org/embulk/input/s3/explorer/S3TimeOrderPrefixFileExplorer.java
|
61
|
+
- src/main/java/org/embulk/input/s3/utils/DateUtils.java
|
57
62
|
- src/test/java/org/embulk/input/s3/TestAwsCredentials.java
|
58
63
|
- src/test/java/org/embulk/input/s3/TestDefaultRetryable.java
|
59
64
|
- src/test/java/org/embulk/input/s3/TestFileList.java
|
60
65
|
- src/test/java/org/embulk/input/s3/TestHttpProxy.java
|
61
66
|
- src/test/java/org/embulk/input/s3/TestS3FileInputPlugin.java
|
62
67
|
- src/test/java/org/embulk/input/s3/TestS3InputStreamReopener.java
|
68
|
+
- src/test/java/org/embulk/input/s3/explorer/TestS3NameOrderPrefixFileExplorer.java
|
69
|
+
- src/test/java/org/embulk/input/s3/explorer/TestS3PrefixFileExplorer.java
|
70
|
+
- src/test/java/org/embulk/input/s3/explorer/TestS3SingleFileExplorer.java
|
71
|
+
- src/test/java/org/embulk/input/s3/explorer/TestS3TimeOrderPrefixFileExplorer.java
|
63
72
|
- src/test/resources/sample_01.csv
|
64
|
-
- classpath/embulk-util-aws-credentials-0.3.
|
73
|
+
- classpath/embulk-util-aws-credentials-0.3.5.jar
|
65
74
|
- classpath/httpcore-4.4.9.jar
|
66
75
|
- classpath/httpclient-4.5.5.jar
|
76
|
+
- classpath/embulk-input-s3-0.3.5.jar
|
67
77
|
- classpath/ion-java-1.0.2.jar
|
68
|
-
- classpath/embulk-input-s3-0.3.0.jar
|
69
78
|
- classpath/aws-java-sdk-core-1.11.466.jar
|
70
79
|
- classpath/jcl-over-slf4j-1.7.12.jar
|
71
80
|
- classpath/commons-codec-1.10.jar
|
@@ -73,6 +82,7 @@ files:
|
|
73
82
|
- classpath/jackson-databind-2.6.7.2.jar
|
74
83
|
- classpath/jackson-dataformat-cbor-2.6.7.jar
|
75
84
|
- classpath/aws-java-sdk-s3-1.11.466.jar
|
85
|
+
- classpath/aws-java-sdk-sts-1.11.466.jar
|
76
86
|
- classpath/aws-java-sdk-kms-1.11.466.jar
|
77
87
|
homepage: https://github.com/embulk/embulk-input-s3
|
78
88
|
licenses:
|
Binary file
|
Binary file
|
@@ -1,164 +0,0 @@
|
|
1
|
-
package org.embulk.input.s3;
|
2
|
-
|
3
|
-
import com.amazonaws.AmazonServiceException;
|
4
|
-
import com.amazonaws.services.s3.AmazonS3;
|
5
|
-
import com.amazonaws.services.s3.model.GetObjectMetadataRequest;
|
6
|
-
import com.amazonaws.services.s3.model.ListObjectsRequest;
|
7
|
-
import com.amazonaws.services.s3.model.ObjectListing;
|
8
|
-
import com.amazonaws.services.s3.model.ObjectMetadata;
|
9
|
-
import org.apache.http.HttpStatus;
|
10
|
-
import org.embulk.EmbulkTestRuntime;
|
11
|
-
import org.embulk.spi.util.RetryExecutor;
|
12
|
-
import org.junit.Before;
|
13
|
-
import org.junit.Rule;
|
14
|
-
import org.junit.Test;
|
15
|
-
|
16
|
-
import java.util.Optional;
|
17
|
-
|
18
|
-
import static org.mockito.Matchers.any;
|
19
|
-
import static org.mockito.Mockito.doReturn;
|
20
|
-
import static org.mockito.Mockito.doThrow;
|
21
|
-
import static org.mockito.Mockito.mock;
|
22
|
-
|
23
|
-
public class TestAbstractS3FileInputPlugin
|
24
|
-
{
|
25
|
-
private static RetryExecutor retryExecutor()
|
26
|
-
{
|
27
|
-
return RetryExecutor.retryExecutor()
|
28
|
-
.withInitialRetryWait(0)
|
29
|
-
.withMaxRetryWait(0);
|
30
|
-
}
|
31
|
-
|
32
|
-
private static AbstractS3FileInputPlugin dummyS3Plugin()
|
33
|
-
{
|
34
|
-
return new AbstractS3FileInputPlugin()
|
35
|
-
{
|
36
|
-
@Override
|
37
|
-
protected Class<? extends PluginTask> getTaskClass()
|
38
|
-
{
|
39
|
-
return PluginTask.class;
|
40
|
-
}
|
41
|
-
};
|
42
|
-
}
|
43
|
-
|
44
|
-
private static class SomeException extends RuntimeException
|
45
|
-
{
|
46
|
-
}
|
47
|
-
|
48
|
-
@Rule
|
49
|
-
public EmbulkTestRuntime runtime = new EmbulkTestRuntime();
|
50
|
-
|
51
|
-
private AmazonS3 client;
|
52
|
-
|
53
|
-
@Before
|
54
|
-
public void createResources()
|
55
|
-
{
|
56
|
-
client = mock(AmazonS3.class);
|
57
|
-
}
|
58
|
-
|
59
|
-
@Test
|
60
|
-
public void listS3FilesByPrefix()
|
61
|
-
{
|
62
|
-
doReturn(new ObjectListing()).when(client).listObjects(any(ListObjectsRequest.class));
|
63
|
-
FileList.Builder builder = new FileList.Builder();
|
64
|
-
dummyS3Plugin().listS3FilesByPrefix(builder, client, "some_bucket", "some_prefix", Optional.of("last_path"), true);
|
65
|
-
}
|
66
|
-
|
67
|
-
@Test
|
68
|
-
public void listS3FileByPrefix_with_retry()
|
69
|
-
{
|
70
|
-
doThrow(new RuntimeException()).doReturn(new ObjectListing())
|
71
|
-
.when(client).listObjects(any(ListObjectsRequest.class));
|
72
|
-
FileList.Builder builder = new FileList.Builder();
|
73
|
-
dummyS3Plugin().listS3FilesByPrefix(
|
74
|
-
builder, client, "some_bucket", "some_prefix", Optional.of("last_path"), true,
|
75
|
-
retryExecutor().withRetryLimit(1));
|
76
|
-
}
|
77
|
-
|
78
|
-
@Test(expected = SomeException.class)
|
79
|
-
public void listS3FileByPrefix_on_retry_gave_up_should_throw_the_original_exception()
|
80
|
-
{
|
81
|
-
doThrow(new SomeException()).doReturn(new ObjectListing())
|
82
|
-
.when(client).listObjects(any(ListObjectsRequest.class));
|
83
|
-
FileList.Builder builder = new FileList.Builder();
|
84
|
-
dummyS3Plugin().listS3FilesByPrefix(
|
85
|
-
builder, client, "some_bucket", "some_prefix", Optional.of("last_path"), true,
|
86
|
-
retryExecutor().withRetryLimit(0));
|
87
|
-
}
|
88
|
-
|
89
|
-
@Test(expected = AmazonServiceException.class)
|
90
|
-
public void listS3FileByPrefix_on_retry_gave_up_should_throw_the_original_exception_in_forbidden_code()
|
91
|
-
{
|
92
|
-
AmazonServiceException exception = new AmazonServiceException("Forbidden exception");
|
93
|
-
exception.setStatusCode(HttpStatus.SC_FORBIDDEN);
|
94
|
-
exception.setErrorType(AmazonServiceException.ErrorType.Client);
|
95
|
-
|
96
|
-
doThrow(exception).doReturn(new ObjectListing())
|
97
|
-
.when(client).listObjects(any(ListObjectsRequest.class));
|
98
|
-
FileList.Builder builder = new FileList.Builder();
|
99
|
-
dummyS3Plugin().listS3FilesByPrefix(
|
100
|
-
builder, client, "some_bucket", "some_prefix", Optional.of("last_path"), true,
|
101
|
-
retryExecutor().withRetryLimit(1));
|
102
|
-
}
|
103
|
-
|
104
|
-
@Test(expected = AmazonServiceException.class)
|
105
|
-
public void listS3FileByPrefix_on_retry_gave_up_should_throw_the_original_exception_in_methodnotallow_code()
|
106
|
-
{
|
107
|
-
AmazonServiceException exception = new AmazonServiceException("method not allow exception");
|
108
|
-
exception.setStatusCode(HttpStatus.SC_METHOD_NOT_ALLOWED);
|
109
|
-
exception.setErrorType(AmazonServiceException.ErrorType.Client);
|
110
|
-
|
111
|
-
doThrow(exception).doReturn(new ObjectListing())
|
112
|
-
.when(client).listObjects(any(ListObjectsRequest.class));
|
113
|
-
FileList.Builder builder = new FileList.Builder();
|
114
|
-
dummyS3Plugin().listS3FilesByPrefix(
|
115
|
-
builder, client, "some_bucket", "some_prefix", Optional.of("last_path"), true,
|
116
|
-
retryExecutor().withRetryLimit(1));
|
117
|
-
}
|
118
|
-
|
119
|
-
@Test(expected = AmazonServiceException.class)
|
120
|
-
public void listS3FileByPrefix_on_retry_gave_up_should_throw_the_original_exception_in_expiredToken_code()
|
121
|
-
{
|
122
|
-
AmazonServiceException exception = new AmazonServiceException("expired token exception");
|
123
|
-
exception.setStatusCode(HttpStatus.SC_BAD_REQUEST);
|
124
|
-
exception.setErrorCode("ExpiredToken");
|
125
|
-
exception.setErrorType(AmazonServiceException.ErrorType.Client);
|
126
|
-
|
127
|
-
doThrow(exception).doReturn(new ObjectListing())
|
128
|
-
.when(client).listObjects(any(ListObjectsRequest.class));
|
129
|
-
FileList.Builder builder = new FileList.Builder();
|
130
|
-
dummyS3Plugin().listS3FilesByPrefix(
|
131
|
-
builder, client, "some_bucket", "some_prefix", Optional.of("last_path"), true,
|
132
|
-
retryExecutor().withRetryLimit(1));
|
133
|
-
}
|
134
|
-
|
135
|
-
@Test
|
136
|
-
public void addS3DirectObject()
|
137
|
-
{
|
138
|
-
doReturn(new ObjectMetadata()).when(client).getObjectMetadata(any(GetObjectMetadataRequest.class));
|
139
|
-
FileList.Builder builder = new FileList.Builder().pathMatchPattern("");
|
140
|
-
dummyS3Plugin().addS3DirectObject(builder, client, "some_bucket", "some_prefix");
|
141
|
-
}
|
142
|
-
|
143
|
-
@Test
|
144
|
-
public void addS3DirectObject_with_retry()
|
145
|
-
{
|
146
|
-
doThrow(new RuntimeException()).doReturn(new ObjectMetadata())
|
147
|
-
.when(client).getObjectMetadata(any(GetObjectMetadataRequest.class));
|
148
|
-
FileList.Builder builder = new FileList.Builder().pathMatchPattern("");
|
149
|
-
dummyS3Plugin().addS3DirectObject(
|
150
|
-
builder, client, "some_bucket", "some_prefix",
|
151
|
-
retryExecutor());
|
152
|
-
}
|
153
|
-
|
154
|
-
@Test(expected = SomeException.class)
|
155
|
-
public void addS3DirectObject_on_retry_gave_up_should_throw_original_exception()
|
156
|
-
{
|
157
|
-
doThrow(new SomeException()).doReturn(new ObjectMetadata())
|
158
|
-
.when(client).getObjectMetadata(any(GetObjectMetadataRequest.class));
|
159
|
-
FileList.Builder builder = new FileList.Builder().pathMatchPattern("");
|
160
|
-
dummyS3Plugin().addS3DirectObject(
|
161
|
-
builder, client, "some_bucket", "some_prefix",
|
162
|
-
retryExecutor().withRetryLimit(0));
|
163
|
-
}
|
164
|
-
}
|