Search in sources :

Example 11 with BatchStatistics

use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.

the class BatchStatisticsQueryTest method testStatisticsRetriedFailedJobs.

@Test
public void testStatisticsRetriedFailedJobs() {
    // given
    Batch batch = helper.createMigrationBatchWithSize(3);
    // when
    helper.completeSeedJobs(batch);
    helper.failExecutionJobs(batch, 3);
    // then
    BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
    assertEquals(3, batchStatistics.getTotalJobs());
    assertEquals(3, batchStatistics.getJobsCreated());
    assertEquals(3, batchStatistics.getRemainingJobs());
    assertEquals(0, batchStatistics.getCompletedJobs());
    assertEquals(3, batchStatistics.getFailedJobs());
    // when
    helper.setRetries(batch, 3, 1);
    helper.completeJobs(batch, 3);
    // then
    batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
    assertEquals(3, batchStatistics.getTotalJobs());
    assertEquals(3, batchStatistics.getJobsCreated());
    assertEquals(0, batchStatistics.getRemainingJobs());
    assertEquals(3, 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 12 with BatchStatistics

use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.

the class BatchStatisticsQueryTest method testStatisticsActivate.

@Test
public void testStatisticsActivate() {
    // given
    Batch batch = helper.migrateProcessInstancesAsync(1);
    managementService.suspendBatchById(batch.getId());
    // when
    managementService.activateBatchById(batch.getId());
    // then
    BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().batchId(batch.getId()).singleResult();
    assertFalse(batchStatistics.isSuspended());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) BatchStatistics(org.camunda.bpm.engine.batch.BatchStatistics) Test(org.junit.Test)

Example 13 with BatchStatistics

use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.

the class BatchStatisticsQueryTest method testStatisticsOneCompletedJob.

@Test
public void testStatisticsOneCompletedJob() {
    // given
    Batch batch = helper.createMigrationBatchWithSize(3);
    // when
    helper.completeSeedJobs(batch);
    helper.completeJobs(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(0, batchStatistics.getFailedJobs());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) BatchStatistics(org.camunda.bpm.engine.batch.BatchStatistics) Test(org.junit.Test)

Example 14 with BatchStatistics

use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.

the class BatchStatisticsQueryTest method testStatisticsWithNotAllGeneratedAndAlreadyCompletedAndFailedJobs.

@Test
public void testStatisticsWithNotAllGeneratedAndAlreadyCompletedAndFailedJobs() {
    // given
    Batch batch = helper.createMigrationBatchWithSize(13);
    // when
    helper.executeJob(helper.getSeedJob(batch));
    helper.completeJobs(batch, 2);
    helper.failExecutionJobs(batch, 2);
    // then
    BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
    assertEquals(13, batchStatistics.getTotalJobs());
    assertEquals(10, batchStatistics.getJobsCreated());
    assertEquals(11, batchStatistics.getRemainingJobs());
    assertEquals(2, batchStatistics.getCompletedJobs());
    assertEquals(2, batchStatistics.getFailedJobs());
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) BatchStatistics(org.camunda.bpm.engine.batch.BatchStatistics) Test(org.junit.Test)

Example 15 with BatchStatistics

use of org.camunda.bpm.engine.batch.BatchStatistics in project camunda-bpm-platform by camunda.

the class BatchStatisticsQueryTest method testStatisticsMostExecutionJobsGenerated.

@Test
public void testStatisticsMostExecutionJobsGenerated() {
    // given
    Batch batch = helper.createMigrationBatchWithSize(13);
    // when
    helper.executeJob(helper.getSeedJob(batch));
    // then
    BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
    assertEquals(13, batchStatistics.getTotalJobs());
    assertEquals(10, batchStatistics.getJobsCreated());
    assertEquals(13, batchStatistics.getRemainingJobs());
    assertEquals(0, 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)

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