use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class WindowTest method testDisplayDataExcludesDefaults.
@Test
public void testDisplayDataExcludesDefaults() {
Window<?> window = Window.into(new GlobalWindows()).triggering(DefaultTrigger.of()).withAllowedLateness(Duration.millis(BoundedWindow.TIMESTAMP_MAX_VALUE.getMillis()));
DisplayData data = DisplayData.from(window);
assertThat(data, not(hasDisplayItem("trigger")));
assertThat(data, not(hasDisplayItem("allowedLateness")));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class WindowTest method testAssignDisplayDataUnchanged.
@Test
public void testAssignDisplayDataUnchanged() {
FixedWindows windowFn = FixedWindows.of(Duration.standardHours(5));
Window<Object> original = Window.into(windowFn);
WindowingStrategy<?, ?> updated = WindowingStrategy.globalDefault().withWindowFn(windowFn);
DisplayData displayData = DisplayData.from(new Window.Assign<>(original, updated));
assertThat(displayData, hasDisplayItem("windowFn", windowFn.getClass()));
assertThat(displayData, includesDisplayDataFor("windowFn", windowFn));
assertThat(displayData, not(hasDisplayItem("trigger")));
assertThat(displayData, not(hasDisplayItem("accumulationMode")));
assertThat(displayData, not(hasDisplayItem("allowedLateness")));
assertThat(displayData, not(hasDisplayItem("closingBehavior")));
assertThat(displayData, not(hasDisplayItem("timestampCombiner")));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class DatastoreV1Test method testDeleteKeyDisplayData.
@Test
public void testDeleteKeyDisplayData() {
DeleteKey deleteKey = DatastoreIO.v1().deleteKey().withProjectId(PROJECT_ID);
DisplayData displayData = DisplayData.from(deleteKey);
assertThat(displayData, hasDisplayItem("projectId", PROJECT_ID));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class DatastoreV1Test method testSourcePrimitiveDisplayData.
@Test
public void testSourcePrimitiveDisplayData() {
DisplayDataEvaluator evaluator = DisplayDataEvaluator.create();
int numSplits = 98;
PTransform<PBegin, PCollection<Entity>> read = DatastoreIO.v1().read().withProjectId(PROJECT_ID).withQuery(Query.newBuilder().build()).withNumQuerySplits(numSplits);
String assertMessage = "DatastoreIO read should include the '%s' in its primitive display data";
Set<DisplayData> displayData = evaluator.displayDataForPrimitiveSourceTransforms(read);
assertThat(String.format(assertMessage, "project id"), displayData, hasItem(hasDisplayItem("projectId", PROJECT_ID)));
assertThat(String.format(assertMessage, "number of query splits"), displayData, hasItem(hasDisplayItem("numQuerySplits", numSplits)));
}
use of org.apache.beam.sdk.transforms.display.DisplayData in project beam by apache.
the class DatastoreV1Test method testReadDisplayData.
@Test
public void testReadDisplayData() {
DatastoreV1.Read read = DatastoreIO.v1().read().withProjectId(PROJECT_ID).withQuery(QUERY).withNamespace(NAMESPACE);
DisplayData displayData = DisplayData.from(read);
assertThat(displayData, hasDisplayItem("projectId", PROJECT_ID));
assertThat(displayData, hasDisplayItem("query", QUERY.toString()));
assertThat(displayData, hasDisplayItem("namespace", NAMESPACE));
}
Aggregations