001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.projectimport.eclipse;
043:
044: import java.io.File;
045: import java.util.Collection;
046:
047: /**
048: * Tests importing of complex project (still without workspace provided). This
049: * test should check all features if project analyzer.
050: *
051: * @author mkrauskopf
052: */
053: public class ComplexProjectAnalysisTest extends ProjectImporterTestCase {
054:
055: /**
056: * Creates a new instance of ComplexProjectAnalysisTest
057: */
058: public ComplexProjectAnalysisTest(String name) {
059: super (name);
060: }
061:
062: public void testComplexAloneProjectForLatestMilestone()
063: throws Exception {
064: File projectDir = extractToWorkDir("complexAlone-3.1M6.zip");
065: EclipseProject project = ProjectFactory.getInstance().load(
066: projectDir);
067: assertNotNull(project);
068: doProjectTest(project);
069: }
070:
071: private void doProjectTest(EclipseProject project) {
072: /* usage (see printOtherProjects to see how to use them) */
073: String name = project.getName();
074: assertTrue("Name cannot be null or empty",
075: (name != null && !name.equals("")));
076:
077: File directory = project.getDirectory();
078: assertNotNull(directory);
079:
080: String jdkDir = project.getJDKDirectory();
081: // assertNotNull("Cannot resolve JDK directory \"" + jdkDir + "\"", jdkDir);
082:
083: Collection srcRoots = project.getSourceRoots();
084: assertFalse("Tere should be at least on source root", srcRoots
085: .isEmpty());
086:
087: Collection extSrcRoots = project.getExternalSourceRoots();
088: assertTrue(
089: "There shouldn't be any external source roots for the project",
090: extSrcRoots.isEmpty());
091:
092: Collection libs = project.getLibraries();
093: assertFalse("There are some libraries for the project.", libs
094: .isEmpty());
095:
096: Collection extLibs = project.getExternalLibraries();
097: assertFalse(
098: "There are some external libraries for the project",
099: extLibs.isEmpty());
100:
101: Collection variables = project.getVariables();
102: assertTrue("There are no variables for the project.", variables
103: .isEmpty());
104:
105: Collection projects = project.getProjectsEntries();
106: assertTrue("There are no required projects for the project.",
107: projects.isEmpty());
108:
109: /* print data (if verbose is true) */
110: printMessage("\n\n\nGathered info:");
111: printMessage(" name: " + name);
112: printMessage(" dir: " + directory);
113: printMessage(" jdkDir: " + jdkDir);
114: printCollection("sourceRoots", srcRoots);
115: printCollection("externalSourceRoots", extSrcRoots);
116: printCollection("libraries", libs);
117: printCollection("external libraries", extLibs);
118: printCollection("projects", projects);
119: printCollection("variables", variables);
120: }
121: }
|