use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.
the class BatchStatisticsQueryTest method testQueryById.
@Test
public void testQueryById() {
// given
helper.createMigrationBatchWithSize(1);
Batch batch = helper.createMigrationBatchWithSize(1);
// when
BatchStatistics statistics = managementService.createBatchStatisticsQuery().batchId(batch.getId()).singleResult();
// then
assertEquals(batch.getId(), statistics.getId());
}
use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.
the class BatchStatisticsQueryTest method testMultipleBatchesStatistics.
@Test
public void testMultipleBatchesStatistics() {
// given
Batch batch1 = helper.createMigrationBatchWithSize(3);
Batch batch2 = helper.createMigrationBatchWithSize(13);
Batch batch3 = helper.createMigrationBatchWithSize(15);
// when
helper.executeJob(helper.getSeedJob(batch2));
helper.completeJobs(batch2, 2);
helper.failExecutionJobs(batch2, 3);
helper.executeJob(helper.getSeedJob(batch3));
deleteMigrationJobs(batch3);
helper.executeJob(helper.getSeedJob(batch3));
helper.completeJobs(batch3, 2);
helper.failExecutionJobs(batch3, 3);
// then
List<BatchStatistics> batchStatisticsList = managementService.createBatchStatisticsQuery().list();
for (BatchStatistics batchStatistics : batchStatisticsList) {
if (batch1.getId().equals(batchStatistics.getId())) {
// batch 1
assertEquals(3, batchStatistics.getTotalJobs());
assertEquals(0, batchStatistics.getJobsCreated());
assertEquals(3, batchStatistics.getRemainingJobs());
assertEquals(0, batchStatistics.getCompletedJobs());
assertEquals(0, batchStatistics.getFailedJobs());
} else if (batch2.getId().equals(batchStatistics.getId())) {
// batch 2
assertEquals(13, batchStatistics.getTotalJobs());
assertEquals(10, batchStatistics.getJobsCreated());
assertEquals(11, batchStatistics.getRemainingJobs());
assertEquals(2, batchStatistics.getCompletedJobs());
assertEquals(3, batchStatistics.getFailedJobs());
} else if (batch3.getId().equals(batchStatistics.getId())) {
// batch 3
assertEquals(15, batchStatistics.getTotalJobs());
assertEquals(15, batchStatistics.getJobsCreated());
assertEquals(3, batchStatistics.getRemainingJobs());
assertEquals(12, batchStatistics.getCompletedJobs());
assertEquals(3, batchStatistics.getFailedJobs());
}
}
}
use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.
the class MultiTenancyBatchQueryTest method testBatchStatisticsQueryFilterByTenant.
@Test
public void testBatchStatisticsQueryFilterByTenant() {
// when
BatchStatistics returnedBatch = managementService.createBatchStatisticsQuery().tenantIdIn(TENANT_ONE).singleResult();
// then
Assert.assertNotNull(returnedBatch);
Assert.assertEquals(tenant1Batch.getId(), returnedBatch.getId());
}
Aggregations