use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.
the class BatchRestServiceImpl method getStatistics.
public List<BatchStatisticsDto> getStatistics(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
BatchStatisticsQueryDto queryDto = new BatchStatisticsQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
BatchStatisticsQuery query = queryDto.toQuery(getProcessEngine());
List<BatchStatistics> batchStatisticsList;
if (firstResult != null || maxResults != null) {
batchStatisticsList = executePaginatedStatisticsQuery(query, firstResult, maxResults);
} else {
batchStatisticsList = query.list();
}
List<BatchStatisticsDto> statisticsResults = new ArrayList<BatchStatisticsDto>();
for (BatchStatistics batchStatistics : batchStatisticsList) {
statisticsResults.add(BatchStatisticsDto.fromBatchStatistics(batchStatistics));
}
return statisticsResults;
}
use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.
the class MockBatchStatisticsBuilder method build.
public BatchStatistics build() {
BatchStatistics batchStatistics = mock(BatchStatistics.class);
when(batchStatistics.getId()).thenReturn(id);
when(batchStatistics.getType()).thenReturn(type);
when(batchStatistics.getTotalJobs()).thenReturn(size);
when(batchStatistics.getJobsCreated()).thenReturn(jobsCreated);
when(batchStatistics.getBatchJobsPerSeed()).thenReturn(batchJobsPerSeed);
when(batchStatistics.getInvocationsPerBatchJob()).thenReturn(invocationsPerBatchJob);
when(batchStatistics.getSeedJobDefinitionId()).thenReturn(seedJobDefinitionId);
when(batchStatistics.getMonitorJobDefinitionId()).thenReturn(monitorJobDefinitionId);
when(batchStatistics.getBatchJobDefinitionId()).thenReturn(batchJobDefinitionId);
when(batchStatistics.getTenantId()).thenReturn(tenantId);
when(batchStatistics.getRemainingJobs()).thenReturn(remainingJobs);
when(batchStatistics.getCompletedJobs()).thenReturn(completedJobs);
when(batchStatistics.getFailedJobs()).thenReturn(failedJobs);
when(batchStatistics.isSuspended()).thenReturn(suspended);
return batchStatistics;
}
use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.
the class MultiTenancyBatchQueryTest method testBatchStatisticsQueryFilterWithoutTenantId.
@Test
public void testBatchStatisticsQueryFilterWithoutTenantId() {
// when
BatchStatistics returnedBatch = managementService.createBatchStatisticsQuery().withoutTenantId().singleResult();
// then
Assert.assertNotNull(returnedBatch);
Assert.assertEquals(sharedBatch.getId(), returnedBatch.getId());
}
use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.
the class BatchStatisticsQueryTest method testStatisticsOneFailedJob.
@Test
public void testStatisticsOneFailedJob() {
// given
Batch batch = helper.createMigrationBatchWithSize(3);
// when
helper.completeSeedJobs(batch);
helper.failExecutionJobs(batch, 1);
// then
BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
assertEquals(3, batchStatistics.getTotalJobs());
assertEquals(3, batchStatistics.getJobsCreated());
assertEquals(3, batchStatistics.getRemainingJobs());
assertEquals(0, batchStatistics.getCompletedJobs());
assertEquals(1, batchStatistics.getFailedJobs());
}
use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.
the class BatchStatisticsQueryTest method testStatisticsAllExecutionJobsGenerated.
@Test
public void testStatisticsAllExecutionJobsGenerated() {
// given
Batch batch = helper.createMigrationBatchWithSize(3);
// when
helper.completeSeedJobs(batch);
// then
BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
assertEquals(3, batchStatistics.getTotalJobs());
assertEquals(3, batchStatistics.getJobsCreated());
assertEquals(3, batchStatistics.getRemainingJobs());
assertEquals(0, batchStatistics.getCompletedJobs());
assertEquals(0, batchStatistics.getFailedJobs());
}
Aggregations