1 19 20 package org.netbeans.modules.projectimport.eclipse; 21 22 import java.io.File ; 23 import java.util.ArrayList ; 24 import java.util.Arrays ; 25 import java.util.Collection ; 26 import java.util.Iterator ; 27 28 34 public class WorkspaceAnalysisTest extends ProjectImporterTestCase { 35 36 public WorkspaceAnalysisTest(String name) { 37 super(name); 38 } 39 40 public void testComplexAloneProjectFor_3_1_M6() throws Exception { 41 File workspaceDir = extractToWorkDir("workspace-test-3.1M6.zip"); 42 Workspace workspace = WorkspaceFactory.getInstance().load(workspaceDir); 43 assertNotNull("Unable to load workspace", workspace); 44 printMessage("Checking " + workspace.getDirectory()); 45 assertFalse("Workspace shouldn't be emtpy", workspace.getProjects().isEmpty()); 46 printMessage("Project in the workspace: " + workspace.getProjects()); 47 48 String [] ws31M6ProjectNames = {"p1", "p2", "p3"}; 51 String [] p1RequiredProjects = {"/p2", "/p3"}; 52 53 boolean p1Tested = false; 54 Collection p1ReqProjectsNames = 55 new ArrayList (Arrays.asList(p1RequiredProjects)); 56 Collection wsProjectNames = 57 new ArrayList (Arrays.asList(ws31M6ProjectNames)); 58 Collection gainedP1ReqProjects = null; 59 60 for (Iterator it = workspace.getProjects().iterator(); it.hasNext(); ) { 61 EclipseProject project = (EclipseProject) it.next(); 62 63 if ("p1".equals(project.getName())) { 64 SingleProjectAnalysisTest.doBasicProjectTest(project); gainedP1ReqProjects = project.getProjectsEntries(); 66 assertEquals("Incorrect project count for p1", 67 p1RequiredProjects.length, gainedP1ReqProjects.size()); 68 printCollection("projects", gainedP1ReqProjects); 69 p1Tested = true; 70 } 71 wsProjectNames.remove(project.getName()); 72 } 73 assertTrue("\"p1\" project wasn't found in the workspace.", p1Tested); 74 assertTrue("All project should be processed.", wsProjectNames.isEmpty()); 75 for (Iterator it = gainedP1ReqProjects.iterator(); it.hasNext(); ) { 76 p1ReqProjectsNames.remove(((ClassPathEntry)it.next()).getRawPath()); 77 } 78 assertTrue("\"p1\" project depends on unknown projects: " + p1ReqProjectsNames, 79 p1ReqProjectsNames.isEmpty()); 80 } 81 82 public void test_73542() throws Exception { 83 File workspaceDir = extractToWorkDir("workspace_73542-3.1.2.zip"); 84 Workspace workspace = WorkspaceFactory.getInstance().load(workspaceDir); 85 assertNotNull("Unable to load workspace", workspace); 86 } 87 88 } 89 | Popular Tags |