Example #1
0
        public virtual void testCompetingJoins()
        {
            IProcessInstance processInstance = runtimeService.StartProcessInstanceByKey("CompetingJoinsProcess");
            IExecution       execution1      = runtimeService.CreateExecutionQuery(c => c.ProcessInstanceId == processInstance.Id && c.ActivityId == "wait1").First();

            IExecution execution2 = runtimeService.CreateExecutionQuery(c => c.ProcessInstanceId == processInstance.Id && c.ActivityId == "wait2").First();

            Debug.WriteLine("test thread starts thread one");
            SignalThread threadOne = new SignalThread(this, execution1.Id);

            threadOne.startAndWaitUntilControlIsReturned();

            Debug.WriteLine("test thread continues to start thread two");
            SignalThread threadTwo = new SignalThread(this, execution2.Id);

            threadTwo.startAndWaitUntilControlIsReturned();

            Debug.WriteLine("test thread notifies thread 1");
            threadOne.proceedAndWaitTillDone();
            Assert.IsNull(threadOne.exception);

            Debug.WriteLine("test thread notifies thread 2");
            threadTwo.proceedAndWaitTillDone();
            Assert.NotNull(threadTwo.exception);
            AssertTextPresent("was updated by another transaction concurrently", threadTwo.exception.Message);
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testCompetingJoins() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testCompetingJoins()
        {
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("CompetingJoinsProcess");
            Execution       execution1      = runtimeService.createExecutionQuery().processInstanceId(processInstance.Id).activityId("wait1").singleResult();

            Execution execution2 = runtimeService.createExecutionQuery().processInstanceId(processInstance.Id).activityId("wait2").singleResult();

            LOG.debug("test thread starts thread one");
            SignalThread threadOne = new SignalThread(this, execution1.Id);

            threadOne.startAndWaitUntilControlIsReturned();

            LOG.debug("test thread continues to start thread two");
            SignalThread threadTwo = new SignalThread(this, execution2.Id);

            threadTwo.startAndWaitUntilControlIsReturned();

            LOG.debug("test thread notifies thread 1");
            threadOne.proceedAndWaitTillDone();
            assertNull(threadOne.exception);

            LOG.debug("test thread notifies thread 2");
            threadTwo.proceedAndWaitTillDone();
            assertNotNull(threadTwo.exception);
            assertTextPresent("was updated by another transaction concurrently", threadTwo.exception.Message);
        }
Example #3
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);
        }
Example #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testCompetingSignals() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testCompetingSignals()
        {
            ProcessInstance processInstance   = runtimeService.startProcessInstanceByKey("CompetingSignalsProcess");
            string          processInstanceId = processInstance.Id;

            LOG.debug("test thread starts thread one");
            SignalThread threadOne = new SignalThread(this, processInstanceId);

            threadOne.startAndWaitUntilControlIsReturned();

            LOG.debug("test thread continues to start thread two");
            SignalThread threadTwo = new SignalThread(this, processInstanceId);

            threadTwo.startAndWaitUntilControlIsReturned();

            LOG.debug("test thread notifies thread 1");
            threadOne.proceedAndWaitTillDone();
            assertNull(threadOne.exception);

            LOG.debug("test thread notifies thread 2");
            threadTwo.proceedAndWaitTillDone();
            assertNotNull(threadTwo.exception);
            assertTextPresent("was updated by another transaction concurrently", threadTwo.exception.Message);
        }