use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class DatastoreV1Test method testReadDisplayDataWithGqlQuery.
@Test
public void testReadDisplayDataWithGqlQuery() {
DatastoreV1.Read read = DatastoreIO.v1().read().withProjectId(PROJECT_ID).withLiteralGqlQuery(GQL_QUERY).withNamespace(NAMESPACE);
DisplayData displayData = DisplayData.from(read);
assertThat(displayData, hasDisplayItem("projectId", PROJECT_ID));
assertThat(displayData, hasDisplayItem("gqlQuery", GQL_QUERY));
assertThat(displayData, hasDisplayItem("namespace", NAMESPACE));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class DatastoreV1Test method testWriteDisplayData.
@Test
public void testWriteDisplayData() {
Write write = DatastoreIO.v1().write().withProjectId(PROJECT_ID);
DisplayData displayData = DisplayData.from(write);
assertThat(displayData, hasDisplayItem("projectId", PROJECT_ID));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class BigtableIOTest method testReadingDisplayData.
@Test
public void testReadingDisplayData() {
RowFilter rowFilter = RowFilter.newBuilder().setRowKeyRegexFilter(ByteString.copyFromUtf8("foo.*")).build();
ByteKeyRange keyRange = ByteKeyRange.ALL_KEYS.withEndKey(ByteKey.of(0xab, 0xcd));
BigtableIO.Read read = BigtableIO.read().withBigtableOptions(BIGTABLE_OPTIONS).withTableId("fooTable").withRowFilter(rowFilter).withKeyRange(keyRange);
DisplayData displayData = DisplayData.from(read);
assertThat(displayData, hasDisplayItem(allOf(hasKey("tableId"), hasLabel("Bigtable Table Id"), hasValue("fooTable"))));
assertThat(displayData, hasDisplayItem("rowFilter", rowFilter.toString()));
assertThat(displayData, hasDisplayItem("keyRanges", "[ByteKeyRange{startKey=[], endKey=[abcd]}]"));
// BigtableIO adds user-agent to options; assert only on key and not value.
assertThat(displayData, hasDisplayItem("bigtableOptions"));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class BigtableConfigTest method testPopulateDisplayData.
@Test
public void testPopulateDisplayData() {
DisplayData displayData = DisplayData.from(config.withProjectId(PROJECT_ID).withInstanceId(INSTANCE_ID).withTableId(TABLE_ID)::populateDisplayData);
assertThat(displayData, hasDisplayItem(allOf(hasKey("projectId"), hasLabel("Bigtable Project Id"), hasValue(PROJECT_ID.get()))));
assertThat(displayData, hasDisplayItem(allOf(hasKey("instanceId"), hasLabel("Bigtable Instance Id"), hasValue(INSTANCE_ID.get()))));
assertThat(displayData, hasDisplayItem(allOf(hasKey("tableId"), hasLabel("Bigtable Table Id"), hasValue(TABLE_ID.get()))));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class DatastoreV1Test method testDeleteEntityPrimitiveDisplayData.
@Test
public void testDeleteEntityPrimitiveDisplayData() {
int hintNumWorkers = 10;
DisplayDataEvaluator evaluator = DisplayDataEvaluator.create();
PTransform<PCollection<Entity>, ?> write = DatastoreIO.v1().deleteEntity().withProjectId("myProject").withHintNumWorkers(hintNumWorkers);
Set<DisplayData> displayData = evaluator.displayDataForPrimitiveTransforms(write);
assertThat("DatastoreIO write should include the project in its primitive display data", displayData, hasItem(hasDisplayItem("projectId")));
assertThat("DatastoreIO write should include the deleteEntityFn in its primitive display data", displayData, hasItem(hasDisplayItem("deleteEntityFn")));
assertThat("DatastoreIO write should include ramp-up throttling worker count hint if enabled", displayData, hasItem(hasDisplayItem("hintNumWorkers", hintNumWorkers)));
}
Aggregations