Search in sources :

Example 11 with CaseStage

use of org.jbpm.casemgmt.api.model.CaseStage in project jbpm by kiegroup.

the class StageCompletionConditionTest method testAutoCompleteNoAutoStartTaskNotExistingAdHocInStage.

@Test
public void testAutoCompleteNoAutoStartTaskNotExistingAdHocInStage() {
    String caseId = caseService.startCase(deploymentUnit.getIdentifier(), STAGE_WITH_TASK_NO_AUTOSTART);
    assertThat(caseId).isNotNull().isEqualTo(FIRST_CASE_ID);
    assertCaseInstanceActive(caseId);
    List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER, new QueryFilter());
    assertThat(tasks).isEmpty();
    CaseDefinition caseDef = caseRuntimeDataService.getCase(deploymentUnit.getIdentifier(), STAGE_WITH_TASK_NO_AUTOSTART);
    Collection<CaseStage> stages = caseDef.getCaseStages();
    assertThat(stages).hasSize(1);
    String stageId = stages.iterator().next().getId();
    assertThatExceptionOfType(AdHocFragmentNotFoundException.class).isThrownBy(() -> {
        caseService.triggerAdHocFragment(caseId, stageId, "not existing", null);
    }).withMessageContaining("AdHoc fragment 'not existing' not found in case " + caseId + " and stage " + stageId);
    assertCaseInstanceActive(caseId);
    tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER, new QueryFilter());
    assertThat(tasks).hasSize(0);
    caseService.cancelCase(caseId);
    assertCaseInstanceNotActive(caseId);
}
Also used : QueryFilter(org.kie.internal.query.QueryFilter) CaseStage(org.jbpm.casemgmt.api.model.CaseStage) CaseDefinition(org.jbpm.casemgmt.api.model.CaseDefinition) TaskSummary(org.kie.api.task.model.TaskSummary) AbstractCaseServicesBaseTest(org.jbpm.casemgmt.impl.util.AbstractCaseServicesBaseTest) Test(org.junit.Test)

Aggregations

CaseStage (org.jbpm.casemgmt.api.model.CaseStage)11 CaseDefinition (org.jbpm.casemgmt.api.model.CaseDefinition)10 AbstractCaseServicesBaseTest (org.jbpm.casemgmt.impl.util.AbstractCaseServicesBaseTest)8 Test (org.junit.Test)8 AdHocFragment (org.jbpm.casemgmt.api.model.AdHocFragment)5 QueryContext (org.kie.api.runtime.query.QueryContext)5 HashMap (java.util.HashMap)4 CaseNotFoundException (org.jbpm.casemgmt.api.CaseNotFoundException)4 CaseRole (org.jbpm.casemgmt.api.model.CaseRole)4 CaseInstance (org.jbpm.casemgmt.api.model.instance.CaseInstance)4 ArrayList (java.util.ArrayList)3 CaseMilestone (org.jbpm.casemgmt.api.model.CaseMilestone)3 CaseStageImpl (org.jbpm.casemgmt.impl.model.CaseStageImpl)3 BoundaryEventNode (org.jbpm.workflow.core.node.BoundaryEventNode)3 DynamicNode (org.jbpm.workflow.core.node.DynamicNode)3 MilestoneNode (org.jbpm.workflow.core.node.MilestoneNode)3 StartNode (org.jbpm.workflow.core.node.StartNode)3 Node (org.kie.api.definition.process.Node)3 TaskSummary (org.kie.api.task.model.TaskSummary)3 QueryFilter (org.kie.internal.query.QueryFilter)3