public virtual void testExceptionThrownBySecondScopeServiceTaskIsNotHandled()
        {
            IDictionary <object, object> beans = processEngineConfiguration.Beans;

            beans["dummyServiceTask"]        = new DummyServiceTask();
            processEngineConfiguration.Beans = beans;
            try
            {
                IDictionary <string, ITypedValue> variables = new Dictionary <string, ITypedValue>();
                variables["Count"] = new IntegerValueImpl(0);

                runtimeService.StartProcessInstanceByKey("process", variables);
                //Assert.Fail();
            }
            // since the NVE extends the ProcessEngineException we have to handle it
            // separately
            catch (NullValueException e) //
            {
                Assert.Fail("Shouldn't have received NullValueException");
            }
            catch (ProcessEngineException e)
            {
                // Assert.That(e.Message.Contains("Invalid format"));
                Assert.IsTrue(true);
            }
        }
        public virtual void TestDefaultSequenceFlowOnTask()
        {
            IDictionary <string, ITypedValue> variables = new Dictionary <string, ITypedValue>();

            variables["input"] = new IntegerValueImpl(2);

            string procId = runtimeService.StartProcessInstanceByKey("defaultSeqFlow", variables).Id;

            Assert.NotNull(
                runtimeService.CreateExecutionQuery(c => c.ProcessInstanceId == procId && c.ActivityId == "task2").First());
            variables["input"] = new IntegerValueImpl(3);
            procId             = runtimeService.StartProcessInstanceByKey("defaultSeqFlow", variables).Id;
            Assert.NotNull(
                runtimeService.CreateExecutionQuery(c => c.ProcessInstanceId == procId && c.ActivityId == "task3").First());
            variables["input"] = new IntegerValueImpl(123);
            procId             = runtimeService.StartProcessInstanceByKey("defaultSeqFlow", variables).Id;
            Assert.NotNull(
                runtimeService.CreateExecutionQuery(c => c.ProcessInstanceId == procId && c.ActivityId == "task1").First());
        }
Example #3
0
            public override IntegerValue convertFromTypedValue(TypedValue typedValue)
            {
                if (typedValue.Type != org.camunda.bpm.engine.variable.type.ValueType_Fields.NUMBER)
                {
                    throw unsupportedConversion(typedValue.Type);
                }

                IntegerValueImpl integerValue = null;
                NumberValue      numberValue  = (NumberValue)typedValue;

                if (numberValue.Value != null)
                {
                    integerValue = (IntegerValueImpl)Variables.integerValue(numberValue.Value.intValue());
                }
                else
                {
                    integerValue = (IntegerValueImpl)Variables.integerValue(null);
                }
                integerValue.Transient = numberValue.Transient;
                return(integerValue);
            }