Search in sources :

Example 6 with BatchStatistics

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

Example 7 with BatchStatistics

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

Example 8 with BatchStatistics

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

Example 9 with BatchStatistics

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

Example 10 with BatchStatistics

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