コード例 #1
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());
        }
コード例 #2
0
        public virtual void signalExecution(ExecutionTriggerDto triggerDto)
        {
            RuntimeService runtimeService = engine.RuntimeService;

            try
            {
                VariableMap variables = VariableValueDto.toMap(triggerDto.Variables, engine, objectMapper);
                runtimeService.signal(executionId, variables);
            }
            catch (RestException e)
            {
                string errorMessage = string.Format("Cannot signal execution {0}: {1}", executionId, e.Message);
                throw new InvalidRequestException(e.Status, e, errorMessage);
            }
            catch (AuthorizationException e)
            {
                throw e;
            }
            catch (ProcessEngineException e)
            {
                throw new RestException(Status.INTERNAL_SERVER_ERROR, e, "Cannot signal execution " + executionId + ": " + e.Message);
            }
        }