For example:
import static ag.carnot.workflow.query.ProcessInstanceQuery.ROOT_PROCESS_INSTANCE_OID;
...
/**I also added a sample test, which is at the moment only starting the Emergency Voting process and retrieves all started "Vote" subprocesses. To get the test running, you have to make sure, that the $JBOSS_HOME\client\jbossall-client.jar is on the classpath.
* Gets all process instances for ProcessOID of a process
*
* @param processId
* in model
* @param rootPoid
* root process instance oid
* @return all process instances matching process ID and root process OID
*/
@SuppressWarnings("unchecked")
public static final List<ProcessInstance> findAllProcessInstancesForProcessIdAndRootPoid(
String processId, long rootPoid) {
ProcessInstanceQuery query = ProcessInstanceQuery.findForProcess(processId);
query.where(ROOT_PROCESS_INSTANCE_OID.isEqual(rootPoid));
List<ProcessInstance> allProcessInstances = queryService.getAllProcessInstances(query);
return allProcessInstances;
}
public static void testEmergencyVoting() throws InterruptedException {
long votingProcessOID = startEmergencyVotingProcess();
//Wait for Subprocesses to be started
Thread.sleep(ProcessHelper.PROCESS_CHECK_RETRY_DELAY);
List<ProcessInstance> processInstances = ProcessHelper
.findAllProcessInstancesForProcessIdAndRootPoid(VOTING_PID, votingProcessOID);
LOG.info("Found "+ processInstances.size()+" Instances of Vote Subprocesses");
//TODO: real testcase to be implemented
}
-Larissa Werlein-
No comments:
Post a Comment