Search in sources :

Example 36 with HistoricBatch

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

the class RetryIntervalsConfigurationTest method cleanBatch.

@After
public void cleanBatch() {
    Batch batch = managementService.createBatchQuery().singleResult();
    if (batch != null) {
        managementService.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 37 with HistoricBatch

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

the class AbstractBatchAuthorizationTest 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 38 with HistoricBatch

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

the class SetExternalTaskRetriesUserOperationLogTest method removeAllRunningAndHistoricBatches.

@After
public void removeAllRunningAndHistoricBatches() {
    HistoryService historyService = rule.getHistoryService();
    ManagementService managementService = rule.getManagementService();
    for (Batch batch : managementService.createBatchQuery().list()) {
        managementService.deleteBatch(batch.getId(), true);
    }
    // remove history of completed batches
    for (HistoricBatch historicBatch : historyService.createHistoricBatchQuery().list()) {
        historyService.deleteHistoricBatch(historicBatch.getId());
    }
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) ManagementService(org.camunda.bpm.engine.ManagementService) HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) HistoryService(org.camunda.bpm.engine.HistoryService) After(org.junit.After)

Example 39 with HistoricBatch

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

the class BatchModificationHistoryTest method testHistoricBatchForBatchDeletion.

@Test
public void testHistoricBatchForBatchDeletion() {
    ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
    Batch batch = helper.startTransitionAsync("process1", 1, "seq", processDefinition.getId());
    // when
    Date deletionDate = helper.addSecondsToClock(12);
    rule.getManagementService().deleteBatch(batch.getId(), false);
    // then the end time was set for the historic batch
    HistoricBatch historicBatch = helper.getHistoricBatch(batch);
    assertNotNull(historicBatch);
    assertEquals(deletionDate, 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) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Date(java.util.Date) Test(org.junit.Test)

Example 40 with HistoricBatch

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

the class BatchModificationHistoryTest method testHistoricBatchCreation.

@Test
public void testHistoricBatchCreation() {
    // when
    ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
    Batch batch = helper.startAfterAsync("process1", 10, "user1", processDefinition.getId());
    // 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) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) 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