Search in sources :

Example 56 with Batch

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

the class BatchStatisticsQueryTest method testStatisticsAllExecutionJobsGenerated.

@Test
public void testStatisticsAllExecutionJobsGenerated() {
    // given
    Batch batch = helper.createMigrationBatchWithSize(3);
    // when
    helper.completeSeedJobs(batch);
    // then
    BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
    assertEquals(3, batchStatistics.getTotalJobs());
    assertEquals(3, batchStatistics.getJobsCreated());
    assertEquals(3, 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)

Example 57 with Batch

use of org.camunda.bpm.engine.batch.Batch 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 58 with Batch

use of org.camunda.bpm.engine.batch.Batch 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 59 with Batch

use of org.camunda.bpm.engine.batch.Batch 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 60 with Batch

use of org.camunda.bpm.engine.batch.Batch 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

Batch (org.camunda.bpm.engine.batch.Batch)324 Test (org.junit.Test)286 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)125 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)95 Job (org.camunda.bpm.engine.runtime.Job)78 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)64 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)32 Date (java.util.Date)28 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)28 AbstractAsyncOperationsTest (org.camunda.bpm.engine.test.api.AbstractAsyncOperationsTest)26 HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)24 ArrayList (java.util.ArrayList)23 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)19 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)18 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)17 ExternalTask (org.camunda.bpm.engine.externaltask.ExternalTask)16 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)15 Deployment (org.camunda.bpm.engine.test.Deployment)15 ExpectedException (org.junit.rules.ExpectedException)14 Matchers.anyString (org.mockito.Matchers.anyString)14