use of software.amazon.awssdk.testutils.RandomTempFile in project aws-sdk-java-v2 by aws.
the class CrtExceptionTransformationIntegrationTest method setupFixture.
@BeforeClass
public static void setupFixture() throws IOException {
createBucket(BUCKET);
testFile = new RandomTempFile(BUCKET, OBJ_SIZE);
s3Crt = S3CrtAsyncClient.builder().credentialsProvider(CREDENTIALS_PROVIDER_CHAIN).region(S3IntegrationTestBase.DEFAULT_REGION).build();
transferManager = S3TransferManager.builder().s3ClientConfiguration(b -> b.credentialsProvider(CREDENTIALS_PROVIDER_CHAIN).region(S3IntegrationTestBase.DEFAULT_REGION)).build();
}
use of software.amazon.awssdk.testutils.RandomTempFile in project aws-sdk-java-v2 by aws.
the class S3CrtGetObjectIntegrationTest method setup.
@BeforeClass
public static void setup() throws IOException {
S3IntegrationTestBase.createBucket(BUCKET);
crtClient = S3CrtAsyncClient.builder().region(S3IntegrationTestBase.DEFAULT_REGION).credentialsProvider(AwsTestBase.CREDENTIALS_PROVIDER_CHAIN).build();
file = new RandomTempFile(10_000);
S3IntegrationTestBase.s3.putObject(PutObjectRequest.builder().bucket(BUCKET).key(KEY).build(), file.toPath());
executorService = Executors.newFixedThreadPool(2);
}
use of software.amazon.awssdk.testutils.RandomTempFile in project aws-sdk-java-v2 by aws.
the class BucketAccelerateIntegrationTest method testAccelerateEndpoint.
@Test
public void testAccelerateEndpoint() throws Exception {
String status = s3.getBucketAccelerateConfiguration(GetBucketAccelerateConfigurationRequest.builder().bucket(US_BUCKET_NAME).build()).statusAsString();
if (status == null || !status.equals("Enabled")) {
enableAccelerateOnBucket();
}
// PutObject
File uploadFile = new RandomTempFile(KEY_NAME, 1000);
try {
accelerateClient.putObject(PutObjectRequest.builder().bucket(US_BUCKET_NAME).key(KEY_NAME).build(), RequestBody.fromFile(uploadFile));
} catch (Exception e) {
// We really only need to verify the request is using the accelerate endpoint
}
}
use of software.amazon.awssdk.testutils.RandomTempFile in project aws-sdk-java-v2 by aws.
the class ListObjectsV2PaginatorsIntegrationTest method createKey.
/**
* Creates a test object in S3 with the specified name, using random ASCII
* data of the default content length as defined in this test class.
*
* @param key The key under which to create the object in this test class'
* test bucket.
*/
private static void createKey(String key) throws Exception {
File file = new RandomTempFile("list-objects-integ-test-" + new Date().getTime(), CONTENT_LENGTH);
s3.putObject(PutObjectRequest.builder().bucket(bucketName).key(key).build(), RequestBody.fromFile(file));
keys.add(key);
}
use of software.amazon.awssdk.testutils.RandomTempFile in project aws-sdk-java-v2 by aws.
the class ServerSideEncryptionIntegrationTestBase method setupFixture.
@BeforeClass
public static void setupFixture() throws IOException {
createBucket(BUCKET);
createBucket(BUCKET_WITH_SSE);
keyId = KMS.createKey().keyMetadata().keyId();
s3.putBucketEncryption(r -> r.bucket(BUCKET_WITH_SSE).serverSideEncryptionConfiguration(ssec -> ssec.rules(rule -> rule.applyServerSideEncryptionByDefault(d -> d.kmsMasterKeyID(keyId).sseAlgorithm(ServerSideEncryption.AWS_KMS)))));
file = new RandomTempFile(10_000);
}
Aggregations