use of org.camunda.bpm.engine.batch.history.HistoricBatch in project camunda-bpm-platform by camunda.
the class RuntimeServiceAsyncOperationsTest method cleanBatch.
@After
public void cleanBatch() {
List<Batch> batches = managementService.createBatchQuery().list();
if (batches.size() > 0) {
for (Batch batch : batches) managementService.deleteBatch(batch.getId(), true);
}
HistoricBatch historicBatch = historyService.createHistoricBatchQuery().singleResult();
if (historicBatch != null) {
historyService.deleteHistoricBatch(historicBatch.getId());
}
}
use of org.camunda.bpm.engine.batch.history.HistoricBatch in project camunda-bpm-platform by camunda.
the class BatchCreationAuthorizationTest 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());
}
}
use of org.camunda.bpm.engine.batch.history.HistoricBatch in project camunda-bpm-platform by camunda.
the class ManagementServiceAsyncOperationsTest 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());
}
}
use of org.camunda.bpm.engine.batch.history.HistoricBatch in project camunda-bpm-platform by camunda.
the class HistoryCleanupHistoricBatchTest method testBatchOperationTypeConfigurationOnly.
@Test
public void testBatchOperationTypeConfigurationOnly() {
Map<String, String> map = new HashMap<String, String>();
map.put("instance-migration", "P2D");
map.put("instance-deletion", DEFAULT_TTL_DAYS);
processEngineConfiguration.setBatchOperationHistoryTimeToLive(null);
processEngineConfiguration.setBatchOperationsForHistoryCleanup(map);
processEngineConfiguration.initHistoryCleanup();
assertNull(processEngineConfiguration.getBatchOperationHistoryTimeToLive());
Date startDate = ClockUtil.getCurrentTime();
int daysInThePast = -11;
ClockUtil.setCurrentTime(DateUtils.addDays(startDate, daysInThePast));
List<String> batchIds = new ArrayList<String>();
int migrationCountBatch = 10;
batchIds.addAll(createMigrationBatchList(migrationCountBatch));
int cancelationCountBatch = 20;
batchIds.addAll(createCancelationBatchList(cancelationCountBatch));
ClockUtil.setCurrentTime(DateUtils.addDays(startDate, -7));
for (String batchId : batchIds) {
managementService.deleteBatch(batchId, false);
}
ClockUtil.setCurrentTime(new Date());
// when
List<HistoricBatch> historicList = historyService.createHistoricBatchQuery().list();
assertEquals(30, historicList.size());
String jobId = historyService.cleanUpHistoryAsync(true).getId();
managementService.executeJob(jobId);
// then
assertEquals(0, historyService.createHistoricBatchQuery().count());
for (String batchId : batchIds) {
assertEquals(0, historyService.createHistoricJobLogQuery().jobDefinitionConfiguration(batchId).count());
}
}
use of org.camunda.bpm.engine.batch.history.HistoricBatch in project camunda-bpm-platform by camunda.
the class MultiTenancyBatchTest method testHistoricBatchTenantId.
@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testHistoricBatchTenantId() {
// given
batchHelper.migrateProcessInstanceAsync(tenant1Definition, tenant1Definition);
// then
HistoricBatch historicBatch = historyService.createHistoricBatchQuery().singleResult();
Assert.assertEquals(TENANT_ONE, historicBatch.getTenantId());
}
Aggregations