use of org.camunda.bpm.engine.runtime.CaseExecutionQuery in project camunda-bpm-platform by camunda.
the class RepetitionRuleTest method testRepeatTaskWithoutEntryCriteriaOnCustomStandardEvent.
@Deployment
public void testRepeatTaskWithoutEntryCriteriaOnCustomStandardEvent() {
// given
String caseInstanceId = createCaseInstance().getId();
CaseExecutionQuery query = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1");
assertEquals(1, query.count());
CaseExecution enabledCaseExecution = query.enabled().singleResult();
assertNotNull(enabledCaseExecution);
// when (1)
disable(enabledCaseExecution.getId());
// then (1)
query = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1");
assertEquals(2, query.count());
enabledCaseExecution = query.enabled().singleResult();
assertNotNull(enabledCaseExecution);
// when (2)
disable(enabledCaseExecution.getId());
// then (2)
query = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1");
assertEquals(3, query.count());
enabledCaseExecution = query.enabled().singleResult();
assertNotNull(enabledCaseExecution);
// when (3)
complete(caseInstanceId);
// then (3)
query = caseService.createCaseExecutionQuery();
assertEquals(1, query.count());
assertEquals(caseInstanceId, query.singleResult().getId());
}
use of org.camunda.bpm.engine.runtime.CaseExecutionQuery in project camunda-bpm-platform by camunda.
the class RepetitionRuleTest method testRepeatTaskMultipleTimes.
@Deployment
public void testRepeatTaskMultipleTimes() {
// given
createCaseInstance();
String firstHumanTaskId = queryCaseExecutionByActivityId("PI_HumanTask_1").getId();
// when (1)
disable(firstHumanTaskId);
// then (1)
CaseExecutionQuery query = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_2");
assertEquals(2, query.count());
CaseExecution originInstance = query.active().singleResult();
assertNotNull(originInstance);
CaseExecution repetitionInstance = query.available().singleResult();
assertNotNull(repetitionInstance);
// when (2)
reenable(firstHumanTaskId);
disable(firstHumanTaskId);
// then (2)
query = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_2");
assertEquals(3, query.count());
// active instances
assertEquals(2, query.active().count());
// available instances
assertEquals(1, query.available().count());
}
use of org.camunda.bpm.engine.runtime.CaseExecutionQuery in project camunda-bpm-platform by camunda.
the class RepetitionRuleTest method testRepeatMilestoneMultipleTimes.
@Deployment
public void testRepeatMilestoneMultipleTimes() {
// given
createCaseInstance();
String firstHumanTaskId = queryCaseExecutionByActivityId("PI_HumanTask_1").getId();
String milestoneId = queryCaseExecutionByActivityId("PI_Milestone_1").getId();
// when (1)
disable(firstHumanTaskId);
// then (2)
CaseExecutionQuery query = caseService.createCaseExecutionQuery().activityId("PI_Milestone_1");
assertEquals(1, query.count());
assertTrue(query.singleResult().isAvailable());
assertFalse(milestoneId.equals(query.singleResult().getId()));
// when (2)
reenable(firstHumanTaskId);
disable(firstHumanTaskId);
// then (2)
query = caseService.createCaseExecutionQuery().activityId("PI_Milestone_1");
assertEquals(1, query.count());
assertTrue(query.singleResult().isAvailable());
assertFalse(milestoneId.equals(query.singleResult().getId()));
}
use of org.camunda.bpm.engine.runtime.CaseExecutionQuery in project camunda-bpm-platform by camunda.
the class RepetitionRuleTest method testRepeatMilestone.
@Deployment
public void testRepeatMilestone() {
// given
createCaseInstance();
String firstHumanTaskId = queryCaseExecutionByActivityId("PI_HumanTask_1").getId();
String milestoneId = queryCaseExecutionByActivityId("PI_Milestone_1").getId();
// when
complete(firstHumanTaskId);
// then
CaseExecutionQuery query = caseService.createCaseExecutionQuery().activityId("PI_Milestone_1");
assertEquals(1, query.count());
assertTrue(query.singleResult().isAvailable());
assertFalse(milestoneId.equals(query.singleResult().getId()));
}
use of org.camunda.bpm.engine.runtime.CaseExecutionQuery in project camunda-bpm-platform by camunda.
the class AutoCompleteTest method testManualActivationDisabled.
@Deployment
public void testManualActivationDisabled() {
// given
// a deployed case definition
// when (1)
String caseInstanceId = createCaseInstanceByKey(CASE_DEFINITION_KEY).getId();
// then (1)
CaseInstanceQuery instanceQuery = caseService.createCaseInstanceQuery().caseInstanceId(caseInstanceId);
CaseInstance caseInstance = instanceQuery.singleResult();
assertNotNull(caseInstance);
assertTrue(caseInstance.isActive());
CaseExecutionQuery executionQuery = caseService.createCaseExecutionQuery();
String humanTask2Id = executionQuery.activityId("PI_HumanTask_2").singleResult().getId();
// when (2)
caseService.completeCaseExecution(humanTask2Id);
// then (2)
caseInstance = instanceQuery.singleResult();
assertNotNull(caseInstance);
assertTrue(caseInstance.isCompleted());
// humanTask1 and humanTask2 are not available
assertNull(executionQuery.activityId("PI_HumanTask_1").singleResult());
assertNull(executionQuery.activityId("PI_HumanTask_2").singleResult());
}
Aggregations