history.storeNotification(new NamespaceNotification("/a/b",
EventType.FILE_ADDED.getByteValue(), 10));
history.storeNotification(new NamespaceNotification("/a/c",
EventType.FILE_ADDED.getByteValue(), 11));
historyNotifications = new LinkedList<NamespaceNotification>();
history.addNotificationsToQueue(new NamespaceEvent("/a",
EventType.FILE_ADDED.getByteValue()), 10, historyNotifications);
Assert.assertEquals(1, historyNotifications.size());
Assert.assertEquals(11, historyNotifications.peek().txId);
Assert.assertEquals("/a/c", historyNotifications.peek().path);
// Step 2 - test with FILE_CLOSED
history.storeNotification(new NamespaceNotification("/a/d",
EventType.FILE_CLOSED.getByteValue(), 12));
history.storeNotification(new NamespaceNotification("/a/e",
EventType.FILE_CLOSED.getByteValue(), 13));
historyNotifications = new LinkedList<NamespaceNotification>();
history.addNotificationsToQueue(new NamespaceEvent("/a",
EventType.FILE_CLOSED.getByteValue()), 12, historyNotifications);
Assert.assertEquals(1, historyNotifications.size());
Assert.assertEquals(13, historyNotifications.peek().txId);
Assert.assertEquals("/a/e", historyNotifications.peek().path);
// test the sub directories
historyNotifications = new LinkedList<NamespaceNotification>();
history.addNotificationsToQueue(new NamespaceEvent("/",
EventType.FILE_ADDED.getByteValue()), 10, historyNotifications);
Assert.assertEquals(1, historyNotifications.size());
history.addNotificationsToQueue(new NamespaceEvent("/",
EventType.FILE_CLOSED.getByteValue()), 10, historyNotifications);
Assert.assertEquals(3, historyNotifications.size());
core.shutdown();
}