use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class ActivityInstanceImpl method writeTree.
protected void writeTree(StringWriter writer, String prefix, boolean isTail) {
writer.append(prefix);
if (isTail) {
writer.append("└── ");
} else {
writer.append("├── ");
}
writer.append(getActivityId() + "=>" + getId() + "\n");
for (int i = 0; i < childTransitionInstances.length; i++) {
TransitionInstance transitionInstance = childTransitionInstances[i];
boolean transitionIsTail = (i == (childTransitionInstances.length - 1)) && (childActivityInstances.length == 0);
writeTransition(transitionInstance, writer, prefix + (isTail ? " " : "│ "), transitionIsTail);
}
for (int i = 0; i < childActivityInstances.length; i++) {
ActivityInstanceImpl child = (ActivityInstanceImpl) childActivityInstances[i];
child.writeTree(writer, prefix + (isTail ? " " : "│ "), (i == (childActivityInstances.length - 1)));
}
}
use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class JobPrioritizationTest method testPriorityOnModification.
@Test
public void testPriorityOnModification() {
// given
processInstance = runtimeService.startProcessInstanceByKey("serviceTaskProcess");
TransitionInstance transitionInstance = runtimeService.getActivityInstance(processInstance.getId()).getTransitionInstances("serviceTask")[0];
// when
runtimeService.createProcessInstanceModification(processInstance.getId()).startBeforeActivity("serviceTask").cancelTransitionInstance(transitionInstance.getId()).execute();
// then
Job job = managementService.createJobQuery().singleResult();
Assert.assertEquals(PriorityBean.PRIORITY, job.getPriority());
}
use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationAsyncTest method testCancelTransitionInstanceTwiceFailsCase2.
/**
* CAM-4090
*/
@Deployment(resources = NESTED_ASYNC_BEFORE_TASK_PROCESS)
public void testCancelTransitionInstanceTwiceFailsCase2() {
// given there are two transition instances in an inner scope
// and an active activity instance in an outer scope
ProcessInstance instance = runtimeService.createProcessInstanceByKey("nestedOneTaskProcess").startBeforeActivity("innerTask").startBeforeActivity("innerTask").execute();
ActivityInstance tree = runtimeService.getActivityInstance(instance.getId());
// when i cancel both transition instances
TransitionInstance[] transitionInstances = tree.getTransitionInstances("innerTask");
try {
runtimeService.createProcessInstanceModification(instance.getId()).cancelTransitionInstance(// compacts the tree;
transitionInstances[0].getId()).startBeforeActivity(// expand tree again
"innerTask").startBeforeActivity("innerTask").cancelTransitionInstance(// does not trigger compaction
transitionInstances[1].getId()).cancelTransitionInstance(// should fail
transitionInstances[1].getId()).execute();
fail("should not be possible to cancel the first instance twice");
} catch (NotValidException e) {
String transitionInstanceId = transitionInstances[1].getId();
assertTextPresentIgnoreCase("Cannot perform instruction: Cancel transition instance '" + transitionInstanceId + "'; Transition instance '" + transitionInstanceId + "' does not exist: transitionInstance is null", e.getMessage());
}
}
use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testTransitionInstanceActivityNamePropertyAfterStartEvent.
@Deployment
@Test
public void testTransitionInstanceActivityNamePropertyAfterStartEvent() {
// given
String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
// when
ActivityInstance tree = runtimeService.getActivityInstance(processInstanceId);
// then
TransitionInstance[] instances = tree.getTransitionInstances("start");
TransitionInstance task = instances[0];
assertNotNull(task);
assertNotNull(task.getActivityName());
assertEquals("The Start Event", task.getActivityName());
}
use of org.camunda.bpm.engine.runtime.TransitionInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testActivityInstanceTreeForConcurrentAsyncBeforeTask.
@Deployment
@Test
public void testActivityInstanceTreeForConcurrentAsyncBeforeTask() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("concurrentTasksProcess");
ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId());
assertThat(tree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).activity("theTask").transition("asyncTask").done());
TransitionInstance asyncBeforeTransitionInstance = tree.getChildTransitionInstances()[0];
String asyncExecutionId = managementService.createJobQuery().singleResult().getExecutionId();
assertEquals(asyncExecutionId, asyncBeforeTransitionInstance.getExecutionId());
}
Aggregations