01: package process;
02:
03: import java.util.Collection;
04: import java.util.Iterator;
05:
06: import junit.framework.Test;
07: import junit.framework.TestSuite;
08: import de.danet.an.util.junit.EJBClientTest;
09:
10: /**
11: * Test the transitions of different activities and processes.
12: * The transitions are triggered by the engine.
13: * @author <a href="mailto:weidauer@danet.de">Christian Weidauer</a>
14: * @version 1.0
15: */
16: public class ProcLifeCycleFailingToolInvocation extends WfMOpenTestCase {
17:
18: /**
19: * Constructor of this TestCase
20: * @param name a <code>String</code> value
21: */
22: public ProcLifeCycleFailingToolInvocation(String name) {
23: super (name);
24: }
25:
26: /**
27: * Construct this test suite.
28: * @return a <code>Test</code> value
29: */
30: public static Test suite() {
31: TestSuite suite = new TestSuite();
32: suite.addTest(new ProcLifeCycleFailingToolInvocation(
33: "importProcessDefinitions"));
34: suite.addTest(new ProcLifeCycleFailingToolInvocation(
35: "checkP7FailingToolInvocation"));
36: return new EJBClientTest(plc, suite);
37: }
38:
39: /**
40: * Initialisation.
41: * The <code>setUp</code> method defines the way a state change is
42: * realized. Override this method to change this way.
43: * @exception Exception if an error occurs
44: */
45: protected void setUp() throws Exception {
46: xpdlFile = "/process/systestproc2.xml";
47: super .setUp();
48: }
49:
50: //checkPxT5T4 already checked by checkP0T4T257 in parentProcess->activities
51:
52: /**
53: * Test a simple process definition. The process is terminated without
54: * being started.
55: * @exception Exception if an error occurs
56: */
57: public void checkP7FailingToolInvocation() throws Exception {
58: // create the process
59: SmartWfProcess process = createProcess("st-process2", "P7");
60: assertState(process, NOT_STARTED);
61: Collection c = process.steps();
62: Iterator it = c.iterator();
63: SmartWfActivity aAutomaticTerminating = (SmartWfActivity) it
64: .next();
65:
66: aAutomaticTerminating.setupWaitForState(TERMINATED);
67: process.setupWaitForState(TERMINATED);
68: process.start();
69: // tool invocation fails because there is no assignee.
70: aAutomaticTerminating.waitForState();
71: process.waitForState();
72: assertState(process, TERMINATED);
73:
74: removeProcess(process);
75: }
76: }
|