1
2
3
4
5
6
7
8
9
10
11 package org.astrogrid.jes.jobscheduler.impl.groovy;
12
13 import org.astrogrid.workflow.beans.v1.Script;
14 import org.astrogrid.workflow.beans.v1.Set;
15 import org.astrogrid.workflow.beans.v1.While;
16 import org.astrogrid.workflow.beans.v1.Workflow;
17
18 /***
19 * @author Noel Winstanley nw@jb.man.ac.uk 05-Aug-2004
20 *
21 */
22 public class WhileNeverFeatureTest extends AbstractTestForFeature {
23
24 /*** Construct a new WhileFalseFeatureTest
25 * @param name
26 */
27 public WhileNeverFeatureTest(String name) {
28 super(name);
29 }
30 /***
31 * @see org.astrogrid.jes.jobscheduler.impl.groovy.AbstractTestForFeature#buildWorkflow()
32 */
33 protected Workflow buildWorkflow() {
34 Workflow wf = super.createMinimalWorkflow();
35 Set x = new Set();
36 x.setVar("x");
37 x.setValue("${false}");
38 wf.getSequence().addActivity(x);
39
40 While w = new While();
41 w.setTest("${x}");
42 Script sc = new Script();
43 sc.setBody("x=!x");
44 w.setActivity(sc);
45 wf.getSequence().addActivity(w);
46
47 Script end = new Script();
48 end.setBody("print (!x)");
49 wf.getSequence().addActivity(end);
50 return wf;
51 }
52
53 /***
54 * @see org.astrogrid.jes.jobscheduler.impl.groovy.AbstractTestForFeature#verifyWorkflow(org.astrogrid.workflow.beans.v1.Workflow)
55 */
56 protected void verifyWorkflow(Workflow result) {
57 assertWorkflowCompleted(result);
58 Script body = (Script)((While)result.getSequence().getActivity(1)).getActivity();
59
60 assertEquals(0,body.getStepExecutionRecordCount());
61
62 Script end = (Script)result.getSequence().getActivity(2);
63 assertScriptCompletedWithMessage(end,"true");
64 }
65 }
66
67
68
69
70
71
72
73