Skip to content

Commit 861d64d

Browse files
committed
fix test utils after merge
1 parent 9ad9c56 commit 861d64d

4 files changed

Lines changed: 12 additions & 13 deletions

File tree

core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/async/FileAsyncResponseTransformer.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,6 @@ public void onResponse(ResponseT response) {
147147
this.response = response;
148148
}
149149

150-
public FileTransformerConfiguration getConfiguration() {
151-
return this.configuration;
152-
}
153-
154150
@Override
155151
public void onStream(SdkPublisher<ByteBuffer> publisher) {
156152
try {

services/s3/src/test/java/software/amazon/awssdk/services/s3/internal/multipart/NonLinearMultipartDownloaderSubscriberWiremockTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import software.amazon.awssdk.regions.Region;
4040
import software.amazon.awssdk.services.s3.S3AsyncClient;
4141
import software.amazon.awssdk.services.s3.S3Configuration;
42+
import software.amazon.awssdk.services.s3.internal.multipart.utils.MultipartDownloadTestUtils;
4243
import software.amazon.awssdk.services.s3.model.GetObjectRequest;
4344
import software.amazon.awssdk.services.s3.model.GetObjectResponse;
4445

@@ -49,7 +50,7 @@ class NonLinearMultipartDownloaderSubscriberWiremockTest {
4950
private final String testKey = "test-key";
5051

5152
private S3AsyncClient s3AsyncClient;
52-
private MultipartDownloadTestUtil util;
53+
private MultipartDownloadTestUtils utils;
5354
private FileSystem fileSystem;
5455
private Path testFile;
5556

@@ -64,7 +65,7 @@ public void init(WireMockRuntimeInfo wiremock) throws Exception {
6465
.pathStyleAccessEnabled(true)
6566
.build())
6667
.build();
67-
util = new MultipartDownloadTestUtil(testBucket, testKey, "test-etag");
68+
utils = new MultipartDownloadTestUtils(testBucket, testKey, "test-etag");
6869
fileSystem = Jimfs.newFileSystem(Configuration.unix());
6970
testFile = fileSystem.getPath("/test-file.txt");
7071
}
@@ -78,7 +79,7 @@ void tearDown() throws Exception {
7879
@ValueSource(ints = {2, 3, 4, 5, 6, 7, 8, 9, 10})
7980
void happyPath_multipartDownload(int numParts) throws Exception {
8081
int partSize = 1024;
81-
byte[] expectedBody = util.stubAllParts(testBucket, testKey, numParts, partSize);
82+
byte[] expectedBody = utils.stubAllParts(testBucket, testKey, numParts, partSize);
8283

8384
AsyncResponseTransformer<GetObjectResponse, GetObjectResponse> transformer = AsyncResponseTransformer.toFile(testFile);
8485
AsyncResponseTransformer.SplitResult<GetObjectResponse, GetObjectResponse> split = transformer.split(
@@ -103,13 +104,13 @@ void happyPath_multipartDownload(int numParts) throws Exception {
103104
byte[] actualBody = Files.readAllBytes(testFile);
104105
assertThat(actualBody).isEqualTo(expectedBody);
105106
assertThat(getObjectResponse).isNotNull();
106-
util.verifyCorrectAmountOfRequestsMade(numParts);
107+
utils.verifyCorrectAmountOfRequestsMade(numParts);
107108
}
108109

109110
@Test
110111
void singlePartObject_shouldCompleteWithoutMultipart() throws Exception {
111112
int partSize = 1024;
112-
byte[] expectedBody = util.stubSinglePart(testBucket, testKey, partSize);
113+
byte[] expectedBody = utils.stubSinglePart(testBucket, testKey, partSize);
113114

114115
AsyncResponseTransformer<GetObjectResponse, GetObjectResponse> transformer = AsyncResponseTransformer.toFile(testFile);
115116
AsyncResponseTransformer.SplitResult<GetObjectResponse, GetObjectResponse> split = transformer.split(
@@ -134,7 +135,7 @@ void singlePartObject_shouldCompleteWithoutMultipart() throws Exception {
134135
byte[] actualBody = Files.readAllBytes(testFile);
135136
assertThat(actualBody).isEqualTo(expectedBody);
136137
assertThat(getObjectResponse).isNotNull();
137-
util.verifyCorrectAmountOfRequestsMade(1);
138+
utils.verifyCorrectAmountOfRequestsMade(1);
138139
}
139140

140141
}

services/s3/src/test/java/software/amazon/awssdk/services/s3/internal/multipart/S3MultipartFileDownloadWiremockTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
2424
import static com.github.tomakehurst.wiremock.client.WireMock.verify;
2525
import static org.assertj.core.api.Assertions.assertThat;
26-
import static software.amazon.awssdk.services.s3.internal.multipart.MultipartDownloadTestUtil.contentRangeHeader;
26+
import static software.amazon.awssdk.services.s3.internal.multipart.utils.MultipartDownloadTestUtils.contentRangeHeader;
2727

2828
import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
2929
import com.github.tomakehurst.wiremock.junit5.WireMockTest;
@@ -48,6 +48,7 @@
4848
import software.amazon.awssdk.regions.Region;
4949
import software.amazon.awssdk.services.s3.S3AsyncClient;
5050
import software.amazon.awssdk.services.s3.S3Configuration;
51+
import software.amazon.awssdk.services.s3.internal.multipart.utils.MultipartDownloadTestUtils;
5152
import software.amazon.awssdk.services.s3.model.GetObjectResponse;
5253
import software.amazon.awssdk.services.s3.model.S3Exception;
5354

@@ -58,7 +59,7 @@ class S3MultipartFileDownloadWiremockTest {
5859
private final String testKey = "test-key";
5960

6061
private S3AsyncClient s3AsyncClient;
61-
private MultipartDownloadTestUtil util;
62+
private MultipartDownloadTestUtils util;
6263
private FileSystem fileSystem;
6364
private Path testFile;
6465

@@ -81,7 +82,7 @@ public void init(WireMockRuntimeInfo wiremock) throws Exception {
8182
.build())
8283
// .httpClient(AwsCrtAsyncHttpClient.create())
8384
.build();
84-
util = new MultipartDownloadTestUtil(testBucket, testKey, "test-etag");
85+
util = new MultipartDownloadTestUtils(testBucket, testKey, "test-etag");
8586
fileSystem = Jimfs.newFileSystem(Configuration.unix());
8687
testFile = fileSystem.getPath("/test-file.txt");
8788
}

utils/src/main/java/software/amazon/awssdk/utils/ContentRangeParser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public static Optional<Pair<Long, Long>> range(String contentRange) {
109109
long endInt = Long.parseLong(end);
110110
return Optional.of(Pair.of(startInt, endInt));
111111
} catch (Exception e) {
112+
log.warn(() -> "failed to parse content range", e);
112113
return Optional.empty();
113114
}
114115
}

0 commit comments

Comments
 (0)