예제 #1
0
        public virtual void testScriptListener()
        {
            var processInstance = runtimeService.StartProcessInstanceByKey("process");

            Assert.True(processInstance.IsEnded);


            if (processEngineRule.ProcessEngineConfiguration.HistoryLevel.Id >=
                ProcessEngineConfigurationImpl.HistorylevelAudit)
            {
                var query = historyService.CreateHistoricVariableInstanceQuery();
                var Count = query.Count();
                Assert.AreEqual(5, Count);

                IHistoricVariableInstance variableInstance = null;
                string[] variableNames = { "start-start", "start-end", "start-take", "end-start", "end-end" };
                foreach (var VariableName in variableNames)
                {
                    variableInstance = query/*.VariableName(VariableName)*/
                                       .First();
                    Assert.NotNull(variableInstance, "Unable ot find variable with name '" + VariableName + "'");
                    Assert.True((bool)variableInstance.Value, "Variable '" + VariableName + "' should be set to true");
                }
            }
        }
예제 #2
0
        public virtual void FAILING_testBoundaryCompensationHandlerHistoryVariableInstance()
        {
            // given a process instance
            IProcessInstance processInstance = runtimeService.StartProcessInstanceByKey("boundaryHandlerProcess");

            // when throwing compensation
            ITask beforeCompensationTask = taskService.CreateTaskQuery().First();

            taskService.Complete(beforeCompensationTask.Id);

            string compensationHandlerActivityInstanceId = runtimeService.GetActivityInstance(processInstance.Id).GetActivityInstances("compensationHandler")[0].Id;

            // . setting a variable via task service API
            ITask compensationHandler = taskService.CreateTaskQuery().First();

            runtimeService.SetVariableLocal(compensationHandler.ExecutionId, "apiVariable", "someValue");

            // . and completing compensation
            taskService.Complete(compensationHandler.Id);

            // then there is a historic variable instance for the variable set by API
            IHistoricVariableInstance historicVariableInstance = historyService.CreateHistoricVariableInstanceQuery().First();

            Assert.NotNull(historicVariableInstance);
            Assert.AreEqual(compensationHandlerActivityInstanceId, historicVariableInstance.ActivityInstanceId);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void Execute(org.Camunda.bpm.Engine.Delegate.IDelegateExecution execution) throws Exception
        public virtual void Execute(IBaseDelegateExecution execution)
        {
            IHistoryService historyService = ((IDelegateExecution)execution).ProcessEngineServices.HistoryService;

            IHistoricVariableInstance variableInstance = historyService.CreateHistoricVariableInstanceQuery() /*.VariableName("listVar")*/.First();

            IList <string> list = (IList <string>)variableInstance.Value;

            // implicit update of the list, should not trigger an update
            // of the value since we deal with historic variables
            list.Add(NEW_ELEMENT);
        }
예제 #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void Execute(org.Camunda.bpm.Engine.Delegate.IDelegateExecution execution) throws Exception
        public virtual void Execute(IBaseDelegateExecution execution)
        {
            IHistoryService historyService = ((IDelegateExecution)execution).ProcessEngineServices.HistoryService;

            IHistoricVariableInstance variableInstance = historyService.CreateHistoricVariableInstanceQuery() /*.VariableName("listVar")*/.First();

            IHistoricVariableUpdate initialUpdate = (IHistoricVariableUpdate)historyService.CreateHistoricDetailQuery() /*.VariableUpdates()*//*/ /.VariableInstanceId(variableInstance.Id)   //.OrderPartiallyByOccurrence()*//*.Asc()*/.First();

                                                    IList <string> list = (IList <string>)initialUpdate.Value;

            // implicit update of the list, should not trigger an update
            // of the value since we deal with historic variables
            list.Add(NEW_ELEMENT);
        }