use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class TextIOWriteTest method testWriteDisplayDataValidateThenHeader.
@Test
public void testWriteDisplayDataValidateThenHeader() {
TextIO.Write write = TextIO.write().to("foo").withHeader("myHeader");
DisplayData displayData = DisplayData.from(write);
assertThat(displayData, hasDisplayItem("fileHeader", "myHeader"));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class TextIOWriteTest method testWriteDisplayData.
@Test
public void testWriteDisplayData() {
// TODO: Java core test failing on windows, https://issues.apache.org/jira/browse/BEAM-10737
assumeFalse(SystemUtils.IS_OS_WINDOWS);
TextIO.Write write = TextIO.write().to("/foo").withSuffix("bar").withShardNameTemplate("-SS-of-NN-").withNumShards(100).withFooter("myFooter").withHeader("myHeader");
DisplayData displayData = DisplayData.from(write);
assertThat(displayData, hasDisplayItem("filePrefix", "/foo"));
assertThat(displayData, hasDisplayItem("fileSuffix", "bar"));
assertThat(displayData, hasDisplayItem("fileHeader", "myHeader"));
assertThat(displayData, hasDisplayItem("fileFooter", "myFooter"));
assertThat(displayData, hasDisplayItem("shardNameTemplate", "-SS-of-NN-"));
assertThat(displayData, hasDisplayItem("numShards", 100));
assertThat(displayData, hasDisplayItem("writableByteChannelFactory", "UNCOMPRESSED"));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class ProxyInvocationHandlerTest method testDisplayDataItemProperties.
@Test
public void testDisplayDataItemProperties() {
PipelineOptions options = PipelineOptionsFactory.create();
options.setTempLocation("myTemp");
DisplayData displayData = DisplayData.from(options);
assertThat(displayData, hasDisplayItem(allOf(hasKey("tempLocation"), hasType(DisplayData.Type.STRING), hasValue("myTemp"), hasNamespace(PipelineOptions.class))));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class ProxyInvocationHandlerTest method testDisplayDataNullValuesConvertedToEmptyString.
@Test
public void testDisplayDataNullValuesConvertedToEmptyString() throws Exception {
FooOptions options = PipelineOptionsFactory.as(FooOptions.class);
options.setFoo(null);
DisplayData data = DisplayData.from(options);
assertThat(data, hasDisplayItem("foo", ""));
FooOptions deserializedOptions = serializeDeserialize(FooOptions.class, options);
DisplayData deserializedData = DisplayData.from(deserializedOptions);
assertThat(deserializedData, hasDisplayItem("foo", ""));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class ProxyInvocationHandlerTest method testDisplayDataExcludedFromOverriddenBaseClass.
@Test
public void testDisplayDataExcludedFromOverriddenBaseClass() {
ExtendsBaseOptions options = PipelineOptionsFactory.as(ExtendsBaseOptions.class);
options.setFoo("bar");
DisplayData displayData = DisplayData.from(options);
assertThat(displayData, not(hasDisplayItem(hasNamespace(BaseOptions.class))));
}
Aggregations