use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project beam by apache.
the class AwsModuleTest method testStaticCredentialsProviderSerializationDeserialization.
@Test
public void testStaticCredentialsProviderSerializationDeserialization() throws Exception {
AwsCredentialsProvider provider = StaticCredentialsProvider.create(AwsBasicCredentials.create("key", "secret"));
assertThat(serializeAndDeserialize(provider)).hasSameClassAs(provider).isEqualToComparingFieldByFieldRecursively(provider);
provider = StaticCredentialsProvider.create(AwsSessionCredentials.create("key", "secret", "token"));
assertThat(serializeAndDeserialize(provider)).hasSameClassAs(provider).isEqualToComparingFieldByFieldRecursively(provider);
}
use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project beam by apache.
the class AwsSerializableUtilsTest method testAwsCredentialsProviderSerialization.
@Test
public void testAwsCredentialsProviderSerialization() {
AwsCredentialsProvider awsCredentialsProvider = StaticCredentialsProvider.create(AwsBasicCredentials.create(ACCESS_KEY_ID, SECRET_ACCESS_KEY));
String awsCredentialsProviderSerialized = AwsSerializableUtils.serializeAwsCredentialsProvider(awsCredentialsProvider);
AwsCredentialsProvider awsCredentialsProviderDeserialized = AwsSerializableUtils.deserializeAwsCredentialsProvider(awsCredentialsProviderSerialized);
assertTrue(awsCredentialsProviderDeserialized instanceof StaticCredentialsProvider);
AwsCredentials awsCredentials = awsCredentialsProviderDeserialized.resolveCredentials();
assertEquals(ACCESS_KEY_ID, awsCredentials.accessKeyId());
assertEquals(SECRET_ACCESS_KEY, awsCredentials.secretAccessKey());
}
use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project beam by apache.
the class AwsOptionsTest method testSetAwsCredentialsProvider.
@Test
public void testSetAwsCredentialsProvider() {
AwsOptions options = create("--awsCredentialsProvider={\"@type\":\"StaticCredentialsProvider\",\"accessKeyId\":\"key\",\"secretAccessKey\":\"secret\"}");
AwsCredentialsProvider expected = StaticCredentialsProvider.create(AwsBasicCredentials.create("key", "secret"));
assertThat(options.getAwsCredentialsProvider()).isEqualToComparingFieldByFieldRecursively(expected);
assertThat(serializeDeserialize(options).getAwsCredentialsProvider()).isEqualToComparingFieldByFieldRecursively(expected);
}
use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project beam by apache.
the class SnsIOTest method testBuildWithCredentialsProviderAndRegion.
@Test
public void testBuildWithCredentialsProviderAndRegion() {
Region region = Region.US_EAST_1;
AwsCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create();
Write<Object> write = SnsIO.write().withSnsClientProvider(credentialsProvider, region.id());
assertThat(write.getClientConfiguration()).isEqualTo(ClientConfiguration.create(credentialsProvider, region, null));
}
use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project beam by apache.
the class SqsIOReadTest method testBuildWithCredentialsProviderAndRegionAndEndpoint.
@Test
public void testBuildWithCredentialsProviderAndRegionAndEndpoint() {
Region region = Region.US_EAST_1;
AwsCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create();
URI endpoint = URI.create("localhost:9999");
Read read = SqsIO.read().withSqsClientProvider(credentialsProvider, region.id(), endpoint);
assertThat(read.clientConfiguration()).isEqualTo(ClientConfiguration.create(credentialsProvider, region, endpoint));
}
Aggregations