*
* @throws Exception
*/
@Test
public void testNoUpdateEventWithRemoveEvent() throws Exception {
IFolder folder = fFactory.createFolder(null, null, "Folder");
fFactory.createFolder(null, folder, "Child folder #1");
fFactory.createFolder(null, folder, "Child folder #2");
fFactory.createFolder(null, folder, "Child folder #3");
final IFolder savedFolder = DynamicDAO.save(folder);
final IFolder savedChildFolder1 = savedFolder.getFolders().get(0);
final IFolder savedChildFolder2 = savedFolder.getFolders().get(1);
final IFolder savedChildFolder3 = savedFolder.getFolders().get(2);
List<IFolder> foldersToRemove = new ArrayList<IFolder>();
foldersToRemove.add(savedChildFolder1);
foldersToRemove.add(savedChildFolder2);
final boolean[] folderDeletedCalled = new boolean[1];
final boolean[] folderUpdatedCalled = new boolean[1];
FolderListener listener = new FolderAdapter() {
@Override
public void entitiesAdded(Set<FolderEvent> events) {
fail("Unexpected folder added event");
}
@Override
public void entitiesDeleted(Set<FolderEvent> events) {
assertEquals(2, events.size());
for (FolderEvent event : events) {
IFolder folder = event.getEntity();
if (!folder.equals(savedChildFolder1) && (!folder.equals(savedChildFolder2)))
fail("No delete event expected for folder: " + folder.getId());
folderDeletedCalled[0] = true;
}
}