use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.
the class BatchStatisticsQueryTest method testQuery.
@Test
public void testQuery() {
List<BatchStatistics> statistics = managementService.createBatchStatisticsQuery().list();
assertEquals(0, statistics.size());
Batch batch1 = helper.createMigrationBatchWithSize(1);
statistics = managementService.createBatchStatisticsQuery().list();
assertEquals(1, statistics.size());
assertEquals(batch1.getId(), statistics.get(0).getId());
Batch batch2 = helper.createMigrationBatchWithSize(1);
Batch batch3 = helper.createMigrationBatchWithSize(1);
statistics = managementService.createBatchStatisticsQuery().list();
assertEquals(3, statistics.size());
helper.completeBatch(batch1);
helper.completeBatch(batch3);
statistics = managementService.createBatchStatisticsQuery().list();
assertEquals(1, statistics.size());
assertEquals(batch2.getId(), statistics.get(0).getId());
helper.completeBatch(batch2);
statistics = managementService.createBatchStatisticsQuery().list();
assertEquals(0, statistics.size());
}
use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.
the class BatchStatisticsQueryTest method testStatisticsNoExecutionJobsGenerated.
@Test
public void testStatisticsNoExecutionJobsGenerated() {
// given
helper.createMigrationBatchWithSize(3);
// when
BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
// then
assertEquals(3, batchStatistics.getTotalJobs());
assertEquals(0, batchStatistics.getJobsCreated());
assertEquals(3, batchStatistics.getRemainingJobs());
assertEquals(0, batchStatistics.getCompletedJobs());
assertEquals(0, batchStatistics.getFailedJobs());
}
use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.
the class BatchStatisticsQueryTest method testStatisticsOneCompletedAndOneFailedJob.
@Test
public void testStatisticsOneCompletedAndOneFailedJob() {
// given
Batch batch = helper.createMigrationBatchWithSize(3);
// when
helper.completeSeedJobs(batch);
helper.completeJobs(batch, 1);
helper.failExecutionJobs(batch, 1);
// then
BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
assertEquals(3, batchStatistics.getTotalJobs());
assertEquals(3, batchStatistics.getJobsCreated());
assertEquals(2, batchStatistics.getRemainingJobs());
assertEquals(1, 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 testStatisticsWithDeletedJobs.
@Test
public void testStatisticsWithDeletedJobs() {
// given
Batch batch = helper.createMigrationBatchWithSize(13);
// when
helper.executeJob(helper.getSeedJob(batch));
deleteMigrationJobs(batch);
// then
BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
assertEquals(13, batchStatistics.getTotalJobs());
assertEquals(10, batchStatistics.getJobsCreated());
assertEquals(3, batchStatistics.getRemainingJobs());
assertEquals(10, batchStatistics.getCompletedJobs());
assertEquals(0, batchStatistics.getFailedJobs());
}
use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.
the class BatchStatisticsQueryTest method testStatisticsSuspend.
@Test
public void testStatisticsSuspend() {
// given
Batch batch = helper.migrateProcessInstancesAsync(1);
// when
managementService.suspendBatchById(batch.getId());
// then
BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().batchId(batch.getId()).singleResult();
assertTrue(batchStatistics.isSuspended());
}
Aggregations