//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testBuiltinFunctionMapperRegistration() public virtual void testBuiltinFunctionMapperRegistration() { // given a process engine configuration with a custom function mapper ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().setJdbcUrl("jdbc:h2:mem:camunda" + this.GetType().Name); CustomExpressionManager customExpressionManager = new CustomExpressionManager(); Assert.assertTrue(customExpressionManager.FunctionMappers.Count == 0); config.ExpressionManager = customExpressionManager; // when the engine is initialized engine = config.buildProcessEngine(); // then two default function mappers should be registered Assert.assertSame(customExpressionManager, config.ExpressionManager); Assert.assertEquals(2, customExpressionManager.FunctionMappers.Count); bool commandContextMapperFound = false; bool dateTimeMapperFound = false; foreach (FunctionMapper functionMapper in customExpressionManager.FunctionMappers) { if (functionMapper is CommandContextFunctionMapper) { commandContextMapperFound = true; } if (functionMapper is DateTimeFunctionMapper) { dateTimeMapperFound = true; } } Assert.assertTrue(commandContextMapperFound && dateTimeMapperFound); }
public virtual void testJobExecutorHintConfiguration() { ProcessEngineConfiguration engineConfig1 = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration(); assertTrue("default setting is true", engineConfig1.HintJobExecutor); ProcessEngineConfiguration engineConfig2 = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().setHintJobExecutor(false); assertFalse(engineConfig2.HintJobExecutor); ProcessEngineConfiguration engineConfig3 = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().setHintJobExecutor(true); assertTrue(engineConfig3.HintJobExecutor); }
protected internal virtual ProcessEngineConfigurationImpl createProcessEngineConfiguration() { return((ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().setJdbcUrl("jdbc:h2:mem:camunda" + this.GetType().Name)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testBatchWindow24Hours() throws java.text.ParseException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testBatchWindow24Hours() { //given //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl configuration = (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)org.camunda.bpm.engine.ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration(); ProcessEngineConfigurationImpl configuration = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration(); //we have batch window for 24 hours configuration.HistoryCleanupBatchWindows[DayOfWeek.Monday] = new BatchWindowConfiguration("06:00", "06:00"); configuration.JdbcUrl = "jdbc:h2:mem:camunda" + this.GetType().Name + "testBatchWindow24Hours"; //when //we're on Monday early morning ClockUtil.CurrentTime = sdf.parse("2018-05-14T05:00:00"); //monday //and we bootstrap the engine ProcessEngine engine = configuration.buildProcessEngine(); //then //job is scheduled for Monday 06 AM IList <Job> historyCleanupJobs = engine.HistoryService.findHistoryCleanupJobs(); assertFalse(historyCleanupJobs.Count == 0); assertEquals(1, historyCleanupJobs.Count); assertEquals(sdf.parse("2018-05-14T06:00:00"), historyCleanupJobs[0].Duedate); assertEquals(false, historyCleanupJobs[0].Suspended); //when //we're on Monday afternoon ClockUtil.CurrentTime = sdf.parse("2018-05-14T15:00:00"); //we force history job to be rescheduled engine.ManagementService.executeJob(historyCleanupJobs[0].Id); //then //job is still within current batch window historyCleanupJobs = engine.HistoryService.findHistoryCleanupJobs(); assertFalse(historyCleanupJobs.Count == 0); assertEquals(1, historyCleanupJobs.Count); assertTrue(sdf.parse("2018-05-15T06:00:00").after(historyCleanupJobs[0].Duedate)); assertEquals(false, historyCleanupJobs[0].Suspended); //when //we're on Tuesday early morning close to the end of batch window ClockUtil.CurrentTime = sdf.parse("2018-05-15T05:59:00"); //we force history job to be rescheduled engine.ManagementService.executeJob(historyCleanupJobs[0].Id); //then //job is still within current batch window historyCleanupJobs = engine.HistoryService.findHistoryCleanupJobs(); assertFalse(historyCleanupJobs.Count == 0); assertEquals(1, historyCleanupJobs.Count); assertTrue(sdf.parse("2018-05-15T06:00:00").after(historyCleanupJobs[0].Duedate)); assertEquals(false, historyCleanupJobs[0].Suspended); //when //we're on Tuesday early morning shortly after the end of batch window ClockUtil.CurrentTime = sdf.parse("2018-05-15T06:01:00"); //we force history job to be rescheduled engine.ManagementService.executeJob(historyCleanupJobs[0].Id); //then //job is rescheduled till next Monday historyCleanupJobs = engine.HistoryService.findHistoryCleanupJobs(); assertFalse(historyCleanupJobs.Count == 0); assertEquals(1, historyCleanupJobs.Count); assertEquals(sdf.parse("2018-05-21T06:00:00"), historyCleanupJobs[0].Duedate); assertEquals(false, historyCleanupJobs[0].Suspended); closeProcessEngine(engine); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testBatchWindowOneDayOfWeek() throws java.text.ParseException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testBatchWindowOneDayOfWeek() { ClockUtil.CurrentTime = sdf.parse("2018-05-14T22:00:00"); //monday //given //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl configuration = (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)org.camunda.bpm.engine.ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration(); ProcessEngineConfigurationImpl configuration = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration(); //we have batch window only once per week - Monday afternoon configuration.HistoryCleanupBatchWindows[DayOfWeek.Monday] = new BatchWindowConfiguration("18:00", "20:00"); configuration.JdbcUrl = "jdbc:h2:mem:camunda" + this.GetType().Name + "testBatchWindowOneDayOfWeek"; //when //we're on Monday evening //and we bootstrap the engine ProcessEngine engine = configuration.buildProcessEngine(); //then //job is scheduled for next week Monday IList <Job> historyCleanupJobs = engine.HistoryService.findHistoryCleanupJobs(); assertFalse(historyCleanupJobs.Count == 0); assertEquals(1, historyCleanupJobs.Count); assertEquals(sdf.parse("2018-05-21T18:00:00"), historyCleanupJobs[0].Duedate); //monday next week assertEquals(false, historyCleanupJobs[0].Suspended); //when //we're on Monday evening next week, right aftre the end of batch window ClockUtil.CurrentTime = sdf.parse("2018-05-21T20:00:01"); //monday //we force history job to be rescheduled engine.ManagementService.executeJob(historyCleanupJobs[0].Id); //then //job is scheduled for next week Monday historyCleanupJobs = engine.HistoryService.findHistoryCleanupJobs(); assertFalse(historyCleanupJobs.Count == 0); assertEquals(1, historyCleanupJobs.Count); assertEquals(sdf.parse("2018-05-28T18:00:00"), historyCleanupJobs[0].Duedate); //monday next week assertEquals(false, historyCleanupJobs[0].Suspended); closeProcessEngine(engine); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testHistoryCleanupJobScheduled() throws java.text.ParseException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testHistoryCleanupJobScheduled() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl standaloneInMemProcessEngineConfiguration = (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)org.camunda.bpm.engine.ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration(); ProcessEngineConfigurationImpl standaloneInMemProcessEngineConfiguration = (ProcessEngineConfigurationImpl)ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration(); standaloneInMemProcessEngineConfiguration.HistoryCleanupBatchWindowStartTime = "23:00"; standaloneInMemProcessEngineConfiguration.HistoryCleanupBatchWindowEndTime = "01:00"; standaloneInMemProcessEngineConfiguration.JdbcUrl = "jdbc:h2:mem:camunda" + this.GetType().Name + "testHistoryCleanupJobScheduled"; ProcessEngine engine = standaloneInMemProcessEngineConfiguration.buildProcessEngine(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<org.camunda.bpm.engine.runtime.Job> historyCleanupJobs = engine.getHistoryService().findHistoryCleanupJobs(); IList <Job> historyCleanupJobs = engine.HistoryService.findHistoryCleanupJobs(); assertFalse(historyCleanupJobs.Count == 0); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl processEngineConfiguration = (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) engine.getProcessEngineConfiguration(); ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl)engine.ProcessEngineConfiguration; foreach (Job historyCleanupJob in historyCleanupJobs) { assertEquals(processEngineConfiguration.BatchWindowManager.getCurrentOrNextBatchWindow(ClockUtil.CurrentTime, processEngineConfiguration).Start, historyCleanupJob.Duedate); } closeProcessEngine(engine); }