public virtual void testCompetingEnd() { runtimeService.StartProcessInstanceByKey("CompetingEndProcess"); IList <ITask> tasks = taskService.CreateTaskQuery() .ToList(); Assert.AreEqual(3, tasks.Count); Debug.WriteLine("test thread starts thread one"); CompleteTaskThread threadOne = new CompleteTaskThread(this, tasks[0].Id); threadOne.startAndWaitUntilControlIsReturned(); Debug.WriteLine("test thread continues to start thread two"); CompleteTaskThread threadTwo = new CompleteTaskThread(this, tasks[1].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); }
public virtual void FAILING_testCompetingFork() { runtimeService.StartProcessInstanceByKey("process"); IQueryable <ITask> query = taskService.CreateTaskQuery(); string task1 = query.Where(c => c.TaskDefinitionKey == "task1").First().Id; string task2 = query.Where(c => c.TaskDefinitionKey == "task2").First().Id; string task3 = query.Where(c => c.TaskDefinitionKey == "task3").First().Id; Debug.WriteLine("test thread starts thread one"); CompleteTaskThread threadOne = new CompleteTaskThread(this, task1); threadOne.startAndWaitUntilControlIsReturned(); Debug.WriteLine("test thread thread two"); CompleteTaskThread threadTwo = new CompleteTaskThread(this, task2); threadTwo.startAndWaitUntilControlIsReturned(); Debug.WriteLine("test thread continues to start thread three"); CompleteTaskThread threadThree = new CompleteTaskThread(this, task3); threadThree.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); Debug.WriteLine("test thread notifies thread 3"); threadThree.proceedAndWaitTillDone(); Assert.NotNull(threadThree.exception); AssertTextPresent("was updated by another transaction concurrently", threadThree.exception.Message); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Deployment public void FAILING_testCompetingFork() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void FAILING_testCompetingFork() { runtimeService.startProcessInstanceByKey("process"); TaskQuery query = taskService.createTaskQuery(); string task1 = query.taskDefinitionKey("task1").singleResult().Id; string task2 = query.taskDefinitionKey("task2").singleResult().Id; string task3 = query.taskDefinitionKey("task3").singleResult().Id; LOG.debug("test thread starts thread one"); CompleteTaskThread threadOne = new CompleteTaskThread(this, task1); threadOne.startAndWaitUntilControlIsReturned(); LOG.debug("test thread thread two"); CompleteTaskThread threadTwo = new CompleteTaskThread(this, task2); threadTwo.startAndWaitUntilControlIsReturned(); LOG.debug("test thread continues to start thread three"); CompleteTaskThread threadThree = new CompleteTaskThread(this, task3); threadThree.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); LOG.debug("test thread notifies thread 3"); threadThree.proceedAndWaitTillDone(); assertNotNull(threadThree.exception); assertTextPresent("was updated by another transaction concurrently", threadThree.exception.Message); }