use of software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider 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.ProfileCredentialsProvider 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());
}
Aggregations