//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testUsingAnInjectedScopedProxy() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testUsingAnInjectedScopedProxy() { logger.info("Running 'component-waiter' process instance with scoped beans."); StatefulObject one = run(); StatefulObject two = run(); Assert.assertNotSame(one.Name, two.Name); Assert.assertEquals(one.VisitedCount, two.VisitedCount); }
public override bool Equals(object o) { if (this == o) { return(true); } if (o == null || this.GetType() != o.GetType()) { return(false); } StatefulObject that = (StatefulObject)o; if (visitedCount != that.visitedCount) { return(false); } if (!string.ReferenceEquals(name, null) ?!name.Equals(that.name) :!string.ReferenceEquals(that.name, null)) { return(false); } return(true); }
/// <summary> /// this code instantiates a business process that in turn delegates to a few Spring beans that in turn inject a process scoped object, <seealso cref="StatefulObject"/>. /// </summary> /// <returns> the StatefulObject that was injected across different components, that all share the same state. </returns> /// <exception cref="Throwable"> if anythign goes wrong </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private StatefulObject run() throws Throwable private StatefulObject run() { logger.info("----------------------------------------------"); IDictionary <string, object> vars = new Dictionary <string, object>(); vars[customerIdProcVarName] = CUSTOMER_ID_PROC_VAR_VALUE; ProcessInstance processInstance = processEngine.RuntimeService.startProcessInstanceByKey("component-waiter", vars); StatefulObject scopedObject = (StatefulObject)processEngine.RuntimeService.getVariable(processInstance.Id, "scopedTarget.c1"); Assert.assertNotNull("the scopedObject can't be null", scopedObject); Assert.assertTrue("the 'name' property can't be null.", StringUtils.hasText(scopedObject.Name)); Assert.assertEquals(scopedObject.VisitedCount, 2); // the process has paused string procId = processInstance.ProcessInstanceId; IList <Task> tasks = taskService.createTaskQuery().executionId(procId).list(); Assert.assertEquals("there should be 1 (one) task enqueued at this point.", tasks.Count, 1); Task t = tasks.GetEnumerator().next(); this.taskService.claim(t.Id, "me"); logger.info("sleeping for 10 seconds while a user performs his task. " + "The first transaction has committed. A new one will start in 10 seconds"); Thread.Sleep(1000 * 5); this.taskService.complete(t.Id); scopedObject = (StatefulObject)processEngine.RuntimeService.getVariable(processInstance.Id, "scopedTarget.c1"); Assert.assertEquals(scopedObject.VisitedCount, 3); Assert.assertEquals("the customerId injected should " + "be what was given as a processVariable parameter.", ScopingTest.CUSTOMER_ID_PROC_VAR_VALUE, scopedObject.CustomerId); return(scopedObject); }