use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project flink by apache.
the class AWSGeneralUtilTest method testGetCredentialsProviderSystemProperties.
@Test
public void testGetCredentialsProviderSystemProperties() {
Properties properties = TestUtil.properties(AWS_CREDENTIALS_PROVIDER, "SYS_PROP");
AwsCredentialsProvider credentialsProvider = AWSGeneralUtil.getCredentialsProvider(properties);
assertTrue(credentialsProvider instanceof SystemPropertyCredentialsProvider);
}
use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project flink by apache.
the class AWSGeneralUtilTest method testGetCredentialsProviderNamedProfile.
@Test
public void testGetCredentialsProviderNamedProfile() {
Properties properties = TestUtil.properties(AWS_CREDENTIALS_PROVIDER, "PROFILE");
properties.setProperty(AWSConfigConstants.profileName(AWS_CREDENTIALS_PROVIDER), "foo");
properties.setProperty(AWSConfigConstants.profilePath(AWS_CREDENTIALS_PROVIDER), "src/test/resources/profile");
AwsCredentialsProvider credentialsProvider = AWSGeneralUtil.getCredentialsProvider(properties);
assertTrue(credentialsProvider instanceof ProfileCredentialsProvider);
AwsCredentials credentials = credentialsProvider.resolveCredentials();
assertEquals("22222222222222222222", credentials.accessKeyId());
assertEquals("wJalrXUtnFEMI/K7MDENG/bPxRfiCY2222222222", credentials.secretAccessKey());
}
use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project flink by apache.
the class AWSGeneralUtilTest method testGetCredentialsProviderEnvironmentVariables.
@Test
public void testGetCredentialsProviderEnvironmentVariables() {
Properties properties = TestUtil.properties(AWS_CREDENTIALS_PROVIDER, "ENV_VAR");
AwsCredentialsProvider credentialsProvider = AWSGeneralUtil.getCredentialsProvider(properties);
assertTrue(credentialsProvider instanceof EnvironmentVariableCredentialsProvider);
}
use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project flink by apache.
the class AWSGeneralUtilTest method testGetCredentialsProviderProfile.
@Test
public void testGetCredentialsProviderProfile() {
Properties properties = TestUtil.properties(AWS_CREDENTIALS_PROVIDER, "PROFILE");
properties.put(AWSConfigConstants.profileName(AWS_CREDENTIALS_PROVIDER), "default");
properties.put(AWSConfigConstants.profilePath(AWS_CREDENTIALS_PROVIDER), "src/test/resources/profile");
AwsCredentialsProvider credentialsProvider = AWSGeneralUtil.getCredentialsProvider(properties);
assertTrue(credentialsProvider instanceof ProfileCredentialsProvider);
AwsCredentials credentials = credentialsProvider.resolveCredentials();
assertEquals("11111111111111111111", credentials.accessKeyId());
assertEquals("wJalrXUtnFEMI/K7MDENG/bPxRfiCY1111111111", credentials.secretAccessKey());
}
use of software.amazon.awssdk.auth.credentials.AwsCredentialsProvider in project flink by apache.
the class GlueSchemaRegistryInputStreamDeserializerTest method testAwsCredentialsProviderFromConfig.
@Test
public void testAwsCredentialsProviderFromConfig() throws Exception {
Map<String, Object> config = new HashMap<>(configs);
config.put(AWS_ACCESS_KEY_ID, "ak");
config.put(AWS_SECRET_ACCESS_KEY, "sk");
GlueSchemaRegistryInputStreamDeserializer glueSchemaRegistryInputStreamDeserializer = new GlueSchemaRegistryInputStreamDeserializer(config);
GlueSchemaRegistryDeserializationFacade facade = getField("glueSchemaRegistryDeserializationFacade", glueSchemaRegistryInputStreamDeserializer);
AwsCredentialsProvider credentialsProvider = facade.getCredentialsProvider();
assertThat(credentialsProvider.resolveCredentials().accessKeyId()).isEqualTo("ak");
assertThat(credentialsProvider.resolveCredentials().secretAccessKey()).isEqualTo("sk");
}
Aggregations