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: ProcessRelevantDataTests.java,v 1.2 2006/09/29 12:32:07 drmlipp Exp $
021: */
022: package load;
023:
024: import java.util.HashMap;
025: import java.util.Map;
026:
027: import javax.security.auth.login.LoginException;
028:
029: import de.danet.an.util.junit.EJBClientTest;
030: import de.danet.an.util.junit.NamedTestGroup;
031:
032: import de.danet.an.workflow.omgcore.ProcessData;
033:
034: import de.danet.an.workflow.api.DefaultProcessData;
035:
036: import com.clarkware.junitperf.ConstantTimer;
037: import com.clarkware.junitperf.LoadTest;
038: import common.STProjectLoginContext;
039: import junit.framework.Test;
040: import junit.framework.TestCase;
041: import junit.framework.TestSuite;
042:
043: /**
044: * This class provides ...
045: *
046: * @author <a href="weidauer@danet.de">Christian Weidauer</a>
047: * @version $Revision: 1.2 $
048: */
049:
050: public class ProcessRelevantDataTests extends TestCase {
051:
052: private static STProjectLoginContext plc = null;
053: static {
054: try {
055: plc = new STProjectLoginContext();
056: plc.login();
057: } catch (LoginException e) {
058: throw new IllegalStateException(e.getMessage());
059: }
060: }
061:
062: /**
063: * Creates an instance of <code>ProcessRelevantDataTests</code>
064: * @param name the test suite name
065: */
066: public ProcessRelevantDataTests(String name) {
067: super (name);
068: }
069:
070: /**
071: * Make this test suite.
072: * @return the test suite
073: */
074: public static Test suite() {
075: TestSuite rootSuite = new TestSuite();
076:
077: rootSuite.addTest(prepareSuite());
078:
079: Map tg = new HashMap();
080: tg.put("title",
081: "Create processes with a variable number of process datas "
082: + "and start them");
083: rootSuite.addTest(new NamedTestGroup(createAndStartSuite(),
084: "TestGroup", tg));
085:
086: tg = new HashMap();
087: tg.put("title",
088: "Create processes with a variable number of process datas, "
089: + "initialize and start them ");
090: rootSuite.addTest(new NamedTestGroup(
091: createStartAndInitializeSuite(), "TestGroup", tg));
092: return new EJBClientTest(plc, rootSuite);
093: }
094:
095: private static TestSuite prepareSuite() {
096: TestSuite suite = new TestSuite();
097: suite.addTest(new GenericTest("prepareForCreateProcess",
098: "A5T6comCyNoImplPrRelData5"));
099: suite.addTest(new GenericTest("prepareForCreateProcess",
100: "A5T6comCyNoImplPrRelData10"));
101: suite.addTest(new GenericTest("prepareForCreateProcess",
102: "A5T6comCyNoImplPrRelData20"));
103: return suite;
104: }
105:
106: private static TestSuite createAndStartSuite() {
107: TestSuite suite = new TestSuite();
108: addTest(suite, "5 Process Relevant Datas and 5 Activities "
109: + "(A5T6comCyNoImplPrRelData5)", new GenericTest(
110: "createAndStartProcess", "A5T6comCyNoImplPrRelData5"));
111: addTest(suite, "10 Process Relevant Datas and 5 Activities "
112: + " (A5T6comCyNoImplPrRelData10)", new GenericTest(
113: "createAndStartProcess", "A5T6comCyNoImplPrRelData10"));
114: addTest(suite, "20 Process Relevant Datas and 5 Activities "
115: + " (A5T6comCyNoImplPrRelData20)", new GenericTest(
116: "createAndStartProcess", "A5T6comCyNoImplPrRelData20"));
117: return suite;
118: }
119:
120: private static TestSuite createStartAndInitializeSuite() {
121: TestSuite suite = new TestSuite();
122: ProcessData initialProcessData5 = new DefaultProcessData();
123: initialProcessData5.put("d1", "Initial Data 1");
124: initialProcessData5.put("d2", "Initial Data 2");
125: initialProcessData5.put("d3", "Initial Data 3");
126: initialProcessData5.put("d4", "Initial Data 4");
127: initialProcessData5.put("d5", "Initial Data 5");
128: addTest(suite, "5 Process Relevant Datas And 5 Activities "
129: + " (A5T6comCyNoImplPrRelData5)", new GenericTest(
130: "createStartAndInitializeProcess",
131: "A5T6comCyNoImplPrRelData5", initialProcessData5));
132:
133: ProcessData initialProcessData10 = new DefaultProcessData(
134: initialProcessData5);
135: initialProcessData10.put("d6", "Initial Data 6");
136: initialProcessData10.put("d7", "Initial Data 7");
137: initialProcessData10.put("d8", "Initial Data 8");
138: initialProcessData10.put("d9", "Initial Data 9");
139: initialProcessData10.put("d10", "Initial Data 10");
140: addTest(suite, "10 Process Relevant Datas And 5 Activities "
141: + " (A5T6comCyNoImplPrRelData10)", new GenericTest(
142: "createStartAndInitializeProcess",
143: "A5T6comCyNoImplPrRelData10", initialProcessData10));
144:
145: ProcessData initialProcessData20 = new DefaultProcessData(
146: initialProcessData10);
147: initialProcessData20.put("d11", "Initial Data 11");
148: initialProcessData20.put("d12", "Initial Data 12");
149: initialProcessData20.put("d13", "Initial Data 13");
150: initialProcessData20.put("d14", "Initial Data 14");
151: initialProcessData20.put("d15", "Initial Data 15");
152: initialProcessData20.put("d16", "Initial Data 16");
153: initialProcessData20.put("d17", "Initial Data 17");
154: initialProcessData20.put("d18", "Initial Data 18");
155: initialProcessData20.put("d19", "Initial Data 19");
156: initialProcessData20.put("d20", "Initial Data 20");
157: addTest(suite, "20 Process Relevant Datas And 5 Activities "
158: + "(A5T6comCyNoImplPrRelData10)", new GenericTest(
159: "createStartAndInitializeProcess",
160: "A5T6comCyNoImplPrRelData20", initialProcessData20));
161:
162: return suite;
163: }
164:
165: private static void addTest(TestSuite parentSuite, String title,
166: Test testCase) {
167: TestSuite suite = new TestSuite();
168: Map sas = new HashMap();
169: sas.put("users", "1");
170: suite.addTest(new NamedTestGroup(new LoadTest(testCase, 1, 20,
171: new ConstantTimer(10)), "Samples", sas));
172: suite.addTest(GenericTest.cleaningSuite());
173:
174: sas.put("users", "2");
175: suite.addTest(new NamedTestGroup(new LoadTest(testCase, 2, 10,
176: new ConstantTimer(10)), "Samples", sas));
177: suite.addTest(GenericTest.cleaningSuite());
178:
179: sas.put("users", "4");
180: suite.addTest(new NamedTestGroup(new LoadTest(testCase, 4, 5,
181: new ConstantTimer(10)), "Samples", sas));
182: suite.addTest(GenericTest.cleaningSuite());
183:
184: sas.put("users", "5");
185: suite.addTest(new NamedTestGroup(new LoadTest(testCase, 5, 4,
186: new ConstantTimer(10)), "Samples", sas));
187: suite.addTest(GenericTest.cleaningSuite());
188:
189: sas.put("users", "10");
190: suite.addTest(new NamedTestGroup(new LoadTest(testCase, 10, 2,
191: new ConstantTimer(10)), "Samples", sas));
192: suite.addTest(GenericTest.cleaningSuite());
193:
194: Map tt = new HashMap();
195: tt.put("title", title);
196: parentSuite.addTest(new NamedTestGroup(suite, "Test", tt));
197: }
198:
199: }
|