use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class PTransformTest method testPopulateDisplayDataDefaultBehavior.
@Test
public void testPopulateDisplayDataDefaultBehavior() {
PTransform<PCollection<String>, PCollection<String>> transform = new PTransform<PCollection<String>, PCollection<String>>() {
@Override
public PCollection<String> expand(PCollection<String> begin) {
throw new IllegalArgumentException("Should never be applied");
}
};
DisplayData displayData = DisplayData.from(transform);
assertThat(displayData.items(), empty());
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class PartitionTest method testDisplayData.
@Test
public void testDisplayData() {
Partition<?> partition = Partition.of(123, new IdentityFn());
DisplayData displayData = DisplayData.from(partition);
assertThat(displayData, hasDisplayItem("numPartitions", 123));
assertThat(displayData, hasDisplayItem("partitionFn", IdentityFn.class));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class PubsubIOTest method testWriteDisplayData.
@Test
public void testWriteDisplayData() {
String topic = "projects/project/topics/topic";
PubsubIO.Write<?> write = PubsubIO.writeStrings().to(topic).withTimestampAttribute("myTimestamp").withIdAttribute("myId");
DisplayData displayData = DisplayData.from(write);
assertThat(displayData, hasDisplayItem("topic", topic));
assertThat(displayData, hasDisplayItem("timestampAttribute", "myTimestamp"));
assertThat(displayData, hasDisplayItem("idAttribute", "myId"));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class PubsubIOTest method testReadSubscriptionDisplayData.
@Test
public void testReadSubscriptionDisplayData() {
String subscription = "projects/project/subscriptions/subscription";
PubsubIO.Read<String> read = PubsubIO.readStrings().fromSubscription(StaticValueProvider.of(subscription)).withTimestampAttribute("myTimestamp").withIdAttribute("myId");
DisplayData displayData = DisplayData.from(read);
assertThat(displayData, hasDisplayItem("subscription", subscription));
assertThat(displayData, hasDisplayItem("timestampAttribute", "myTimestamp"));
assertThat(displayData, hasDisplayItem("idAttribute", "myId"));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class ParquetIOTest method testReadDisplayData.
@Test
public void testReadDisplayData() {
Configuration configuration = new Configuration();
configuration.set("parquet.foo", "foo");
DisplayData displayData = DisplayData.from(ParquetIO.read(SCHEMA).from("foo.parquet").withSplit().withProjection(REQUESTED_SCHEMA, SCHEMA).withAvroDataModel(GenericData.get()).withConfiguration(configuration));
assertThat(displayData, hasDisplayItem("filePattern", "foo.parquet"));
assertThat(displayData, hasDisplayItem("schema", SCHEMA.toString()));
assertThat(displayData, hasDisplayItem("inferBeamSchema", false));
assertThat(displayData, hasDisplayItem("splittable", true));
assertThat(displayData, hasDisplayItem("projectionSchema", REQUESTED_SCHEMA.toString()));
assertThat(displayData, hasDisplayItem("avroDataModel", GenericData.get().toString()));
assertThat(displayData, hasDisplayItem("parquet.foo", "foo"));
}
Aggregations