|
13 | 13 | package org.flowable.cmmn.test.runtime; |
14 | 14 |
|
15 | 15 | import static org.assertj.core.api.Assertions.assertThat; |
16 | | -import static org.assertj.core.api.Assertions.entry; |
17 | | -import static org.assertj.core.api.Assertions.tuple; |
18 | | -import static org.flowable.cmmn.api.runtime.PlanItemInstanceState.ACTIVE; |
19 | 16 |
|
20 | 17 | import java.util.ArrayList; |
21 | | -import java.util.Arrays; |
22 | | -import java.util.Date; |
23 | 18 | import java.util.List; |
24 | 19 |
|
25 | | -import org.flowable.cmmn.api.history.HistoricPlanItemInstance; |
26 | | -import org.flowable.cmmn.api.runtime.CaseInstance; |
27 | 20 | import org.flowable.cmmn.api.runtime.PlanItemDefinitionType; |
28 | | -import org.flowable.cmmn.api.runtime.PlanItemInstance; |
29 | 21 | import org.flowable.cmmn.api.runtime.PlanItemInstanceState; |
30 | | -import org.flowable.cmmn.api.runtime.UserEventListenerInstance; |
31 | | -import org.flowable.cmmn.engine.PlanItemLocalizationManager; |
32 | 22 | import org.flowable.cmmn.engine.impl.CmmnManagementServiceImpl; |
33 | 23 | import org.flowable.cmmn.engine.impl.persistence.entity.PlanItemInstanceEntity; |
34 | 24 | import org.flowable.cmmn.engine.impl.util.CommandContextUtil; |
35 | | -import org.flowable.cmmn.engine.test.CmmnDeployment; |
36 | 25 | import org.flowable.cmmn.engine.test.FlowableCmmnTestCase; |
37 | | -import org.flowable.common.engine.impl.interceptor.Command; |
38 | | -import org.flowable.common.engine.impl.interceptor.CommandContext; |
39 | | -import org.flowable.task.api.Task; |
40 | 26 | import org.junit.Before; |
41 | 27 | import org.junit.Test; |
42 | 28 |
|
@@ -72,6 +58,28 @@ public void testFindByCaseInstanceIdAndTypeAndState() { |
72 | 58 |
|
73 | 59 | assertThat(planItemInstances).hasSize(1); |
74 | 60 | assertThat(planItemInstances.get(0).getName()).isEqualTo("B"); |
| 61 | + |
| 62 | + planItemInstances = ((CmmnManagementServiceImpl) cmmnManagementService).executeCommand( |
| 63 | + commandContext -> CommandContextUtil.getPlanItemInstanceEntityManager().findByCaseInstanceIdAndTypeAndState(caseInstanceId, |
| 64 | + null, List.of(PlanItemInstanceState.ENABLED), false)); |
| 65 | + |
| 66 | + assertThat(planItemInstances).hasSize(1); |
| 67 | + assertThat(planItemInstances.get(0).getName()).isEqualTo("B"); |
| 68 | + |
| 69 | + planItemInstances = ((CmmnManagementServiceImpl) cmmnManagementService).executeCommand( |
| 70 | + commandContext -> CommandContextUtil.getPlanItemInstanceEntityManager().findByCaseInstanceIdAndTypeAndState(caseInstanceId, |
| 71 | + null, null, false)); |
| 72 | + |
| 73 | + assertThat(planItemInstances).hasSize(4); |
| 74 | + List<String> names = new ArrayList<>(); |
| 75 | + for (PlanItemInstanceEntity planItemInstance : planItemInstances) { |
| 76 | + names.add(planItemInstance.getName()); |
| 77 | + } |
| 78 | + |
| 79 | + assertThat(names).contains("A"); |
| 80 | + assertThat(names).contains("B"); |
| 81 | + assertThat(names).contains("Stage one"); |
| 82 | + assertThat(names).contains("Stage two"); |
75 | 83 | } |
76 | 84 |
|
77 | 85 | private List<String> startInstances(int numberOfInstances) { |
|
0 commit comments