checkAndNotify(); checkCollectionsEmpty("A"); File testDirA = new File(testDir, "test-dir-A"); testDirA.mkdir(); testDir = touch(testDir); testDirA = touch(testDirA); File testDirAFile1 = touch(new File(testDirA, "A-file1.java")); final File testDirAFile2 = touch(new File(testDirA, "A-file2.java")); File testDirAFile3 = touch(new File(testDirA, "A-file3.java")); final File testDirAFile4 = touch(new File(testDirA, "A-file4.java")); File testDirAFile5 = touch(new File(testDirA, "A-file5.java")); checkAndNotify(); checkCollectionSizes("B", 1, 0, 0, 5, 0, 0); assertTrue("B testDirAFile1", listener.getCreatedFiles().contains(testDirAFile1)); assertTrue("B testDirAFile2", listener.getCreatedFiles().contains(testDirAFile2)); checkAndNotify(); checkCollectionsEmpty("C"); testDirAFile1 = touch(testDirAFile1); testDirA = touch(testDirA); checkAndNotify(); checkCollectionSizes("D", 0, 1, 0, 0, 1, 0); assertTrue("D testDirAFile1", listener.getChangedFiles().contains(testDirAFile1)); testDirAFile3 = touch(testDirAFile3); testDirA = touch(testDirA); checkAndNotify();
checkAndNotify(); checkCollectionsEmpty("A"); File testDirA = new File(testDir, "test-dir-A"); testDirA.mkdir(); testDir = touch(testDir); testDirA = touch(testDirA); File testDirAFile1 = new File(testDirA, "A-file1.java"); final File testDirAFile2 = touch(new File(testDirA, "A-file2.java")); File testDirAFile3 = new File(testDirA, "A-file3.java"); final File testDirAFile4 = touch(new File(testDirA, "A-file4.java")); File testDirAFile5 = new File(testDirA, "A-file5.java"); checkAndNotify(); checkCollectionSizes("B", 1, 0, 0, 2, 0, 0); assertFalse("B testDirAFile1", listener.getCreatedFiles().contains(testDirAFile1)); assertTrue("B testDirAFile2", listener.getCreatedFiles().contains(testDirAFile2)); checkAndNotify(); checkCollectionsEmpty("C"); testDirAFile1 = touch(testDirAFile1); testDirA = touch(testDirA); checkAndNotify(); checkCollectionSizes("D", 0, 1, 0, 1, 0, 0); assertTrue("D testDirAFile1 exists", testDirAFile1.exists()); assertTrue("D testDirAFile1", listener.getCreatedFiles().contains(testDirAFile1)); testDirAFile3 = touch(testDirAFile3); testDirA = touch(testDirA);
checkAndNotify(); checkCollectionsEmpty("A"); File testDirA = new File(testDir, "test-dir-A"); testDirA.mkdir(); testDir = touch(testDir); testDirA = touch(testDirA); final File testDirAFile1 = touch(new File(testDirA, "A-file1.java")); final File testDirAFile2 = touch(new File(testDirA, "A-file2.java")); final File testDirAFile3 = touch(new File(testDirA, "A-file3.java")); final File testDirAFile4 = touch(new File(testDirA, "A-file4.java")); final File testDirAFile5 = touch(new File(testDirA, "A-file5.java")); checkAndNotify(); checkCollectionSizes("B", 1, 0, 0, 5, 0, 0); assertTrue("B testDirAFile1", listener.getCreatedFiles().contains(testDirAFile1)); assertTrue("B testDirAFile2", listener.getCreatedFiles().contains(testDirAFile2)); checkAndNotify(); checkCollectionsEmpty("C"); testDirA = touch(testDirA); checkAndNotify(); checkCollectionSizes("D", 0, 1, 0, 0, 0, 1); assertFalse("D testDirAFile1 exists", testDirAFile1.exists()); assertTrue("D testDirAFile1", listener.getDeletedFiles().contains(testDirAFile1)); testDirA = touch(testDirA); checkAndNotify(); checkCollectionSizes("E", 0, 1, 0, 0, 0, 1);
checkAndNotify(); checkCollectionsEmpty("A"); final File testDirA = new File(testDir, "test-dir-A"); final File testDirB = new File(testDir, "test-dir-B"); testDirB.mkdir(); testDirC.mkdir(); final File testDirAFile1 = touch(new File(testDirA, "A-file1.java")); final File testDirAFile2 = touch(new File(testDirA, "A-file2.txt")); // filter should ignore this final File testDirAFile3 = touch(new File(testDirA, "A-file3.java")); File testDirAFile4 = touch(new File(testDirA, "A-file4.java")); final File testDirBFile1 = touch(new File(testDirB, "B-file1.java")); checkAndNotify(); checkCollectionSizes("B", 3, 0, 0, 4, 0, 0); assertTrue("B testDirA", listener.getCreatedDirectories().contains(testDirA)); assertTrue("B testDirB", listener.getCreatedDirectories().contains(testDirB)); checkAndNotify(); checkCollectionsEmpty("C"); testDirAFile4 = touch(testDirAFile4); FileUtils.deleteDirectory(testDirB); checkAndNotify(); checkCollectionSizes("D", 0, 0, 1, 0, 1, 1); assertTrue("D testDirB", listener.getDeletedDirectories().contains(testDirB)); assertTrue("D testDirAFile4", listener.getChangedFiles().contains(testDirAFile4)); checkAndNotify();
createObserver(testDirA, nameFilter); checkAndNotify(); checkCollectionsEmpty("A"); assertFalse("A testDirAFile1 exists", testDirAFile1.exists()); testDirAFile1 = touch(testDirAFile1); File testDirAFile2 = touch(new File(testDirA, "A-file2.txt")); /* filter should ignore */ File testDirAFile3 = touch(new File(testDirA, "A-file3.java")); /* filter should ignore */ assertTrue("B testDirAFile1 exists", testDirAFile1.exists()); assertTrue("B testDirAFile2 exists", testDirAFile2.exists()); assertTrue("B testDirAFile3 exists", testDirAFile3.exists()); checkAndNotify(); checkCollectionSizes("C", 0, 0, 0, 1, 0, 0); assertTrue("C created", listener.getCreatedFiles().contains(testDirAFile1)); assertFalse("C created", listener.getCreatedFiles().contains(testDirAFile2)); testDirAFile1 = touch(testDirAFile1); testDirAFile2 = touch(testDirAFile2); testDirAFile3 = touch(testDirAFile3); checkAndNotify(); checkCollectionSizes("D", 0, 0, 0, 0, 1, 0); assertTrue("D changed", listener.getChangedFiles().contains(testDirAFile1)); assertFalse("D changed", listener.getChangedFiles().contains(testDirAFile2)); assertFalse("E testDirAFile2 exists", testDirAFile2.exists()); assertFalse("E testDirAFile3 exists", testDirAFile3.exists()); checkAndNotify(); checkCollectionSizes("E", 0, 0, 0, 0, 0, 1); assertTrue("E deleted", listener.getDeletedFiles().contains(testDirAFile1));