Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ static void setUp() throws IOException {
@Test
@EnabledIf("versionAvailable")
void mavenProject_shouldConvert() throws IOException {
boolean experimental = true;
verifyTransformation(experimental);
verifyTransformation();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ static void setUp() throws IOException {
@Test
@EnabledIf("versionAvailable")
void mavenProject_shouldConvert() throws IOException {
boolean experimental = false;
verifyTransformation(experimental);
verifyTransformation();
verifyCompilation();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,8 @@ protected static void deleteTempDirectories() throws IOException {
FileUtils.deleteDirectory(mavenExpected.toFile());
}

protected static void verifyTransformation(boolean experimental) throws IOException {
protected static void verifyTransformation() throws IOException {
String recipeCmd = "-Drewrite.activeRecipes=software.amazon.awssdk.v2migration.AwsSdkJavaV1ToV2";
if (experimental) {
recipeCmd += "Experimental";
}

List<String> rewriteArgs = new ArrayList<>();
// pin version since updates have broken tests
String rewriteMavenPluginVersion = "5.46.0";
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
<artifactId>s3-event-notifications</artifactId>
<version>V2_VERSION</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3-transfer-manager</artifactId>
<version>V2_VERSION</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

package foo.bar;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.time.Duration;
import software.amazon.awssdk.auth.credentials.AwsCredentials;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
Expand All @@ -41,18 +45,13 @@
import software.amazon.awssdk.transfer.s3.model.UploadRequest;
import software.amazon.awssdk.transfer.s3.progress.TransferProgress;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.time.Duration;

public class TransferManagerS3 {

File file = new File("path/to/file.txt");

void tmConstructor(AwsCredentials credentials, AwsCredentialsProvider credentialsProvider) {
S3TransferManager tm = S3TransferManager.builder()
.build();
.build();
S3TransferManager tmBuilderDefault = S3TransferManager.create();
S3TransferManager tmBuilderWithS3 = S3TransferManager.builder().build();
S3TransferManager tmConstructorWithCred = S3TransferManager.builder().s3Client(S3AsyncClient.builder().credentialsProvider(StaticCredentialsProvider.create(credentials)).build()).build();
Expand All @@ -66,7 +65,7 @@ void download(S3TransferManager tm, String bucket, String key) {
FileDownload download2 = tm.downloadFile(DownloadFileRequest.builder().getObjectRequest(GetObjectRequest.builder().bucket(bucket).key(key).overrideConfiguration(AwsRequestOverrideConfiguration.builder().apiCallTimeout(Duration.ofMillis(timeout)).build()).build()).destination(file).build());

GetObjectRequest getObjectRequest = GetObjectRequest.builder().bucket(bucket).key(key)
.build();
.build();

FileDownload download3 = tm.downloadFile(DownloadFileRequest.builder().getObjectRequest(getObjectRequest).destination(file).build());

Expand All @@ -78,19 +77,19 @@ void upload(S3TransferManager tm, String bucket, String key) {

File file = new File("file1.txt");
PutObjectRequest requestWithFile = PutObjectRequest.builder().bucket(bucket).key(key)
.build();
.build();
tm.uploadFile(UploadFileRequest.builder().putObjectRequest(requestWithFile).source(file).build());

PutObjectRequest requestWithoutPayload = PutObjectRequest.builder().bucket(bucket).key(key).websiteRedirectLocation("location")
.build();
.build();
tm.upload(UploadRequest.builder().putObjectRequest(requestWithoutPayload).requestBody(AsyncRequestBody.empty()).build());
}

void copy(S3TransferManager tm, String sourceBucket, String sourceKey, String destinationBucket, String destinationKey) {
Copy copy = tm.copy(CopyRequest.builder().copyObjectRequest(CopyObjectRequest.builder().sourceBucket(sourceBucket).sourceKey(sourceKey).destinationBucket(destinationBucket).destinationKey(destinationKey).build()).build());

CopyObjectRequest copyRequest = CopyObjectRequest.builder().sourceBucket(sourceBucket).sourceKey(sourceKey).destinationBucket(destinationBucket).destinationKey(destinationKey)
.build();
.build();
Copy copy2 = tm.copy(CopyRequest.builder().copyObjectRequest(copyRequest).build());
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ tags:
- aws
- sdk
recipeList:
- software.amazon.awssdk.v2migration.AddTransferManagerDependency
- software.amazon.awssdk.v2migration.AddS3EventNotificationDependency
- software.amazon.awssdk.v2migration.UpgradeSdkDependencies
- software.amazon.awssdk.v2migration.S3AddImportsAndComments
Expand All @@ -34,6 +35,7 @@ recipeList:
- software.amazon.awssdk.v2migration.S3MethodsConstructorToFluent
- software.amazon.awssdk.v2migration.S3UriToV2
- software.amazon.awssdk.v2migration.EnumGettersToV2
- software.amazon.awssdk.v2migration.ChangeTransferManagerTypes
- software.amazon.awssdk.v2migration.ChangeS3EventNotificationTypes
- software.amazon.awssdk.v2migration.ChangeSdkType
- software.amazon.awssdk.v2migration.ChangeSdkCoreTypes
Expand All @@ -50,4 +52,7 @@ recipeList:
- software.amazon.awssdk.v2migration.DateToInstant
- software.amazon.awssdk.v2migration.S3NonStreamingRequestToV2Complex
- software.amazon.awssdk.v2migration.S3PutObjectRequestToV2
- software.amazon.awssdk.v2migration.SettersToBuilderV2
- software.amazon.awssdk.v2migration.SettersToBuilderV2
- software.amazon.awssdk.v2migration.S3TmAddComments
- software.amazon.awssdk.v2migration.ChangeTransferManagerSimpleMethods
- software.amazon.awssdk.v2migration.TransferManagerMethodsToV2
Loading