KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > projectimport > eclipse > ComplexProjectAnalysisTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.projectimport.eclipse;
21
22 import java.io.File JavaDoc;
23 import java.util.Collection JavaDoc;
24
25 /**
26  * Tests importing of complex project (still without workspace provided). This
27  * test should check all features if project analyzer.
28  *
29  * @author mkrauskopf
30  */

31 public class ComplexProjectAnalysisTest extends ProjectImporterTestCase {
32
33     /**
34      * Creates a new instance of ComplexProjectAnalysisTest
35      */

36     public ComplexProjectAnalysisTest(String JavaDoc name) {
37         super(name);
38     }
39
40     public void testComplexAloneProjectForLatestMilestone() throws Exception JavaDoc {
41         File JavaDoc projectDir = extractToWorkDir("complexAlone-3.1M6.zip");
42         EclipseProject project = ProjectFactory.getInstance().load(projectDir);
43         assertNotNull(project);
44         doProjectTest(project);
45     }
46     
47     private void doProjectTest(EclipseProject project) {
48         /* usage (see printOtherProjects to see how to use them) */
49         String JavaDoc name = project.getName();
50         assertTrue("Name cannot be null or empty", (name != null && !name.equals("")));
51         
52         File JavaDoc directory = project.getDirectory();
53         assertNotNull(directory);
54         
55         String JavaDoc jdkDir = project.getJDKDirectory();
56         // assertNotNull("Cannot resolve JDK directory \"" + jdkDir + "\"", jdkDir);
57

58         Collection JavaDoc srcRoots = project.getSourceRoots();
59         assertFalse("Tere should be at least on source root",
60                 srcRoots.isEmpty());
61         
62         Collection JavaDoc extSrcRoots = project.getExternalSourceRoots();
63         assertTrue("There shouldn't be any external source roots for the project",
64                 extSrcRoots.isEmpty());
65         
66         Collection JavaDoc libs = project.getLibraries();
67         assertFalse("There are some libraries for the project.", libs.isEmpty());
68         
69         Collection JavaDoc extLibs = project.getExternalLibraries();
70         assertFalse("There are some external libraries for the project",
71                 extLibs.isEmpty());
72         
73         Collection JavaDoc variables = project.getVariables();
74         assertTrue("There are no variables for the project.", variables.isEmpty());
75         
76         Collection JavaDoc projects = project.getProjectsEntries();
77         assertTrue("There are no required projects for the project.", projects.isEmpty());
78         
79         /* print data (if verbose is true) */
80         printMessage("\n\n\nGathered info:");
81         printMessage(" name: " + name);
82         printMessage(" dir: " + directory);
83         printMessage(" jdkDir: " + jdkDir);
84         printCollection("sourceRoots", srcRoots);
85         printCollection("externalSourceRoots", extSrcRoots);
86         printCollection("libraries", libs);
87         printCollection("external libraries", extLibs);
88         printCollection("projects", projects);
89         printCollection("variables", variables);
90     }
91 }
92
Popular Tags