-
Notifications
You must be signed in to change notification settings - Fork 853
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip downloading S3 folders (0-content-length folders created in the …
…S3 console) in downloadDirectory in the S3 Transfer Manager. (#5225)
- Loading branch information
Showing
5 changed files
with
98 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"type": "bugfix", | ||
"category": "S3 Transfer Manager", | ||
"contributor": "", | ||
"description": "Skip downloading S3 folders (0-content-length folders created in the S3 console) in downloadDirectory in the S3 Transfer Manager." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...r-manager/src/test/java/software/amazon/awssdk/transfer/s3/config/DownloadFilterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package software.amazon.awssdk.transfer.s3.config; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.stream.Stream; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
import software.amazon.awssdk.services.s3.model.S3Object; | ||
|
||
public class DownloadFilterTest { | ||
|
||
public static Stream<Arguments> s3Objects() { | ||
return Stream.of( | ||
Arguments.of(S3Object.builder().key("no-slash-zero-content").size(0L).build(), true), | ||
Arguments.of(S3Object.builder().key("slash-zero-content/").size(0L).build(), false), | ||
Arguments.of(S3Object.builder().key("key").size(10L).build(), true) | ||
); | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("s3Objects") | ||
void allObjectsFilter_shouldWork(S3Object s3Object, boolean result) { | ||
assertThat(DownloadFilter.allObjects().test(s3Object)).isEqualTo(result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters