public virtual CountResultDto getCleanableHistoricCaseInstanceReportCount(UriInfo uriInfo) { CleanableHistoricCaseInstanceReportDto queryDto = new CleanableHistoricCaseInstanceReportDto(objectMapper, uriInfo.QueryParameters); queryDto.ObjectMapper = objectMapper; CleanableHistoricCaseInstanceReport query = queryDto.toQuery(processEngine); long count = query.count(); CountResultDto result = new CountResultDto(); result.Count = count; return(result); }
private void setupHistoryReportMock() { CleanableHistoricCaseInstanceReport report = mock(typeof(CleanableHistoricCaseInstanceReport)); when(report.caseDefinitionIdIn(anyString())).thenReturn(report); when(report.caseDefinitionKeyIn(anyString())).thenReturn(report); CleanableHistoricCaseInstanceReportResult reportResult = mock(typeof(CleanableHistoricCaseInstanceReportResult)); when(reportResult.CaseDefinitionId).thenReturn(EXAMPLE_CD_ID); when(reportResult.CaseDefinitionKey).thenReturn(EXAMPLE_CD_KEY); when(reportResult.CaseDefinitionName).thenReturn(EXAMPLE_CD_NAME); when(reportResult.CaseDefinitionVersion).thenReturn(EXAMPLE_CD_VERSION); when(reportResult.HistoryTimeToLive).thenReturn(EXAMPLE_TTL); when(reportResult.FinishedCaseInstanceCount).thenReturn(EXAMPLE_FINISHED_CI_COUNT); when(reportResult.CleanableCaseInstanceCount).thenReturn(EXAMPLE_CLEANABLE_CI_COUNT); when(reportResult.TenantId).thenReturn(EXAMPLE_TENANT_ID); CleanableHistoricCaseInstanceReportResult anotherReportResult = mock(typeof(CleanableHistoricCaseInstanceReportResult)); when(anotherReportResult.CaseDefinitionId).thenReturn(ANOTHER_EXAMPLE_CD_ID); when(anotherReportResult.CaseDefinitionKey).thenReturn(ANOTHER_EXAMPLE_CD_KEY); when(anotherReportResult.CaseDefinitionName).thenReturn("cdName"); when(anotherReportResult.CaseDefinitionVersion).thenReturn(33); when(anotherReportResult.HistoryTimeToLive).thenReturn(null); when(anotherReportResult.FinishedCaseInstanceCount).thenReturn(13l); when(anotherReportResult.CleanableCaseInstanceCount).thenReturn(0l); when(anotherReportResult.TenantId).thenReturn(ANOTHER_EXAMPLE_TENANT_ID); IList <CleanableHistoricCaseInstanceReportResult> mocks = new List <CleanableHistoricCaseInstanceReportResult>(); mocks.Add(reportResult); mocks.Add(anotherReportResult); when(report.list()).thenReturn(mocks); when(report.count()).thenReturn((long)mocks.Count); historicCaseInstanceReport = report; when(processEngine.HistoryService.createCleanableHistoricCaseInstanceReport()).thenReturn(historicCaseInstanceReport); }