use of bigtable.WorkloadGenerator.ReadFromTableFn in project java-docs-samples by GoogleCloudPlatform.
the class WorkloadGeneratorTest method testGenerateWorkload.
@Test
public void testGenerateWorkload() {
BigtableWorkloadOptions options = PipelineOptionsFactory.create().as(BigtableWorkloadOptions.class);
options.setBigtableInstanceId(instanceId);
options.setBigtableTableId(TABLE_ID);
options.setRegion(REGION_ID);
Pipeline p = Pipeline.create(options);
CloudBigtableTableConfiguration bigtableTableConfig = new CloudBigtableTableConfiguration.Builder().withProjectId(options.getProject()).withInstanceId(options.getBigtableInstanceId()).withTableId(options.getBigtableTableId()).build();
// Initiates a new pipeline every second
p.apply(Create.of(1L)).apply(ParDo.of(new ReadFromTableFn(bigtableTableConfig)));
p.run().waitUntilFinish();
String output = bout.toString();
assertThat(output.contains("Connected to table"));
}
Aggregations