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: LoadTests.java,v 1.2 2006/09/29 12:32:07 drmlipp Exp $
021: *
022: * $Log: LoadTests.java,v $
023: * Revision 1.2 2006/09/29 12:32:07 drmlipp
024: * Consistently using WfMOpen as projct name now.
025: *
026: * Revision 1.1.1.1 2003/12/19 13:01:46 drmlipp
027: * Updated to 1.1rc1
028: *
029: * Revision 1.5 2003/11/24 16:19:11 weidauer
030: * added debug output
031: *
032: * Revision 1.4 2003/10/30 16:22:51 weidauer
033: * added cleaning suite
034: *
035: * Revision 1.3 2003/10/28 14:53:06 barzik
036: * *** empty log message ***
037: *
038: * Revision 1.2 2003/10/28 11:39:36 barzik
039: * *** empty log message ***
040: *
041: * Revision 1.1 2003/10/28 07:54:05 barzik
042: * *** empty log message ***
043: *
044: */
045: package load;
046:
047: import java.util.HashMap;
048: import java.util.Map;
049:
050: import javax.security.auth.login.LoginException;
051:
052: import de.danet.an.util.junit.EJBClientTest;
053: import de.danet.an.util.junit.NamedTestGroup;
054:
055: import com.clarkware.junitperf.ConstantTimer;
056: import com.clarkware.junitperf.LoadTest;
057: import common.STProjectLoginContext;
058: import junit.framework.Test;
059: import junit.framework.TestCase;
060: import junit.framework.TestSuite;
061:
062: /**
063: * This class provides
064: *
065: * @author <a href="mailto:barzik@danet.de">Horst-Günther Barzik</a>
066: * @version $Revision: 1.2 $
067: */
068:
069: public class LoadTests extends TestCase {
070:
071: private static STProjectLoginContext plc = null;
072: static {
073: try {
074: plc = new STProjectLoginContext();
075: plc.login();
076: } catch (LoginException e) {
077: throw new IllegalStateException(e.getMessage());
078: }
079: }
080:
081: /**
082: * Creates an instance of <code>LoadRuns</code>
083: * with all attributes initialized to default values.
084: * @param name the test suite name
085: */
086: public LoadTests(String name) {
087: super (name);
088: }
089:
090: /**
091: * Make this test suite.
092: * @return the test suite
093: */
094: public static Test suite() {
095:
096: // create the root test suite
097: TestSuite rootSuite = new TestSuite();
098: Map tg = new HashMap();
099:
100: // prepare the environment
101: TestSuite suite = new TestSuite();
102: suite.addTest(new GenericTest("prepareForCreateProcess",
103: "A5T4seqCnNoImpl"));
104: suite.addTest(new GenericTest("prepareForCreateProcess",
105: "A5T4parCnNoImpl"));
106: suite.addTest(new GenericTest("prepareForCreateProcess",
107: "A5T6comCnNoImpl"));
108: suite.addTest(new GenericTest("prepareForCreateProcess",
109: "A5T6comCyNoImpl"));
110: suite.addTest(new GenericTest("prepareForCreateProcess",
111: "A10T9seqCnNoImpl"));
112: suite.addTest(new GenericTest("prepareForCreateProcess",
113: "A5T4seqCnEmptyScript"));
114: suite.addTest(new GenericTest("prepareForCreateProcess",
115: "A5T4seqCnSleepScript"));
116: //suite.addTest(new GenericTest("prepareForCreateProcess",
117: // "A5T4seqCnSleepTool"));
118:
119: /* Examine the performance for creating a process depending on
120: the number of activities and transitions a process contains */
121:
122: addTest(suite, "5 activities", new GenericTest("createProcess",
123: "A5T4seqCnNoImpl"));
124:
125: addTest(suite, "10 activities", new GenericTest(
126: "createProcess", "A10T9seqCnNoImpl"));
127:
128: tg.put("title",
129: "Create processes with variable number of activities");
130: rootSuite.addTest(new NamedTestGroup(suite, "TestGroup", tg));
131:
132: /* Examine the performance for creating and starting a process
133: depending on its structure */
134:
135: suite = new TestSuite();
136:
137: addTest(suite, "seriell(A5,T4)", new GenericTest(
138: "createAndStartProcess", "A5T4seqCnNoImpl"));
139:
140: addTest(suite, "paralell(A5,T4)", new GenericTest(
141: "createAndStartProcess", "A5T4parCnNoImpl"));
142:
143: addTest(suite, "complex(A5,T6)", new GenericTest(
144: "createAndStartProcess", "A5T6comCnNoImpl"));
145:
146: tg.put("title",
147: "Create and start processes of different structure");
148: rootSuite.addTest(new NamedTestGroup(suite, "TestGroup", tg));
149:
150: /* examine the performance for creating and starting a process
151: depending on the type of conditions */
152:
153: suite = new TestSuite();
154:
155: addTest(suite, "no conditions", new GenericTest(
156: "createAndStartProcess", "A5T6comCnNoImpl"));
157: addTest(suite, "f1 == '1' && f2=='2'", new GenericTest(
158: "createAndStartProcess", "A5T6comCyNoImpl"));
159:
160: tg.put("title",
161: "Create and start Processes with different types of "
162: + "(un)conditional transitions");
163: rootSuite.addTest(new NamedTestGroup(suite, "TestGroup", tg));
164:
165: /* Examine the performance for creating and starting a process
166: depending on a tool in use */
167:
168: suite = new TestSuite();
169:
170: addTest(suite, "no implementation", new GenericTest(
171: "createAndStartProcess", "A5T4seqCnNoImpl"));
172: addTest(suite, "empty script", new GenericTest(
173: "createAndStartProcess", "A5T4seqCnEmptyScript"));
174: addTest(suite, "sleep script", new GenericTest(
175: "createAndStartProcess", "A5T4seqCnSleepScript"));
176:
177: //addTest(suite, "sleep tool",
178: // new GenericTest("createAndStartProcess",
179: // "A5T4seqCnSleepTool"));
180:
181: tg.put("title",
182: "Create and start Processes with different tools assigned "
183: + "to activities");
184: rootSuite.addTest(new NamedTestGroup(suite, "TestGroup", tg));
185:
186: /* Examine the performance for creating and starting a process
187: depending on ... */
188:
189: //suite = new TestSuite ();
190: //addTest(suite, "wait tool",
191: // new GenericTest("createAndStartProcess",
192: // "A4T5seqCnWaitTool"));
193: //
194: //tg.put ("title", "<insert here description>");
195: //rootSuite.addTest (new NamedTestGroup (suite, "TestGroup", tg));
196: return new EJBClientTest(plc, rootSuite);
197: }
198:
199: private static void addTest(TestSuite parentSuite, String title,
200: Test testCase) {
201: TestSuite suite = new TestSuite();
202: Map sas = new HashMap();
203: sas.put("users", "1");
204: suite.addTest(new NamedTestGroup(new LoadTest(testCase, 1, 20,
205: new ConstantTimer(10)), "Samples", sas));
206: suite.addTest(GenericTest.cleaningSuite());
207:
208: sas.put("users", "2");
209: suite.addTest(new NamedTestGroup(new LoadTest(testCase, 2, 10,
210: new ConstantTimer(10)), "Samples", sas));
211: suite.addTest(GenericTest.cleaningSuite());
212:
213: sas.put("users", "4");
214: suite.addTest(new NamedTestGroup(new LoadTest(testCase, 4, 5,
215: new ConstantTimer(10)), "Samples", sas));
216: suite.addTest(GenericTest.cleaningSuite());
217:
218: sas.put("users", "5");
219: suite.addTest(new NamedTestGroup(new LoadTest(testCase, 5, 4,
220: new ConstantTimer(10)), "Samples", sas));
221: suite.addTest(GenericTest.cleaningSuite());
222:
223: sas.put("users", "10");
224: suite.addTest(new NamedTestGroup(new LoadTest(testCase, 10, 2,
225: new ConstantTimer(10)), "Samples", sas));
226: suite.addTest(GenericTest.cleaningSuite());
227:
228: Map tt = new HashMap();
229: tt.put("title", title);
230: parentSuite.addTest(new NamedTestGroup(suite, "Test", tt));
231: }
232: }
|