001: /*
002: * This file is part of the WfMOpen project.
003: * Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
004: * All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * $Id: LoadRuns.java,v 1.2 2006/09/29 12:32:13 drmlipp Exp $
021: *
022: * $Log: LoadRuns.java,v $
023: * Revision 1.2 2006/09/29 12:32:13 drmlipp
024: * Consistently using WfMOpen as projct name now.
025: *
026: * Revision 1.1.1.1 2003/12/19 13:01:51 drmlipp
027: * Updated to 1.1rc1
028: *
029: * Revision 1.7 2003/10/23 14:22:43 lipp
030: * Moved import to a better place.
031: *
032: * Revision 1.6 2003/10/22 15:26:54 lipp
033: * Added create and start test.
034: *
035: * Revision 1.5 2003/10/22 11:00:58 lipp
036: * Extended.
037: *
038: * Revision 1.4 2003/10/21 21:00:45 lipp
039: * Moved EJBClientTest to new junit sub-package.
040: *
041: * Revision 1.3 2003/10/21 20:25:58 lipp
042: * Updated.
043: *
044: * Revision 1.2 2003/10/21 15:51:42 lipp
045: * Specific load test output.
046: *
047: * Revision 1.1 2003/10/20 21:04:34 lipp
048: * Getting started.
049: *
050: */
051: package load;
052:
053: import java.util.HashMap;
054: import java.util.Map;
055:
056: import javax.security.auth.login.LoginException;
057:
058: import de.danet.an.util.junit.EJBClientTest;
059: import de.danet.an.util.junit.NamedTestGroup;
060:
061: import com.clarkware.junitperf.ConstantTimer;
062: import com.clarkware.junitperf.LoadTest;
063: import com.clarkware.junitperf.TestMethodFactory;
064: import common.UTLoginContext;
065: import junit.framework.Test;
066: import junit.framework.TestCase;
067: import junit.framework.TestSuite;
068:
069: /**
070: * This class provides ...
071: *
072: * @author <a href="mailto:mnl@mnl.de">Michael N. Lipp</a>
073: * @version $Revision: 1.2 $
074: */
075:
076: public class LoadRuns extends TestCase {
077:
078: private static UTLoginContext plc = null;
079: static {
080: try {
081: plc = new UTLoginContext();
082: plc.login();
083: } catch (LoginException e) {
084: throw new IllegalStateException(e.getMessage());
085: }
086: }
087:
088: /**
089: * Creates an instance of <code>LoadRuns</code>
090: * with all attributes initialized to default values.
091: */
092: public LoadRuns(String name) {
093: super (name);
094: }
095:
096: /**
097: * Make this test suite.
098: */
099: public static Test suite() {
100: TestSuite rootSuite = new TestSuite();
101: rootSuite.addTest(new ProcHandling("importProcessDefinitions"));
102:
103: TestSuite suite = new TestSuite();
104: TestMethodFactory factory = new TestMethodFactory(
105: ProcHandling.class, "createProcess6Acts");
106: addTest(suite, "Create 6 activities", factory);
107:
108: factory = new TestMethodFactory(ProcHandling.class,
109: "createProcess11Acts");
110: addTest(suite, "Create 11 activities", factory);
111:
112: factory = new TestMethodFactory(ProcHandling.class,
113: "createProcess21Acts");
114: addTest(suite, "Create 21 activities", factory);
115:
116: Map tg = new HashMap();
117: tg.put("title", "Create Tests");
118: rootSuite.addTest(new NamedTestGroup(suite, "TestGroup", tg));
119:
120: suite = new TestSuite();
121:
122: factory = new TestMethodFactory(ProcHandling.class,
123: "createStart11Acts");
124: addTest(suite, "Create and start 11 activities", factory);
125:
126: tg.put("title", "Create and Start Tests");
127: rootSuite.addTest(new NamedTestGroup(suite, "TestGroup", tg));
128:
129: return new EJBClientTest(plc, rootSuite);
130: }
131:
132: private static void addTest(TestSuite parentSuite, String title,
133: TestMethodFactory factory) {
134: TestSuite suite = new TestSuite();
135: Map sas = new HashMap();
136: sas.put("users", "1");
137: suite.addTest(new NamedTestGroup(new LoadTest(factory, 1, 20,
138: new ConstantTimer(10)), "Samples", sas));
139: sas.put("users", "2");
140: suite.addTest(new NamedTestGroup(new LoadTest(factory, 2, 10,
141: new ConstantTimer(10)), "Samples", sas));
142: sas.put("users", "4");
143: suite.addTest(new NamedTestGroup(new LoadTest(factory, 4, 5,
144: new ConstantTimer(10)), "Samples", sas));
145: sas.put("users", "5");
146: suite.addTest(new NamedTestGroup(new LoadTest(factory, 5, 4,
147: new ConstantTimer(10)), "Samples", sas));
148: sas.put("users", "10");
149: suite.addTest(new NamedTestGroup(new LoadTest(factory, 10, 2,
150: new ConstantTimer(10)), "Samples", sas));
151:
152: Map tt = new HashMap();
153: tt.put("title", title);
154: parentSuite.addTest(new NamedTestGroup(suite, "Test", tt));
155: }
156: }
|