Search in sources :

Example 11 with HistoricBatch

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

the class HistoryServiceAsyncOperationsTest method cleanBatch.

@After
public void cleanBatch() {
    Batch batch = managementService.createBatchQuery().singleResult();
    if (batch != null) {
        managementService.deleteBatch(batch.getId(), true);
    }
    HistoricBatch historicBatch = historyService.createHistoricBatchQuery().singleResult();
    if (historicBatch != null) {
        historyService.deleteHistoricBatch(historicBatch.getId());
    }
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) After(org.junit.After)

Example 12 with HistoricBatch

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

the class BatchModificationAuthorizationTest method cleanBatch.

@After
public void cleanBatch() {
    Batch batch = engineRule.getManagementService().createBatchQuery().singleResult();
    if (batch != null) {
        engineRule.getManagementService().deleteBatch(batch.getId(), true);
    }
    HistoricBatch historicBatch = engineRule.getHistoryService().createHistoricBatchQuery().singleResult();
    if (historicBatch != null) {
        engineRule.getHistoryService().deleteHistoricBatch(historicBatch.getId());
    }
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) After(org.junit.After)

Example 13 with HistoricBatch

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

the class BatchModificationHistoryTest method testDeleteHistoricBatch.

@Test
public void testDeleteHistoricBatch() {
    ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
    Batch batch = helper.startTransitionAsync("process1", 1, "seq", processDefinition.getId());
    helper.executeSeedJob(batch);
    helper.executeJobs(batch);
    helper.executeMonitorJob(batch);
    // when
    HistoricBatch historicBatch = helper.getHistoricBatch(batch);
    rule.getHistoryService().deleteHistoricBatch(historicBatch.getId());
    // then the historic batch was removed and all job logs
    assertNull(helper.getHistoricBatch(batch));
    assertTrue(helper.getHistoricSeedJobLog(batch).isEmpty());
    assertTrue(helper.getHistoricMonitorJobLog(batch).isEmpty());
    assertTrue(helper.getHistoricBatchJobLog(batch).isEmpty());
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 14 with HistoricBatch

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

the class BatchMigrationHistoryTest method testHistoricBatchCompletion.

@Test
public void testHistoricBatchCompletion() {
    Batch batch = helper.migrateProcessInstancesAsync(1);
    helper.executeSeedJob(batch);
    helper.executeJobs(batch);
    Date endDate = helper.addSecondsToClock(12);
    // when
    helper.executeMonitorJob(batch);
    // then the historic batch has an end time set
    HistoricBatch historicBatch = helper.getHistoricBatch(batch);
    assertNotNull(historicBatch);
    assertEquals(endDate, historicBatch.getEndTime());
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) Date(java.util.Date) Test(org.junit.Test)

Example 15 with HistoricBatch

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

the class BatchMigrationHistoryTest method testHistoricBatchCreation.

@Test
public void testHistoricBatchCreation() {
    // when
    Batch batch = helper.migrateProcessInstancesAsync(10);
    // then a historic batch was created
    HistoricBatch historicBatch = helper.getHistoricBatch(batch);
    assertNotNull(historicBatch);
    assertEquals(batch.getId(), historicBatch.getId());
    assertEquals(batch.getType(), historicBatch.getType());
    assertEquals(batch.getTotalJobs(), historicBatch.getTotalJobs());
    assertEquals(batch.getBatchJobsPerSeed(), historicBatch.getBatchJobsPerSeed());
    assertEquals(batch.getInvocationsPerBatchJob(), historicBatch.getInvocationsPerBatchJob());
    assertEquals(batch.getSeedJobDefinitionId(), historicBatch.getSeedJobDefinitionId());
    assertEquals(batch.getMonitorJobDefinitionId(), historicBatch.getMonitorJobDefinitionId());
    assertEquals(batch.getBatchJobDefinitionId(), historicBatch.getBatchJobDefinitionId());
    assertEquals(START_DATE, historicBatch.getStartTime());
    assertNull(historicBatch.getEndTime());
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) Test(org.junit.Test)

Aggregations

HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)45 Batch (org.camunda.bpm.engine.batch.Batch)34 Test (org.junit.Test)26 Date (java.util.Date)13 After (org.junit.After)12 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)4 HistoryService (org.camunda.bpm.engine.HistoryService)4 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)4 ManagementService (org.camunda.bpm.engine.ManagementService)3 CleanableHistoricBatchReportResult (org.camunda.bpm.engine.history.CleanableHistoricBatchReportResult)3 HistoricBatchQuery (org.camunda.bpm.engine.batch.history.HistoricBatchQuery)2 HashSet (java.util.HashSet)1 List (java.util.List)1 HashedMap (org.apache.commons.collections.map.HashedMap)1 BatchEntity (org.camunda.bpm.engine.impl.batch.BatchEntity)1 HistoricBatchEntity (org.camunda.bpm.engine.impl.batch.history.HistoricBatchEntity)1 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)1 HistoricBatchManager (org.camunda.bpm.engine.impl.persistence.entity.HistoricBatchManager)1 HistoricBatchDto (org.camunda.bpm.engine.rest.dto.history.batch.HistoricBatchDto)1