public virtual CountResultDto getCleanableHistoricProcessInstanceReportCount(UriInfo uriInfo) { CleanableHistoricProcessInstanceReportDto queryDto = new CleanableHistoricProcessInstanceReportDto(objectMapper, uriInfo.QueryParameters); queryDto.ObjectMapper = objectMapper; CleanableHistoricProcessInstanceReport query = queryDto.toQuery(processEngine); long count = query.count(); CountResultDto result = new CountResultDto(); result.Count = count; return(result); }
public virtual IList <CleanableHistoricProcessInstanceReportResultDto> getCleanableHistoricProcessInstanceReport(UriInfo uriInfo, int?firstResult, int?maxResults) { CleanableHistoricProcessInstanceReportDto queryDto = new CleanableHistoricProcessInstanceReportDto(objectMapper, uriInfo.QueryParameters); CleanableHistoricProcessInstanceReport query = queryDto.toQuery(processEngine); IList <CleanableHistoricProcessInstanceReportResult> reportResult; if (firstResult != null || maxResults != null) { reportResult = executePaginatedQuery(query, firstResult, maxResults); } else { reportResult = query.list(); } return(CleanableHistoricProcessInstanceReportResultDto.convert(reportResult)); }
private void setupHistoryReportMock() { CleanableHistoricProcessInstanceReport report = mock(typeof(CleanableHistoricProcessInstanceReport)); when(report.processDefinitionIdIn(anyString())).thenReturn(report); when(report.processDefinitionKeyIn(anyString())).thenReturn(report); CleanableHistoricProcessInstanceReportResult reportResult = mock(typeof(CleanableHistoricProcessInstanceReportResult)); when(reportResult.ProcessDefinitionId).thenReturn(EXAMPLE_PROCESS_DEFINITION_ID); when(reportResult.ProcessDefinitionKey).thenReturn(EXAMPLE_PD_KEY); when(reportResult.ProcessDefinitionName).thenReturn(EXAMPLE_PD_NAME); when(reportResult.ProcessDefinitionVersion).thenReturn(EXAMPLE_PD_VERSION); when(reportResult.HistoryTimeToLive).thenReturn(EXAMPLE_TTL); when(reportResult.FinishedProcessInstanceCount).thenReturn(EXAMPLE_FINISHED_PI_COUNT); when(reportResult.CleanableProcessInstanceCount).thenReturn(EXAMPLE_CLEANABLE_PI_COUNT); when(reportResult.TenantId).thenReturn(EXAMPLE_TENANT_ID); CleanableHistoricProcessInstanceReportResult anotherReportResult = mock(typeof(CleanableHistoricProcessInstanceReportResult)); when(anotherReportResult.ProcessDefinitionId).thenReturn(ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID); when(anotherReportResult.ProcessDefinitionKey).thenReturn(ANOTHER_EXAMPLE_PD_KEY); when(anotherReportResult.ProcessDefinitionName).thenReturn("pdName"); when(anotherReportResult.ProcessDefinitionVersion).thenReturn(33); when(anotherReportResult.HistoryTimeToLive).thenReturn(null); when(anotherReportResult.FinishedProcessInstanceCount).thenReturn(13l); when(anotherReportResult.CleanableProcessInstanceCount).thenReturn(0l); when(anotherReportResult.TenantId).thenReturn(ANOTHER_EXAMPLE_TENANT_ID); IList <CleanableHistoricProcessInstanceReportResult> mocks = new List <CleanableHistoricProcessInstanceReportResult>(); mocks.Add(reportResult); mocks.Add(anotherReportResult); when(report.list()).thenReturn(mocks); when(report.count()).thenReturn((long)mocks.Count); historicProcessInstanceReport = report; when(processEngine.HistoryService.createCleanableHistoricProcessInstanceReport()).thenReturn(historicProcessInstanceReport); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testReportByInvalidProcessDefinitionKey() public virtual void testReportByInvalidProcessDefinitionKey() { CleanableHistoricProcessInstanceReport report = historyService.createCleanableHistoricProcessInstanceReport(); try { report.processDefinitionKeyIn(null); fail("Expected NotValidException"); } catch (NotValidException) { // expected } try { report.processDefinitionKeyIn("abc", null, "def"); fail("Expected NotValidException"); } catch (NotValidException) { // expected } }
private IList <CleanableHistoricProcessInstanceReportResult> executePaginatedQuery(CleanableHistoricProcessInstanceReport query, int?firstResult, int?maxResults) { if (firstResult == null) { firstResult = 0; } if (maxResults == null) { maxResults = int.MaxValue; } return(query.listPage(firstResult, maxResults)); }