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-2007 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 gui.menu;
043:
044: import org.netbeans.jellytools.ProjectsTabOperator;
045: import org.netbeans.jellytools.nodes.Node;
046: import org.netbeans.jellytools.nodes.SourcePackagesNode;
047:
048: import org.netbeans.junit.NbTestSuite;
049:
050: /**
051: * Test of popup menu on nodes in Projects View.
052: * @author mmirilovic@netbeans.org
053: */
054: public class ProjectsViewPopupMenu extends ValidatePopupMenuOnNodes {
055:
056: protected static ProjectsTabOperator projectsTab = null;
057:
058: /** Creates a new instance of ProjectsViewPopupMenu */
059: public ProjectsViewPopupMenu(String testName) {
060: super (testName);
061: }
062:
063: /** Creates a new instance of ProjectsViewPopupMenu */
064: public ProjectsViewPopupMenu(String testName,
065: String performanceDataName) {
066: super (testName, performanceDataName);
067:
068: }
069:
070: public static NbTestSuite suite() {
071: NbTestSuite suite = new NbTestSuite();
072: suite.addTest(new ProjectsViewPopupMenu(
073: "testProjectNodePopupMenuProjects",
074: "Project node popup in Projects View"));
075:
076: suite.addTest(new ProjectsViewPopupMenu(
077: "testSourcePackagesPopupMenuProjects",
078: "Source Packages node popup in Projects View"));
079: suite.addTest(new ProjectsViewPopupMenu(
080: "testTestPackagesPopupMenuProjects",
081: "Test Packages node popup in Projects View"));
082:
083: suite.addTest(new ProjectsViewPopupMenu(
084: "testPackagePopupMenuProjects",
085: "Package node popup in Projects View"));
086:
087: suite.addTest(new ProjectsViewPopupMenu(
088: "testJavaFilePopupMenuProjects",
089: "Java file node popup in Projects View"));
090: suite.addTest(new ProjectsViewPopupMenu(
091: "testTxtFilePopupMenuProjects",
092: "Txt file node popup in Projects View"));
093: suite.addTest(new ProjectsViewPopupMenu(
094: "testPropertiesFilePopupMenuProjects",
095: "Properties file node popup in Projects View"));
096: suite.addTest(new ProjectsViewPopupMenu(
097: "testXmlFilePopupMenuProjects",
098: "Xml file node popup in Projects View"));
099: suite.addTest(new ProjectsViewPopupMenu(
100: "testJspFilePopupMenuProjects",
101: "Jsp file node popup in Projects View"));
102:
103: suite.addTest(new ProjectsViewPopupMenu(
104: "testNBProjectNodePopupMenuProjects",
105: "NB Project node popup in Projects View"));
106:
107: return suite;
108: }
109:
110: public void testProjectNodePopupMenuProjects() {
111: testNode(getProjectNode("PerformanceTestData"));
112: }
113:
114: public void testSourcePackagesPopupMenuProjects() {
115: testNode(new SourcePackagesNode("PerformanceTestData"));
116: }
117:
118: public void testTestPackagesPopupMenuProjects() {
119: testNode(new Node(getProjectNode("PerformanceTestData"),
120: gui.Utilities.TEST_PACKAGES));
121: }
122:
123: public void testPackagePopupMenuProjects() {
124: testNode(new Node(
125: new SourcePackagesNode("PerformanceTestData"),
126: "org.netbeans.test.performance"));
127: }
128:
129: public void testJavaFilePopupMenuProjects() {
130: testNode(new Node(
131: new SourcePackagesNode("PerformanceTestData"),
132: "org.netbeans.test.performance|Main.java"));
133: }
134:
135: public void testTxtFilePopupMenuProjects() {
136: testNode(new Node(
137: new SourcePackagesNode("PerformanceTestData"),
138: "org.netbeans.test.performance|textfile.txt"));
139: }
140:
141: public void testPropertiesFilePopupMenuProjects() {
142: testNode(new Node(
143: new SourcePackagesNode("PerformanceTestData"),
144: "org.netbeans.test.performance|Bundle20kB.properties"));
145: }
146:
147: public void testXmlFilePopupMenuProjects() {
148: testNode(new Node(
149: new SourcePackagesNode("PerformanceTestData"),
150: "org.netbeans.test.performance|xmlfile.xml"));
151: }
152:
153: public void testJspFilePopupMenuProjects() {
154: testNode(new Node(
155: getProjectNode("PerformanceTestWebApplication"),
156: org.netbeans.jellytools.Bundle.getStringTrimmed(
157: "org.netbeans.modules.web.project.ui.Bundle",
158: "LBL_Node_DocBase")
159: + "|Test.jsp"));
160: }
161:
162: public void testNBProjectNodePopupMenuProjects() {
163: testNode(getProjectNode("SystemProperties"));
164: }
165:
166: public void testNode(Node node) {
167: dataObjectNode = node;
168: doMeasurement();
169: }
170:
171: protected Node getProjectNode(String projectName) {
172: if (projectsTab == null)
173: projectsTab = new ProjectsTabOperator();
174:
175: return projectsTab.getProjectRootNode(projectName);
176: }
177:
178: }
|