Search in sources :

Example 96 with AWSCredentialsProvider

use of com.amazonaws.auth.AWSCredentialsProvider in project beam by apache.

the class AwsSerializableUtilsTest method testSystemPropertiesCredentialsProviderSerialization.

@Test
public void testSystemPropertiesCredentialsProviderSerialization() {
    AWSCredentialsProvider credentialsProvider = new SystemPropertiesCredentialsProvider();
    String expectedSerializedProvider = "{\"@type\":\"SystemPropertiesCredentialsProvider\"}";
    String serializedProvider = serialize(credentialsProvider);
    assertEquals(expectedSerializedProvider, serializedProvider);
    assertEquals(expectedSerializedProvider, serialize(deserialize(serializedProvider)));
}
Also used : SystemPropertiesCredentialsProvider(com.amazonaws.auth.SystemPropertiesCredentialsProvider) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) Test(org.junit.Test)

Example 97 with AWSCredentialsProvider

use of com.amazonaws.auth.AWSCredentialsProvider in project beam by apache.

the class AwsSerializableUtilsTest method testEnvironmentVariableCredentialsProviderSerialization.

@Test
public void testEnvironmentVariableCredentialsProviderSerialization() {
    AWSCredentialsProvider credentialsProvider = new EnvironmentVariableCredentialsProvider();
    String expectedSerializedProvider = "{\"@type\":\"EnvironmentVariableCredentialsProvider\"}";
    String serializedProvider = serialize(credentialsProvider);
    assertEquals(expectedSerializedProvider, serializedProvider);
    assertEquals(expectedSerializedProvider, serialize(deserialize(serializedProvider)));
}
Also used : EnvironmentVariableCredentialsProvider(com.amazonaws.auth.EnvironmentVariableCredentialsProvider) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) Test(org.junit.Test)

Example 98 with AWSCredentialsProvider

use of com.amazonaws.auth.AWSCredentialsProvider in project beam by apache.

the class AwsSerializableUtilsTest method testBasicCredentialsProviderSerialization.

@Test
public void testBasicCredentialsProviderSerialization() {
    AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY));
    String serializedProvider = serialize(credentialsProvider);
    checkStaticBasicCredentials(deserialize(serializedProvider));
}
Also used : AWSStaticCredentialsProvider(com.amazonaws.auth.AWSStaticCredentialsProvider) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) BasicAWSCredentials(com.amazonaws.auth.BasicAWSCredentials) Test(org.junit.Test)

Example 99 with AWSCredentialsProvider

use of com.amazonaws.auth.AWSCredentialsProvider in project beam by apache.

the class AwsSerializableUtilsTest method testProfileCredentialsProviderSerialization.

@Test
public void testProfileCredentialsProviderSerialization() {
    AWSCredentialsProvider credentialsProvider = new ProfileCredentialsProvider();
    String expectedSerializedProvider = "{\"@type\":\"ProfileCredentialsProvider\"}";
    String serializedProvider = serialize(credentialsProvider);
    assertEquals(expectedSerializedProvider, serializedProvider);
    assertEquals(expectedSerializedProvider, serialize(deserialize(serializedProvider)));
}
Also used : ProfileCredentialsProvider(com.amazonaws.auth.profile.ProfileCredentialsProvider) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) Test(org.junit.Test)

Example 100 with AWSCredentialsProvider

use of com.amazonaws.auth.AWSCredentialsProvider in project beam by apache.

the class KinesisIOReadTest method testReadWithCredentialsProviderAndCustomEndpoint.

@Test
public void testReadWithCredentialsProviderAndCustomEndpoint() {
    String customEndpoint = "localhost:9999";
    Regions region = Regions.US_WEST_1;
    AWSCredentialsProvider credentialsProvider = DefaultAWSCredentialsProviderChain.getInstance();
    Read<KinesisRecord> read = KinesisIO.read().withAWSClientsProvider(credentialsProvider, region, customEndpoint);
    assertEquals(read.getAWSClientsProvider(), new BasicKinesisProvider(credentialsProvider, region, customEndpoint, true));
}
Also used : Regions(com.amazonaws.regions.Regions) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) Test(org.junit.Test)

Aggregations

AWSCredentialsProvider (com.amazonaws.auth.AWSCredentialsProvider)125 Test (org.junit.Test)75 DefaultAWSCredentialsProviderChain (com.amazonaws.auth.DefaultAWSCredentialsProviderChain)26 BasicAWSCredentials (com.amazonaws.auth.BasicAWSCredentials)20 AWSStaticCredentialsProvider (com.amazonaws.auth.AWSStaticCredentialsProvider)19 AWSCredentials (com.amazonaws.auth.AWSCredentials)16 TestRunner (org.apache.nifi.util.TestRunner)15 ClientConfiguration (com.amazonaws.ClientConfiguration)12 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)12 STSAssumeRoleSessionCredentialsProvider (com.amazonaws.auth.STSAssumeRoleSessionCredentialsProvider)8 ProfileCredentialsProvider (com.amazonaws.auth.profile.ProfileCredentialsProvider)8 PropertyDescriptor (org.apache.nifi.components.PropertyDescriptor)8 AWSCredentialsProviderChain (com.amazonaws.auth.AWSCredentialsProviderChain)7 ClasspathPropertiesFileCredentialsProvider (com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider)7 EnvironmentVariableCredentialsProvider (com.amazonaws.auth.EnvironmentVariableCredentialsProvider)7 SystemPropertiesCredentialsProvider (com.amazonaws.auth.SystemPropertiesCredentialsProvider)7 ArrayList (java.util.ArrayList)7 Properties (java.util.Properties)7 Configuration (org.apache.hadoop.conf.Configuration)7 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)7