mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
DirectoryIndex: store info for excluded and ignored directories
This commit is contained in:
@@ -188,7 +188,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
}
|
||||
|
||||
public void testDirInfos() throws IOException {
|
||||
checkInfoNull(myRootVFile);
|
||||
checkNotInProject(myRootVFile);
|
||||
|
||||
// beware: files in directory index
|
||||
checkInfo(myFileLibSrc, null, false, true, "", null, myModule);
|
||||
@@ -206,21 +206,21 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
checkInfo(myLibSrcDir, myModule, false, true, "", null, myModule2, myModule3);
|
||||
checkInfo(myLibClsDir, myModule, true, false, "", null, myModule2, myModule3);
|
||||
|
||||
assertEquals(myLibSrcDir, checkInfoNotNull(myLibSrcDir).getSourceRoot());
|
||||
assertEquals(myLibSrcDir, checkInProject(myLibSrcDir).getSourceRoot());
|
||||
|
||||
checkInfo(myModule2Dir, myModule2, false, false, null, null);
|
||||
checkInfo(mySrcDir2, myModule2, false, false, "", JavaSourceRootType.SOURCE, myModule2, myModule3);
|
||||
checkInfoNull(myCvsDir);
|
||||
checkInfoNull(myExcludeDir);
|
||||
checkInfoNull(myExcludedLibClsDir);
|
||||
checkInfoNull(myExcludedLibSrcDir);
|
||||
checkNotInProject(myCvsDir);
|
||||
checkExcluded(myExcludeDir, myModule2);
|
||||
checkExcluded(myExcludedLibClsDir, myModule);
|
||||
checkExcluded(myExcludedLibSrcDir, myModule);
|
||||
|
||||
assertEquals(myModule1Dir, checkInfoNotNull(myLibClsDir).getContentRoot());
|
||||
assertEquals(myModule1Dir, checkInProject(myLibClsDir).getContentRoot());
|
||||
|
||||
checkInfo(myModule3Dir, myModule3, false, false, null, null);
|
||||
|
||||
VirtualFile cvs = myPack1Dir.createChildDirectory(this, "CVS");
|
||||
checkInfoNull(cvs);
|
||||
checkNotInProject(cvs);
|
||||
assertNull(ProjectRootManager.getInstance(myProject).getFileIndex().getPackageNameByDirectory(cvs));
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
VirtualFile newDir = myModule1Dir.createChildDirectory(this, "newDir");
|
||||
|
||||
myIndex.checkConsistency();
|
||||
checkInfoNotNull(newDir);
|
||||
checkInProject(newDir);
|
||||
|
||||
final FileTypeManagerEx fileTypeManager = (FileTypeManagerEx)FileTypeManager.getInstance();
|
||||
final String list = fileTypeManager.getIgnoredFilesList();
|
||||
@@ -345,7 +345,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
}
|
||||
});
|
||||
myIndex.checkConsistency();
|
||||
checkInfoNull(newDir);
|
||||
checkNotInProject(newDir);
|
||||
}
|
||||
finally {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@@ -354,7 +354,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
fileTypeManager.setIgnoredFilesList(list);
|
||||
}
|
||||
});
|
||||
checkInfoNotNull(newDir);
|
||||
checkInProject(newDir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,16 +379,18 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
public void testModuleUnderIgnoredDir() throws IOException {
|
||||
final VirtualFile ignored = myRootVFile.createChildDirectory(this, "RCS");
|
||||
assertTrue(FileTypeManager.getInstance().isFileIgnored(ignored));
|
||||
assertTrue(ProjectRootManager.getInstance(myProject).getFileIndex().isIgnored(ignored));
|
||||
final VirtualFile module4 = ignored.createChildDirectory(this, "module4");
|
||||
assertFalse(FileTypeManager.getInstance().isFileIgnored(module4));
|
||||
|
||||
assertTrue(ProjectRootManager.getInstance(myProject).getFileIndex().isIgnored(module4));
|
||||
|
||||
new WriteCommandAction.Simple(getProject()) {
|
||||
@Override
|
||||
protected void run() throws Throwable {
|
||||
ModuleManager moduleManager = ModuleManager.getInstance(myProject);
|
||||
Module module = moduleManager.newModule(myRootVFile.getPath() + "/newModule.iml", StdModuleTypes.JAVA.getId());
|
||||
PsiTestUtil.addContentRoot(module, module4);
|
||||
checkInfoNull(ignored);
|
||||
checkNotInProject(ignored);
|
||||
checkInfo(module4, module, false, false, null, null);
|
||||
}
|
||||
}.execute().throwException();
|
||||
@@ -436,20 +438,20 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
VirtualFile output1 = myModule1Dir.createChildDirectory(this, "output1");
|
||||
VirtualFile output2 = myModule1Dir.createChildDirectory(this, "output2");
|
||||
|
||||
checkInfoNotNull(output1);
|
||||
checkInfoNotNull(output2);
|
||||
checkInProject(output1);
|
||||
checkInProject(output2);
|
||||
|
||||
getCompilerProjectExtension().setCompilerOutputUrl(output1.getUrl());
|
||||
fireRootsChanged();
|
||||
|
||||
checkInfoNull(output1);
|
||||
checkInfoNotNull(output2);
|
||||
checkExcluded(output1, myModule);
|
||||
checkInProject(output2);
|
||||
|
||||
getCompilerProjectExtension().setCompilerOutputUrl(output2.getUrl());
|
||||
fireRootsChanged();
|
||||
|
||||
checkInfoNotNull(output1);
|
||||
checkInfoNull(output2);
|
||||
checkInProject(output1);
|
||||
checkExcluded(output2, myModule);
|
||||
}
|
||||
|
||||
private void fireRootsChanged() {
|
||||
@@ -460,12 +462,12 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
ModuleRootModificationUtil.addModuleLibrary(myModule, "someLib", Collections.<String>emptyList(), Arrays.asList(mySrcDir1.getUrl()));
|
||||
|
||||
checkInfo(mySrcDir1, myModule, false, true, "", JavaSourceRootType.SOURCE, myModule, myModule);
|
||||
OrderEntry[] entries = myIndex.getInfoForDirectory(mySrcDir1).getOrderEntries();
|
||||
OrderEntry[] entries = myIndex.getInfoForFile(mySrcDir1).getOrderEntries();
|
||||
assertInstanceOf(entries[0], LibraryOrderEntry.class);
|
||||
assertInstanceOf(entries[1], ModuleSourceOrderEntry.class);
|
||||
|
||||
checkInfo(myTestSrc1, myModule, false, true, "testSrc", JavaSourceRootType.TEST_SOURCE, myModule, myModule);
|
||||
entries = myIndex.getInfoForDirectory(myTestSrc1).getOrderEntries();
|
||||
entries = myIndex.getInfoForFile(myTestSrc1).getOrderEntries();
|
||||
assertInstanceOf(entries[0], LibraryOrderEntry.class);
|
||||
assertInstanceOf(entries[1], ModuleSourceOrderEntry.class);
|
||||
}
|
||||
@@ -473,7 +475,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
public void testModuleSourceAsLibraryClasses() throws Exception {
|
||||
ModuleRootModificationUtil.addModuleLibrary(myModule, "someLib", Arrays.asList(mySrcDir1.getUrl()), Collections.<String>emptyList());
|
||||
checkInfo(mySrcDir1, myModule, true, false, "", JavaSourceRootType.SOURCE, myModule);
|
||||
assertInstanceOf(assertOneElement(checkInfoNotNull(mySrcDir1).getOrderEntries()), ModuleSourceOrderEntry.class);
|
||||
assertInstanceOf(assertOneElement(checkInProject(mySrcDir1).getOrderEntries()), ModuleSourceOrderEntry.class);
|
||||
}
|
||||
|
||||
public void testModulesWithSameSourceContentRoot() {
|
||||
@@ -487,7 +489,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
checkInfo(myResDir, myModule, false, false, "", JavaResourceRootType.RESOURCE, myModule);
|
||||
|
||||
checkInfo(mySrcDir2, myModule2, false, false, "", JavaSourceRootType.SOURCE, myModule2, myModule3);
|
||||
assertEquals(myModule2Dir, myIndex.getInfoForDirectory(mySrcDir2).getContentRoot());
|
||||
assertEquals(myModule2Dir, myIndex.getInfoForFile(mySrcDir2).getContentRoot());
|
||||
}
|
||||
|
||||
public void testModuleWithSameSourceRoot() {
|
||||
@@ -503,7 +505,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
|
||||
public void testSameSourceAndOutput() {
|
||||
PsiTestUtil.setCompilerOutputPath(myModule, mySrcDir1.getUrl(), false);
|
||||
checkInfoNull(mySrcDir1);
|
||||
checkExcluded(mySrcDir1, myModule);
|
||||
}
|
||||
|
||||
public void testExcludedDirShouldBeExcludedRightAfterItsCreation() throws Exception {
|
||||
@@ -512,10 +514,10 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
VirtualFile module2Output = myModule1Dir.createChildDirectory(this, "module2Output");
|
||||
VirtualFile module2TestOutput = myModule2Dir.createChildDirectory(this, "module2TestOutput");
|
||||
|
||||
checkInfoNotNull(excluded);
|
||||
checkInfoNotNull(projectOutput);
|
||||
checkInfoNotNull(module2Output);
|
||||
checkInfoNotNull(module2TestOutput);
|
||||
checkInProject(excluded);
|
||||
checkInProject(projectOutput);
|
||||
checkInProject(module2Output);
|
||||
checkInProject(module2TestOutput);
|
||||
|
||||
getCompilerProjectExtension().setCompilerOutputUrl(projectOutput.getUrl());
|
||||
|
||||
@@ -524,10 +526,10 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
PsiTestUtil.setCompilerOutputPath(myModule2, module2TestOutput.getUrl(), true);
|
||||
PsiTestUtil.setExcludeCompileOutput(myModule2, true);
|
||||
|
||||
checkInfoNull(excluded);
|
||||
checkInfoNull(projectOutput);
|
||||
checkInfoNull(module2Output);
|
||||
checkInfoNull(module2TestOutput);
|
||||
checkExcluded(excluded, myModule);
|
||||
checkExcluded(projectOutput, myModule);
|
||||
checkExcluded(module2Output, myModule);
|
||||
checkExcluded(module2TestOutput, myModule2);
|
||||
|
||||
assertFalse(myIndex.isProjectExcludeRoot(excluded));
|
||||
assertFalse(myIndex.isProjectExcludeRoot(projectOutput));
|
||||
@@ -544,10 +546,10 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
@Override
|
||||
public void fileCreated(@NotNull VirtualFileEvent e) {
|
||||
VirtualFile file = e.getFile();
|
||||
checkInfoNull(file);
|
||||
created.add(file);
|
||||
|
||||
String fileName = e.getFileName();
|
||||
checkExcluded(file, fileName.contains("module2TestOutput") ? myModule2 : myModule);
|
||||
created.add(file);
|
||||
|
||||
if (fileName.equals("projectOutput")) {
|
||||
assertFalse(myIndex.isProjectExcludeRoot(file));
|
||||
}
|
||||
@@ -573,10 +575,10 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
module2TestOutput = myModule2Dir.createChildDirectory(this, module2TestOutput.getName());
|
||||
assertFalse(myIndex.isProjectExcludeRoot(module2TestOutput));
|
||||
|
||||
checkInfoNull(excluded);
|
||||
checkInfoNull(projectOutput);
|
||||
checkInfoNull(module2Output);
|
||||
checkInfoNull(module2TestOutput);
|
||||
checkExcluded(excluded, myModule);
|
||||
checkExcluded(projectOutput, myModule);
|
||||
checkExcluded(module2Output, myModule);
|
||||
checkExcluded(module2TestOutput, myModule2);
|
||||
|
||||
assertEquals(created.toString(), 4, created.size());
|
||||
|
||||
@@ -607,9 +609,9 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
assertEquals("dir", e.getFileName());
|
||||
|
||||
VirtualFile file = e.getFile();
|
||||
checkInfoNotNull(file);
|
||||
checkInfoNull(file.findFileByRelativePath("excluded"));
|
||||
checkInfoNull(file.findFileByRelativePath("excluded/foo"));
|
||||
checkInProject(file);
|
||||
checkExcluded(file.findFileByRelativePath("excluded"), myModule);
|
||||
checkExcluded(file.findFileByRelativePath("excluded/foo"), myModule);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -638,8 +640,8 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
});
|
||||
|
||||
|
||||
checkInfoNull(LocalFileSystem.getInstance().findFileByIoFile(f.getParentFile().getParentFile()));
|
||||
checkInfoNotNull(LocalFileSystem.getInstance().findFileByIoFile(f));
|
||||
checkExcluded(LocalFileSystem.getInstance().findFileByIoFile(f.getParentFile().getParentFile()), myModule);
|
||||
checkInProject(LocalFileSystem.getInstance().findFileByIoFile(f));
|
||||
}
|
||||
|
||||
public void testLibraryDirInContent() throws Exception {
|
||||
@@ -661,7 +663,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
checkInfo(myLibSrcDir, myModule, true, true, "", null, myModule, myModule3);
|
||||
|
||||
checkInfo(myResDir, myModule, true, false, "", JavaResourceRootType.RESOURCE, myModule);
|
||||
assertInstanceOf(assertOneElement(checkInfoNotNull(myResDir).getOrderEntries()), ModuleSourceOrderEntry.class);
|
||||
assertInstanceOf(assertOneElement(checkInProject(myResDir).getOrderEntries()), ModuleSourceOrderEntry.class);
|
||||
|
||||
checkInfo(myExcludedLibSrcDir, null, true, false, "lib.src.exc", null, myModule3, myModule);
|
||||
checkInfo(myExcludedLibClsDir, null, true, false, "lib.cls.exc", null, myModule3);
|
||||
@@ -682,6 +684,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
assertTrue(fileIndex.isIgnored(myModule1OutputDir));
|
||||
assertFalse(fileIndex.isIgnored(myOutputDir.getParent()));
|
||||
assertTrue(myIndex.isProjectExcludeRoot(myOutputDir));
|
||||
checkExcluded(myOutputDir, null);
|
||||
assertFalse(myIndex.isProjectExcludeRoot(myModule1OutputDir));
|
||||
String moduleOutputUrl = myModule1OutputDir.getUrl();
|
||||
|
||||
@@ -692,7 +695,9 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
myModule1OutputDir = myOutputDir.createChildDirectory(this, "module1");
|
||||
|
||||
assertTrue(myIndex.isProjectExcludeRoot(myOutputDir));
|
||||
checkExcluded(myOutputDir, null);
|
||||
assertTrue(myIndex.isProjectExcludeRoot(myModule1OutputDir));
|
||||
checkExcluded(myModule1OutputDir, null);
|
||||
assertTrue(fileIndex.isIgnored(myModule1OutputDir));
|
||||
|
||||
PsiTestUtil.setCompilerOutputPath(myModule, moduleOutputUrl, true);
|
||||
@@ -703,6 +708,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
|
||||
// now no module inherits project output dir, but it still should be project-excluded
|
||||
assertTrue(myIndex.isProjectExcludeRoot(myOutputDir));
|
||||
checkExcluded(myOutputDir, null);
|
||||
|
||||
// project output inside module content shouldn't be projectExcludeRoot
|
||||
VirtualFile projectOutputUnderContent = myModule1Dir.createChildDirectory(this, "projectOutputUnderContent");
|
||||
@@ -725,7 +731,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
VirtualFile fileSourceRoot = myRootVFile.createChildData(this, "fileSourceRoot.txt");
|
||||
VirtualFile fileTestSourceRoot = myRootVFile.createChildData(this, "fileTestSourceRoot.txt");
|
||||
|
||||
checkInfoNull(fileRoot);
|
||||
checkNotInProject(fileRoot);
|
||||
assertFalse(fileIndex.isInContent(fileRoot));
|
||||
assertIteratedContent(fileIndex, null, Arrays.asList(fileRoot, fileSourceRoot, fileTestSourceRoot));
|
||||
|
||||
@@ -758,7 +764,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
|
||||
// removing file content root
|
||||
PsiTestUtil.removeContentEntry(myModule, contentEntry);
|
||||
checkInfoNull(fileRoot);
|
||||
checkNotInProject(fileRoot);
|
||||
assertFalse(fileIndex.isInContent(fileRoot));
|
||||
assertFalse(fileIndex.isInSource(fileRoot));
|
||||
assertIteratedContent(fileIndex, Arrays.asList(fileSourceRoot, fileTestSourceRoot), Arrays.asList(fileRoot));
|
||||
@@ -785,7 +791,6 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
VirtualFile fileSourceRoot = myModule1Dir.createChildData(this, "fileSourceRoot.txt");
|
||||
assertTrue(fileIndex.isInContent(fileSourceRoot));
|
||||
assertFalse(fileIndex.isInSource(fileSourceRoot));
|
||||
checkInfoNull(fileSourceRoot);
|
||||
|
||||
PsiTestUtil.addSourceRoot(myModule, fileSourceRoot);
|
||||
assertTrue(fileIndex.isInContent(fileSourceRoot));
|
||||
@@ -796,7 +801,6 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
PsiTestUtil.removeSourceRoot(myModule, fileSourceRoot);
|
||||
assertTrue(fileIndex.isInContent(fileSourceRoot));
|
||||
assertFalse(fileIndex.isInSource(fileSourceRoot));
|
||||
checkInfoNull(fileSourceRoot);
|
||||
}
|
||||
|
||||
public void testFileModuleExcludeRootUnderDirectoryRoot() throws IOException {
|
||||
@@ -805,20 +809,18 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
VirtualFile fileExcludeRoot = mySrcDir1.createChildData(this, "fileExcludeRoot.txt");
|
||||
assertTrue(fileIndex.isInContent(fileExcludeRoot));
|
||||
assertTrue(fileIndex.isInSource(fileExcludeRoot));
|
||||
checkInfoNull(fileExcludeRoot);
|
||||
assertIteratedContent(fileIndex, Arrays.asList(fileExcludeRoot), null);
|
||||
|
||||
PsiTestUtil.addExcludedRoot(myModule, fileExcludeRoot);
|
||||
assertFalse(fileIndex.isInContent(fileExcludeRoot));
|
||||
assertFalse(fileIndex.isInSource(fileExcludeRoot));
|
||||
checkInfoNull(fileExcludeRoot);
|
||||
checkExcluded(fileExcludeRoot, myModule);
|
||||
assertIteratedContent(fileIndex, null, Arrays.asList(fileExcludeRoot));
|
||||
|
||||
// removing file exclude root
|
||||
PsiTestUtil.removeExcludedRoot(myModule, fileExcludeRoot);
|
||||
assertTrue(fileIndex.isInContent(fileExcludeRoot));
|
||||
assertTrue(fileIndex.isInSource(fileExcludeRoot));
|
||||
checkInfoNull(fileExcludeRoot);
|
||||
assertIteratedContent(fileIndex, Arrays.asList(fileExcludeRoot), null);
|
||||
}
|
||||
|
||||
@@ -833,7 +835,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
|
||||
PsiTestUtil.addExcludedRoot(myModule, fileRoot);
|
||||
assertFalse(fileIndex.isInContent(fileRoot));
|
||||
checkInfoNull(fileRoot);
|
||||
checkExcluded(fileRoot, myModule);
|
||||
assertIteratedContent(fileIndex, null, Arrays.asList(fileRoot));
|
||||
|
||||
// removing file exclude root
|
||||
@@ -860,7 +862,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
VirtualFile temp = myRootVFile.createChildDirectory(this, "temp");
|
||||
|
||||
VirtualFile fileSourceRoot = myRootVFile.createChildData(this, "fileSourceRoot.txt");
|
||||
checkInfoNull(fileSourceRoot);
|
||||
checkNotInProject(fileSourceRoot);
|
||||
|
||||
PsiTestUtil.addContentRoot(myModule, fileSourceRoot);
|
||||
PsiTestUtil.addSourceRoot(myModule, fileSourceRoot);
|
||||
@@ -870,7 +872,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
|
||||
// delete and recreate
|
||||
fileSourceRoot.delete(this);
|
||||
checkInfoNull(fileSourceRoot);
|
||||
checkNotInProject(fileSourceRoot);
|
||||
assertFalse(fileIndex.isInContent(fileSourceRoot));
|
||||
assertFalse(fileIndex.isInSource(fileSourceRoot));
|
||||
fileSourceRoot = myRootVFile.createChildData(this, "fileSourceRoot.txt");
|
||||
@@ -880,11 +882,11 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
|
||||
// delete and move from another dir
|
||||
fileSourceRoot.delete(this);
|
||||
checkInfoNull(fileSourceRoot);
|
||||
checkNotInProject(fileSourceRoot);
|
||||
assertFalse(fileIndex.isInContent(fileSourceRoot));
|
||||
assertFalse(fileIndex.isInSource(fileSourceRoot));
|
||||
fileSourceRoot = temp.createChildData(this, "fileSourceRoot.txt");
|
||||
checkInfoNull(fileSourceRoot);
|
||||
checkNotInProject(fileSourceRoot);
|
||||
fileSourceRoot.move(this, myRootVFile);
|
||||
checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
|
||||
assertTrue(fileIndex.isInContent(fileSourceRoot));
|
||||
@@ -892,11 +894,11 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
|
||||
// delete and copy from another dir
|
||||
fileSourceRoot.delete(this);
|
||||
checkInfoNull(fileSourceRoot);
|
||||
checkNotInProject(fileSourceRoot);
|
||||
assertFalse(fileIndex.isInContent(fileSourceRoot));
|
||||
assertFalse(fileIndex.isInSource(fileSourceRoot));
|
||||
fileSourceRoot = temp.createChildData(this, "fileSourceRoot.txt");
|
||||
checkInfoNull(fileSourceRoot);
|
||||
checkNotInProject(fileSourceRoot);
|
||||
fileSourceRoot = fileSourceRoot.copy(this, myRootVFile, "fileSourceRoot.txt");
|
||||
checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
|
||||
assertTrue(fileIndex.isInContent(fileSourceRoot));
|
||||
@@ -904,11 +906,11 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
|
||||
// delete and rename from another file
|
||||
fileSourceRoot.delete(this);
|
||||
checkInfoNull(fileSourceRoot);
|
||||
checkNotInProject(fileSourceRoot);
|
||||
assertFalse(fileIndex.isInContent(fileSourceRoot));
|
||||
assertFalse(fileIndex.isInSource(fileSourceRoot));
|
||||
fileSourceRoot = myRootVFile.createChildData(this, "temp_file.txt");
|
||||
checkInfoNull(fileSourceRoot);
|
||||
checkNotInProject(fileSourceRoot);
|
||||
fileSourceRoot.rename(this, "fileSourceRoot.txt");
|
||||
checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
|
||||
assertTrue(fileIndex.isInContent(fileSourceRoot));
|
||||
@@ -922,7 +924,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
@Nullable String packageName,
|
||||
@Nullable final JpsModuleSourceRootType<?> moduleSourceRootType,
|
||||
Module... modulesOfOrderEntries) {
|
||||
DirectoryInfo info = checkInfoNotNull(dir);
|
||||
DirectoryInfo info = checkInProject(dir);
|
||||
assertEquals(module, info.getModule());
|
||||
if (moduleSourceRootType != null) {
|
||||
assertTrue("isInModuleSource", info.isInModuleSource());
|
||||
@@ -946,12 +948,21 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkInfoNull(VirtualFile dir) {
|
||||
assertNull(myIndex.getInfoForDirectory(dir));
|
||||
private void checkNotInProject(VirtualFile dir) {
|
||||
DirectoryInfo info = myIndex.getInfoForFile(dir);
|
||||
assertFalse(info.toString(), info.isInProject());
|
||||
assertFalse(info.toString(), info.isExcluded());
|
||||
}
|
||||
private DirectoryInfo checkInfoNotNull(VirtualFile output2) {
|
||||
DirectoryInfo info = myIndex.getInfoForDirectory(output2);
|
||||
assertNotNull(output2.toString(), info);
|
||||
|
||||
private void checkExcluded(VirtualFile dir, Module module) {
|
||||
DirectoryInfo info = myIndex.getInfoForFile(dir);
|
||||
assertTrue(info.toString(), info.isExcluded());
|
||||
assertEquals(module, info.getModule());
|
||||
}
|
||||
|
||||
private DirectoryInfo checkInProject(VirtualFile output2) {
|
||||
DirectoryInfo info = myIndex.getInfoForFile(output2);
|
||||
assertTrue(output2.toString(), info.isInProject());
|
||||
info.assertConsistency();
|
||||
return info;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user