use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class ProxyInvocationHandlerTest method testDisplayDataMissingPipelineOptionsRegistration.
@Test
public void testDisplayDataMissingPipelineOptionsRegistration() throws Exception {
HasClassOptions options = PipelineOptionsFactory.as(HasClassOptions.class);
options.setClassOption(ProxyInvocationHandlerTest.class);
PipelineOptions deserializedOptions = serializeDeserialize(PipelineOptions.class, options);
DisplayData displayData = DisplayData.from(deserializedOptions);
String expectedJsonValue = MAPPER.writeValueAsString(ProxyInvocationHandlerTest.class);
assertThat(displayData, hasDisplayItem("classOption", expectedJsonValue));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class ProxyInvocationHandlerTest method testDisplayDataExcludesHiddenValues.
@Test
public void testDisplayDataExcludesHiddenValues() {
HasHidden options = PipelineOptionsFactory.as(HasHidden.class);
options.setFoo("bar");
DisplayData data = DisplayData.from(options);
assertThat(data, not(hasDisplayItem("foo")));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class ProxyInvocationHandlerTest method testDisplayDataInheritanceNamespace.
@Test
public void testDisplayDataInheritanceNamespace() {
ExtendsBaseOptions options = PipelineOptionsFactory.as(ExtendsBaseOptions.class);
options.setFoo("bar");
DisplayData displayData = DisplayData.from(options);
assertThat(displayData, hasDisplayItem(allOf(hasKey("foo"), hasValue("bar"), hasNamespace(ExtendsBaseOptions.class))));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class HBaseIOTest method testWritingDisplayData.
@Test
public void testWritingDisplayData() {
final String table = tmpTable.getName();
HBaseIO.Write write = HBaseIO.write().withTableId(table).withConfiguration(conf);
DisplayData displayData = DisplayData.from(write);
assertThat(displayData, hasDisplayItem("tableId", table));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class CompressedSourceTest method testDisplayData.
@Test
public void testDisplayData() {
ByteSource inputSource = new ByteSource("foobar.txt", 1) {
@Override
public void populateDisplayData(DisplayData.Builder builder) {
builder.add(DisplayData.item("foo", "bar"));
}
};
CompressedSource<?> compressedSource = CompressedSource.from(inputSource);
CompressedSource<?> gzipSource = compressedSource.withCompression(Compression.GZIP);
DisplayData compressedSourceDisplayData = DisplayData.from(compressedSource);
DisplayData gzipDisplayData = DisplayData.from(gzipSource);
assertThat(compressedSourceDisplayData, hasDisplayItem("compressionMode"));
assertThat(gzipDisplayData, hasDisplayItem("compressionMode", Compression.GZIP.toString()));
assertThat(compressedSourceDisplayData, hasDisplayItem("source", inputSource.getClass()));
assertThat(compressedSourceDisplayData, includesDisplayDataFor("source", inputSource));
}
Aggregations