Esempio n. 1
0
        /// <summary>
        /// Ensures that suspending a process definition and its process instances will also increase the revision of the executions
        /// such that concurrent updates fail with an OptimisticLockingException.
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testCompetingSuspension()
        public virtual void testCompetingSuspension()
        {
            ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("CompetingSuspensionProcess").singleResult();

            ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.Id);
            Execution       execution       = runtimeService.createExecutionQuery().processInstanceId(processInstance.Id).activityId("wait1").singleResult();

            SuspendProcessDefinitionThread suspensionThread = new SuspendProcessDefinitionThread(this, processDefinition.Id);

            suspensionThread.startAndWaitUntilControlIsReturned();

            SignalThread signalExecutionThread = new SignalThread(this, execution.Id);

            signalExecutionThread.startAndWaitUntilControlIsReturned();

            suspensionThread.proceedAndWaitTillDone();
            assertNull(suspensionThread.exception);

            signalExecutionThread.proceedAndWaitTillDone();
            assertNotNull(signalExecutionThread.exception);
        }
        public virtual void testCompetingSuspension()
        {
            IProcessDefinition processDefinition = repositoryService.CreateProcessDefinitionQuery(c => c.Key == "CompetingSuspensionProcess").First();

            IProcessInstance processInstance = runtimeService.StartProcessInstanceById(processDefinition.Id);
            IExecution       execution       = runtimeService.CreateExecutionQuery(c => c.ProcessInstanceId == processInstance.Id && c.ActivityId == "wait1").First();

            SuspendProcessDefinitionThread suspensionThread = new SuspendProcessDefinitionThread(this, processDefinition.Id);

            suspensionThread.startAndWaitUntilControlIsReturned();

            SignalThread signalExecutionThread = new SignalThread(this, execution.Id);

            signalExecutionThread.startAndWaitUntilControlIsReturned();

            suspensionThread.proceedAndWaitTillDone();
            Assert.IsNull(suspensionThread.exception);

            signalExecutionThread.proceedAndWaitTillDone();
            Assert.NotNull(signalExecutionThread.exception);
        }