Search in sources :

Example 46 with AWSCredentialsProvider

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

the class KinesisIOReadTest method testReadWithCredentialsProvider.

@Test
public void testReadWithCredentialsProvider() {
    Regions region = Regions.US_EAST_1;
    AWSCredentialsProvider credentialsProvider = DefaultAWSCredentialsProviderChain.getInstance();
    Read<KinesisRecord> read = KinesisIO.read().withAWSClientsProvider(credentialsProvider, region);
    assertEquals(read.getAWSClientsProvider(), new BasicKinesisProvider(credentialsProvider, region, null, true));
}
Also used : Regions(com.amazonaws.regions.Regions) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) Test(org.junit.Test)

Example 47 with AWSCredentialsProvider

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

the class KinesisIOReadTest method testReadWithCredentialsProviderAndVerificationDisabled.

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

Example 48 with AWSCredentialsProvider

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

the class AwsSerializableUtilsTest method testStaticSessionCredentialsProviderSerialization.

@Test
public void testStaticSessionCredentialsProviderSerialization() {
    AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(new BasicSessionCredentials(ACCESS_KEY_ID, SECRET_ACCESS_KEY, SESSION_TOKEN));
    String serializedCredentials = serialize(credentialsProvider);
    checkStaticSessionCredentials(deserialize(serializedCredentials));
}
Also used : AWSStaticCredentialsProvider(com.amazonaws.auth.AWSStaticCredentialsProvider) BasicSessionCredentials(com.amazonaws.auth.BasicSessionCredentials) AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) Test(org.junit.Test)

Example 49 with AWSCredentialsProvider

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

the class AwsSerializableUtilsTest method testEC2ContainerCredentialsProviderWrapperSerialization.

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

Example 50 with AWSCredentialsProvider

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

the class AwsSerializableUtilsTest method testClasspathPropertiesFileCredentialsProviderSerialization.

@Test
public void testClasspathPropertiesFileCredentialsProviderSerialization() {
    AWSCredentialsProvider credentialsProvider = new ClasspathPropertiesFileCredentialsProvider("AwsCredentials.properties");
    String expectedSerializedProvider = "{\"@type\":\"ClasspathPropertiesFileCredentialsProvider\",\"credentialsFilePath\":\"/AwsCredentials.properties\"}";
    String serializedProvider = serialize(credentialsProvider);
    assertEquals(expectedSerializedProvider, serializedProvider);
    assertEquals(expectedSerializedProvider, serialize(deserialize(serializedProvider)));
}
Also used : AWSCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider) ClasspathPropertiesFileCredentialsProvider(com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider) 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