diff --git a/modules/flowable-app-engine/src/test/java/org/flowable/app/engine/test/repository/AppDefinitionQueryTest.java b/modules/flowable-app-engine/src/test/java/org/flowable/app/engine/test/repository/AppDefinitionQueryTest.java index ea4c9defe4f..eebe1e83a27 100644 --- a/modules/flowable-app-engine/src/test/java/org/flowable/app/engine/test/repository/AppDefinitionQueryTest.java +++ b/modules/flowable-app-engine/src/test/java/org/flowable/app/engine/test/repository/AppDefinitionQueryTest.java @@ -90,18 +90,22 @@ public void testQueryNoParams() { public void testQueryByDeploymentId() { assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId1).list()).hasSize(1); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId1).listIds()).hasSize(1); + assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId1).listIdsPage(0, 10)).hasSize(1); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId1).count()).isEqualTo(1); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId2).list()).hasSize(1); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId2).listIds()).hasSize(1); + assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId2).listIdsPage(0, 10)).hasSize(1); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId2).count()).isEqualTo(1); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId3).list()).hasSize(1); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId3).listIds()).hasSize(1); + assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId3).listIdsPage(0, 10)).hasSize(1); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId3).count()).isEqualTo(1); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId4).list()).hasSize(1); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId4).listIds()).hasSize(1); + assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId4).listIdsPage(0, 10)).hasSize(1); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId(deploymentId4).count()).isEqualTo(1); } @@ -109,6 +113,7 @@ public void testQueryByDeploymentId() { public void testQueryByInvalidDeploymentId() { assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId("invalid").list()).isEmpty(); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId("invalid").listIds()).isEmpty(); + assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId("invalid").listIdsPage(0, 10)).isEmpty(); assertThat(appRepositoryService.createAppDefinitionQuery().deploymentId("invalid").count()).isZero(); } @@ -228,10 +233,12 @@ public void testQueryByAppDefinitionCategoryNotEquals() { public void testQueryByAppDefinitionName() { assertThat(appRepositoryService.createAppDefinitionQuery().appDefinitionName("Test app").list()).hasSize(3); assertThat(appRepositoryService.createAppDefinitionQuery().appDefinitionName("Test app").listIds()).hasSize(3); + assertThat(appRepositoryService.createAppDefinitionQuery().appDefinitionName("Test app").listIdsPage(0, 10)).hasSize(3); assertThat(appRepositoryService.createAppDefinitionQuery().appDefinitionName("Test app").count()).isEqualTo(3); assertThat(appRepositoryService.createAppDefinitionQuery().appDefinitionName("Full info app").list()).hasSize(1); assertThat(appRepositoryService.createAppDefinitionQuery().appDefinitionName("Full info app").listIds()).hasSize(1); + assertThat(appRepositoryService.createAppDefinitionQuery().appDefinitionName("Full info app").listIdsPage(0, 10)).hasSize(1); assertThat(appRepositoryService.createAppDefinitionQuery().appDefinitionName("Full info app").count()).isEqualTo(1); assertThat(appRepositoryService.createAppDefinitionQuery().appDefinitionName("Full info app").singleResult().getDeploymentId()) diff --git a/modules/flowable-app-engine/src/test/java/org/flowable/app/engine/test/repository/DeploymentQueryTest.java b/modules/flowable-app-engine/src/test/java/org/flowable/app/engine/test/repository/DeploymentQueryTest.java index 7373c9d1940..c9f5f916243 100644 --- a/modules/flowable-app-engine/src/test/java/org/flowable/app/engine/test/repository/DeploymentQueryTest.java +++ b/modules/flowable-app-engine/src/test/java/org/flowable/app/engine/test/repository/DeploymentQueryTest.java @@ -60,14 +60,17 @@ public void deleteTestDeployments() { public void testQueryNoParams() { assertThat(appRepositoryService.createDeploymentQuery().list()).hasSize(2); assertThat(appRepositoryService.createDeploymentQuery().listIds()).hasSize(2); + assertThat(appRepositoryService.createDeploymentQuery().listIdsPage(0, 10)).hasSize(2); assertThat(appRepositoryService.createDeploymentQuery().count()).isEqualTo(2); assertThat(appRepositoryService.createDeploymentQuery().list()) - .extracting(AppDeployment::getId) - .containsExactlyInAnyOrder(deploymentId1, deploymentId2); + .extracting(AppDeployment::getId) + .containsExactlyInAnyOrder(deploymentId1, deploymentId2); assertThat(appRepositoryService.createDeploymentQuery().listIds()) .containsExactlyInAnyOrder(deploymentId1, deploymentId2); + assertThat(appRepositoryService.createDeploymentQuery().listIdsPage(0, 10)) + .containsExactlyInAnyOrder(deploymentId1, deploymentId2); } @Test @@ -76,11 +79,13 @@ public void testQueryByDeploymentId() { assertThat(appRepositoryService.createDeploymentQuery().deploymentId(deploymentId1).singleResult().getId()).isEqualTo(deploymentId1); assertThat(appRepositoryService.createDeploymentQuery().deploymentId(deploymentId1).list()).hasSize(1); assertThat(appRepositoryService.createDeploymentQuery().deploymentId(deploymentId1).listIds()).hasSize(1); + assertThat(appRepositoryService.createDeploymentQuery().deploymentId(deploymentId1).listIdsPage(0, 10)).hasSize(1); assertThat(appRepositoryService.createDeploymentQuery().deploymentId(deploymentId1).count()).isEqualTo(1); assertThat(appRepositoryService.createDeploymentQuery().deploymentId(deploymentId2).singleResult()).isNotNull(); assertThat(appRepositoryService.createDeploymentQuery().deploymentId(deploymentId2).list()).hasSize(1); assertThat(appRepositoryService.createDeploymentQuery().deploymentId(deploymentId2).listIds()).hasSize(1); + assertThat(appRepositoryService.createDeploymentQuery().deploymentId(deploymentId2).listIdsPage(0, 10)).hasSize(1); assertThat(appRepositoryService.createDeploymentQuery().deploymentId(deploymentId2).count()).isEqualTo(1); } @@ -89,6 +94,7 @@ public void testQueryByInvalidDeploymentId() { assertThat(appRepositoryService.createDeploymentQuery().deploymentId("invalid").singleResult()).isNull(); assertThat(appRepositoryService.createDeploymentQuery().deploymentId("invalid").list()).isEmpty(); assertThat(appRepositoryService.createDeploymentQuery().deploymentId("invalid").listIds()).isEmpty(); + assertThat(appRepositoryService.createDeploymentQuery().deploymentId("invalid").listIdsPage(0, 10)).isEmpty(); assertThat(appRepositoryService.createDeploymentQuery().deploymentId("invalid").count()).isZero(); } @@ -96,6 +102,8 @@ public void testQueryByInvalidDeploymentId() { public void testQueryByDeploymentIds() { assertThat(appRepositoryService.createDeploymentQuery().deploymentIds(Arrays.asList(deploymentId1, deploymentId2, "dummy")).list()).hasSize(2); assertThat(appRepositoryService.createDeploymentQuery().deploymentIds(Arrays.asList(deploymentId1, deploymentId2, "dummy")).listIds()).hasSize(2); + assertThat(appRepositoryService.createDeploymentQuery().deploymentIds(Arrays.asList(deploymentId1, deploymentId2, "dummy")).listIdsPage(0, 10)).hasSize( + 2); assertThat(appRepositoryService.createDeploymentQuery().deploymentIds(Arrays.asList(deploymentId2, "dummy")).singleResult()).isNotNull(); } @@ -104,6 +112,7 @@ public void testQueryByInvalidDeploymentIds() { assertThat(appRepositoryService.createDeploymentQuery().deploymentIds(Collections.singletonList("invalid")).singleResult()).isNull(); assertThat(appRepositoryService.createDeploymentQuery().deploymentIds(Collections.singletonList("invalid")).list()).isEmpty(); assertThat(appRepositoryService.createDeploymentQuery().deploymentIds(Collections.singletonList("invalid")).listIds()).isEmpty(); + assertThat(appRepositoryService.createDeploymentQuery().deploymentIds(Collections.singletonList("invalid")).listIdsPage(0, 10)).isEmpty(); assertThat(appRepositoryService.createDeploymentQuery().deploymentIds(Collections.singletonList("invalid")).count()).isZero(); assertThatThrownBy(() -> appRepositoryService.createDeploymentQuery().deploymentIds(null)) .isInstanceOf(FlowableIllegalArgumentException.class) @@ -131,11 +140,13 @@ public void testQueryByDeploymentNameLike() { assertThat(appRepositoryService.createDeploymentQuery().deploymentNameLike("test%").singleResult().getId()).isEqualTo(deploymentId2); assertThat(appRepositoryService.createDeploymentQuery().deploymentNameLike("test%").list()).hasSize(1); assertThat(appRepositoryService.createDeploymentQuery().deploymentNameLike("test%").listIds()).hasSize(1); + assertThat(appRepositoryService.createDeploymentQuery().deploymentNameLike("test%").listIdsPage(0, 10)).hasSize(1); assertThat(appRepositoryService.createDeploymentQuery().deploymentNameLike("test%").count()).isEqualTo(1); assertThat(appRepositoryService.createDeploymentQuery().deploymentNameLike("inval%").singleResult()).isNull(); assertThat(appRepositoryService.createDeploymentQuery().deploymentNameLike("inval%").list()).isEmpty(); assertThat(appRepositoryService.createDeploymentQuery().deploymentNameLike("inval%").listIds()).isEmpty(); + assertThat(appRepositoryService.createDeploymentQuery().deploymentNameLike("inval%").listIdsPage(0, 10)).isEmpty(); assertThat(appRepositoryService.createDeploymentQuery().deploymentNameLike("inval%").count()).isZero(); } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/CmmnHistoricVariableInstanceQueryImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/CmmnHistoricVariableInstanceQueryImpl.java index c62104a18db..6cadc7c1a3a 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/CmmnHistoricVariableInstanceQueryImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/CmmnHistoricVariableInstanceQueryImpl.java @@ -179,4 +179,9 @@ public List listPage(int firstResult, int maxResults) return wrappedHistoricVariableInstanceQuery.listPage(firstResult, maxResults); } + @Override + public List listIdsPage(int firstResult, int maxResults) { + return wrappedHistoricVariableInstanceQuery.listIdsPage(firstResult, maxResults); + } + } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CmmnVariableInstanceQueryImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CmmnVariableInstanceQueryImpl.java index 5b24f2febd7..70b42e5a7be 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CmmnVariableInstanceQueryImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CmmnVariableInstanceQueryImpl.java @@ -178,4 +178,9 @@ public List listPage(int firstResult, int maxResults) { return wrappedVariableInstanceQuery.listPage(firstResult, maxResults); } + @Override + public List listIdsPage(int firstResult, int maxResults) { + return wrappedVariableInstanceQuery.listIdsPage(firstResult, maxResults); + } + } diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/GenericEventListenerInstanceQueryImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/GenericEventListenerInstanceQueryImpl.java index f980f02baa8..eff5327f620 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/GenericEventListenerInstanceQueryImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/GenericEventListenerInstanceQueryImpl.java @@ -146,6 +146,11 @@ public List listPage(int firstResult, int maxResul return convertPlanItemInstances(innerQuery.listPage(firstResult, maxResults)); } + @Override + public List listIdsPage(int firstResult, int maxResults) { + return innerQuery.listIdsPage(firstResult, maxResults); + } + protected List convertPlanItemInstances(List instances) { if (instances == null) { return null; diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/SignalEventListenerInstanceQueryImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/SignalEventListenerInstanceQueryImpl.java index 75603101403..01918ddb365 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/SignalEventListenerInstanceQueryImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/SignalEventListenerInstanceQueryImpl.java @@ -147,6 +147,11 @@ public List listPage(int firstResult, int maxResult return convertPlanItemInstances(innerQuery.listPage(firstResult, maxResults)); } + @Override + public List listIdsPage(int firstResult, int maxResults) { + return innerQuery.listIdsPage(firstResult, maxResults); + } + protected List convertPlanItemInstances(List instances) { if (instances == null) { return null; diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/UserEventListenerInstanceQueryImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/UserEventListenerInstanceQueryImpl.java index 7ffcbf2ef46..e8573f195e0 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/UserEventListenerInstanceQueryImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/UserEventListenerInstanceQueryImpl.java @@ -154,6 +154,11 @@ public List listPage(int firstResult, int maxResults) return convertPlanItemInstances(innerQuery.listPage(firstResult, maxResults)); } + @Override + public List listIdsPage(int firstResult, int maxResults) { + return innerQuery.listIdsPage(firstResult, maxResults); + } + protected List convertPlanItemInstances(List instances) { if (instances == null) { return null; diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/history/HistoricPlanItemInstanceQueryTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/history/HistoricPlanItemInstanceQueryTest.java index 9da5a97f031..16cb95808c0 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/history/HistoricPlanItemInstanceQueryTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/history/HistoricPlanItemInstanceQueryTest.java @@ -55,6 +55,7 @@ public void testByCaseDefinitionId() { if (CmmnHistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, cmmnEngineConfiguration)) { assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().list()).hasSize(20); assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().listIds()).hasSize(20); + assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().listIdsPage(0, 100)).hasSize(20); } } @@ -65,6 +66,8 @@ public void testByCaseInstanceId() { if (CmmnHistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, cmmnEngineConfiguration)) { assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceCaseInstanceId(caseInstanceId).list()).hasSize(4); assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceCaseInstanceId(caseInstanceId).listIds()).hasSize(4); + assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceCaseInstanceId(caseInstanceId).listIdsPage(0, 10)).hasSize( + 4); } } } @@ -79,6 +82,8 @@ public void testByStageInstanceId() { .singleResult(); assertThat(planItemInstance).isNotNull(); assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceStageInstanceId(planItemInstance.getId()).listIds()).hasSize(2); + assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceStageInstanceId(planItemInstance.getId()) + .listIdsPage(0, 10)).hasSize(2); assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceStageInstanceId(planItemInstance.getId()).count()).isEqualTo(2); } } @@ -91,6 +96,7 @@ public void testByPlanItemInstanceId() { List planItemInstances = cmmnHistoryService.createHistoricPlanItemInstanceQuery().list(); for (HistoricPlanItemInstance planItemInstance : planItemInstances) { assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceId(planItemInstance.getId()).listIds()).hasSize(1); + assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceId(planItemInstance.getId()).listIdsPage(0, 10)).hasSize(1); assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceId(planItemInstance.getId()).count()).isEqualTo(1); } } @@ -102,6 +108,7 @@ public void testByElementId() { if (CmmnHistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, cmmnEngineConfiguration)) { assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceElementId("planItem3").listIds()).hasSize(4); + assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceElementId("planItem3").listIdsPage(0, 10)).hasSize(4); assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceElementId("planItem3").list()).hasSize(4); } } @@ -112,6 +119,7 @@ public void testByName() { if (CmmnHistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, cmmnEngineConfiguration)) { assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceName("B").listIds()).hasSize(9); + assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceName("B").listIdsPage(0, 10)).hasSize(9); assertThat(cmmnHistoryService.createHistoricPlanItemInstanceQuery().planItemInstanceName("B").list()).hasSize(9); } } diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/mgmt/ExternalWorkerJobQueryTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/mgmt/ExternalWorkerJobQueryTest.java index a7a575a53c8..406958ba2ce 100755 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/mgmt/ExternalWorkerJobQueryTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/mgmt/ExternalWorkerJobQueryTest.java @@ -54,6 +54,7 @@ public void testQueryByNoCriteria() { .extracting(ExternalWorkerJob::getScopeId) .containsOnly(caseInstance.getId()); assertThat(query.listIds()).hasSize(2); + assertThat(query.listIdsPage(0, 10)).hasSize(2); } @Test @@ -72,6 +73,7 @@ public void testQueryByCaseInstanceId() { .extracting(ExternalWorkerJob::getScopeId) .containsOnly(caseInstance1.getId()); assertThat(query.listIds()).hasSize(2); + assertThat(query.listIdsPage(0, 10)).hasSize(2); query = cmmnManagementService.createExternalWorkerJobQuery().caseInstanceId(caseInstance2.getId()); assertThat(query.count()).isEqualTo(2); @@ -79,12 +81,14 @@ public void testQueryByCaseInstanceId() { .extracting(ExternalWorkerJob::getScopeId) .containsOnly(caseInstance2.getId()); assertThat(query.listIds()).hasSize(2); + assertThat(query.listIdsPage(0, 10)).hasSize(2); query = cmmnManagementService.createExternalWorkerJobQuery().caseInstanceId("invalid"); assertThat(query.count()).isZero(); assertThat(query.list()).isEmpty(); assertThat(query.singleResult()).isNull(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); } @Test @@ -106,6 +110,7 @@ public void testQueryByCaseDefinitionId() { assertThat(query.count()).isZero(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.singleResult()).isNull(); } diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/repository/CaseDefinitionQueryTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/repository/CaseDefinitionQueryTest.java index 7621b95949c..c3dfb5cb0da 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/repository/CaseDefinitionQueryTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/repository/CaseDefinitionQueryTest.java @@ -74,6 +74,7 @@ public void deleteTestDeployments() { public void testQueryNoParams() { assertThat(cmmnRepositoryService.createCaseDefinitionQuery().list()).hasSize(4); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().listIds()).hasSize(4); + assertThat(cmmnRepositoryService.createCaseDefinitionQuery().listIdsPage(0, 10)).hasSize(4); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().count()).isEqualTo(4); } @@ -81,14 +82,17 @@ public void testQueryNoParams() { public void testQueryByDeploymentId() { assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId(deploymentId1).list()).hasSize(2); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId(deploymentId1).listIds()).hasSize(2); + assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId(deploymentId1).listIdsPage(0, 10)).hasSize(2); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId(deploymentId1).count()).isEqualTo(2); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId(deploymentId2).list()).hasSize(1); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId(deploymentId2).listIds()).hasSize(1); + assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId(deploymentId2).listIdsPage(0, 10)).hasSize(1); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId(deploymentId2).count()).isEqualTo(1); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId(deploymentId3).list()).hasSize(1); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId(deploymentId3).listIds()).hasSize(1); + assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId(deploymentId3).listIdsPage(0, 10)).hasSize(1); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId(deploymentId3).count()).isEqualTo(1); } @@ -96,6 +100,7 @@ public void testQueryByDeploymentId() { public void testQueryByInvalidDeploymentId() { assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId("invalid").list()).isEmpty(); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId("invalid").listIds()).isEmpty(); + assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId("invalid").listIdsPage(0, 10)).isEmpty(); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentId("invalid").count()).isZero(); } @@ -105,6 +110,8 @@ public void testQueryByDeploymentIds() { .list()).hasSize(4); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentIds(new HashSet<>(Arrays.asList(deploymentId1, deploymentId2, deploymentId3))) .listIds()).hasSize(4); + assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentIds(new HashSet<>(Arrays.asList(deploymentId1, deploymentId2, deploymentId3))) + .listIdsPage(0, 10)).hasSize(4); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentIds(new HashSet<>(Arrays.asList(deploymentId1, deploymentId2, deploymentId3))) .count()).isEqualTo(4); @@ -112,6 +119,8 @@ public void testQueryByDeploymentIds() { .hasSize(2); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentIds(new HashSet<>(Collections.singletonList(deploymentId1))).listIds()) .hasSize(2); + assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentIds(new HashSet<>(Collections.singletonList(deploymentId1))).listIdsPage(0, 10)) + .hasSize(2); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentIds(new HashSet<>(Collections.singletonList(deploymentId1))).count()) .isEqualTo(2); @@ -119,6 +128,9 @@ public void testQueryByDeploymentIds() { .hasSize(2); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentIds(new HashSet<>(Arrays.asList(deploymentId2, deploymentId3))).listIds()) .hasSize(2); + assertThat( + cmmnRepositoryService.createCaseDefinitionQuery().deploymentIds(new HashSet<>(Arrays.asList(deploymentId2, deploymentId3))).listIdsPage(0, 10)) + .hasSize(2); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentIds(new HashSet<>(Arrays.asList(deploymentId2, deploymentId3))).count()) .isEqualTo(2); @@ -126,6 +138,8 @@ public void testQueryByDeploymentIds() { .hasSize(1); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentIds(new HashSet<>(Collections.singletonList(deploymentId3))).listIds()) .hasSize(1); + assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentIds(new HashSet<>(Collections.singletonList(deploymentId3))).listIdsPage(0, 10)) + .hasSize(1); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().deploymentIds(new HashSet<>(Collections.singletonList(deploymentId3))).count()) .isEqualTo(1); } @@ -149,6 +163,7 @@ public void testQueryByParentDeploymentId() { tuple("myCase", deployment1.getId()) ); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().parentDeploymentId("parent1").listIds()).hasSize(1); + assertThat(cmmnRepositoryService.createCaseDefinitionQuery().parentDeploymentId("parent1").listIdsPage(0, 10)).hasSize(1); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().parentDeploymentId("parent1").count()).isEqualTo(1); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().parentDeploymentId("parent2").list()) @@ -158,10 +173,12 @@ public void testQueryByParentDeploymentId() { tuple("myCase2", deployment2.getId()) ); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().parentDeploymentId("parent2").listIds()).hasSize(2); + assertThat(cmmnRepositoryService.createCaseDefinitionQuery().parentDeploymentId("parent2").listIdsPage(0, 10)).hasSize(2); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().parentDeploymentId("parent2").count()).isEqualTo(2); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().parentDeploymentId("unknown").list()).isEmpty(); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().parentDeploymentId("unknown").listIds()).isEmpty(); + assertThat(cmmnRepositoryService.createCaseDefinitionQuery().parentDeploymentId("unknown").listIdsPage(0, 10)).isEmpty(); assertThat(cmmnRepositoryService.createCaseDefinitionQuery().parentDeploymentId("unknown").count()).isEqualTo(0); } diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/repository/DeploymentQueryTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/repository/DeploymentQueryTest.java index 2dbc985314b..31e3ac65cc8 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/repository/DeploymentQueryTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/repository/DeploymentQueryTest.java @@ -60,6 +60,7 @@ public void deleteTestDeployments() { public void testQueryNoParams() { assertThat(cmmnRepositoryService.createDeploymentQuery().list()).hasSize(2); assertThat(cmmnRepositoryService.createDeploymentQuery().listIds()).hasSize(2); + assertThat(cmmnRepositoryService.createDeploymentQuery().listIdsPage(0, 10)).hasSize(2); assertThat(cmmnRepositoryService.createDeploymentQuery().count()).isEqualTo(2); assertThat(cmmnRepositoryService.createDeploymentQuery().list()) @@ -68,6 +69,8 @@ public void testQueryNoParams() { assertThat(cmmnRepositoryService.createDeploymentQuery().listIds()) .containsExactlyInAnyOrder(deploymentId1, deploymentId2); + assertThat(cmmnRepositoryService.createDeploymentQuery().listIdsPage(0, 10)) + .containsExactlyInAnyOrder(deploymentId1, deploymentId2); } @Test @@ -76,11 +79,13 @@ public void testQueryByDeploymentId() { assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId1).singleResult().getId()).isEqualTo(deploymentId1); assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId1).list()).hasSize(1); assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId1).listIds()).hasSize(1); + assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId1).listIdsPage(0, 10)).hasSize(1); assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId1).count()).isEqualTo(1); assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId2).singleResult()).isNotNull(); assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId2).list()).hasSize(1); assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId2).listIds()).hasSize(1); + assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId2).listIdsPage(0, 10)).hasSize(1); assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId2).count()).isEqualTo(1); } @@ -89,6 +94,7 @@ public void testQueryByInvalidDeploymentId() { assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId("invalid").singleResult()).isNull(); assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId("invalid").list()).isEmpty(); assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId("invalid").listIds()).isEmpty(); + assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId("invalid").listIdsPage(0, 10)).isEmpty(); assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentId("invalid").count()).isZero(); } @@ -96,6 +102,9 @@ public void testQueryByInvalidDeploymentId() { public void testQueryByDeploymentIds() { assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentIds(Arrays.asList(deploymentId1, deploymentId2, "dummy")).list()).hasSize(2); assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentIds(Arrays.asList(deploymentId1, deploymentId2, "dummy")).listIds()).hasSize(2); + assertThat( + cmmnRepositoryService.createDeploymentQuery().deploymentIds(Arrays.asList(deploymentId1, deploymentId2, "dummy")).listIdsPage(0, 10)).hasSize( + 2); assertThat(cmmnRepositoryService.createDeploymentQuery().deploymentIds(Arrays.asList(deploymentId2, "dummy")).singleResult()).isNotNull(); } diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/CaseInstanceQueryImplTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/CaseInstanceQueryImplTest.java index fd2169867db..558dcae2466 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/CaseInstanceQueryImplTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/CaseInstanceQueryImplTest.java @@ -79,6 +79,7 @@ public void getCaseInstanceByCaseDefinitionKey() { assertThat(cmmnRuntimeService.createCaseInstanceQuery().caseDefinitionKey("oneTaskCase").count()).isEqualTo(1); assertThat(cmmnRuntimeService.createCaseInstanceQuery().caseDefinitionKey("oneTaskCase").list().get(0).getId()).isEqualTo(caseInstance.getId()); assertThat(cmmnRuntimeService.createCaseInstanceQuery().caseDefinitionKey("oneTaskCase").listIds().get(0)).isEqualTo(caseInstance.getId()); + assertThat(cmmnRuntimeService.createCaseInstanceQuery().caseDefinitionKey("oneTaskCase").listIdsPage(0, 10).get(0)).isEqualTo(caseInstance.getId()); assertThat(cmmnRuntimeService.createCaseInstanceQuery().caseDefinitionKey("oneTaskCase").singleResult().getId()).isEqualTo(caseInstance.getId()); assertThat(cmmnRuntimeService.createCaseInstanceQuery().or().caseDefinitionKey("oneTaskCase").caseInstanceId("Undefined").endOr().count()) @@ -101,6 +102,8 @@ public void getCaseInstanceByCaseDefinitionKeys() { .isEqualTo(caseInstance.getId()); assertThat(cmmnRuntimeService.createCaseInstanceQuery().caseDefinitionKeys(Collections.singleton("oneTaskCase")).listIds().get(0)) .isEqualTo(caseInstance.getId()); + assertThat(cmmnRuntimeService.createCaseInstanceQuery().caseDefinitionKeys(Collections.singleton("oneTaskCase")).listIdsPage(0, 1).get(0)) + .isEqualTo(caseInstance.getId()); assertThat(cmmnRuntimeService.createCaseInstanceQuery().caseDefinitionKeys(Collections.singleton("oneTaskCase")).singleResult().getId()) .isEqualTo(caseInstance.getId()); diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/MilestoneQueryTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/MilestoneQueryTest.java index 986feea6064..247478494f2 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/MilestoneQueryTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/MilestoneQueryTest.java @@ -50,6 +50,8 @@ public void testSimpleMilestoneInstanceQuery() { List milestoneInstanceIds = cmmnRuntimeService.createMilestoneInstanceQuery().listIds(); assertThat(milestoneInstanceIds).isEmpty(); + milestoneInstanceIds = cmmnRuntimeService.createMilestoneInstanceQuery().listIdsPage(0, 10); + assertThat(milestoneInstanceIds).isEmpty(); //event triggering setClockTo(new Date(System.currentTimeMillis() + 60_000L)); @@ -84,6 +86,7 @@ public void testSimpleMilestoneInstanceQuery() { assertThat(cmmnRuntimeService.createMilestoneInstanceQuery().milestoneInstanceCaseInstanceId(caseInstance.getId()).count()).isEqualTo(3); assertThat(cmmnRuntimeService.createMilestoneInstanceQuery().milestoneInstanceCaseInstanceId(caseInstance.getId()).listIds()).hasSize(3); + assertThat(cmmnRuntimeService.createMilestoneInstanceQuery().milestoneInstanceCaseInstanceId(caseInstance.getId()).listIdsPage(0, 10)).hasSize(3); //There are two named milestones MilestoneInstance abcMilestone = cmmnRuntimeService.createMilestoneInstanceQuery().milestoneInstanceName("abcMilestone").singleResult(); diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/PlanItemInstanceQueryTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/PlanItemInstanceQueryTest.java index 39fbf8b9513..eae5966d044 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/PlanItemInstanceQueryTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/PlanItemInstanceQueryTest.java @@ -56,6 +56,7 @@ public void testByCaseDefinitionId() { startInstances(5); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().list()).hasSize(20); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().listIds()).hasSize(20); + assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().listIdsPage(0, 100)).hasSize(20); } @Test @@ -64,6 +65,7 @@ public void testByCaseInstanceId() { for (String caseInstanceId : caseInstanceIds) { assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().caseInstanceId(caseInstanceId).list()).hasSize(4); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().caseInstanceId(caseInstanceId).listIds()).hasSize(4); + assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().caseInstanceId(caseInstanceId).listIdsPage(0, 10)).hasSize(4); } } @@ -91,6 +93,7 @@ public void testByElementId() { startInstances(4); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceElementId("planItem3").list()).hasSize(4); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceElementId("planItem3").listIds()).hasSize(4); + assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceElementId("planItem3").listIdsPage(0, 10)).hasSize(4); } @Test @@ -98,6 +101,7 @@ public void testByName() { startInstances(9); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceName("B").list()).hasSize(9); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceName("B").listIds()).hasSize(9); + assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceName("B").listIdsPage(0, 10)).hasSize(9); } @Test @@ -106,10 +110,12 @@ public void testByState() { assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceState(PlanItemInstanceState.ACTIVE).list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateActive().list()).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateActive().listIds()).hasSize(2); + assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateActive().listIdsPage(0, 10)).hasSize(2); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceState(PlanItemInstanceState.AVAILABLE).list()).hasSize(1); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateAvailable().list()).hasSize(1); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateAvailable().listIds()).hasSize(1); + assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateAvailable().listIdsPage(0, 10)).hasSize(1); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceState(PlanItemInstanceState.ENABLED).list()).hasSize(1); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateEnabled().list()).hasSize(1); @@ -123,7 +129,9 @@ public void testByPlanItemDefinitionType() { assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemDefinitionType(PlanItemDefinitionType.STAGE).list()).hasSize(6); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK).listIds()).hasSize(6); + assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK).listIdsPage(0, 10)).hasSize(6); assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemDefinitionType(PlanItemDefinitionType.STAGE).listIds()).hasSize(6); + assertThat(cmmnRuntimeService.createPlanItemInstanceQuery().planItemDefinitionType(PlanItemDefinitionType.STAGE).listIdsPage(0, 10)).hasSize(6); } @Test @@ -134,6 +142,8 @@ public void testByPlanItemDefinitionTypes() { assertThat(cmmnRuntimeService.createPlanItemInstanceQuery() .planItemDefinitionTypes(Arrays.asList(PlanItemDefinitionType.STAGE, PlanItemDefinitionType.HUMAN_TASK)).listIds()).hasSize(8); + assertThat(cmmnRuntimeService.createPlanItemInstanceQuery() + .planItemDefinitionTypes(Arrays.asList(PlanItemDefinitionType.STAGE, PlanItemDefinitionType.HUMAN_TASK)).listIdsPage(0, 10)).hasSize(8); } @Test diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/task/CmmnTaskQueryTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/task/CmmnTaskQueryTest.java index 1a2636ce9c1..84819fcaef4 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/task/CmmnTaskQueryTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/task/CmmnTaskQueryTest.java @@ -54,6 +54,7 @@ public void testNoParams() { assertThat(cmmnTaskService.createTaskQuery().count()).isEqualTo(NR_CASE_INSTANCES); assertThat(cmmnTaskService.createTaskQuery().list()).hasSize(NR_CASE_INSTANCES); assertThat(cmmnTaskService.createTaskQuery().listIds()).hasSize(NR_CASE_INSTANCES); + assertThat(cmmnTaskService.createTaskQuery().listIdsPage(0, 10)).hasSize(NR_CASE_INSTANCES); } @Test @@ -63,6 +64,7 @@ public void testQueryByCaseInstanceId() { for (CaseInstance caseInstance : caseInstances) { assertThat(cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).list()).hasSize(1); assertThat(cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).listIds()).hasSize(1); + assertThat(cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).listIdsPage(0, 10)).hasSize(1); } } @@ -89,6 +91,7 @@ public void testQueryByCaseDefinitionId() { assertThat(caseDefinition).isNotNull(); assertThat(cmmnTaskService.createTaskQuery().caseDefinitionId(caseDefinition.getId()).list()).hasSize(NR_CASE_INSTANCES); assertThat(cmmnTaskService.createTaskQuery().caseDefinitionId(caseDefinition.getId()).listIds()).hasSize(NR_CASE_INSTANCES); + assertThat(cmmnTaskService.createTaskQuery().caseDefinitionId(caseDefinition.getId()).listIdsPage(0, 10)).hasSize(NR_CASE_INSTANCES); } @Test @@ -97,6 +100,7 @@ public void testQueryByCaseDefinitionKey() { assertThat(caseDefinition).isNotNull(); assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKey(caseDefinition.getKey()).list()).hasSize(NR_CASE_INSTANCES); assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKey(caseDefinition.getKey()).listIds()).hasSize(NR_CASE_INSTANCES); + assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKey(caseDefinition.getKey()).listIdsPage(0, 10)).hasSize(NR_CASE_INSTANCES); } @Test @@ -105,6 +109,7 @@ public void testQueryByCaseDefinitionKeyLike() { assertThat(caseDefinition).isNotNull(); assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKeyLike("oneTask%").list()).hasSize(NR_CASE_INSTANCES); assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKeyLike("oneTask%").listIds()).hasSize(NR_CASE_INSTANCES); + assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKeyLike("oneTask%").listIdsPage(0, 10)).hasSize(NR_CASE_INSTANCES); } public void testQueryByCaseDefinitionKeyLikeIgnoreCase() { @@ -112,15 +117,18 @@ public void testQueryByCaseDefinitionKeyLikeIgnoreCase() { assertThat(caseDefinition).isNotNull(); assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKeyLikeIgnoreCase("onetask%").list()).hasSize(NR_CASE_INSTANCES); assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKeyLikeIgnoreCase("onetask%").listIds()).hasSize(NR_CASE_INSTANCES); + assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKeyLikeIgnoreCase("onetask%").listIdsPage(0, 10)).hasSize(NR_CASE_INSTANCES); } @Test public void testQueryByCaseDefinitionKeyIn() { CaseDefinition caseDefinition = cmmnRepositoryService.createCaseDefinitionQuery().singleResult(); assertThat(caseDefinition).isNotNull(); - assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKeyIn(Arrays.asList(caseDefinition.getKey(),"dummyKey")).list()) + assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKeyIn(Arrays.asList(caseDefinition.getKey(), "dummyKey")).list()) .hasSize(NR_CASE_INSTANCES); - assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKeyIn(Arrays.asList(caseDefinition.getKey(),"dummyKey")).listIds()) + assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKeyIn(Arrays.asList(caseDefinition.getKey(), "dummyKey")).listIds()) + .hasSize(NR_CASE_INSTANCES); + assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKeyIn(Arrays.asList(caseDefinition.getKey(), "dummyKey")).listIdsPage(0, 10)) .hasSize(NR_CASE_INSTANCES); } @@ -130,18 +138,20 @@ public void testQueryByCmmnDeploymentId() { assertThat(deployment).isNotNull(); assertThat(cmmnTaskService.createTaskQuery().cmmnDeploymentId(deployment.getId()).list()).hasSize(NR_CASE_INSTANCES); assertThat(cmmnTaskService.createTaskQuery().cmmnDeploymentId(deployment.getId()).listIds()).hasSize(NR_CASE_INSTANCES); + assertThat(cmmnTaskService.createTaskQuery().cmmnDeploymentId(deployment.getId()).listIdsPage(0, 10)).hasSize(NR_CASE_INSTANCES); } @Test public void testQueryByAssignee() { assertThat(cmmnTaskService.createTaskQuery().taskAssignee("johnDoe").list()).hasSize(NR_CASE_INSTANCES); assertThat(cmmnTaskService.createTaskQuery().taskAssignee("johnDoe").listIds()).hasSize(NR_CASE_INSTANCES); - + assertThat(cmmnTaskService.createTaskQuery().taskAssignee("johnDoe").listIdsPage(0, 10)).hasSize(NR_CASE_INSTANCES); + List caseInstances = cmmnRuntimeService.createCaseInstanceQuery().caseDefinitionKey("oneTaskCase").list(); assertThat(caseInstances).hasSize(5); - + String caseInstanceId = caseInstances.get(0).getId(); - + Task task = cmmnTaskService.createTaskQuery().taskAssignee("johnDoe").caseInstanceId(caseInstanceId).singleResult(); assertThat(task.getAssignee()).isEqualTo("johnDoe"); assertThat(task.getScopeId()).isEqualTo(caseInstanceId); @@ -165,9 +175,10 @@ public void testQueryByAssignee() { public void testQueryWithoutProcessInstanceId() { assertThat(cmmnTaskService.createTaskQuery().withoutProcessInstanceId().list()).hasSize(NR_CASE_INSTANCES); assertThat(cmmnTaskService.createTaskQuery().withoutProcessInstanceId().listIds()).hasSize(NR_CASE_INSTANCES); - + assertThat(cmmnTaskService.createTaskQuery().withoutProcessInstanceId().listIdsPage(0, 10)).hasSize(NR_CASE_INSTANCES); + assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKey("oneTaskCase").withoutProcessInstanceId().list()).hasSize(NR_CASE_INSTANCES); - + assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKey("unexisting").withoutProcessInstanceId().list()).hasSize(0); } @@ -177,6 +188,7 @@ public void testQueryWithoutScopeId() { assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKey("oneTaskCase").withoutScopeId().list()).hasSize(0); assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKey("oneTaskCase").withoutScopeId().listIds()).hasSize(0); + assertThat(cmmnTaskService.createTaskQuery().caseDefinitionKey("oneTaskCase").withoutScopeId().listIdsPage(0, 10)).hasSize(0); } @Test diff --git a/modules/flowable-dmn-engine/src/test/java/org/flowable/dmn/engine/test/deployment/DeploymentQueryTest.java b/modules/flowable-dmn-engine/src/test/java/org/flowable/dmn/engine/test/deployment/DeploymentQueryTest.java index 301bff332bb..239d4fa648f 100644 --- a/modules/flowable-dmn-engine/src/test/java/org/flowable/dmn/engine/test/deployment/DeploymentQueryTest.java +++ b/modules/flowable-dmn-engine/src/test/java/org/flowable/dmn/engine/test/deployment/DeploymentQueryTest.java @@ -64,11 +64,13 @@ public void testQueryById() { assertThat(repositoryService.createDeploymentQuery().deploymentId(deploymentId1).singleResult()).isNotNull(); assertThat(repositoryService.createDeploymentQuery().deploymentId(deploymentId1).list()).hasSize(1); assertThat(repositoryService.createDeploymentQuery().deploymentId(deploymentId1).listIds()).hasSize(1); + assertThat(repositoryService.createDeploymentQuery().deploymentId(deploymentId1).listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createDeploymentQuery().deploymentId(deploymentId1).count()).isEqualTo(1); assertThat(repositoryService.createDeploymentQuery().deploymentId("invalid").singleResult()).isNull(); assertThat(repositoryService.createDeploymentQuery().deploymentId("invalid").list()).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentId("invalid").listIds()).isEmpty(); + assertThat(repositoryService.createDeploymentQuery().deploymentId("invalid").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentId("invalid").count()).isZero(); } @@ -77,11 +79,13 @@ public void testQueryByName() { assertThat(repositoryService.createDeploymentQuery().deploymentName("test2.dmn").singleResult()).isNotNull(); assertThat(repositoryService.createDeploymentQuery().deploymentName("test2.dmn").list()).hasSize(1); assertThat(repositoryService.createDeploymentQuery().deploymentName("test2.dmn").listIds()).hasSize(1); + assertThat(repositoryService.createDeploymentQuery().deploymentName("test2.dmn").listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createDeploymentQuery().deploymentName("test2.dmn").count()).isEqualTo(1); assertThat(repositoryService.createDeploymentQuery().deploymentName("invalid").singleResult()).isNull(); assertThat(repositoryService.createDeploymentQuery().deploymentName("invalid").list()).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentName("invalid").listIds()).isEmpty(); + assertThat(repositoryService.createDeploymentQuery().deploymentName("invalid").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentName("invalid").count()).isZero(); } @@ -89,11 +93,13 @@ public void testQueryByName() { public void testQueryByNameLike() { assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("test%").list()).hasSize(3); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("test%").listIds()).hasSize(3); + assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("test%").listIdsPage(0, 10)).hasSize(3); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("test%").count()).isEqualTo(3); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("inva%").singleResult()).isNull(); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("inva%").list()).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("inva%").listIds()).isEmpty(); + assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("inva%").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("inva%").count()).isZero(); } @@ -102,11 +108,13 @@ public void testQueryByCategory() { assertThat(repositoryService.createDeploymentQuery().deploymentCategory("testCategoryC").singleResult()).isNotNull(); assertThat(repositoryService.createDeploymentQuery().deploymentCategory("testCategoryC").list()).hasSize(1); assertThat(repositoryService.createDeploymentQuery().deploymentCategory("testCategoryC").listIds()).hasSize(1); + assertThat(repositoryService.createDeploymentQuery().deploymentCategory("testCategoryC").listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createDeploymentQuery().deploymentCategory("testCategoryC").count()).isEqualTo(1); assertThat(repositoryService.createDeploymentQuery().deploymentCategory("inva%").singleResult()).isNull(); assertThat(repositoryService.createDeploymentQuery().deploymentCategory("inva%").list()).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentCategory("inva%").listIds()).isEmpty(); + assertThat(repositoryService.createDeploymentQuery().deploymentCategory("inva%").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentCategory("inva%").count()).isZero(); } @@ -114,10 +122,12 @@ public void testQueryByCategory() { public void testQueryByCategoryNotEquals() { assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("testCategoryC").list()).hasSize(2); assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("testCategoryC").listIds()).hasSize(2); + assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("testCategoryC").listIdsPage(0, 10)).hasSize(2); assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("testCategoryC").count()).isEqualTo(2); assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("invalid").list()).hasSize(3); assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("invalid").listIds()).hasSize(3); + assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("invalid").listIdsPage(0, 10)).hasSize(3); assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("invalid").count()).isEqualTo(3); } diff --git a/modules/flowable-engine-common-api/src/main/java/org/flowable/common/engine/api/query/Query.java b/modules/flowable-engine-common-api/src/main/java/org/flowable/common/engine/api/query/Query.java index 3426a47a25c..44ecfa0d50b 100644 --- a/modules/flowable-engine-common-api/src/main/java/org/flowable/common/engine/api/query/Query.java +++ b/modules/flowable-engine-common-api/src/main/java/org/flowable/common/engine/api/query/Query.java @@ -66,4 +66,9 @@ enum NullHandlingOnOrder { * Executes the query and get a list of entities as the result. */ List listPage(int firstResult, int maxResults); + + /** + * Executes the query and get a list of ids as the result. + */ + List listIdsPage(int firstResult, int maxResults); } diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/db/ListQueryParameterObject.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/db/ListQueryParameterObject.java index 419f309a783..e51c167cac1 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/db/ListQueryParameterObject.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/db/ListQueryParameterObject.java @@ -29,7 +29,7 @@ public class ListQueryParameterObject { public enum ResultType { - LIST, LIST_IDS, LIST_PAGE, SINGLE_RESULT, COUNT + LIST, LIST_IDS, LIST_PAGE, LIST_IDS_PAGE, SINGLE_RESULT, COUNT } protected static final OrderBy DEFAULT_ORDER_BY = new OrderBy("RES.ID_", "asc", null); diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/query/AbstractQuery.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/query/AbstractQuery.java index d8598707c91..10ad6e17627 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/query/AbstractQuery.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/query/AbstractQuery.java @@ -156,6 +156,29 @@ public List listPage(int firstResult, int maxResults) { return executeList(Context.getCommandContext()); } + @Override + @SuppressWarnings("unchecked") + public List listIdsPage(int firstResult, int maxResults) { + this.firstResult = firstResult; + this.maxResults = maxResults; + if (this.maxResults >= 0) { + if (this.firstResult < 0) { + this.firstResult = 0; + } + } else { + if (this.firstResult >= 0) { + this.maxResults = Integer.MAX_VALUE; + } + } + this.resultType = ResultType.LIST_IDS_PAGE; + if (commandExecutor != null) { + return (List) commandExecutor.execute(this); + } + // The execute has a checkQueryOk() call as well, so no need to do the call earlier + checkQueryOk(); + return executeListIds(Context.getCommandContext()); + } + @Override public long count() { this.resultType = ResultType.COUNT; @@ -178,6 +201,8 @@ public Object execute(CommandContext commandContext) { return executeList(commandContext); } else if (resultType == ResultType.LIST_IDS) { return executeListIds(commandContext); + } else if (resultType == ResultType.LIST_IDS_PAGE) { + return executeListIds(commandContext); } else { return executeCount(commandContext); } diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/history/HistoricProcessInstanceAndVariablesQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/history/HistoricProcessInstanceAndVariablesQueryTest.java index 3ec7261fe71..5db3d5d4371 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/history/HistoricProcessInstanceAndVariablesQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/history/HistoricProcessInstanceAndVariablesQueryTest.java @@ -96,6 +96,8 @@ public void testQuery() { List instanceListIds = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().listIds(); assertThat(instanceListIds).hasSize(6); + instanceListIds = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().listIdsPage(0, 10); + assertThat(instanceListIds).hasSize(6); instanceList = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().processDefinitionKey(PROCESS_DEFINITION_KEY).list(); assertThat(instanceList).hasSize(4); @@ -107,7 +109,11 @@ public void testQuery() { entry("test2", "test2")); assertThat(instanceList.get(0).getProcessDefinitionKey()).isEqualTo(PROCESS_DEFINITION_KEY); - instanceListIds = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().processDefinitionKey(PROCESS_DEFINITION_KEY).listIds(); + instanceListIds = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().processDefinitionKey(PROCESS_DEFINITION_KEY) + .listIds(); + assertThat(instanceListIds).hasSize(4); + instanceListIds = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().processDefinitionKey(PROCESS_DEFINITION_KEY) + .listIdsPage(0, 10); assertThat(instanceListIds).hasSize(4); processInstance = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().processDefinitionKey(PROCESS_DEFINITION_KEY_2) @@ -216,21 +222,24 @@ public void testQueryOnTaskVariable() { ProcessInstance taskProcessInstance = runtimeService.createProcessInstanceQuery().processDefinitionKey("oneTaskProcess3").singleResult(); Task task = taskService.createTaskQuery().processInstanceId(taskProcessInstance.getId()).singleResult(); taskService.setVariableLocal(task.getId(), "localVar", "test"); - + assertThat(runtimeService.createProcessInstanceQuery().variableValueEquals("localVar", "test").list()).isEmpty(); assertThat(runtimeService.createProcessInstanceQuery().variableValueEquals("localVar", "test").listIds()).isEmpty(); - + assertThat(runtimeService.createProcessInstanceQuery().variableValueEquals("localVar", "test").listIdsPage(0, 10)).isEmpty(); + if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, processEngineConfiguration)) { HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().includeProcessVariables() .variableValueEquals("anothertest", 123).singleResult(); Map variableMap = processInstance.getProcessVariables(); assertThat(variableMap).containsExactly(entry("anothertest", 123)); - + assertThat(historyService.createHistoricProcessInstanceQuery().variableValueEquals("localVar", "test").list()).isEmpty(); assertThat(historyService.createHistoricProcessInstanceQuery().variableValueEquals("localVar", "test").listIds()).isEmpty(); + assertThat(historyService.createHistoricProcessInstanceQuery().variableValueEquals("localVar", "test").listIdsPage(0, 10)).isEmpty(); assertThat(historyService.createHistoricProcessInstanceQuery().localVariableValueEquals("localVar", "test").list()).hasSize(1); assertThat(historyService.createHistoricProcessInstanceQuery().localVariableValueEquals("localVar", "test").listIds()).hasSize(1); + assertThat(historyService.createHistoricProcessInstanceQuery().localVariableValueEquals("localVar", "test").listIdsPage(0, 10)).hasSize(1); } } diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/history/HistoricProcessInstanceQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/history/HistoricProcessInstanceQueryTest.java index bd779af6c24..6cb20075973 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/history/HistoricProcessInstanceQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/history/HistoricProcessInstanceQueryTest.java @@ -60,6 +60,9 @@ public void testLocalization() throws Exception { .containsExactly(tuple(null, null)); List processIds = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).listIds(); + assertThat(processIds) + .containsExactly(processInstanceId); + processIds = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).listIdsPage(0, 10); assertThat(processIds) .containsExactly(processInstanceId); @@ -130,6 +133,8 @@ public void testQueryByCallbackId() { .contains(processInstance.getId()); assertThat(historyService.createHistoricProcessInstanceQuery().processInstanceCallbackId("callbackId").listIds()) .contains(processInstance.getId()); + assertThat(historyService.createHistoricProcessInstanceQuery().processInstanceCallbackId("callbackId").listIdsPage(0, 10)) + .contains(processInstance.getId()); assertThat(historyService.createHistoricProcessInstanceQuery() .or() @@ -141,6 +146,7 @@ public void testQueryByCallbackId() { assertThat(historyService.createHistoricProcessInstanceQuery().processInstanceCallbackId("invalid").list()).isEmpty(); assertThat(historyService.createHistoricProcessInstanceQuery().processInstanceCallbackId("invalid").listIds()).isEmpty(); + assertThat(historyService.createHistoricProcessInstanceQuery().processInstanceCallbackId("invalid").listIdsPage(0, 10)).isEmpty(); } } diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/history/HistoricTaskAndVariablesQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/history/HistoricTaskAndVariablesQueryTest.java index 5c9e3dd6d1b..e1f3f596ec4 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/history/HistoricTaskAndVariablesQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/history/HistoricTaskAndVariablesQueryTest.java @@ -87,6 +87,7 @@ public void testQuery() { assertThat(historyService.createHistoricTaskInstanceQuery().list()).hasSize(3); assertThat(historyService.createHistoricTaskInstanceQuery().listIds()).hasSize(3); + assertThat(historyService.createHistoricTaskInstanceQuery().listIdsPage(0, 10)).hasSize(3); task = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().taskAssignee("gonzo").singleResult(); assertThat(task.getProcessVariables()).isEmpty(); @@ -192,6 +193,8 @@ public void testQuery() { .isEqualTo(taskId); assertThat(historyService.createHistoricTaskInstanceQuery().taskInvolvedGroups(Collections.singleton("testGroup")).listIds().get(0)) .isEqualTo(taskId); + assertThat(historyService.createHistoricTaskInstanceQuery().taskInvolvedGroups(Collections.singleton("testGroup")).listIdsPage(0, 10).get(0)) + .isEqualTo(taskId); assertThat(historyService.createHistoricTaskInstanceQuery().taskInvolvedGroups(Collections.singleton("testGroup")).singleResult().getId()) .isEqualTo(taskId); assertThat(historyService.createHistoricTaskInstanceQuery() diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/identity/GroupQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/identity/GroupQueryTest.java index 7b94985d373..63b9942ae9a 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/identity/GroupQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/identity/GroupQueryTest.java @@ -221,6 +221,7 @@ public void testQueryInvalidSortingUsage() { private void verifyQueryResults(GroupQuery query, int countExpected) { assertThat(query.list()).hasSize(countExpected); assertThat(query.listIds()).hasSize(countExpected); + assertThat(query.listIdsPage(0, countExpected)).hasSize(countExpected); assertThat(query.count()).isEqualTo(countExpected); if (countExpected == 1) { diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/mgmt/ExternalWorkerJobQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/mgmt/ExternalWorkerJobQueryTest.java index afcb80ea7e0..e06891847bc 100755 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/mgmt/ExternalWorkerJobQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/mgmt/ExternalWorkerJobQueryTest.java @@ -65,6 +65,7 @@ public void testQueryByNoCriteria() { .extracting(ExternalWorkerJob::getProcessInstanceId) .containsOnly(processInstance.getId()); assertThat(query.listIds()).hasSize(2); + assertThat(query.listIdsPage(0, 10)).hasSize(2); } @Test @@ -88,6 +89,7 @@ public void testQueryByProcessInstanceId() { assertThat(query.count()).isZero(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.singleResult()).isNull(); } diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/nonpublic/EventSubscriptionQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/nonpublic/EventSubscriptionQueryTest.java index 3d6cc72de57..133c4b643e9 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/nonpublic/EventSubscriptionQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/nonpublic/EventSubscriptionQueryTest.java @@ -62,9 +62,11 @@ public Void execute(CommandContext commandContext) { assertThat(newEventSubscriptionQuery().eventName("messageName").list()).hasSize(2); assertThat(newEventSubscriptionQuery().eventName("messageName").listIds()).hasSize(2); + assertThat(newEventSubscriptionQuery().eventName("messageName").listIdsPage(0, 10)).hasSize(2); assertThat(newEventSubscriptionQuery().eventName("messageName2").list()).hasSize(1); assertThat(newEventSubscriptionQuery().eventName("messageName2").listIds()).hasSize(1); + assertThat(newEventSubscriptionQuery().eventName("messageName2").listIdsPage(0, 10)).hasSize(1); cleanDb(); @@ -74,6 +76,7 @@ public Void execute(CommandContext commandContext) { public void testQueryByEventType() { processEngineConfiguration.getCommandExecutor().execute(new Command() { + @Override public Void execute(CommandContext commandContext) { EventSubscriptionService eventSubscriptionService = processEngineConfiguration.getEventSubscriptionServiceConfiguration().getEventSubscriptionService(); @@ -95,9 +98,11 @@ public Void execute(CommandContext commandContext) { assertThat(newEventSubscriptionQuery().eventType("signal").list()).hasSize(1); assertThat(newEventSubscriptionQuery().eventType("signal").listIds()).hasSize(1); + assertThat(newEventSubscriptionQuery().eventType("signal").listIdsPage(0, 10)).hasSize(1); assertThat(newEventSubscriptionQuery().eventType("message").list()).hasSize(2); assertThat(newEventSubscriptionQuery().eventType("message").listIds()).hasSize(2); + assertThat(newEventSubscriptionQuery().eventType("message").listIdsPage(0, 10)).hasSize(2); cleanDb(); @@ -131,9 +136,11 @@ public Void execute(CommandContext commandContext) { assertThat(newEventSubscriptionQuery().activityId("someOtherActivity").list()).hasSize(1); assertThat(newEventSubscriptionQuery().activityId("someOtherActivity").listIds()).hasSize(1); + assertThat(newEventSubscriptionQuery().activityId("someOtherActivity").listIdsPage(0, 10)).hasSize(1); assertThat(newEventSubscriptionQuery().activityId("someActivity").eventType("message").list()).hasSize(2); assertThat(newEventSubscriptionQuery().activityId("someActivity").eventType("message").listIds()).hasSize(2); + assertThat(newEventSubscriptionQuery().activityId("someActivity").eventType("message").listIdsPage(0, 10)).hasSize(2); cleanDb(); diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/repository/DeploymentQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/repository/DeploymentQueryTest.java index f4b09a1d057..e68156c26a0 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/repository/DeploymentQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/repository/DeploymentQueryTest.java @@ -61,6 +61,7 @@ public void testQueryNoCriteria() { DeploymentQuery query = repositoryService.createDeploymentQuery(); assertThat(query.list()).hasSize(2); assertThat(query.listIds()).hasSize(2); + assertThat(query.listIdsPage(0, 10)).hasSize(2); assertThat(query.count()).isEqualTo(2); assertThatThrownBy(() -> query.singleResult()) @@ -73,6 +74,7 @@ public void testQueryByDeploymentId() { assertThat(query.singleResult()).isNotNull(); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); } @@ -82,6 +84,7 @@ public void testQueryByInvalidDeploymentId() { assertThat(query.singleResult()).isNull(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.count()).isZero(); assertThatThrownBy(() -> repositoryService.createDeploymentQuery().deploymentId(null)) @@ -93,6 +96,7 @@ public void testQueryByDeploymentIds() { DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentIds(Arrays.asList(deploymentOneId, deploymentTwoId, "dummy")); assertThat(query.list()).hasSize(2); assertThat(query.listIds()).hasSize(2); + assertThat(query.listIdsPage(0, 10)).hasSize(2); assertThat(query.count()).isEqualTo(2); } @@ -102,6 +106,7 @@ public void testQueryByInvalidDeploymentIds() { assertThat(query.singleResult()).isNull(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.count()).isZero(); assertThatThrownBy(() -> repositoryService.createDeploymentQuery().deploymentIds(null)) @@ -115,6 +120,7 @@ public void testQueryByName() { assertThat(query.singleResult()).isNotNull(); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); } @@ -124,6 +130,7 @@ public void testQueryByInvalidName() { assertThat(query.singleResult()).isNull(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.count()).isZero(); assertThatThrownBy(() -> repositoryService.createDeploymentQuery().deploymentName(null)) @@ -135,6 +142,7 @@ public void testQueryByNameLike() { DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentNameLike("%flowable%"); assertThat(query.list()).hasSize(2); assertThat(query.listIds()).hasSize(2); + assertThat(query.listIdsPage(0, 10)).hasSize(2); assertThat(query.count()).isEqualTo(2); assertThatThrownBy(() -> query.singleResult()) @@ -147,6 +155,7 @@ public void testQueryByInvalidNameLike() { assertThat(query.singleResult()).isNull(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.count()).isZero(); assertThatThrownBy(() -> repositoryService.createDeploymentQuery().deploymentNameLike(null)) @@ -158,6 +167,7 @@ public void testQueryByNameAndCategory() { DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentCategory("testCategory").deploymentNameLike("%flowable%"); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); assertThat(query.singleResult()).isNotNull(); } @@ -167,6 +177,7 @@ public void testQueryByProcessDefinitionKey() { DeploymentQuery query = repositoryService.createDeploymentQuery().processDefinitionKey("one"); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); assertThat(query.singleResult()).isNotNull(); } @@ -176,6 +187,7 @@ public void testQueryByProcessDefinitionKeyLike() { DeploymentQuery query = repositoryService.createDeploymentQuery().processDefinitionKeyLike("%o%"); assertThat(query.list()).hasSize(2); assertThat(query.listIds()).hasSize(2); + assertThat(query.listIdsPage(0, 10)).hasSize(2); assertThat(query.count()).isEqualTo(2); } @@ -189,6 +201,7 @@ public void testQueryByProcessDefinitionKeyLikeMultipleProcessDefinitions() { DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentId(deploymentId).processDefinitionKeyLike("%o%"); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); repositoryService.deleteDeployment(deploymentId, true); @@ -199,6 +212,7 @@ public void testQueryByInvalidProcessDefinitionKeyLike() { DeploymentQuery query = repositoryService.createDeploymentQuery().processDefinitionKeyLike("invalid"); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.count()).isZero(); } @@ -213,6 +227,8 @@ public void testVerifyDeploymentProperties() { ); assertThat(repositoryService.createDeploymentQuery().orderByDeploymentName().asc().listIds()) .containsExactly(deploymentOneId, deploymentTwoId); + assertThat(repositoryService.createDeploymentQuery().orderByDeploymentName().asc().listIdsPage(0, 10)) + .containsExactly(deploymentOneId, deploymentTwoId); deployments = repositoryService.createDeploymentQuery().deploymentNameLike("%one%").orderByDeploymentName().asc().list(); assertThat(deployments) @@ -222,12 +238,16 @@ public void testVerifyDeploymentProperties() { ); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("%one%").orderByDeploymentName().asc().listIds()) .containsExactly(deploymentOneId); + assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("%one%").orderByDeploymentName().asc().listIdsPage(0, 10)) + .containsExactly(deploymentOneId); assertThat(repositoryService.createDeploymentQuery().orderByDeploymentId().asc().list()).hasSize(2); assertThat(repositoryService.createDeploymentQuery().orderByDeploymentId().asc().listIds()).hasSize(2); + assertThat(repositoryService.createDeploymentQuery().orderByDeploymentId().asc().listIdsPage(0, 10)).hasSize(2); assertThat(repositoryService.createDeploymentQuery().orderByDeploymentTime().asc().list()).hasSize(2); assertThat(repositoryService.createDeploymentQuery().orderByDeploymentTime().asc().listIds()).hasSize(2); + assertThat(repositoryService.createDeploymentQuery().orderByDeploymentTime().asc().listIdsPage(0, 10)).hasSize(2); } @@ -260,6 +280,7 @@ public void testQueryByParentDeploymentId() { assertThat(repositoryService.createDeploymentQuery().parentDeploymentId("parent1").singleResult().getId()).isEqualTo(deploymentId); assertThat(repositoryService.createDeploymentQuery().parentDeploymentId("parent1").list()).hasSize(1); assertThat(repositoryService.createDeploymentQuery().parentDeploymentId("parent1").listIds()).hasSize(1); + assertThat(repositoryService.createDeploymentQuery().parentDeploymentId("parent1").listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createDeploymentQuery().parentDeploymentId("parent1").count()).isEqualTo(1); } @@ -268,6 +289,7 @@ public void testQueryByInvalidParentDeploymentId() { assertThat(repositoryService.createDeploymentQuery().parentDeploymentId("invalid").singleResult()).isNull(); assertThat(repositoryService.createDeploymentQuery().parentDeploymentId("invalid").list()).isEmpty(); assertThat(repositoryService.createDeploymentQuery().parentDeploymentId("invalid").listIds()).isEmpty(); + assertThat(repositoryService.createDeploymentQuery().parentDeploymentId("invalid").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createDeploymentQuery().parentDeploymentId("invalid").count()).isZero(); } @@ -290,6 +312,7 @@ public void testQueryByParentDeploymentIds() { deploymentIdsForAutoCleanup.add(otherDeploymentId); assertThat(repositoryService.createDeploymentQuery().parentDeploymentIds(Arrays.asList("parent1", "parent2", "dummy")).list()).hasSize(2); assertThat(repositoryService.createDeploymentQuery().parentDeploymentIds(Arrays.asList("parent1", "parent2", "dummy")).listIds()).hasSize(2); + assertThat(repositoryService.createDeploymentQuery().parentDeploymentIds(Arrays.asList("parent1", "parent2", "dummy")).listIdsPage(0, 10)).hasSize(2); assertThat(repositoryService.createDeploymentQuery().parentDeploymentIds(Arrays.asList("parent1", "dummy")).singleResult()).isNotNull(); } diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/repository/ModelQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/repository/ModelQueryTest.java index 7a4368f1e80..61810e8944a 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/repository/ModelQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/repository/ModelQueryTest.java @@ -71,6 +71,7 @@ public void testQueryNoCriteria() { ModelQuery query = repositoryService.createModelQuery(); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); } @@ -82,6 +83,7 @@ public void testQueryByName() throws Exception { assertThat(new String(repositoryService.getModelEditorSource(model.getId()), StandardCharsets.UTF_8)).isEqualTo("bytes"); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); } @@ -91,6 +93,7 @@ public void testQueryByInvalidName() { assertThat(query.singleResult()).isNull(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.count()).isZero(); } @@ -102,6 +105,7 @@ public void testQueryByNameLike() throws Exception { assertThat(new String(repositoryService.getModelEditorSource(model.getId()), StandardCharsets.UTF_8)).isEqualTo("bytes"); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); } @@ -111,6 +115,7 @@ public void testQueryByInvalidNameLike() { assertThat(query.singleResult()).isNull(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.count()).isZero(); } @@ -121,6 +126,7 @@ public void testQueryByKey() { assertThat(model).isNotNull(); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); } @@ -131,6 +137,7 @@ public void testQueryByNameAndKey() { assertThat(model).isNotNull(); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); } @@ -140,6 +147,7 @@ public void testQueryByInvalidKey() { assertThat(query.singleResult()).isNull(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.count()).isZero(); } @@ -148,6 +156,7 @@ public void testQueryByCategory() { ModelQuery query = repositoryService.createModelQuery().modelCategory("test"); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); } @@ -157,6 +166,7 @@ public void testQueryByInvalidCategory() { assertThat(query.singleResult()).isNull(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.count()).isZero(); } @@ -165,6 +175,7 @@ public void testQueryByCategoryLike() { ModelQuery query = repositoryService.createModelQuery().modelCategoryLike("%te%"); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); } @@ -174,6 +185,7 @@ public void testQueryByInvalidCategoryLike() { assertThat(query.singleResult()).isNull(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.count()).isZero(); } @@ -182,6 +194,7 @@ public void testQueryByCategoryNotEquals() { ModelQuery query = repositoryService.createModelQuery().modelCategoryNotEquals("aap"); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); } @@ -190,6 +203,7 @@ public void testQueryByVersion() { ModelQuery query = repositoryService.createModelQuery().modelVersion(1); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); assertThat(query.count()).isEqualTo(1); } @@ -232,6 +246,7 @@ public void testNotDeployed() { assertThat(query.count()).isEqualTo(1); assertThat(query.list()).hasSize(1); assertThat(query.listIds()).hasSize(1); + assertThat(query.listIdsPage(0, 10)).hasSize(1); } @Test @@ -283,6 +298,7 @@ public void testVerifyModelProperties() { assertThat(repositoryService.createModelQuery().orderByModelId().asc().list()).hasSize(1); assertThat(repositoryService.createModelQuery().orderByModelId().asc().listIds()).hasSize(1); + assertThat(repositoryService.createModelQuery().orderByModelId().asc().listIdsPage(0, 10)).hasSize(1); } @Test diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/repository/ProcessDefinitionQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/repository/ProcessDefinitionQueryTest.java index b15151707b6..0027d67ad19 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/repository/ProcessDefinitionQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/repository/ProcessDefinitionQueryTest.java @@ -316,6 +316,7 @@ public void testQuerySorting() { private void verifyQueryResults(ProcessDefinitionQuery query, int countExpected) { assertThat(query.list()).hasSize(countExpected); assertThat(query.listIds()).hasSize(countExpected); + assertThat(query.listIdsPage(0, 10)).hasSize(countExpected); assertThat(query.count()).isEqualTo(countExpected); if (countExpected == 1) { diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ExecutionQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ExecutionQueryTest.java index 2ceec8cb729..af1c731e199 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ExecutionQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ExecutionQueryTest.java @@ -89,9 +89,11 @@ public void testQueryByProcessDefinitionKey() { // Concurrent process with 3 executions for each process instance assertThat(runtimeService.createExecutionQuery().processDefinitionKey(CONCURRENT_PROCESS_KEY).list()).hasSize(12); assertThat(runtimeService.createExecutionQuery().processDefinitionKey(CONCURRENT_PROCESS_KEY).listIds()).hasSize(12); + assertThat(runtimeService.createExecutionQuery().processDefinitionKey(CONCURRENT_PROCESS_KEY).listIdsPage(0, 100)).hasSize(12); assertThat(runtimeService.createExecutionQuery().processDefinitionKey(SEQUENTIAL_PROCESS_KEY).list()).hasSize(2); assertThat(runtimeService.createExecutionQuery().processDefinitionKey(SEQUENTIAL_PROCESS_KEY).listIds()).hasSize(2); + assertThat(runtimeService.createExecutionQuery().processDefinitionKey(SEQUENTIAL_PROCESS_KEY).listIdsPage(0, 10)).hasSize(2); } @Test @@ -116,6 +118,7 @@ public void testQueryByInvalidProcessDefinitionKey() { assertThat(query.singleResult()).isNull(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.count()).isZero(); } @@ -124,6 +127,7 @@ public void testQueryByProcessDefinitionCategory() { // Concurrent process with 3 executions for each process instance assertThat(runtimeService.createExecutionQuery().processDefinitionCategory(CONCURRENT_PROCESS_CATEGORY).list()).hasSize(12); assertThat(runtimeService.createExecutionQuery().processDefinitionCategory(CONCURRENT_PROCESS_CATEGORY).listIds()).hasSize(12); + assertThat(runtimeService.createExecutionQuery().processDefinitionCategory(CONCURRENT_PROCESS_CATEGORY).listIdsPage(0, 100)).hasSize(12); assertThat(runtimeService.createExecutionQuery().processDefinitionCategory(SEQUENTIAL_PROCESS_CATEGORY).list()).hasSize(2); } @@ -133,6 +137,7 @@ public void testQueryByInvalidProcessDefinitionCategory() { assertThat(query.singleResult()).isNull(); assertThat(query.list()).isEmpty(); assertThat(query.listIds()).isEmpty(); + assertThat(query.listIdsPage(0, 10)).isEmpty(); assertThat(query.count()).isZero(); } @@ -141,6 +146,7 @@ public void testQueryByProcessDefinitionName() { // Concurrent process with 3 executions for each process instance assertThat(runtimeService.createExecutionQuery().processDefinitionName(CONCURRENT_PROCESS_NAME).list()).hasSize(12); assertThat(runtimeService.createExecutionQuery().processDefinitionName(CONCURRENT_PROCESS_NAME).listIds()).hasSize(12); + assertThat(runtimeService.createExecutionQuery().processDefinitionName(CONCURRENT_PROCESS_NAME).listIdsPage(0, 100)).hasSize(12); assertThat(runtimeService.createExecutionQuery().processDefinitionName(SEQUENTIAL_PROCESS_NAME).list()).hasSize(2); } diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceAndVariablesQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceAndVariablesQueryTest.java index 1ccba8e4771..c440ca49cd6 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceAndVariablesQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceAndVariablesQueryTest.java @@ -86,6 +86,7 @@ public void testQuery() { List instanceList = runtimeService.createProcessInstanceQuery().includeProcessVariables().list(); assertThat(instanceList).hasSize(7); assertThat(runtimeService.createProcessInstanceQuery().includeProcessVariables().listIds()).hasSize(7); + assertThat(runtimeService.createProcessInstanceQuery().includeProcessVariables().listIdsPage(0, 10)).hasSize(7); processInstance = runtimeService.createProcessInstanceQuery().includeProcessVariables() .variableValueLike("casetest", "MyCase%").singleResult(); diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceQueryTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceQueryTest.java index bbe1156703e..cf434c605fe 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceQueryTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/ProcessInstanceQueryTest.java @@ -101,6 +101,7 @@ public void testQueryNoSpecificsList() { assertThat(query.count()).isEqualTo(PROCESS_DEPLOY_COUNT); assertThat(query.list()).hasSize(PROCESS_DEPLOY_COUNT); assertThat(query.listIds()).hasSize(PROCESS_DEPLOY_COUNT); + assertThat(query.listIdsPage(0, 10)).hasSize(PROCESS_DEPLOY_COUNT); } @Test @@ -116,6 +117,7 @@ public void testQueryByProcessDefinitionKeySingleResult() { assertThat(query.count()).isEqualTo(PROCESS_DEFINITION_KEY_2_DEPLOY_COUNT); assertThat(query.list()).hasSize(PROCESS_DEFINITION_KEY_2_DEPLOY_COUNT); assertThat(query.listIds()).hasSize(PROCESS_DEFINITION_KEY_2_DEPLOY_COUNT); + assertThat(query.listIdsPage(0, 10)).hasSize(PROCESS_DEFINITION_KEY_2_DEPLOY_COUNT); assertThat(query.singleResult()).isNotNull(); } @@ -124,6 +126,7 @@ public void testQueryByInvalidProcessDefinitionKey() { assertThat(runtimeService.createProcessInstanceQuery().processDefinitionKey("invalid").singleResult()).isNull(); assertThat(runtimeService.createProcessInstanceQuery().processDefinitionKey("invalid").list()).isEmpty(); assertThat(runtimeService.createProcessInstanceQuery().processDefinitionKey("invalid").listIds()).isEmpty(); + assertThat(runtimeService.createProcessInstanceQuery().processDefinitionKey("invalid").listIdsPage(0, 10)).isEmpty(); } @Test @@ -132,6 +135,7 @@ public void testQueryByProcessDefinitionKeyMultipleResults() { assertThat(query.count()).isEqualTo(PROCESS_DEFINITION_KEY_DEPLOY_COUNT); assertThat(query.list()).hasSize(PROCESS_DEFINITION_KEY_DEPLOY_COUNT); assertThat(query.listIds()).hasSize(PROCESS_DEFINITION_KEY_DEPLOY_COUNT); + assertThat(query.listIdsPage(0, 10)).hasSize(PROCESS_DEFINITION_KEY_DEPLOY_COUNT); assertThatThrownBy(() -> query.singleResult()) .isExactlyInstanceOf(FlowableException.class); } @@ -146,6 +150,7 @@ public void testQueryByProcessDefinitionKeys() { assertThat(query.count()).isEqualTo(PROCESS_DEPLOY_COUNT); assertThat(query.list()).hasSize(PROCESS_DEPLOY_COUNT); assertThat(query.listIds()).hasSize(PROCESS_DEPLOY_COUNT); + assertThat(query.listIdsPage(0, PROCESS_DEPLOY_COUNT)).hasSize(PROCESS_DEPLOY_COUNT); assertThatThrownBy(() -> query.singleResult()) .isExactlyInstanceOf(FlowableException.class); } @@ -165,6 +170,7 @@ public void testQueryByProcessInstanceId() { assertThat(runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult()).isNotNull(); assertThat(runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).list()).hasSize(1); assertThat(runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).listIds().get(0)).isEqualTo(processInstanceId); + assertThat(runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).listIdsPage(0, 10).get(0)).isEqualTo(processInstanceId); } } @@ -210,6 +216,7 @@ public void testQueryByProcessInstanceName() { assertThat(runtimeService.createProcessInstanceQuery().processInstanceName("new name").singleResult()).isNotNull(); assertThat(runtimeService.createProcessInstanceQuery().processInstanceName("new name").list()).hasSize(1); assertThat(runtimeService.createProcessInstanceQuery().processInstanceName("new name").listIds()).hasSize(1); + assertThat(runtimeService.createProcessInstanceQuery().processInstanceName("new name").listIdsPage(0, 10)).hasSize(1); assertThat(runtimeService.createProcessInstanceQuery().processInstanceName("unexisting").singleResult()).isNull(); } @@ -220,7 +227,10 @@ public void testOrQueryByProcessInstanceName() { assertThat(runtimeService.createProcessInstanceQuery().or().processInstanceName("new name").processDefinitionId("undefined").endOr().singleResult()) .isNotNull(); assertThat(runtimeService.createProcessInstanceQuery().or().processInstanceName("new name").processDefinitionId("undefined").endOr().list()).hasSize(1); - assertThat(runtimeService.createProcessInstanceQuery().or().processInstanceName("new name").processDefinitionId("undefined").endOr().listIds()).hasSize(1); + assertThat(runtimeService.createProcessInstanceQuery().or().processInstanceName("new name").processDefinitionId("undefined").endOr().listIds()).hasSize( + 1); + assertThat(runtimeService.createProcessInstanceQuery().or().processInstanceName("new name").processDefinitionId("undefined").endOr() + .listIdsPage(0, 10)).hasSize(1); assertThat(runtimeService.createProcessInstanceQuery() .or() @@ -253,6 +263,7 @@ public void testQueryByProcessInstanceNameLike() { assertThat(runtimeService.createProcessInstanceQuery().processInstanceNameLike("% name").singleResult()).isNotNull(); assertThat(runtimeService.createProcessInstanceQuery().processInstanceNameLike("new name").list()).hasSize(1); assertThat(runtimeService.createProcessInstanceQuery().processInstanceNameLike("new name").listIds()).hasSize(1); + assertThat(runtimeService.createProcessInstanceQuery().processInstanceNameLike("new name").listIdsPage(0, 10)).hasSize(1); assertThat(runtimeService.createProcessInstanceQuery().processInstanceNameLike("%nope").singleResult()).isNull(); } @@ -264,7 +275,9 @@ public void testOrQueryByProcessInstanceNameLike() { .isNotNull(); assertThat(runtimeService.createProcessInstanceQuery().or().processInstanceNameLike("new name").processDefinitionId("undefined").endOr().list()) .hasSize(1); - assertThat(runtimeService.createProcessInstanceQuery().or().processInstanceNameLike("new name").processDefinitionId("undefined").endOr().listIds()) + assertThat(runtimeService.createProcessInstanceQuery().or().processInstanceNameLike("new name").processDefinitionId("undefined").endOr().listIds()); + assertThat(runtimeService.createProcessInstanceQuery().or().processInstanceNameLike("new name").processDefinitionId("undefined").endOr() + .listIdsPage(0, 10)) .hasSize(1); assertThat(runtimeService.createProcessInstanceQuery().or().processInstanceNameLike("%nope").processDefinitionId("undefined").endOr().singleResult()) @@ -402,6 +415,7 @@ public void testQueryByProcessDefinitionIds() { assertThat(query.count()).isEqualTo(PROCESS_DEPLOY_COUNT); assertThat(query.list()).hasSize(PROCESS_DEPLOY_COUNT); assertThat(query.listIds()).hasSize(PROCESS_DEPLOY_COUNT); + assertThat(query.listIdsPage(0, PROCESS_DEPLOY_COUNT)).hasSize(PROCESS_DEPLOY_COUNT); assertThatThrownBy(() -> query.singleResult()) .isExactlyInstanceOf(FlowableException.class); } diff --git a/modules/flowable-event-registry/src/test/java/org/flowable/eventregistry/test/api/repository/ChannelDefinitionQueryTest.java b/modules/flowable-event-registry/src/test/java/org/flowable/eventregistry/test/api/repository/ChannelDefinitionQueryTest.java index 16b1af6413c..60c4ef197aa 100644 --- a/modules/flowable-event-registry/src/test/java/org/flowable/eventregistry/test/api/repository/ChannelDefinitionQueryTest.java +++ b/modules/flowable-event-registry/src/test/java/org/flowable/eventregistry/test/api/repository/ChannelDefinitionQueryTest.java @@ -71,6 +71,7 @@ void queryByParentDeploymentId() { tuple("one", deployment1Id) ); assertThat(repositoryService.createChannelDefinitionQuery().parentDeploymentId("parent1").listIds()).hasSize(1); + assertThat(repositoryService.createChannelDefinitionQuery().parentDeploymentId("parent1").listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createChannelDefinitionQuery().parentDeploymentId("parent1").count()).isEqualTo(1); assertThat(repositoryService.createChannelDefinitionQuery().parentDeploymentId("parent2").list()) @@ -80,10 +81,11 @@ void queryByParentDeploymentId() { tuple("two", deployment2Id) ); assertThat(repositoryService.createChannelDefinitionQuery().parentDeploymentId("parent2").listIds()).hasSize(2); + assertThat(repositoryService.createChannelDefinitionQuery().parentDeploymentId("parent2").listIdsPage(0, 10)).hasSize(2); assertThat(repositoryService.createChannelDefinitionQuery().parentDeploymentId("parent2").count()).isEqualTo(2); assertThat(repositoryService.createChannelDefinitionQuery().parentDeploymentId("unknown").list()).isEmpty(); - assertThat(repositoryService.createChannelDefinitionQuery().parentDeploymentId("unknown").listIds()).isEmpty(); + assertThat(repositoryService.createChannelDefinitionQuery().parentDeploymentId("unknown").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createChannelDefinitionQuery().parentDeploymentId("unknown").count()).isEqualTo(0); } @@ -102,6 +104,7 @@ void queryByNameLikeIgnoreCase() { tuple("two", "Two channel") ); assertThat(repositoryService.createChannelDefinitionQuery().listIds()).hasSize(3); + assertThat(repositoryService.createChannelDefinitionQuery().listIdsPage(0, 10)).hasSize(3); assertThat(repositoryService.createChannelDefinitionQuery().count()).isEqualTo(3); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLike("%channel").list()) @@ -110,6 +113,7 @@ void queryByNameLikeIgnoreCase() { tuple("two", "Two channel") ); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLike("%channel").listIds()).hasSize(1); + assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLike("%channel").listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLike("%channel").count()).isEqualTo(1); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLike("%Channel").list()) @@ -118,6 +122,7 @@ void queryByNameLikeIgnoreCase() { tuple("one", "One Channel") ); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLike("%Channel").listIds()).hasSize(1); + assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLike("%Channel").listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLike("%Channel").count()).isEqualTo(1); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLikeIgnoreCase("%channel").list()) @@ -127,6 +132,7 @@ void queryByNameLikeIgnoreCase() { tuple("two", "Two channel") ); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLikeIgnoreCase("%channel").listIds()).hasSize(2); + assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLikeIgnoreCase("%channel").listIdsPage(0, 10)).hasSize(2); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLikeIgnoreCase("%channel").count()).isEqualTo(2); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLikeIgnoreCase("%Channel").list()) @@ -136,12 +142,14 @@ void queryByNameLikeIgnoreCase() { tuple("two", "Two channel") ); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLikeIgnoreCase("%Channel").listIds()).hasSize(2); + assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLikeIgnoreCase("%Channel").listIdsPage(0, 10)).hasSize(2); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLikeIgnoreCase("%Channel").count()).isEqualTo(2); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLikeIgnoreCase("%dummy").list()) .extracting(ChannelDefinition::getKey, ChannelDefinition::getName) .isEmpty(); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLikeIgnoreCase("%dummy").listIds()).isEmpty(); + assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLikeIgnoreCase("%dummy").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createChannelDefinitionQuery().channelDefinitionNameLikeIgnoreCase("%dummy").count()).isZero(); } diff --git a/modules/flowable-event-registry/src/test/java/org/flowable/eventregistry/test/api/repository/EventDefinitionQueryTest.java b/modules/flowable-event-registry/src/test/java/org/flowable/eventregistry/test/api/repository/EventDefinitionQueryTest.java index 90d0d158505..7ea11deb186 100644 --- a/modules/flowable-event-registry/src/test/java/org/flowable/eventregistry/test/api/repository/EventDefinitionQueryTest.java +++ b/modules/flowable-event-registry/src/test/java/org/flowable/eventregistry/test/api/repository/EventDefinitionQueryTest.java @@ -69,6 +69,7 @@ void queryByParentDeploymentId() { tuple("one", deployment1Id) ); assertThat(repositoryService.createEventDefinitionQuery().parentDeploymentId("parent1").listIds()).hasSize(1); + assertThat(repositoryService.createEventDefinitionQuery().parentDeploymentId("parent1").listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createEventDefinitionQuery().parentDeploymentId("parent1").count()).isEqualTo(1); assertThat(repositoryService.createEventDefinitionQuery().parentDeploymentId("parent2").list()) @@ -78,10 +79,12 @@ void queryByParentDeploymentId() { tuple("two", deployment2Id) ); assertThat(repositoryService.createEventDefinitionQuery().parentDeploymentId("parent2").listIds()).hasSize(2); + assertThat(repositoryService.createEventDefinitionQuery().parentDeploymentId("parent2").listIdsPage(0, 10)).hasSize(2); assertThat(repositoryService.createEventDefinitionQuery().parentDeploymentId("parent2").count()).isEqualTo(2); assertThat(repositoryService.createEventDefinitionQuery().parentDeploymentId("unknown").list()).isEmpty(); assertThat(repositoryService.createEventDefinitionQuery().parentDeploymentId("unknown").listIds()).isEmpty(); + assertThat(repositoryService.createEventDefinitionQuery().parentDeploymentId("unknown").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createEventDefinitionQuery().parentDeploymentId("unknown").count()).isEqualTo(0); } @@ -98,6 +101,7 @@ void queryByNameLikeIgnoreCase() { tuple("two", "My second event") ); assertThat(repositoryService.createEventDefinitionQuery().listIds()).hasSize(2); + assertThat(repositoryService.createEventDefinitionQuery().listIdsPage(0, 10)).hasSize(2); assertThat(repositoryService.createEventDefinitionQuery().count()).isEqualTo(2); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLike("%event").list()) @@ -106,6 +110,7 @@ void queryByNameLikeIgnoreCase() { tuple("two", "My second event") ); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLike("%event").listIds()).hasSize(1); + assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLike("%event").listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLike("%event").count()).isEqualTo(1); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLike("%Event").list()) @@ -114,6 +119,7 @@ void queryByNameLikeIgnoreCase() { tuple("one", "My first Event") ); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLike("%Event").listIds()).hasSize(1); + assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLike("%Event").listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLike("%Event").count()).isEqualTo(1); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLikeIgnoreCase("%event").list()) @@ -123,6 +129,7 @@ void queryByNameLikeIgnoreCase() { tuple("two", "My second event") ); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLikeIgnoreCase("%event").listIds()).hasSize(2); + assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLikeIgnoreCase("%event").listIdsPage(0, 10)).hasSize(2); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLikeIgnoreCase("%event").count()).isEqualTo(2); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLikeIgnoreCase("%Event").list()) @@ -132,12 +139,14 @@ void queryByNameLikeIgnoreCase() { tuple("two", "My second event") ); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLikeIgnoreCase("%Event").listIds()).hasSize(2); + assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLikeIgnoreCase("%Event").listIdsPage(0, 10)).hasSize(2); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLikeIgnoreCase("%Event").count()).isEqualTo(2); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLikeIgnoreCase("%dummy").list()) .extracting(EventDefinition::getKey, EventDefinition::getName) .isEmpty(); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLikeIgnoreCase("%dummy").listIds()).isEmpty(); + assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLikeIgnoreCase("%dummy").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionNameLikeIgnoreCase("%dummy").count()).isZero(); } @@ -152,24 +161,28 @@ void queryByKeyLikeIgnoreCase() { .extracting(EventDefinition::getKey) .containsExactlyInAnyOrder("one", "one-test", "two"); assertThat(repositoryService.createEventDefinitionQuery().listIds()).hasSize(3); + assertThat(repositoryService.createEventDefinitionQuery().listIdsPage(0, 10)).hasSize(3); assertThat(repositoryService.createEventDefinitionQuery().count()).isEqualTo(3); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionKeyLike("%Ne%").list()) .extracting(EventDefinition::getKey) .isEmpty(); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionKeyLike("%Ne%").listIds()).isEmpty(); + assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionKeyLike("%Ne%").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionKeyLike("%Ne%").count()).isZero(); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionKeyLikeIgnoreCase("%Ne%").list()) .extracting(EventDefinition::getKey) .containsExactlyInAnyOrder("one", "one-test"); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionKeyLikeIgnoreCase("%Ne%").listIds()).hasSize(2); + assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionKeyLikeIgnoreCase("%Ne%").listIdsPage(0, 10)).hasSize(2); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionKeyLikeIgnoreCase("%Ne%").count()).isEqualTo(2); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionKeyLikeIgnoreCase("%dummy").list()) .extracting(EventDefinition::getKey) .isEmpty(); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionKeyLikeIgnoreCase("%dummy").listIds()).isEmpty(); + assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionKeyLikeIgnoreCase("%dummy").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createEventDefinitionQuery().eventDefinitionKeyLikeIgnoreCase("%dummy").count()).isZero(); } } diff --git a/modules/flowable-event-registry/src/test/java/org/flowable/eventregistry/test/deployment/DeploymentQueryTest.java b/modules/flowable-event-registry/src/test/java/org/flowable/eventregistry/test/deployment/DeploymentQueryTest.java index fe66962bc44..9d27e4639d9 100644 --- a/modules/flowable-event-registry/src/test/java/org/flowable/eventregistry/test/deployment/DeploymentQueryTest.java +++ b/modules/flowable-event-registry/src/test/java/org/flowable/eventregistry/test/deployment/DeploymentQueryTest.java @@ -85,11 +85,13 @@ public void testQueryById() { assertThat(repositoryService.createDeploymentQuery().deploymentId(deploymentId1).singleResult()).isNotNull(); assertThat(repositoryService.createDeploymentQuery().deploymentId(deploymentId1).list()).hasSize(1); assertThat(repositoryService.createDeploymentQuery().deploymentId(deploymentId1).listIds()).hasSize(1); + assertThat(repositoryService.createDeploymentQuery().deploymentId(deploymentId1).listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createDeploymentQuery().deploymentId(deploymentId1).count()).isEqualTo(1); assertThat(repositoryService.createDeploymentQuery().deploymentId("invalid").singleResult()).isNull(); assertThat(repositoryService.createDeploymentQuery().deploymentId("invalid").list()).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentId("invalid").listIds()).isEmpty(); + assertThat(repositoryService.createDeploymentQuery().deploymentId("invalid").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentId("invalid").count()).isZero(); } @@ -98,11 +100,13 @@ public void testQueryByName() { assertThat(repositoryService.createDeploymentQuery().deploymentName("test2.event").singleResult()).isNotNull(); assertThat(repositoryService.createDeploymentQuery().deploymentName("test2.event").list()).hasSize(1); assertThat(repositoryService.createDeploymentQuery().deploymentName("test2.event").listIds()).hasSize(1); + assertThat(repositoryService.createDeploymentQuery().deploymentName("test2.event").listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createDeploymentQuery().deploymentName("test2.event").count()).isEqualTo(1); assertThat(repositoryService.createDeploymentQuery().deploymentName("invalid").singleResult()).isNull(); assertThat(repositoryService.createDeploymentQuery().deploymentName("invalid").list()).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentName("invalid").listIds()).isEmpty(); + assertThat(repositoryService.createDeploymentQuery().deploymentName("invalid").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentName("invalid").count()).isZero(); } @@ -110,11 +114,13 @@ public void testQueryByName() { public void testQueryByNameLike() { assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("test%").list()).hasSize(3); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("test%").listIds()).hasSize(3); + assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("test%").listIdsPage(0, 10)).hasSize(3); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("test%").count()).isEqualTo(3); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("inva%").singleResult()).isNull(); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("inva").list()).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("inva").listIds()).isEmpty(); + assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("inva").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentNameLike("inva").count()).isZero(); } @@ -122,19 +128,23 @@ public void testQueryByNameLike() { public void testQueryByCategory() { assertThat(repositoryService.createDeploymentQuery().deploymentCategory("testCategoryC").singleResult()).isNotNull(); assertThat(repositoryService.createDeploymentQuery().deploymentCategory("testCategoryC").list()).hasSize(1); + assertThat(repositoryService.createDeploymentQuery().deploymentCategory("testCategoryC").listIdsPage(0, 10)).hasSize(1); assertThat(repositoryService.createDeploymentQuery().deploymentCategory("testCategoryC").count()).isEqualTo(1); assertThat(repositoryService.createDeploymentQuery().deploymentCategory("inva%").singleResult()).isNull(); assertThat(repositoryService.createDeploymentQuery().deploymentCategory("inva%").list()).isEmpty(); + assertThat(repositoryService.createDeploymentQuery().deploymentCategory("inva%").listIdsPage(0, 10)).isEmpty(); assertThat(repositoryService.createDeploymentQuery().deploymentCategory("inva%").count()).isZero(); } @Test public void testQueryByCategoryNotEquals() { assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("testCategoryC").list()).hasSize(2); + assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("testCategoryC").listIdsPage(0, 10)).hasSize(2); assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("testCategoryC").count()).isEqualTo(2); assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("invalid").list()).hasSize(3); + assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("invalid").listIdsPage(0, 10)).hasSize(3); assertThat(repositoryService.createDeploymentQuery().deploymentCategoryNotEquals("invalid").count()).isEqualTo(3); } diff --git a/modules/flowable-idm-engine/src/test/java/org/flowable/idm/engine/test/api/identity/GroupQueryTest.java b/modules/flowable-idm-engine/src/test/java/org/flowable/idm/engine/test/api/identity/GroupQueryTest.java index b33e30a5009..28a305ec65e 100644 --- a/modules/flowable-idm-engine/src/test/java/org/flowable/idm/engine/test/api/identity/GroupQueryTest.java +++ b/modules/flowable-idm-engine/src/test/java/org/flowable/idm/engine/test/api/identity/GroupQueryTest.java @@ -257,6 +257,7 @@ public void testQueryInvalidSortingUsage() { private void verifyQueryResults(GroupQuery query, int countExpected) { assertThat(query.list()).hasSize(countExpected); assertThat(query.listIds()).hasSize(countExpected); + assertThat(query.listIdsPage(0, 10)).hasSize(countExpected); assertThat(query.count()).isEqualTo(countExpected); if (countExpected == 1) { diff --git a/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java b/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java index 34786e909e3..b5c6d7344fb 100644 --- a/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java +++ b/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java @@ -1840,7 +1840,7 @@ public TaskQuery withoutDueDate() { public TaskQuery withoutTaskDueDate() { return withoutDueDate(); } - + @Override public TaskQuery taskInProgressStartDueDate(Date dueDate) { if (orActive) { @@ -2646,6 +2646,12 @@ public List listPage(int firstResult, int maxResults) { return super.listPage(firstResult, maxResults); } + @Override + public List listIdsPage(int firstResult, int maxResults) { + cachedCandidateGroups = null; + return super.listIdsPage(firstResult, maxResults); + } + @Override public long count() { cachedCandidateGroups = null;