コード例 #1
0
  @Test
  public void testMultipleDirCreation() {
    List<IEvent> events = new ArrayList<>();

    CreateEvent c1 =
        new CreateEvent(
            Config.DEFAULT.getRootTestDir().resolve(Paths.get("myDir1")),
            "myDir1",
            null,
            System.currentTimeMillis());
    CreateEvent c2 =
        new CreateEvent(
            Config.DEFAULT.getRootTestDir().resolve(Paths.get("myDir2")),
            "myDir2",
            null,
            System.currentTimeMillis());
    CreateEvent c3 =
        new CreateEvent(
            Config.DEFAULT.getRootTestDir().resolve(Paths.get("myDir3")),
            "myDir3",
            null,
            System.currentTimeMillis());
    CreateEvent c4 =
        new CreateEvent(
            Config.DEFAULT.getRootTestDir().resolve(Paths.get("myDir4")),
            "myDir4",
            null,
            System.currentTimeMillis());

    events.add(c1);
    events.add(c2);
    events.add(c3);
    events.add(c4);

    List<IEvent> results = moveAggregator.aggregate(events);
    assertEquals("Results do not contain all dir creation events", 4, results.size());
  }
コード例 #2
0
  @Before
  public void before() {
    forceMoveEventList = new ArrayList<>();
    forceNoMoveEventList = new ArrayList<>();

    firstTimestamp = System.currentTimeMillis();
    // this must be greater than HistoryMoveAggregator#EVENT_TIMESTAMP_TOLERANCE
    secondTimestamp = firstTimestamp + 1100;

    DeleteEvent deleteEvent = new DeleteEvent(oldPath, fileName, fileHash, firstTimestamp);
    CreateEvent createEvent = new CreateEvent(newPath, fileName, fileHash, secondTimestamp);

    forceMoveEventList.add(deleteEvent);
    forceMoveEventList.add(createEvent);

    // order the events the other way
    CreateEvent createEvent2 = new CreateEvent(newPath, fileName, fileHash, firstTimestamp);
    DeleteEvent deleteEvent2 = new DeleteEvent(oldPath, fileName, fileHash, secondTimestamp);

    forceNoMoveEventList.add(deleteEvent2);
    forceNoMoveEventList.add(createEvent2);
  }