Search in sources :

Example 11 with Read

use of org.apache.beam.sdk.io.aws2.kinesis.KinesisIO.Read in project beam by apache.

the class KinesisIOReadTest method testBuildWithCredentialsProviderAndCustomEndpoint.

@Test
public void testBuildWithCredentialsProviderAndCustomEndpoint() {
    String customEndpoint = "localhost:9999";
    Region region = Region.US_WEST_1;
    AwsCredentialsProvider credentialsProvider = DefaultCredentialsProvider.create();
    Read read = KinesisIO.read().withAWSClientsProvider(credentialsProvider, region, customEndpoint);
    assertThat(read.getClientConfiguration()).isEqualTo(ClientConfiguration.create(credentialsProvider, region, URI.create(customEndpoint)));
}
Also used : Read(org.apache.beam.sdk.io.aws2.kinesis.KinesisIO.Read) AwsCredentialsProvider(software.amazon.awssdk.auth.credentials.AwsCredentialsProvider) Region(software.amazon.awssdk.regions.Region) Test(org.junit.Test)

Example 12 with Read

use of org.apache.beam.sdk.io.aws2.kinesis.KinesisIO.Read in project beam by apache.

the class KinesisIOReadTest method testBuildWithBasicCredentialsAndCustomEndpoint.

@Test
public void testBuildWithBasicCredentialsAndCustomEndpoint() {
    String customEndpoint = "localhost:9999";
    Region region = Region.US_WEST_1;
    AwsBasicCredentials credentials = AwsBasicCredentials.create("key", "secret");
    StaticCredentialsProvider credentialsProvider = StaticCredentialsProvider.create(credentials);
    Read read = KinesisIO.read().withAWSClientsProvider(KEY, SECRET, region, customEndpoint);
    assertThat(read.getClientConfiguration()).isEqualTo(ClientConfiguration.create(credentialsProvider, region, URI.create(customEndpoint)));
}
Also used : Read(org.apache.beam.sdk.io.aws2.kinesis.KinesisIO.Read) StaticCredentialsProvider(software.amazon.awssdk.auth.credentials.StaticCredentialsProvider) Region(software.amazon.awssdk.regions.Region) AwsBasicCredentials(software.amazon.awssdk.auth.credentials.AwsBasicCredentials) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)11 Region (software.amazon.awssdk.regions.Region)6 Read (org.apache.beam.sdk.io.aws2.kinesis.KinesisIO.Read)5 AwsCredentialsProvider (software.amazon.awssdk.auth.credentials.AwsCredentialsProvider)4 S3TestUtils.buildMockedS3FileSystem (org.apache.beam.sdk.io.aws2.s3.S3TestUtils.buildMockedS3FileSystem)3 GenerateSequence (org.apache.beam.sdk.io.GenerateSequence)2 ITEnvironment (org.apache.beam.sdk.io.aws2.ITEnvironment)2 Read (org.apache.beam.sdk.io.aws2.sqs.SqsIO.Read)2 HashingFn (org.apache.beam.sdk.io.common.HashingFn)2 TestRow (org.apache.beam.sdk.io.common.TestRow)2 DeterministicallyConstructTestRowFn (org.apache.beam.sdk.io.common.TestRow.DeterministicallyConstructTestRowFn)2 TestRow.getExpectedHashForRowCount (org.apache.beam.sdk.io.common.TestRow.getExpectedHashForRowCount)2 MatchResult (org.apache.beam.sdk.io.fs.MatchResult)2 PAssert (org.apache.beam.sdk.testing.PAssert)2 TestPipeline (org.apache.beam.sdk.testing.TestPipeline)2 Combine (org.apache.beam.sdk.transforms.Combine)2 Count (org.apache.beam.sdk.transforms.Count)2 MapElements (org.apache.beam.sdk.transforms.MapElements)2 ParDo (org.apache.beam.sdk.transforms.ParDo)2 PCollection (org.apache.beam.sdk.values.PCollection)2