Skip to content

Commit

Permalink
Exclude default Window.allowedLateness display data
Browse files Browse the repository at this point in the history
(cherry picked from commit d9355c2)
  • Loading branch information
swegner committed May 16, 2016
1 parent 057c841 commit 0cb783f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,13 @@ public void populateDisplayData(DisplayData.Builder builder) {
super.populateDisplayData(builder);
builder
.add(DisplayData.item("windowFn", windowFn.getClass()))
.include(windowFn)
.addIfNotNull(DisplayData.item("allowedLateness", allowedLateness));
.include(windowFn);

if (allowedLateness != null) {
builder.addIfNotDefault(DisplayData.item("allowedLateness", allowedLateness),
Duration.millis(BoundedWindow.TIMESTAMP_MAX_VALUE.getMillis()));

}

if (trigger != null && !(trigger instanceof DefaultTrigger)) {
builder.add(DisplayData.item("trigger", trigger.toString()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,13 @@ public void testDisplayDataExcludesUnspecifiedProperties() {
}

@Test
public void testDisplayDataExcludesDefaultTrigger() {
public void testDisplayDataExcludesDefaults() {
Window.Bound<?> window = Window.into(new GlobalWindows())
.triggering(DefaultTrigger.of());
.triggering(DefaultTrigger.of())
.withAllowedLateness(Duration.millis(BoundedWindow.TIMESTAMP_MAX_VALUE.getMillis()));

DisplayData data = DisplayData.from(window);
assertThat(data, not(hasDisplayItem(hasKey("trigger"))));
assertThat(data, not(hasDisplayItem(hasKey("allowedLateness"))));
}
}

0 comments on commit 0cb783f

Please sign in to comment.