/*
* 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: MassiveProcCreation.java 2840 2008-12-04 14:46:34Z drmlipp $
*
* $Log$
* Revision 1.2 2006/09/29 12:32:13 drmlipp
* Consistently using WfMOpen as projct name now.
*
* Revision 1.1.1.2 2004/08/18 15:18:46 drmlipp
* Update to 1.2
*
* Revision 1.5 2004/01/27 11:45:33 lipp
* Preserve newlines when reading process definitions.
*
* Revision 1.4 2003/10/22 15:26:54 lipp
* Added create and start test.
*
* Revision 1.3 2003/10/22 11:00:58 lipp
* Extended.
*
* Revision 1.2 2003/10/21 21:00:45 lipp
* Moved EJBClientTest to new junit sub-package.
*
* Revision 1.1 2003/10/20 21:04:34 lipp
* Getting started.
*
*/
package load;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import javax.security.auth.login.LoginException;
import com.clarkware.junitperf.ConstantTimer;
import com.clarkware.junitperf.LoadTest;
import de.danet.an.util.junit.EJBClientTest;
import de.danet.an.workflow.omgcore.WfProcess;
import de.danet.an.workflow.omgcore.WfRequester;
import de.danet.an.workflow.api.DefaultRequester;
import de.danet.an.workflow.api.ProcessDefinitionDirectory;
import de.danet.an.workflow.api.ProcessMgr;
import de.danet.an.workflow.api.WorkflowService;
import de.danet.an.workflow.api.WorkflowServiceFactory;
import common.UTLoginContext;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* This class provides ...
*
* @author <a href="mailto:mnl@mnl.de">Michael N. Lipp</a>
* @version $Revision: 2840 $
*/
public class MassiveProcCreation extends TestCase {
private static UTLoginContext plc = null;
static {
try {
plc = new UTLoginContext();
plc.login();
} catch (LoginException e) {
throw new IllegalStateException (e.getMessage ());
}
}
private static ProcessDefinitionDirectory pdd = null;
private static ProcessMgr mgr1To20par = null;
private static WfRequester defReq = null;
/**
* Constructor of this TestCase
*/
public MassiveProcCreation(String name) {
super (name);
}
/**
* Make this test suite.
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new MassiveProcCreation("importProcessDefinitions"));
suite.addTest
(new LoadTest
(new MassiveProcCreation("createProcess"),
5, 20000, new ConstantTimer(10)));
return new EJBClientTest (plc, suite);
}
/**
* Import the process definitions from a XPDL file
* unsing the ProcessDefinitionDirectory bean.
*/
public void importProcessDefinitions() throws Exception {
WorkflowServiceFactory wsf = WorkflowServiceFactory.newInstance();
WorkflowService ws = wsf.newWorkflowService();
pdd = ws.processDefinitionDirectory();
InputStream is = getClass().getResourceAsStream("/load/processes.xml");
assertTrue (is != null);
BufferedReader br = new BufferedReader
(new InputStreamReader(is, "ISO-8859-1"));
StringBuffer sb = new StringBuffer();
String st;
while ((st = br.readLine()) != null) {
sb.append(st + "\n");
}
pdd.importProcessDefinitions(sb.toString());
mgr1To20par = pdd.processMgr("loadUnitTests", "1plus20actsPar");
defReq = new DefaultRequester (ws);
}
public void createProcess () throws Exception {
WfProcess p = mgr1To20par.createProcess(defReq);
}
}