RuntimeService runtimeService = activitiRule.getRuntimeService();
Map<String, Object> variableMap = new HashMap<String, Object>();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process1", variableMap);
assertNotNull(processInstance.getId());
System.out.println("id " + processInstance.getId() + " " + processInstance.getProcessDefinitionId());
TaskService taskService = activitiRule.getTaskService();
assertEquals(3, taskService.createTaskQuery().taskAssignee("henryyan").count());
Task task = taskService.createTaskQuery().taskAssignee("henryyan").listPage(0, 1).get(0);
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
.getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
List<ActivityImpl> activitiList = processDefinition.getActivities();
for (ActivityImpl activity : activitiList) {
ActivityBehavior activityBehavior = activity.getActivityBehavior();
boolean multiinstance = false;
if (activityBehavior instanceof MultiInstanceActivityBehavior) {
multiinstance = true;
}
System.out.println(String.format("activiti id: %s, behavior type: %s, multiinstance: %b", activity.getId(), activityBehavior, multiinstance));
}
taskService.complete(task.getId());
task = taskService.createTaskQuery().taskAssignee("henryyan").listPage(0, 1).get(0);
taskService.complete(task.getId());
}