/*
* This file is part of the WfMOpen project.
* Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: LoadTests.java 2550 2007-10-22 14:00:54Z $
*
* $Log$
* Revision 1.1.1.1 2003/12/19 13:01:46 drmlipp
* Updated to 1.1rc1
*
* Revision 1.5 2003/11/24 16:19:11 weidauer
* added debug output
*
* Revision 1.4 2003/10/30 16:22:51 weidauer
* added cleaning suite
*
* Revision 1.3 2003/10/28 14:53:06 barzik
* *** empty log message ***
*
* Revision 1.2 2003/10/28 11:39:36 barzik
* *** empty log message ***
*
* Revision 1.1 2003/10/28 07:54:05 barzik
* *** empty log message ***
*
*/
package load;
import java.util.HashMap;
import java.util.Map;
import javax.security.auth.login.LoginException;
import de.danet.an.util.junit.EJBClientTest;
import de.danet.an.util.junit.NamedTestGroup;
import com.clarkware.junitperf.ConstantTimer;
import com.clarkware.junitperf.LoadTest;
import common.STProjectLoginContext;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* This class provides
*
* @author <a href="mailto:barzik@danet.de">Horst-G�nther Barzik</a>
* @version $Revision: 2550 $
*/
public class LoadTests extends TestCase {
private static STProjectLoginContext plc = null;
static {
try {
plc = new STProjectLoginContext();
plc.login();
} catch (LoginException e) {
throw new IllegalStateException (e.getMessage ());
}
}
/**
* Creates an instance of <code>LoadRuns</code>
* with all attributes initialized to default values.
* @param name the test suite name
*/
public LoadTests (String name) {
super (name);
}
/**
* Make this test suite.
* @return the test suite
*/
public static Test suite() {
// create the root test suite
TestSuite rootSuite = new TestSuite();
Map tg = new HashMap ();
// prepare the environment
TestSuite suite = new TestSuite();
suite.addTest(new GenericTest("prepareForCreateProcess",
"A5T4seqCnNoImpl"));
suite.addTest(new GenericTest("prepareForCreateProcess",
"A5T4parCnNoImpl"));
suite.addTest(new GenericTest("prepareForCreateProcess",
"A5T6comCnNoImpl"));
suite.addTest(new GenericTest("prepareForCreateProcess",
"A5T6comCyNoImpl"));
suite.addTest(new GenericTest("prepareForCreateProcess",
"A10T9seqCnNoImpl"));
suite.addTest(new GenericTest("prepareForCreateProcess",
"A5T4seqCnEmptyScript"));
suite.addTest(new GenericTest("prepareForCreateProcess",
"A5T4seqCnSleepScript"));
//suite.addTest(new GenericTest("prepareForCreateProcess",
// "A5T4seqCnSleepTool"));
/* Examine the performance for creating a process depending on
the number of activities and transitions a process contains */
addTest(suite, "5 activities",
new GenericTest("createProcess", "A5T4seqCnNoImpl"));
addTest(suite, "10 activities",
new GenericTest("createProcess", "A10T9seqCnNoImpl"));
tg.put ("title",
"Create processes with variable number of activities");
rootSuite.addTest (new NamedTestGroup (suite, "TestGroup", tg));
/* Examine the performance for creating and starting a process
depending on its structure */
suite = new TestSuite();
addTest(suite, "seriell(A5,T4)",
new GenericTest("createAndStartProcess", "A5T4seqCnNoImpl"));
addTest(suite, "paralell(A5,T4)",
new GenericTest("createAndStartProcess", "A5T4parCnNoImpl"));
addTest(suite, "complex(A5,T6)",
new GenericTest("createAndStartProcess", "A5T6comCnNoImpl"));
tg.put("title", "Create and start processes of different structure");
rootSuite.addTest(new NamedTestGroup(suite, "TestGroup", tg));
/* examine the performance for creating and starting a process
depending on the type of conditions */
suite = new TestSuite ();
addTest(suite, "no conditions",
new GenericTest("createAndStartProcess", "A5T6comCnNoImpl"));
addTest(suite, "f1 == '1' && f2=='2'",
new GenericTest("createAndStartProcess", "A5T6comCyNoImpl"));
tg.put ("title",
"Create and start Processes with different types of "
+ "(un)conditional transitions");
rootSuite.addTest(new NamedTestGroup (suite, "TestGroup", tg));
/* Examine the performance for creating and starting a process
depending on a tool in use */
suite = new TestSuite ();
addTest(suite, "no implementation",
new GenericTest("createAndStartProcess",
"A5T4seqCnNoImpl"));
addTest(suite, "empty script",
new GenericTest("createAndStartProcess",
"A5T4seqCnEmptyScript"));
addTest(suite, "sleep script",
new GenericTest("createAndStartProcess",
"A5T4seqCnSleepScript"));
//addTest(suite, "sleep tool",
// new GenericTest("createAndStartProcess",
// "A5T4seqCnSleepTool"));
tg.put ("title",
"Create and start Processes with different tools assigned "
+ "to activities");
rootSuite.addTest (new NamedTestGroup (suite, "TestGroup", tg));
/* Examine the performance for creating and starting a process
depending on ... */
//suite = new TestSuite ();
//addTest(suite, "wait tool",
// new GenericTest("createAndStartProcess",
// "A4T5seqCnWaitTool"));
//
//tg.put ("title", "<insert here description>");
//rootSuite.addTest (new NamedTestGroup (suite, "TestGroup", tg));
return new EJBClientTest (plc, rootSuite);
}
private static void addTest (TestSuite parentSuite, String title,
Test testCase) {
TestSuite suite = new TestSuite ();
Map sas = new HashMap ();
sas.put ("users", "1");
suite.addTest
(new NamedTestGroup
(new LoadTest(testCase, 1, 20, new ConstantTimer(10)),
"Samples", sas));
suite.addTest(GenericTest.cleaningSuite());
sas.put ("users", "2");
suite.addTest
(new NamedTestGroup
(new LoadTest(testCase, 2, 10, new ConstantTimer(10)),
"Samples", sas));
suite.addTest(GenericTest.cleaningSuite());
sas.put ("users", "4");
suite.addTest
(new NamedTestGroup
(new LoadTest(testCase, 4, 5, new ConstantTimer(10)),
"Samples", sas));
suite.addTest(GenericTest.cleaningSuite());
sas.put ("users", "5");
suite.addTest
(new NamedTestGroup
(new LoadTest(testCase, 5, 4, new ConstantTimer(10)),
"Samples", sas));
suite.addTest(GenericTest.cleaningSuite());
sas.put ("users", "10");
suite.addTest
(new NamedTestGroup
(new LoadTest(testCase, 10, 2, new ConstantTimer(10)),
"Samples", sas));
suite.addTest(GenericTest.cleaningSuite());
Map tt = new HashMap ();
tt.put ("title", title);
parentSuite.addTest (new NamedTestGroup(suite, "Test", tt));
}
}