Search in sources :

Example 1 with StructuralChange

use of com.intellij.history.core.changes.StructuralChange in project intellij-community by JetBrains.

the class FileListeningTest method testIgnoringFilesRecursively.

public void testIgnoringFilesRecursively() throws Exception {
    addExcludedDir(myRoot.getPath() + "/dir/subdir");
    addContentRoot(createModule("foo"), myRoot.getPath() + "/dir/subdir/subsubdir1");
    String dir = createDirectoryExternally("dir");
    String dir1_file = createFileExternally("dir/f.txt");
    createFileExternally("dir/f.class");
    createFileExternally("dir/subdir/f.txt");
    String subsubdir1 = createDirectoryExternally("dir/subdir/subsubdir1");
    String subsubdir1_file = createFileExternally("dir/subdir/subsubdir1/f.txt");
    createDirectoryExternally("dir/subdir/subsubdir2");
    createFileExternally("dir/subdir/subsubdir2/f.txt");
    myRoot.refresh(false, true);
    List<Change> changes = getVcs().getChangeListInTests().getChangesInTests().get(0).getChanges();
    List<String> actual = new SmartList<>();
    for (Change each : changes) {
        actual.add(((StructuralChange) each).getPath());
    }
    List<String> expected = new ArrayList<>(Arrays.asList(dir, subsubdir1, dir1_file, subsubdir1_file));
    Collections.sort(actual);
    Collections.sort(expected);
    assertOrderedEquals(actual, expected);
    // ignored folders should not be loaded in VFS
    assertEquals("dir\n" + " f.class\n" + " f.txt\n" + " subdir\n" + "  subsubdir1\n" + "   f.txt\n", buildDBFileStructure(myRoot, 0, new StringBuilder()).toString());
}
Also used : ArrayList(java.util.ArrayList) DeleteChange(com.intellij.history.core.changes.DeleteChange) StructuralChange(com.intellij.history.core.changes.StructuralChange) Change(com.intellij.history.core.changes.Change) SmartList(com.intellij.util.SmartList)

Aggregations

Change (com.intellij.history.core.changes.Change)1 DeleteChange (com.intellij.history.core.changes.DeleteChange)1 StructuralChange (com.intellij.history.core.changes.StructuralChange)1 SmartList (com.intellij.util.SmartList)1 ArrayList (java.util.ArrayList)1