public void testDeleteProjectWithVirtualFolderAndLink() { IPath folderLocation = getRandomLocation(); IFolder virtualFolder = existingProject.getFolder(getUniqueString()); IFolder linkedFolder = virtualFolder.getFolder("a_link"); try { try { folderLocation.toFile().mkdir(); virtualFolder.create(IResource.VIRTUAL, true, null); linkedFolder.createLink(folderLocation, IResource.NONE, getMonitor()); existingProject.delete(IResource.NEVER_DELETE_PROJECT_CONTENT, getMonitor()); existingProject.create(getMonitor()); } catch (CoreException e) { fail("1.0", e); } // virtual folder should not exist until the project is open assertTrue("2.0", !virtualFolder.exists()); assertTrue("3.0", !linkedFolder.exists()); try { existingProject.open(getMonitor()); } catch (CoreException e) { fail("4.0", e); } // virtual folder should now exist assertTrue("5.0", virtualFolder.exists()); assertTrue("6.0", virtualFolder.isVirtual()); // link should now exist assertTrue("7.0", linkedFolder.exists()); assertTrue("8.0", linkedFolder.isLinked()); assertEquals("9.0", folderLocation, linkedFolder.getLocation()); } finally { Workspace.clear(folderLocation.toFile()); } }
public void testDeleteProjectWithVirtualFolder() { IFolder virtualFolder = existingProject.getFolder(getUniqueString()); try { virtualFolder.create(IResource.VIRTUAL, true, null); existingProject.delete(IResource.NEVER_DELETE_PROJECT_CONTENT, getMonitor()); existingProject.create(getMonitor()); } catch (CoreException e) { fail("1.0", e); } // virtual folder should not exist until the project is open assertTrue("2.0", !virtualFolder.exists()); try { existingProject.open(getMonitor()); } catch (CoreException e) { fail("3.0", e); } // virtual folder should now exist assertTrue("4.0", virtualFolder.exists()); assertTrue("5.0", virtualFolder.isVirtual()); }