Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @Deployment public void testSubTaskData()
        public virtual void testSubTaskData()
        {
            //given simple process with user task
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("subTaskTest");
            Task            task            = taskService.createTaskQuery().processInstanceId(processInstance.Id).singleResult();

            // when set variable to user task
            taskService.setVariable(task.Id, "testVariable", "testValue");

            // then variable is set in the scope of execution
            Assert.assertEquals("testValue", runtimeService.getVariable(task.ExecutionId, "testVariable"));

            // when sub task is created create subtask for user task
            Task subTask = taskService.newTask("123456789");

            subTask.ParentTaskId = task.Id;
            subTask.Name         = "Test Subtask";
            taskService.saveTask(subTask);

            // and variable is update
            taskService.setVariable(subTask.Id, "testVariable", "newTestValue");

            //then variable is also updated in the scope execution
            Assert.assertEquals("newTestValue", runtimeService.getVariable(task.ExecutionId, "testVariable"));
        }
Beispiel #2
0
        public virtual void testLogAllOperationWithAuthentication()
        {
            try
            {
                // given
                identityService.AuthenticatedUserId = USER_ID;
                string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

                string taskId = taskService.createTaskQuery().singleResult().Id;

                // when
                taskService.complete(taskId);

                // then
                assertTrue((bool?)runtimeService.getVariable(processInstanceId, "taskListenerCalled"));
                assertTrue((bool?)runtimeService.getVariable(processInstanceId, "serviceTaskCalled"));

                UserOperationLogQuery query = userOperationLogQuery().userId(USER_ID);
                assertEquals(4, query.count());
                assertEquals(1, query.operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE).count());
                assertEquals(1, query.operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_COMPLETE).count());
                assertEquals(2, query.operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_SET_VARIABLE).count());
            }
            finally
            {
                identityService.clearAuthentication();
            }
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSignalCatchBoundaryWithVariables() throws InterruptedException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testSignalCatchBoundaryWithVariables()
        {
            Dictionary <string, object> variables1 = new Dictionary <string, object>();

            variables1["processName"] = "catchSignal";
            ProcessInstance piCatchSignal = runtimeService.startProcessInstanceByKey("catchSignal", variables1);

            Dictionary <string, object> variables2 = new Dictionary <string, object>();

            variables2["processName"]             = "throwSignal";
            variables2["signalProcessInstanceId"] = piCatchSignal.ProcessInstanceId;
            ProcessInstance piThrowSignal = runtimeService.startProcessInstanceByKey("throwSignal", variables2);

            waitForJobExecutorToProcessAllJobs();

            assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(piCatchSignal.ProcessInstanceId).activityId("receiveTask").count());
            assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(piThrowSignal.ProcessInstanceId).activityId("receiveTask").count());

            // TODO: THis fails because of http://jira.codehaus.org/browse/ACT-1257,
            // should be fixed and re-enabled :-)
            assertEquals("catchSignal-visited (was catchSignal)", runtimeService.getVariable(piCatchSignal.Id, "processName"));
            assertEquals("throwSignal-visited (was throwSignal)", runtimeService.getVariable(piThrowSignal.Id, "processName"));

            // clean up
            runtimeService.signal(piCatchSignal.Id);
            runtimeService.signal(piThrowSignal.Id);

            assertEquals(0, runtimeService.createExecutionQuery().processInstanceId(piCatchSignal.ProcessInstanceId).count());
            assertEquals(0, runtimeService.createExecutionQuery().processInstanceId(piThrowSignal.ProcessInstanceId).count());
        }
Beispiel #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetUntypedVariable()
        public virtual void shouldGetUntypedVariable()
        {
            ProcessInstance instance = runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY);

            runtimeService.setVariable(instance.Id, VARIABLE_NAME, typedValue);

            object variableValue = runtimeService.getVariable(instance.Id, VARIABLE_NAME);

            assertEquals(typedValue.Value, variableValue);
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testDelegateExpressionWithProcessServices()
        public virtual void testDelegateExpressionWithProcessServices()
        {
            string processInstanceId = runtimeService.startProcessInstanceByKey("SpringProcess").Id;

            assertThat(couter.Count, @is(1));
            assertThat((int?)runtimeService.getVariable(processInstanceId, "count"), @is(1));
        }
Beispiel #6
0
        public virtual void testPropagateOutputVariablesWhileThrowError()
        {
            // given
            IDictionary <string, object> variables = new Dictionary <string, object>();

            variables["input"] = 42;
            string processInstanceId = runtimeService.startProcessInstanceByKey("ErrorParentProcess", variables).Id;

            // when
            string id = taskService.createTaskQuery().taskName("ut2").singleResult().Id;

            taskService.complete(id);

            // then
            assertEquals(1, taskService.createTaskQuery().taskName("task after catched error").count());
            // and set the output variable of the called process to the process
            assertNotNull(runtimeService.getVariable(processInstanceId, "cancelReason"));
            assertEquals(42, runtimeService.getVariable(processInstanceId, "output"));
        }
Beispiel #7
0
        public virtual void testSignalCatchBoundaryWithVariables()
        {
            Dictionary <string, object> variables1 = new Dictionary <string, object>();

            variables1["processName"] = "catchSignal";
            ProcessInstance pi = runtimeService.startProcessInstanceByKey("catchSignal", variables1);

            Dictionary <string, object> variables2 = new Dictionary <string, object>();

            variables2["processName"] = "throwSignal";
            runtimeService.startProcessInstanceByKey("throwSignal", variables2);

            assertEquals("catchSignal", runtimeService.getVariable(pi.Id, "processName"));
        }
Beispiel #8
0
 public virtual object remove(string name)
 {
     logger.fine("remove '" + name + "'");
     return(runtimeService.getVariable(ExecutionId, name));
 }
Beispiel #9
0
 protected internal virtual object getDecisionResult(ProcessInstance processInstance)
 {
     // the single entry of the single result of the decision result is stored as process variable
     return(runtimeService.getVariable(processInstance.Id, "result"));
 }