@Test
  public void testAggWithSafeWindow() throws ParseException {
    SimpleCollector collector = new SimpleCollector();
    aggregator_1.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:01:00,000"), "user1", "open"),
        collector); // create window
    aggregator_1.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:01:01,000"), "user1", "rename"),
        collector);
    aggregator_1.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:01:59,000"), "user1", "delete"),
        collector);

    aggregator_1.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:02:01,000"), "user1", "open"),
        collector);
    aggregator_1.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:01:58,000"), "user2", "open"),
        collector); // inside safe-window

    aggregator_1.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:02:06,000"), "user2", "open"),
        collector); //

    aggregator_1.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:06:02,000"), "user2", "open"),
        collector); //  outside safe-window

    Assert.assertEquals(4, collector.getResult().size());
    Assert.assertEquals("user2", collector.getResult().get(0).f0());
    Assert.assertEquals("user1", collector.getResult().get(1).f0());
  }
  @Test
  public void testAggWithoutSafeWindow() throws ParseException {
    SimpleCollector collector = new SimpleCollector();
    // yyyy-MM-dd HH:mm:ss,SSS
    aggregator_0.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:01:00,000"), "user1", "open"),
        collector);
    aggregator_0.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:01:01,000"), "user1", "open"),
        collector);
    aggregator_0.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:01:02,000"), "user1", "open"),
        collector);

    aggregator_0.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:01:59,000"), "user2", "open"),
        collector);

    aggregator_0.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:02:01,000"), "user1", "open"),
        collector);
    aggregator_0.accumulate(
        event(DateTimeUtil.humanDateToMilliseconds("2015-09-29 01:02:02,000"), "user2", "open"),
        collector);

    Assert.assertEquals(2, collector.getResult().size());
    Assert.assertEquals("user2", collector.getResult().get(0).f0());
    Assert.assertEquals("user1", collector.getResult().get(1).f0());
  }