public void testFindRoot() throws IOException { VirtualFile root = LocalFileSystem.getInstance().findFileByPath("wrong_path"); assertNull(root); VirtualFile root2; if (SystemInfo.isWindows) { root = LocalFileSystem.getInstance().findFileByPath("\\\\unit-133"); assertNotNull(root); root2 = LocalFileSystem.getInstance().findFileByPath("//UNIT-133"); assertNotNull(root2); assertEquals(String.valueOf(root2), root, root2); RefreshQueue.getInstance().processSingleEvent(new VFileDeleteEvent(this, root, false)); root = LocalFileSystem.getInstance().findFileByIoFile(new File("\\\\unit-133")); assertNotNull(root); RefreshQueue.getInstance().processSingleEvent(new VFileDeleteEvent(this, root, false)); if (new File("c:").exists()) { root = LocalFileSystem.getInstance().findFileByPath("c:"); assertNotNull(root); assertEquals("C:/", root.getPath()); root2 = LocalFileSystem.getInstance().findFileByPath("C:\\"); assertEquals(String.valueOf(root2), root, root2); } } else if (SystemInfo.isUnix) { root = LocalFileSystem.getInstance().findFileByPath("/"); assertNotNull(root); assertEquals(root.getPath(), "/"); } root = LocalFileSystem.getInstance().findFileByPath(""); assertNotNull(root); File jarFile = IoTestUtil.createTestJar(); root = VirtualFileManager.getInstance().findFileByUrl("jar://" + jarFile.getPath() + "!/"); assertNotNull(root); root2 = VirtualFileManager.getInstance() .findFileByUrl("jar://" + jarFile.getPath().replace(File.separator, "//") + "!/"); assertEquals(String.valueOf(root2), root, root2); if (!SystemInfo.isFileSystemCaseSensitive) { root2 = VirtualFileManager.getInstance() .findFileByUrl("jar://" + jarFile.getPath().toUpperCase(Locale.US) + "!/"); assertEquals(String.valueOf(root2), root, root2); } }
@Override public void launch() { mySemaphore.down(); ((RefreshQueueImpl) RefreshQueue.getInstance()).execute(this); }