Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testlocalConfigurationWithNestedChangingExpression() throws java.text.ParseException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testlocalConfigurationWithNestedChangingExpression()
        {
            BpmnModelInstance bpmnModelInstance = Bpmn.createExecutableProcess("process").startEvent().serviceTask().camundaClass("foo").camundaAsyncBefore().camundaFailedJobRetryTimeCycle("${var}").endEvent().done();

            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
            DateTime         startDate        = simpleDateFormat.parse("2017-01-01T09:55:00");

            ClockUtil.CurrentTime = startDate;

            testRule.deploy(bpmnModelInstance);

            VariableMap @params = Variables.createVariables();

            @params.putValue("var", "${nestedVar1},PT15M,${nestedVar3}");
            @params.putValue("nestedVar", "PT13M");
            @params.putValue("nestedVar1", "PT5M");
            @params.putValue("nestedVar3", "PT25M");
            ProcessInstance pi = runtimeService.startProcessInstanceByKey("process", @params);

            ClockUtil.CurrentTime = SIMPLE_DATE_FORMAT.parse("2017-01-01T09:55:00");

            assertNotNull(pi);

            DateTime currentTime = SIMPLE_DATE_FORMAT.parse("2017-01-01T10:00:00");

            ClockUtil.CurrentTime = currentTime;

            string processInstanceId = pi.ProcessInstanceId;

            int jobRetries = executeJob(processInstanceId);

            assertEquals(3, jobRetries);
            currentTime = DateUtils.addMinutes(currentTime, 5);
            assertLockExpirationTime(currentTime);
            ClockUtil.CurrentTime = currentTime;

            jobRetries = executeJob(processInstanceId);
            assertEquals(2, jobRetries);
            currentTime = DateUtils.addMinutes(currentTime, 15);
            assertLockExpirationTime(currentTime);
            ClockUtil.CurrentTime = currentTime;

            runtimeService.setVariable(pi.ProcessInstanceId, "var", "${nestedVar}");

            jobRetries = executeJob(processInstanceId);
            assertEquals(1, jobRetries);
            currentTime = DateUtils.addMinutes(currentTime, 13);
            assertLockExpirationTime(currentTime);
            ClockUtil.CurrentTime = currentTime;

            jobRetries = executeJob(processInstanceId);
            assertEquals(0, jobRetries);
        }
Ejemplo n.º 2
0
 public virtual CaseInstanceBuilder setVariable(string variableName, object variableValue)
 {
     ensureNotNull(typeof(NotValidException), "variableName", variableName);
     if (variables == null)
     {
         variables = Variables.createVariables();
     }
     variables.putValue(variableName, variableValue);
     return(this);
 }