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.window;
043:
044: import org.netbeans.jellytools.Bundle;
045: import org.netbeans.jellytools.TopComponentOperator;
046: import org.netbeans.jellytools.actions.Action;
047:
048: import org.netbeans.jemmy.operators.ComponentOperator;
049:
050: import org.netbeans.junit.NbTestSuite;
051:
052: /**
053: *
054: * @author mkhramov@netbeans.org
055: */
056: public class ProfilerWindows extends
057: org.netbeans.performance.test.utilities.PerformanceTestCase {
058:
059: private static final String menuPrefix = "Window|Profiling|"; //NOI18N
060:
061: private String commandName;
062: private String windowName;
063:
064: /**
065: *
066: * @param testName
067: */
068: public ProfilerWindows(String testName) {
069: super (testName);
070: expectedTime = WINDOW_OPEN;
071: }
072:
073: /**
074: *
075: * @param testName
076: * @param performanceDataName
077: */
078: public ProfilerWindows(String testName, String performanceDataName) {
079: super (testName, performanceDataName);
080: expectedTime = WINDOW_OPEN;
081: }
082:
083: public static NbTestSuite suite() {
084: NbTestSuite suite = new NbTestSuite();
085: suite.addTest(new ProfilerWindows("testProfilerControlPanel",
086: "Open Profiler Control Panel Window"));
087: suite.addTest(new ProfilerWindows(
088: "testProfilerTelemetryOverview",
089: "Open Profiler VM Telemetry Overview Window"));
090: suite.addTest(new ProfilerWindows("testProfilerLiveResults",
091: "Open Profiler Live Results Window"));
092: suite.addTest(new ProfilerWindows("testProfilerVMTelemetry",
093: "Open Profiler Profiler VM Telemetry Window Window"));
094: suite.addTest(new ProfilerWindows("testProfilerThreads",
095: "Open Profiler Threads Window"));
096: suite.addTest(new ProfilerWindows(
097: "testProfilerProfilingPoints",
098: "Open Profiler Profiling Pints Window"));
099: return suite;
100: }
101:
102: public void testProfilerControlPanel() {
103: commandName = "Profiler Control Panel"; //NOI18N
104: windowName = "Profiler"; ////NOI18N
105: doMeasurement();
106: }
107:
108: public void testProfilerTelemetryOverview() {
109: commandName = Bundle.getStringTrimmed(
110: "org.netbeans.modules.profiler.actions.Bundle",
111: "HINT_TelemetryOverviewAction");
112: windowName = Bundle.getStringTrimmed(
113: "org.netbeans.modules.profiler.Bundle",
114: "LAB_TelemetryOverviewPanelName");
115: doMeasurement();
116: }
117:
118: public void testProfilerLiveResults() {
119: commandName = Bundle.getStringTrimmed(
120: "org.netbeans.modules.profiler.actions.Bundle",
121: "LBL_ShowLiveResultsWindowAction");
122: windowName = Bundle.getStringTrimmed(
123: "org.netbeans.modules.profiler.Bundle",
124: "LAB_ResultsWindowName");
125: doMeasurement();
126: }
127:
128: public void testProfilerVMTelemetry() {
129: commandName = "VM Telemetry"; //NOI18N
130: windowName = Bundle.getStringTrimmed(
131: "org.netbeans.modules.profiler.Bundle",
132: "LAB_TelemetryWindowName");
133: doMeasurement();
134: }
135:
136: public void testProfilerThreads() {
137: commandName = "Threads"; //NOI18N
138: windowName = Bundle.getStringTrimmed(
139: "org.netbeans.modules.profiler.Bundle",
140: "ThreadsWindow_ThreadsWindowName");
141: doMeasurement();
142: }
143:
144: public void testProfilerProfilingPoints() {
145: commandName = "Profiling Points"; //NOI18N
146: windowName = "Profiling Points"; ////NOI18N
147: doMeasurement();
148: }
149:
150: public void prepare() {
151: }
152:
153: public ComponentOperator open() {
154: new Action(menuPrefix + commandName, null).performMenu(); // NOI18N
155: waitNoEvent(1000);
156: return new TopComponentOperator(windowName);
157: }
158:
159: public void close() {
160: if (testedComponentOperator != null
161: && testedComponentOperator.isShowing()) {
162: ((TopComponentOperator) this .testedComponentOperator)
163: .close();
164: }
165: }
166:
167: /** Test could be executed internaly in IDE without XTest
168: * @param args arguments from command line
169: */
170: public static void main(String[] args) {
171: repeat = 1;
172: junit.textui.TestRunner.run(suite());
173: }
174:
175: }
|