Java Code Examples for org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl#setBatchOperationHistoryTimeToLive()
The following examples show how to use
org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl#setBatchOperationHistoryTimeToLive() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BatchSetRemovalTimeTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void shouldSetRemovalTimeForBatch_BaseTimeStart() { // given String processInstanceId = testRule.process().serviceTask().deploy().start(); Batch batch = historyService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstanceId), ""); HistoricBatch historicBatch = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .singleResult(); // assume assertThat(historicBatch.getRemovalTime()).isNull(); ProcessEngineConfigurationImpl configuration = testRule.getProcessEngineConfiguration(); configuration.setBatchOperationHistoryTimeToLive("P5D"); configuration.initHistoryCleanup(); HistoricBatchQuery query = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION); // when testRule.syncExec( historyService.setRemovalTimeToHistoricBatches() .calculatedRemovalTime() .byQuery(query) .executeAsync() ); historicBatch = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .singleResult(); // then assertThat(historicBatch.getRemovalTime()).isEqualTo(addDays(CURRENT_DATE, 5)); // clear database managementService.deleteBatch(batch.getId(), true); }
Example 2
Source File: BatchSetRemovalTimeTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void shouldClearRemovalTimeForBatch_BaseTimeEnd() { // given ProcessEngineConfigurationImpl configuration = testRule.getProcessEngineConfiguration(); configuration.setBatchOperationHistoryTimeToLive("P5D"); configuration.initHistoryCleanup(); String processInstanceId = testRule.process().serviceTask().deploy().start(); Batch batch = historyService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstanceId), ""); HistoricBatch historicBatch = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .singleResult(); // assume assertThat(historicBatch.getRemovalTime()).isNotNull(); configuration.setHistoryRemovalTimeStrategy(HISTORY_REMOVAL_TIME_STRATEGY_END); HistoricBatchQuery query = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION); // when testRule.syncExec( historyService.setRemovalTimeToHistoricBatches() .calculatedRemovalTime() .byQuery(query) .executeAsync() ); historicBatch = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .singleResult(); // then assertThat(historicBatch.getRemovalTime()).isNull(); // clear database managementService.deleteBatch(batch.getId(), true); }
Example 3
Source File: BatchSetRemovalTimeTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void shouldSetRemovalTimeForBatch_Null() { // given ProcessEngineConfigurationImpl configuration = testRule.getProcessEngineConfiguration(); configuration.setBatchOperationHistoryTimeToLive("P5D"); configuration.initHistoryCleanup(); String processInstanceId = testRule.process().serviceTask().deploy().start(); Batch batch = historyService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstanceId), ""); HistoricBatch historicBatch = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .singleResult(); // assume assertThat(historicBatch.getRemovalTime()).isNotNull(); HistoricBatchQuery query = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION); // when testRule.syncExec( historyService.setRemovalTimeToHistoricBatches() .clearedRemovalTime() .byQuery(query) .executeAsync() ); historicBatch = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .singleResult(); // then assertThat(historicBatch.getRemovalTime()).isNull(); // clear database managementService.deleteBatch(batch.getId(), true); }
Example 4
Source File: BatchSetRemovalTimeTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void shouldSetRemovalTimeForBatch_ExistingAndNotExistingId() { // given String processInstanceId = testRule.process().serviceTask().deploy().start(); Batch batchOne = historyService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstanceId), ""); HistoricBatch historicBatch = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .singleResult(); // assume assertThat(historicBatch.getRemovalTime()).isNull(); ProcessEngineConfigurationImpl configuration = testRule.getProcessEngineConfiguration(); configuration.setBatchOperationHistoryTimeToLive("P5D"); configuration.initHistoryCleanup(); // when testRule.syncExec( historyService.setRemovalTimeToHistoricBatches() .calculatedRemovalTime() .byIds("notExistingId", batchOne.getId()) .executeAsync() ); historicBatch = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .singleResult(); // then assertThat(historicBatch.getRemovalTime()).isEqualTo(addDays(CURRENT_DATE, 5)); // clear database managementService.deleteBatch(batchOne.getId(), true); }
Example 5
Source File: BatchSetRemovalTimeTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldNotSetRemovalTimeForBatch_BaseTimeNone() { // given ProcessEngineConfigurationImpl configuration = testRule.getProcessEngineConfiguration(); configuration.setHistoryCleanupStrategy("endTimeBased"); configuration.setHistoryRemovalTimeStrategy(HISTORY_REMOVAL_TIME_STRATEGY_NONE); configuration.setBatchOperationHistoryTimeToLive("P5D"); configuration.initHistoryCleanup(); String processInstanceIdOne = testRule.process().serviceTask().deploy().start(); Batch batchOne = historyService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstanceIdOne), ""); testRule.syncExec(batchOne); String processInstanceIdTwo = testRule.process().serviceTask().deploy().start(); Batch batchTwo = historyService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstanceIdTwo), ""); testRule.syncExec(batchTwo); List<HistoricBatch> historicBatches = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .list(); // assume assertThat(historicBatches.get(0).getRemovalTime()).isNull(); assertThat(historicBatches.get(1).getRemovalTime()).isNull(); HistoricBatchQuery query = historyService.createHistoricBatchQuery(); // when testRule.syncExec( historyService.setRemovalTimeToHistoricBatches() .calculatedRemovalTime() .byQuery(query) .executeAsync() ); historicBatches = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .list(); // then assertThat(historicBatches.get(0).getRemovalTime()).isNull(); assertThat(historicBatches.get(1).getRemovalTime()).isNull(); }
Example 6
Source File: BatchSetRemovalTimeTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldClearRemovalTimeForBatch_BaseTimeNone() { // given ProcessEngineConfigurationImpl configuration = testRule.getProcessEngineConfiguration(); configuration.setBatchOperationHistoryTimeToLive("P5D"); configuration.initHistoryCleanup(); String processInstanceIdOne = testRule.process().serviceTask().deploy().start(); Batch batchOne = historyService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstanceIdOne), ""); testRule.syncExec(batchOne); String processInstanceIdTwo = testRule.process().serviceTask().deploy().start(); Batch batchTwo = historyService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstanceIdTwo), ""); testRule.syncExec(batchTwo); List<HistoricBatch> historicBatches = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .list(); // assume assertThat(historicBatches.get(0).getRemovalTime()).isNotNull(); assertThat(historicBatches.get(1).getRemovalTime()).isNotNull(); configuration.setHistoryRemovalTimeStrategy(HISTORY_REMOVAL_TIME_STRATEGY_NONE); HistoricBatchQuery query = historyService.createHistoricBatchQuery(); // when testRule.syncExec( historyService.setRemovalTimeToHistoricBatches() .calculatedRemovalTime() .byQuery(query) .executeAsync() ); historicBatches = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .list(); // then assertThat(historicBatches.get(0).getRemovalTime()).isNull(); assertThat(historicBatches.get(1).getRemovalTime()).isNull(); }
Example 7
Source File: BatchSetRemovalTimeTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldNotSetRemovalTimeForBatch_BaseTimeEnd() { // given ProcessEngineConfigurationImpl configuration = testRule.getProcessEngineConfiguration(); configuration .setHistoryRemovalTimeStrategy(HISTORY_REMOVAL_TIME_STRATEGY_END); String processInstanceId = testRule.process().serviceTask().deploy().start(); Batch batch = historyService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstanceId), ""); HistoricBatch historicBatch = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .singleResult(); // assume assertThat(historicBatch.getRemovalTime()).isNull(); configuration.setBatchOperationHistoryTimeToLive("P5D"); configuration.initHistoryCleanup(); HistoricBatchQuery query = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION); // when testRule.syncExec( historyService.setRemovalTimeToHistoricBatches() .calculatedRemovalTime() .byQuery(query) .executeAsync() ); historicBatch = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .singleResult(); // then assertThat(historicBatch.getRemovalTime()).isNull(); // clear database managementService.deleteBatch(batch.getId(), true); }
Example 8
Source File: BatchSetRemovalTimeTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldSetRemovalTimeForBatch_BaseTimeEnd() { // given ProcessEngineConfigurationImpl configuration = testRule.getProcessEngineConfiguration(); configuration .setHistoryRemovalTimeStrategy(HISTORY_REMOVAL_TIME_STRATEGY_END); String processInstanceId = testRule.process().serviceTask().deploy().start(); Batch batch = historyService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstanceId), ""); ClockUtil.setCurrentTime(addDays(CURRENT_DATE, 1)); testRule.syncExec(batch); HistoricBatch historicBatch = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .singleResult(); // assume assertThat(historicBatch.getRemovalTime()).isNull(); configuration.setBatchOperationHistoryTimeToLive("P5D"); configuration.initHistoryCleanup(); HistoricBatchQuery query = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION); // when testRule.syncExec( historyService.setRemovalTimeToHistoricBatches() .calculatedRemovalTime() .byQuery(query) .executeAsync() ); historicBatch = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .singleResult(); // then assertThat(historicBatch.getRemovalTime()).isEqualTo(addDays(CURRENT_DATE, 5+1)); }
Example 9
Source File: BatchSetRemovalTimeTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldSetRemovalTimeForBatch_BothQueryAndIdsDefined() { // given String processInstanceId = testRule.process().serviceTask().deploy().start(); Batch batchOne = historyService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstanceId), ""); Batch batchTwo = historyService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstanceId), ""); List<HistoricBatch> historicBatches = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .list(); // assume assertThat(historicBatches.get(0).getRemovalTime()).isNull(); assertThat(historicBatches.get(1).getRemovalTime()).isNull(); ProcessEngineConfigurationImpl configuration = testRule.getProcessEngineConfiguration(); configuration.setBatchOperationHistoryTimeToLive("P5D"); configuration.initHistoryCleanup(); HistoricBatchQuery query = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .batchId(batchOne.getId()); // when testRule.syncExec( historyService.setRemovalTimeToHistoricBatches() .calculatedRemovalTime() .byQuery(query) .byIds(batchTwo.getId()) .executeAsync() ); historicBatches = historyService.createHistoricBatchQuery() .type(Batch.TYPE_HISTORIC_PROCESS_INSTANCE_DELETION) .list(); // then assertThat(historicBatches.get(0).getRemovalTime()).isEqualTo(addDays(CURRENT_DATE, 5)); assertThat(historicBatches.get(1).getRemovalTime()).isEqualTo(addDays(CURRENT_DATE, 5)); // clear database managementService.deleteBatch(batchOne.getId(), true); managementService.deleteBatch(batchTwo.getId(), true); }