Search in sources :

Example 16 with BatchStatistics

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());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) BatchStatistics(org.camunda.bpm.engine.batch.BatchStatistics) Test(org.junit.Test)

Example 17 with BatchStatistics

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());
        }
    }
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) BatchStatistics(org.camunda.bpm.engine.batch.BatchStatistics) Test(org.junit.Test)

Example 18 with BatchStatistics

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());
}
Also used : BatchStatistics(org.camunda.bpm.engine.batch.BatchStatistics) Test(org.junit.Test)

Aggregations

BatchStatistics (org.camunda.bpm.engine.batch.BatchStatistics)18 Test (org.junit.Test)16 Batch (org.camunda.bpm.engine.batch.Batch)13 ArrayList (java.util.ArrayList)1 BatchStatisticsQuery (org.camunda.bpm.engine.batch.BatchStatisticsQuery)1 BatchStatisticsDto (org.camunda.bpm.engine.rest.dto.batch.BatchStatisticsDto)1 BatchStatisticsQueryDto (org.camunda.bpm.engine.rest.dto.batch.BatchStatisticsQueryDto)1