package process;
import java.util.Collection;
import java.util.Iterator;
import junit.framework.Test;
import junit.framework.TestSuite;
import de.danet.an.util.junit.EJBClientTest;
/**
* Test the transitions of different activities and processes.
* The transitions are triggered by the engine.
* @author <a href="mailto:weidauer@danet.de">Christian Weidauer</a>
* @version 1.0
*/
public class ProcLifeCycleFailingToolInvocation extends WfMOpenTestCase {
/**
* Constructor of this TestCase
* @param name a <code>String</code> value
*/
public ProcLifeCycleFailingToolInvocation(String name) {
super (name);
}
/**
* Construct this test suite.
* @return a <code>Test</code> value
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.
addTest(new ProcLifeCycleFailingToolInvocation
("importProcessDefinitions"));
suite.
addTest(new ProcLifeCycleFailingToolInvocation
("checkP7FailingToolInvocation"));
return new EJBClientTest (plc, suite);
}
/**
* Initialisation.
* The <code>setUp</code> method defines the way a state change is
* realized. Override this method to change this way.
* @exception Exception if an error occurs
*/
protected void setUp() throws Exception {
xpdlFile = "/process/systestproc2.xml";
super.setUp();
}
//checkPxT5T4 already checked by checkP0T4T257 in parentProcess->activities
/**
* Test a simple process definition. The process is terminated without
* being started.
* @exception Exception if an error occurs
*/
public void checkP7FailingToolInvocation()
throws Exception {
// create the process
SmartWfProcess process = createProcess("st-process2", "P7");
assertState(process, NOT_STARTED);
Collection c = process.steps();
Iterator it = c.iterator();
SmartWfActivity aAutomaticTerminating = (SmartWfActivity)it.next();
aAutomaticTerminating.setupWaitForState(TERMINATED);
process.setupWaitForState(TERMINATED);
process.start();
// tool invocation fails because there is no assignee.
aAutomaticTerminating.waitForState();
process.waitForState();
assertState(process, TERMINATED);
removeProcess(process);
}
}