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: * The Original Software is NetBeans. The Initial Developer of the Original
026: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
027: * Microsystems, Inc. All Rights Reserved.
028: *
029: * If you wish your version of this file to be governed by only the CDDL
030: * or only the GPL Version 2, indicate your decision by adding
031: * "[Contributor] elects to include this software in this distribution
032: * under the [CDDL or GPL Version 2] license." If you do not indicate a
033: * single choice of license, a recipient has the option to distribute
034: * your version of this file under either the CDDL, the GPL Version 2 or
035: * to extend the choice of license to its licensees as provided above.
036: * However, if you add GPL Version 2 code and therefore, elected the GPL
037: * Version 2 license, then the option applies only if the new code is
038: * made subject to such option by the copyright holder.
039: */
040:
041: package org.netbeans.lib.profiler.tests.jfluid.monitor;
042:
043: import junit.framework.Test;
044: import junit.framework.TestSuite;
045: import org.netbeans.lib.profiler.ProfilerEngineSettings;
046:
047: /**
048: *
049: * @author ehucka
050: */
051: public class BasicTest extends MonitorTestCase {
052: //~ Constructors -------------------------------------------------------------------------------------------------------------
053:
054: /** Creates a new instance of BasicTest */
055: public BasicTest(String name) {
056: super (name);
057: }
058:
059: //~ Methods ------------------------------------------------------------------------------------------------------------------
060:
061: public static Test suite() {
062: TestSuite suite = new TestSuite(
063: org.netbeans.lib.profiler.tests.jfluid.monitor.BasicTest.class);
064:
065: return suite;
066: }
067:
068: public void testBasic() {
069: ProfilerEngineSettings settings = initMonitorTest(
070: "j2se-simple", "simple.Monitor");
071: startMonitorTest(settings, 12, 1000, new String[] { "main",
072: "Consumer", "Producer" },
073: new byte[][] {
074: { ST_SLEEPING | ST_WAIT | ST_RUNNING
075: | ST_MONITOR },
076: { ST_UNKNOWN | ST_ZOMBIE,
077: ST_WAIT | ST_RUNNING | ST_MONITOR },
078: {
079: ST_UNKNOWN | ST_ZOMBIE,
080: ST_WAIT | ST_RUNNING | ST_SLEEPING
081: | ST_MONITOR } }, MONITOR_ONLY);
082: }
083:
084: public void testBasicCPU() {
085: ProfilerEngineSettings settings = initMonitorTest(
086: "j2se-simple", "simple.Monitor");
087: startMonitorTest(settings, 12, 1000, new String[] { "main",
088: "Consumer", "Producer" },
089: new byte[][] {
090: { ST_SLEEPING | ST_WAIT | ST_RUNNING
091: | ST_MONITOR },
092: { ST_UNKNOWN | ST_ZOMBIE,
093: ST_WAIT | ST_RUNNING | ST_MONITOR },
094: {
095: ST_UNKNOWN | ST_ZOMBIE,
096: ST_WAIT | ST_RUNNING | ST_SLEEPING
097: | ST_MONITOR } }, WITH_CPU);
098: }
099:
100: public void testBasicMemory() {
101: ProfilerEngineSettings settings = initMonitorTest(
102: "j2se-simple", "simple.Monitor");
103: startMonitorTest(settings, 12, 1000, new String[] { "main",
104: "Consumer", "Producer" },
105: new byte[][] {
106: { ST_SLEEPING | ST_WAIT | ST_RUNNING
107: | ST_MONITOR },
108: { ST_UNKNOWN | ST_ZOMBIE,
109: ST_WAIT | ST_RUNNING | ST_MONITOR },
110: {
111: ST_UNKNOWN | ST_ZOMBIE,
112: ST_WAIT | ST_RUNNING | ST_SLEEPING
113: | ST_MONITOR } }, WITH_MEMORY);
114: }
115:
116: public void testCascadeThreads() {
117: ProfilerEngineSettings settings = initMonitorTest(
118: "j2se-simple", "simple.monitor.Monitor1");
119: startMonitorTest(settings, 12, 1000, new String[] { "main",
120: "Cascade" }, new byte[][] {
121: { ST_SLEEPING | ST_WAIT | ST_RUNNING | ST_MONITOR,
122: ST_ZOMBIE },
123: { ST_UNKNOWN | ST_ZOMBIE, ST_RUNNING, ST_ZOMBIE } },
124: MONITOR_ONLY);
125: }
126:
127: public void testCascadeThreadsCPU() {
128: ProfilerEngineSettings settings = initMonitorTest(
129: "j2se-simple", "simple.monitor.Monitor1");
130: startMonitorTest(settings, 12, 1000, new String[] { "main",
131: "Cascade" }, new byte[][] {
132: { ST_SLEEPING | ST_WAIT | ST_RUNNING | ST_MONITOR,
133: ST_ZOMBIE },
134: { ST_UNKNOWN | ST_ZOMBIE, ST_RUNNING, ST_ZOMBIE } },
135: WITH_CPU);
136: }
137:
138: public void testCascadeThreadsMemory() {
139: ProfilerEngineSettings settings = initMonitorTest(
140: "j2se-simple", "simple.monitor.Monitor1");
141: startMonitorTest(settings, 12, 1000, new String[] { "main",
142: "Cascade" }, new byte[][] {
143: { ST_SLEEPING | ST_WAIT | ST_RUNNING | ST_MONITOR,
144: ST_ZOMBIE },
145: { ST_UNKNOWN | ST_ZOMBIE, ST_RUNNING, ST_ZOMBIE } },
146: WITH_MEMORY);
147: }
148:
149: /*public void testGUICPU() {
150: ProfilerEngineSettings settings = initMonitorTest("j2se-java2demo", "java2d.Intro");
151: startMonitorTest(settings, 30, 1000, new String[] {"main"},
152: new byte[][] {{ST_UNKNOWN|ST_ZOMBIE, ST_SLEEPING|ST_WAIT|ST_RUNNING|ST_MONITOR,ST_UNKNOWN|ST_ZOMBIE}}, WITH_CPU);
153: }*/
154: }
|