//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testStatisticsQueryByActiveBatches() public virtual void testStatisticsQueryByActiveBatches() { // given Batch batch1 = helper.migrateProcessInstancesAsync(1); Batch batch2 = helper.migrateProcessInstancesAsync(1); Batch batch3 = helper.migrateProcessInstancesAsync(1); // when managementService.suspendBatchById(batch1.Id); managementService.suspendBatchById(batch2.Id); managementService.activateBatchById(batch1.Id); // then BatchStatisticsQuery query = managementService.createBatchStatisticsQuery().active(); Assert.assertEquals(2, query.count()); Assert.assertEquals(2, query.list().size()); IList <string> foundIds = new List <string>(); foreach (Batch batch in query.list()) { foundIds.Add(batch.Id); } assertThat(foundIds, hasItems(batch1.Id, batch3.Id)); }
public virtual IList <BatchStatisticsDto> getStatistics(UriInfo uriInfo, int?firstResult, int?maxResults) { BatchStatisticsQueryDto queryDto = new BatchStatisticsQueryDto(ObjectMapper, uriInfo.QueryParameters); BatchStatisticsQuery query = queryDto.toQuery(ProcessEngine); IList <BatchStatistics> batchStatisticsList; if (firstResult != null || maxResults != null) { batchStatisticsList = executePaginatedStatisticsQuery(query, firstResult, maxResults); } else { batchStatisticsList = query.list(); } IList <BatchStatisticsDto> statisticsResults = new List <BatchStatisticsDto>(); foreach (BatchStatistics batchStatistics in batchStatisticsList) { statisticsResults.Add(BatchStatisticsDto.fromBatchStatistics(batchStatistics)); } return(statisticsResults); }
public virtual CountResultDto getStatisticsCount(UriInfo uriInfo) { BatchStatisticsQueryDto queryDto = new BatchStatisticsQueryDto(ObjectMapper, uriInfo.QueryParameters); BatchStatisticsQuery query = queryDto.toQuery(ProcessEngine); long count = query.count(); return(new CountResultDto(count)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUpBatchStatisticsMock() public virtual void setUpBatchStatisticsMock() { mockBatchStatisticsList = MockProvider.createMockBatchStatisticsList(); queryMock = mock(typeof(BatchStatisticsQuery)); when(queryMock.list()).thenReturn(mockBatchStatisticsList); when(queryMock.count()).thenReturn((long)mockBatchStatisticsList.Count); when(processEngine.ManagementService.createBatchStatisticsQuery()).thenReturn(queryMock); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testStatisticsQueryBySuspendedBatches() public virtual void testStatisticsQueryBySuspendedBatches() { // given Batch batch1 = helper.migrateProcessInstancesAsync(1); Batch batch2 = helper.migrateProcessInstancesAsync(1); helper.migrateProcessInstancesAsync(1); // when managementService.suspendBatchById(batch1.Id); managementService.suspendBatchById(batch2.Id); managementService.activateBatchById(batch1.Id); // then BatchStatisticsQuery query = managementService.createBatchStatisticsQuery().suspended(); Assert.assertEquals(1, query.count()); Assert.assertEquals(1, query.list().size()); Assert.assertEquals(batch2.Id, query.singleResult().Id); }
protected internal virtual IList <BatchStatistics> executePaginatedStatisticsQuery(BatchStatisticsQuery query, int?firstResult, int?maxResults) { if (firstResult == null) { firstResult = 0; } if (maxResults == null) { maxResults = int.MaxValue; } return(query.listPage(firstResult, maxResults)); }