Search in sources :

Example 16 with DisplayDataEvaluator

use of org.apache.beam.sdk.transforms.display.DisplayDataEvaluator in project beam by apache.

the class PubsubIOTest method testPrimitiveReadDisplayData.

@Test
public void testPrimitiveReadDisplayData() {
    DisplayDataEvaluator evaluator = DisplayDataEvaluator.create();
    Set<DisplayData> displayData;
    PubsubIO.Read<String> baseRead = PubsubIO.readStrings();
    // Reading from a subscription.
    PubsubIO.Read<String> read = baseRead.fromSubscription("projects/project/subscriptions/subscription");
    displayData = evaluator.displayDataForPrimitiveSourceTransforms(read);
    assertThat("PubsubIO.Read should include the subscription in its primitive display data", displayData, hasItem(hasDisplayItem("subscription")));
    // Reading from a topic.
    read = baseRead.fromTopic("projects/project/topics/topic");
    displayData = evaluator.displayDataForPrimitiveSourceTransforms(read);
    assertThat("PubsubIO.Read should include the topic in its primitive display data", displayData, hasItem(hasDisplayItem("topic")));
}
Also used : ByteString(com.google.protobuf.ByteString) DisplayDataEvaluator(org.apache.beam.sdk.transforms.display.DisplayDataEvaluator) DisplayData(org.apache.beam.sdk.transforms.display.DisplayData) Test(org.junit.Test)

Aggregations

DisplayData (org.apache.beam.sdk.transforms.display.DisplayData)16 DisplayDataEvaluator (org.apache.beam.sdk.transforms.display.DisplayDataEvaluator)16 Test (org.junit.Test)15 PCollection (org.apache.beam.sdk.values.PCollection)7 Category (org.junit.experimental.categories.Category)5 ByteString (com.google.protobuf.ByteString)2 RowFilter (com.google.bigtable.v2.RowFilter)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 GenericRecord (org.apache.avro.generic.GenericRecord)1 PipelineOptions (org.apache.beam.sdk.options.PipelineOptions)1 StreamingOptions (org.apache.beam.sdk.options.StreamingOptions)1 PBegin (org.apache.beam.sdk.values.PBegin)1