use of org.testcontainers.containers.localstack.LocalStackContainer.Service.DYNAMODB in project beam by apache.
the class DynamoDBIOIT method runWrite.
/**
* Write test dataset to DynamoDB.
*/
private void runWrite() {
int rows = env.options().getNumberOfRows();
pipelineWrite.apply("Generate Sequence", GenerateSequence.from(0).to(rows)).apply("Prepare TestRows", ParDo.of(new DeterministicallyConstructTestRowFn())).apply("Write to DynamoDB", DynamoDBIO.<TestRow>write().withAwsClientsProvider(clientProvider()).withWriteRequestMapperFn(row -> buildWriteRequest(row)));
pipelineWrite.run().waitUntilFinish();
}
use of org.testcontainers.containers.localstack.LocalStackContainer.Service.DYNAMODB in project beam by apache.
the class DynamoDBIOIT method runWrite.
/**
* Write test dataset to DynamoDB.
*/
private void runWrite() {
int rows = env.options().getNumberOfRows();
pipelineWrite.apply("Generate Sequence", GenerateSequence.from(0).to(rows)).apply("Prepare TestRows", ParDo.of(new DeterministicallyConstructTestRowFn())).apply("Write to DynamoDB", DynamoDBIO.<TestRow>write().withWriteRequestMapperFn(row -> buildWriteRequest(row)));
pipelineWrite.run().waitUntilFinish();
}
use of org.testcontainers.containers.localstack.LocalStackContainer.Service.DYNAMODB in project beam by apache.
the class DynamoDBIOIT method runRead.
/**
* Read test dataset from DynamoDB.
*/
private void runRead() {
int rows = env.options().getNumberOfRows();
PCollection<Map<String, AttributeValue>> records = pipelineRead.apply("Read from DynamoDB", DynamoDBIO.read().withScanRequestFn(in -> buildScanRequest()).items()).apply("Flatten result", Flatten.iterables());
PAssert.thatSingleton(records.apply("Count All", Count.globally())).isEqualTo((long) rows);
PCollection<String> consolidatedHashcode = records.apply(MapElements.into(strings()).via(record -> record.get(COL_NAME).s())).apply("Hash records", Combine.globally(new HashingFn()).withoutDefaults());
PAssert.that(consolidatedHashcode).containsInAnyOrder(getExpectedHashForRowCount(rows));
pipelineRead.run().waitUntilFinish();
}
use of org.testcontainers.containers.localstack.LocalStackContainer.Service.DYNAMODB in project beam by apache.
the class DynamoDBIOIT method runRead.
/**
* Read test dataset from DynamoDB.
*/
private void runRead() {
int rows = env.options().getNumberOfRows();
PCollection<Map<String, AttributeValue>> records = pipelineRead.apply("Read from DynamoDB", DynamoDBIO.read().withAwsClientsProvider(clientProvider()).withScanRequestFn(in -> buildScanRequest()).items()).apply("Flatten result", Flatten.iterables());
PAssert.thatSingleton(records.apply("Count All", Count.globally())).isEqualTo((long) rows);
PCollection<String> consolidatedHashcode = records.apply(MapElements.into(strings()).via(record -> record.get(COL_NAME).getS())).apply("Hash records", Combine.globally(new HashingFn()).withoutDefaults());
PAssert.that(consolidatedHashcode).containsInAnyOrder(getExpectedHashForRowCount(rows));
pipelineRead.run().waitUntilFinish();
}
Aggregations