use of org.apache.beam.sdk.transforms.display.DisplayData.Builder in project beam by apache.
the class ParDoTest method testWithOutputTagsDisplayData.
@Test
public void testWithOutputTagsDisplayData() {
DoFn<String, String> fn = new DoFn<String, String>() {
@ProcessElement
public void proccessElement(ProcessContext c) {
}
@Override
public void populateDisplayData(Builder builder) {
builder.add(DisplayData.item("fnMetadata", "foobar"));
}
};
ParDo.MultiOutput<String, String> parDo = ParDo.of(fn).withOutputTags(new TupleTag<String>(), TupleTagList.empty());
DisplayData displayData = DisplayData.from(parDo);
assertThat(displayData, includesDisplayDataFor("fn", fn));
assertThat(displayData, hasDisplayItem("fn", fn.getClass()));
}
use of org.apache.beam.sdk.transforms.display.DisplayData.Builder in project beam by apache.
the class ParDoTest method testDoFnWithContextDisplayData.
@Test
public void testDoFnWithContextDisplayData() {
DoFn<String, String> fn = new DoFn<String, String>() {
@ProcessElement
public void proccessElement(ProcessContext c) {
}
@Override
public void populateDisplayData(Builder builder) {
builder.add(DisplayData.item("fnMetadata", "foobar"));
}
};
SingleOutput<String, String> parDo = ParDo.of(fn);
DisplayData displayData = DisplayData.from(parDo);
assertThat(displayData, includesDisplayDataFor("fn", fn));
assertThat(displayData, hasDisplayItem("fn", fn.getClass()));
}
use of org.apache.beam.sdk.transforms.display.DisplayData.Builder in project beam by apache.
the class ParDoTest method testDoFnDisplayData.
@Test
public void testDoFnDisplayData() {
DoFn<String, String> fn = new DoFn<String, String>() {
@ProcessElement
public void processElement(ProcessContext c) {
}
@Override
public void populateDisplayData(Builder builder) {
builder.add(DisplayData.item("doFnMetadata", "bar"));
}
};
SingleOutput<String, String> parDo = ParDo.of(fn);
DisplayData displayData = DisplayData.from(parDo);
assertThat(displayData, hasDisplayItem(allOf(hasKey("fn"), hasType(DisplayData.Type.JAVA_CLASS), DisplayDataMatchers.hasValue(fn.getClass().getName()))));
assertThat(displayData, includesDisplayDataFor("fn", fn));
}
Aggregations