public virtual void initEngineConfiguration(ProcessEngineConfigurationImpl engineConfiguration) { engineConfiguration.setHistoryRemovalTimeStrategy(HISTORY_REMOVAL_TIME_STRATEGY_END).setHistoryRemovalTimeProvider(new DefaultHistoryRemovalTimeProvider()).initHistoryRemovalTime(); engineConfiguration.HistoryCleanupStrategy = HISTORY_CLEANUP_STRATEGY_REMOVAL_TIME_BASED; engineConfiguration.HistoryCleanupBatchSize = MAX_BATCH_SIZE; engineConfiguration.HistoryCleanupBatchWindowStartTime = "13:00"; engineConfiguration.HistoryCleanupDegreeOfParallelism = 1; engineConfiguration.initHistoryCleanup(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testScheduleJobForBatchWindow() throws java.text.ParseException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testScheduleJobForBatchWindow() { ClockUtil.CurrentTime = currentDate; processEngineConfiguration.initHistoryCleanup(); Job job = historyService.cleanUpHistoryAsync(); assertFalse(startDateForCheck > job.Duedate); // job due date is not before start date assertTrue(endDateForCheck > job.Duedate); ClockUtil.CurrentTime = DateUtils.addMinutes(endDateForCheck, -1); job = historyService.cleanUpHistoryAsync(); assertFalse(startDateForCheck > job.Duedate); assertTrue(endDateForCheck > job.Duedate); ClockUtil.CurrentTime = DateUtils.addMinutes(endDateForCheck, 1); job = historyService.cleanUpHistoryAsync(); assertTrue(endDateForCheck < job.Duedate); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @AfterClass public static void tearDownAfterAll() public static void tearDownAfterAll() { if (processEngineConfiguration != null) { processEngineConfiguration.setHistoryRemovalTimeProvider(null).setHistoryRemovalTimeStrategy(null).initHistoryRemovalTime(); processEngineConfiguration.BatchOperationHistoryTimeToLive = null; processEngineConfiguration.BatchOperationsForHistoryCleanup = null; processEngineConfiguration.initHistoryCleanup(); } ClockUtil.reset(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testBatchOperationTypeConfigurationOnly() public virtual void testBatchOperationTypeConfigurationOnly() { IDictionary <string, string> map = new Dictionary <string, string>(); map["instance-migration"] = "P2D"; map["instance-deletion"] = DEFAULT_TTL_DAYS; processEngineConfiguration.BatchOperationHistoryTimeToLive = null; processEngineConfiguration.BatchOperationsForHistoryCleanup = map; processEngineConfiguration.initHistoryCleanup(); assertNull(processEngineConfiguration.BatchOperationHistoryTimeToLive); DateTime startDate = ClockUtil.CurrentTime; int daysInThePast = -11; ClockUtil.CurrentTime = DateUtils.addDays(startDate, daysInThePast); IList <string> batchIds = new List <string>(); int migrationCountBatch = 10; ((IList <string>)batchIds).AddRange(createMigrationBatchList(migrationCountBatch)); int cancelationCountBatch = 20; ((IList <string>)batchIds).AddRange(createCancelationBatchList(cancelationCountBatch)); ClockUtil.CurrentTime = DateUtils.addDays(startDate, -7); foreach (string batchId in batchIds) { managementService.deleteBatch(batchId, false); } ClockUtil.CurrentTime = DateTime.Now; // when IList <HistoricBatch> historicList = historyService.createHistoricBatchQuery().list(); assertEquals(30, historicList.Count); runHistoryCleanup(); // then assertEquals(0, historyService.createHistoricBatchQuery().count()); foreach (string batchId in batchIds) { assertEquals(0, historyService.createHistoricJobLogQuery().jobDefinitionConfiguration(batchId).count()); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @AfterClass public static void tearDownAfterAll() public static void tearDownAfterAll() { if (engineConfiguration != null) { engineConfiguration.setHistoryRemovalTimeProvider(null).setHistoryRemovalTimeStrategy(null).initHistoryRemovalTime(); engineConfiguration.HistoryCleanupStrategy = HISTORY_CLEANUP_STRATEGY_END_TIME_BASED; engineConfiguration.HistoryCleanupBatchSize = MAX_BATCH_SIZE; engineConfiguration.HistoryCleanupBatchWindowStartTime = null; engineConfiguration.HistoryCleanupDegreeOfParallelism = 1; engineConfiguration.initHistoryCleanup(); } ClockUtil.reset(); }
public void execute(ProcessEngine engine, string scenarioName) { for (int i = 0; i < 60; i++) { if (i % 4 == 0) { ClockUtil.CurrentTime = FIXED_DATE; engine.RuntimeService.startProcessInstanceByKey("oneTaskProcess_710", "HistoryCleanupScenario"); string taskId = engine.TaskService.createTaskQuery().processInstanceBusinessKey("HistoryCleanupScenario").singleResult().Id; ClockUtil.CurrentTime = addMinutes(FIXED_DATE, i); engine.TaskService.complete(taskId); } } ProcessEngineConfigurationImpl configuration = ((ProcessEngineConfigurationImpl)engine.ProcessEngineConfiguration); configuration.HistoryCleanupBatchWindowStartTime = "13:00"; configuration.HistoryCleanupBatchWindowEndTime = "14:00"; configuration.HistoryCleanupDegreeOfParallelism = 3; configuration.initHistoryCleanup(); engine.HistoryService.cleanUpHistoryAsync(); IList <Job> jobs = engine.HistoryService.findHistoryCleanupJobs(); for (int i = 0; i < 4; i++) { Job jobOne = jobs[0]; engine.ManagementService.executeJob(jobOne.Id); Job jobTwo = jobs[1]; engine.ManagementService.executeJob(jobTwo.Id); Job jobThree = jobs[2]; engine.ManagementService.executeJob(jobThree.Id); } ClockUtil.reset(); }
protected internal virtual void initBatchOperationHistoryTimeToLive() { configuration.BatchOperationHistoryTimeToLive = "P0D"; configuration.initHistoryCleanup(); }
public virtual void testHistoryCleanup() { if (RollingUpdateConstants.OLD_ENGINE_TAG.Equals(rule.Tag)) { // test cleanup with old engine DateTime currentDate = addDays(FIXED_DATE, 1); ClockUtil.CurrentTime = currentDate; ProcessEngineConfigurationImpl configuration = rule.ProcessEngineConfiguration; configuration.HistoryCleanupBatchWindowStartTime = "13:00"; configuration.HistoryCleanupBatchWindowEndTime = "15:00"; configuration.HistoryCleanupDegreeOfParallelism = 3; configuration.initHistoryCleanup(); IList <Job> jobs = rule.HistoryService.findHistoryCleanupJobs(); Job jobOne = jobs[0]; rule.ManagementService.executeJob(jobOne.Id); Job jobTwo = jobs[1]; rule.ManagementService.executeJob(jobTwo.Id); Job jobThree = jobs[2]; rule.ManagementService.executeJob(jobThree.Id); jobs = rule.HistoryService.findHistoryCleanupJobs(); // assume foreach (Job job in jobs) { assertThat(job.Duedate, @is(addSeconds(currentDate, (int)(Math.Pow(2.0, (double)4) * 10)))); } IList <HistoricProcessInstance> processInstances = rule.HistoryService.createHistoricProcessInstanceQuery().processInstanceBusinessKey("HistoryCleanupScenario").list(); // assume assertThat(jobs.Count, @is(3)); assertThat(processInstances.Count, @is(15)); ClockUtil.CurrentTime = addDays(currentDate, 5); // when rule.ManagementService.executeJob(jobOne.Id); processInstances = rule.HistoryService.createHistoricProcessInstanceQuery().processInstanceBusinessKey("HistoryCleanupScenario").list(); // then assertThat(processInstances.Count, @is(10)); // when rule.ManagementService.executeJob(jobTwo.Id); processInstances = rule.HistoryService.createHistoricProcessInstanceQuery().processInstanceBusinessKey("HistoryCleanupScenario").list(); // then assertThat(processInstances.Count, @is(5)); // when rule.ManagementService.executeJob(jobThree.Id); processInstances = rule.HistoryService.createHistoricProcessInstanceQuery().processInstanceBusinessKey("HistoryCleanupScenario").list(); // then assertThat(processInstances.Count, @is(0)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testReportMixedConfiguration() public virtual void testReportMixedConfiguration() { IDictionary <string, string> map = new Dictionary <string, string>(); int modOperationsTTL = 20; map["instance-modification"] = "P20D"; int defaultTTL = 5; processEngineConfiguration.BatchOperationHistoryTimeToLive = "P5D"; processEngineConfiguration.BatchOperationsForHistoryCleanup = map; processEngineConfiguration.initHistoryCleanup(); DateTime startDate = DateTime.Now; int daysInThePast = -11; ClockUtil.CurrentTime = DateUtils.addDays(startDate, daysInThePast); Batch modificationBatch = createModificationBatch(); IList <string> batchIds = new List <string>(); batchIds.Add(modificationBatch.Id); int migrationCountBatch = 10; IList <string> batchIds1 = new List <string>(); ((IList <string>)batchIds1).AddRange(createMigrationBatchList(migrationCountBatch)); int cancelationCountBatch = 20; IList <string> batchIds2 = new List <string>(); ((IList <string>)batchIds2).AddRange(createCancelationBatchList(cancelationCountBatch)); ClockUtil.CurrentTime = DateUtils.addDays(startDate, -8); foreach (string batchId in batchIds) { managementService.deleteBatch(batchId, false); } ClockUtil.CurrentTime = DateUtils.addDays(startDate, -2); for (int i = 0; i < 4; i++) { managementService.deleteBatch(batchIds1[i], false); } ClockUtil.CurrentTime = DateUtils.addDays(startDate, -7); for (int i = 6; i < batchIds1.Count; i++) { managementService.deleteBatch(batchIds1[i], false); } ClockUtil.CurrentTime = DateUtils.addDays(startDate, -10); for (int i = 0; i < 7; i++) { managementService.deleteBatch(batchIds2[i], false); } ClockUtil.CurrentTime = DateUtils.addDays(startDate, -5); for (int i = 7; i < 11; i++) { managementService.deleteBatch(batchIds2[i], false); } ClockUtil.CurrentTime = DateUtils.addDays(startDate, -1); for (int i = 13; i < batchIds2.Count; i++) { managementService.deleteBatch(batchIds2[i], false); } ClockUtil.CurrentTime = DateUtils.addSeconds(startDate, 1); // when IList <HistoricBatch> historicList = historyService.createHistoricBatchQuery().list(); assertEquals(31, historicList.Count); IList <CleanableHistoricBatchReportResult> list = historyService.createCleanableHistoricBatchReport().list(); assertEquals(3, list.Count); foreach (CleanableHistoricBatchReportResult result in list) { if (result.BatchType.Equals("instance-migration")) { checkResultNumbers(result, 4, 8, defaultTTL); } else if (result.BatchType.Equals("instance-modification")) { checkResultNumbers(result, 0, 1, modOperationsTTL); } else if (result.BatchType.Equals("instance-deletion")) { checkResultNumbers(result, 11, 18, defaultTTL); } } }