use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class GenerateSequenceTest method testUnboundedDisplayData.
@Test
public void testUnboundedDisplayData() {
Duration maxReadTime = Duration.standardHours(5);
SerializableFunction<Long, Instant> timestampFn = input -> Instant.now();
PTransform<?, ?> input = GenerateSequence.from(0).to(1234).withMaxReadTime(maxReadTime).withTimestampFn(timestampFn);
DisplayData displayData = DisplayData.from(input);
assertThat(displayData, hasDisplayItem("maxReadTime", maxReadTime));
assertThat(displayData, hasDisplayItem("timestampFn", timestampFn.getClass()));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class ReadTest method testDisplayData.
@Test
public void testDisplayData() {
SerializableBoundedSource boundedSource = new SerializableBoundedSource() {
@Override
public void populateDisplayData(DisplayData.Builder builder) {
builder.add(DisplayData.item("foo", "bar"));
}
};
SerializableUnboundedSource unboundedSource = new SerializableUnboundedSource() {
@Override
public void populateDisplayData(DisplayData.Builder builder) {
builder.add(DisplayData.item("foo", "bar"));
}
};
Duration maxReadTime = Duration.standardMinutes(2345);
Read.Bounded<String> bounded = Read.from(boundedSource);
BoundedReadFromUnboundedSource<String> unbounded = Read.from(unboundedSource).withMaxNumRecords(1234).withMaxReadTime(maxReadTime);
DisplayData boundedDisplayData = DisplayData.from(bounded);
assertThat(boundedDisplayData, hasDisplayItem("source", boundedSource.getClass()));
assertThat(boundedDisplayData, includesDisplayDataFor("source", boundedSource));
DisplayData unboundedDisplayData = DisplayData.from(unbounded);
assertThat(unboundedDisplayData, hasDisplayItem("source", unboundedSource.getClass()));
assertThat(unboundedDisplayData, includesDisplayDataFor("source", unboundedSource));
assertThat(unboundedDisplayData, hasDisplayItem("maxRecords", 1234));
assertThat(unboundedDisplayData, hasDisplayItem("maxReadTime", maxReadTime));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class TFRecordIOTest method testReadDisplayData.
@Test
public void testReadDisplayData() {
TFRecordIO.Read read = TFRecordIO.read().from("foo.*").withCompression(GZIP).withoutValidation();
DisplayData displayData = DisplayData.from(read);
assertThat(displayData, hasDisplayItem("filePattern", "foo.*"));
assertThat(displayData, hasDisplayItem("compressionType", GZIP.toString()));
assertThat(displayData, hasDisplayItem("validation", false));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class AvroSourceTest method testDisplayData.
@Test
public void testDisplayData() {
AvroSource<Bird> source = AvroSource.from("foobar.txt").withSchema(Bird.class).withMinBundleSize(1234);
DisplayData displayData = DisplayData.from(source);
assertThat(displayData, hasDisplayItem("filePattern", "foobar.txt"));
assertThat(displayData, hasDisplayItem("minBundleSize", 1234));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class ProxyInvocationHandlerTest method testDisplayDataExcludesDefaultValues.
@Test
public void testDisplayDataExcludesDefaultValues() {
PipelineOptions options = PipelineOptionsFactory.as(HasDefaults.class);
DisplayData data = DisplayData.from(options);
assertThat(data, not(hasDisplayItem("foo")));
}
Aggregations