ProcessMgr mgrMin = defDir.processMgr("SystemTest_minimal", "minimal");
ProcessMgr mgrFull = defDir.processMgr("SystemTest_full", "full");
// WfProcess proc1 = mgrMin.createProcess(requester);
// WfProcess proc2 = mgrFull.createProcess(requester);
// WfProcess proc3 = mgrFull.createProcess(requester);
WrappedProcess proc1
= new WrappedProcess(mgrMin.createProcess(requester));
WrappedProcess proc2
= new WrappedProcess(mgrFull.createProcess(requester));
WrappedProcess proc3
= new WrappedProcess(mgrFull.createProcess(requester));
// Test activity of process 1
assertTrue(proc1.steps().size() == 1);
WrappedActivity act = (WrappedActivity)proc1.steps().toArray()[0];
assertTrue(act.assignments().size() == 0);
assertTrue(act.name() == null);
assertTrue(act.priority() == 3); // Default priority
assertTrue(act.container().key().equals(proc1.key()));
assertTrue(act.nextActivities().size() == 0);
// Test activities of processes 2 and 3
assertTrue(proc2.steps().size() == 3);
assertTrue(proc3.steps().size() == 3);
Iterator it = proc2.steps().iterator();
List acts = new LinkedList();
while (it.hasNext()) {
act = (WrappedActivity)it.next();
acts.clear();
if (act.name().equals("ACT1")) {
assertTrue(act.priority() == 1);
assertTrue(act.description()
.equals("Activity with dummy implementation"));
assertTrue(act.assignments().size() == 0);
assertTrue(act.container().equals(proc2));
assertTrue(act.nextActivities().size() == 1);
acts.add("SET1");
assertTrue(activitiesIncluded(act.nextActivities(), acts));
} else if (act.name().equals("ACT2")) {
assertTrue(act.priority() == 2);
assertTrue(act.description() == null);
assertTrue(act.assignments().size() == 0);
assertTrue(act.nextActivities().size() == 1);
acts.add("SET1");
assertTrue(activitiesIncluded(act.nextActivities(), acts));
} else if (act.name().equals("SET1")) {
assertTrue(act.priority() == 3); // default priority
assertTrue(act.description() == null);
assertTrue(act.assignments().size() == 0);
assertTrue(act.nextActivities().size() == 0);
} else {
assertTrue("Invalid activity " + act.name(), false);
}
}
it = proc3.steps().iterator();
Set step3Keys = new HashSet();
while (it.hasNext()) {
step3Keys.add(((WrappedActivity) it.next()).key());
}
it = proc3.activitiesInState("open.not_running.not_started")
.iterator();
Set state3NSKeys = new HashSet();
while (it.hasNext()) {
state3NSKeys.add(((WrappedActivity) it.next()).key());
}
it = proc3.activitiesInState("open.not_running.not_started")
.iterator();
Set state3NRKeys = new HashSet();
while (it.hasNext()) {
state3NRKeys.add(((WrappedActivity) it.next()).key());
}
it = proc2.activitiesInState("open.not_running")
.iterator();
Set state2Keys = new HashSet();
while (it.hasNext()) {
state2Keys.add(((WrappedActivity) it.next()).key());
}
// Make sure that all activities are in state
// "open.not_running.not_started" and differ between process
// instances.
assertTrue(step3Keys.equals(state3NSKeys));
assertTrue(step3Keys.equals(state3NRKeys));
assertTrue(!step3Keys.equals(state2Keys));
assertTrue(proc3.activitiesInState("open.not_running.suspended")
.size() == 0);
assertTrue(proc3.steps().size()
== proc3.activitiesInState("open").size());
assertTrue(proc3.activitiesInState("closed").size() == 0);
assertTrue(proc1.workflowState() == WfExecutionObject.State.OPEN);
assertTrue(proc2.workflowState() == WfExecutionObject.State.OPEN);
assertTrue(proc3.workflowState() == WfExecutionObject.State.OPEN);
procDir.removeProcess(proc1.getWfProcess());
procDir.removeProcess(proc2.getWfProcess());
procDir.removeProcess(proc3.getWfProcess());
}