WindowUtils { public static long msToAppWindowCount(OperatorContext context, long millis) { Preconditions.checkArgument(millis > 0); long appWindowDurationMS = getAppWindowDurationMs(context); long appWindowCount = millis / appWindowDurationMS; if (millis % appWindowDurationMS != 0) { appWindowCount++; } return appWindowCount; }  static long getAppWindowDurationMs(OperatorContext context); static long msToAppWindowCount(OperatorContext context, long millis); static long tpsToTpw(OperatorContext context, long tuplesPerSecond);  }
@Test public void msToAppWindowCountRoundingTest() { OperatorContext context = createOperatorContext(500, 10); long appWindowCount = WindowUtils.msToAppWindowCount(context, 10001L); Assert.assertEquals(3, appWindowCount); }
@Test public void msToAppWindowCountSimpleTest() { OperatorContext context = createOperatorContext(500, 10); long appWindowCount = WindowUtils.msToAppWindowCount(context, 10000L); Assert.assertEquals(2, appWindowCount); appWindowCount = WindowUtils.msToAppWindowCount(context, 10001L); Assert.assertEquals(3, appWindowCount); }