use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class DatastoreV1Test method testDeleteKeyPrimitiveDisplayData.
@Test
public void testDeleteKeyPrimitiveDisplayData() {
int hintNumWorkers = 10;
DisplayDataEvaluator evaluator = DisplayDataEvaluator.create();
PTransform<PCollection<Key>, ?> write = DatastoreIO.v1().deleteKey().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 deleteKeyFn in its primitive display data", displayData, hasItem(hasDisplayItem("deleteKeyFn")));
assertThat("DatastoreIO write should include ramp-up throttling worker count hint if enabled", displayData, hasItem(hasDisplayItem("hintNumWorkers", hintNumWorkers)));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class DatastoreV1Test method testDeleteEntityDisplayData.
@Test
public void testDeleteEntityDisplayData() {
DeleteEntity deleteEntity = DatastoreIO.v1().deleteEntity().withProjectId(PROJECT_ID);
DisplayData displayData = DisplayData.from(deleteEntity);
assertThat(displayData, hasDisplayItem("projectId", PROJECT_ID));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class DatastoreV1Test method testWritePrimitiveDisplayDataDisabledThrottler.
@Test
public void testWritePrimitiveDisplayDataDisabledThrottler() {
DisplayDataEvaluator evaluator = DisplayDataEvaluator.create();
PTransform<PCollection<Entity>, ?> write = DatastoreIO.v1().write().withProjectId("myProject").withRampupThrottlingDisabled();
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 upsertFn in its primitive display data", displayData, hasItem(hasDisplayItem("upsertFn")));
assertThat("DatastoreIO write should include ramp-up throttling worker count hint if enabled", displayData, not(hasItem(hasDisplayItem("hintNumWorkers"))));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class DatastoreV1Test method testDatastoreWriteFnDisplayData.
@Test
public void testDatastoreWriteFnDisplayData() {
DatastoreWriterFn datastoreWriter = new DatastoreWriterFn(PROJECT_ID, null);
DisplayData displayData = DisplayData.from(datastoreWriter);
assertThat(displayData, hasDisplayItem("projectId", PROJECT_ID));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class HadoopFormatIOReadTest method testReadDisplayData.
/**
* This test validates functionality of {@link
* HadoopInputFormatBoundedSource#populateDisplayData(DisplayData.Builder)}
* populateDisplayData(DisplayData.Builder)}.
*/
@Test
public void testReadDisplayData() {
HadoopInputFormatBoundedSource<Text, Employee> boundedSource = new HadoopInputFormatBoundedSource<>(serConf, WritableCoder.of(Text.class), AvroCoder.of(Employee.class), // No key translation required.
null, // No value translation required.
null, new SerializableSplit(), false, false);
DisplayData displayData = DisplayData.from(boundedSource);
assertThat(displayData, hasDisplayItem("mapreduce.job.inputformat.class", serConf.get().get("mapreduce.job.inputformat.class")));
assertThat(displayData, hasDisplayItem("key.class", serConf.get().get("key.class")));
assertThat(displayData, hasDisplayItem("value.class", serConf.get().get("value.class")));
}
Aggregations