//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSuspendStage() public virtual void testSuspendStage() { // given /////////////////////////////////////////////////////////////// // a case definition CmmnCaseDefinition caseDefinition = (new CaseDefinitionBuilder("Case1")).createActivity("X").behavior(new StageActivityBehavior()).createActivity("A").behavior(new TaskWaitState()).endActivity().createActivity("B").behavior(new TaskWaitState()).endActivity().endActivity().buildCaseDefinition(); // an active case instance CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance(); caseInstance.create(); // a case execution associated with Stage X CmmnActivityExecution stageX = caseInstance.findCaseExecution("X"); // a case execution associated with Task A CmmnActivityExecution taskA = caseInstance.findCaseExecution("A"); // a case execution associated with Task B CmmnActivityExecution taskB = caseInstance.findCaseExecution("B"); // when stageX.suspend(); // then assertTrue(caseInstance.Active); assertTrue(stageX.Suspended); assertTrue(taskA.Suspended); assertTrue(taskB.Suspended); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSuspendTask() public virtual void testSuspendTask() { // given /////////////////////////////////////////////////////////////// // a case definition CmmnCaseDefinition caseDefinition = (new CaseDefinitionBuilder("Case1")).createActivity("X").behavior(new StageActivityBehavior()).createActivity("A").behavior(new TaskWaitState()).endActivity().createActivity("B").behavior(new TaskWaitState()).property(ItemHandler.PROPERTY_MANUAL_ACTIVATION_RULE, defaultManualActivation()).endActivity().endActivity().buildCaseDefinition(); // an active case instance CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance(); caseInstance.create(); // a case execution associated with Stage X CmmnActivityExecution stageX = caseInstance.findCaseExecution("X"); // a case execution associated with Task A CmmnActivityExecution taskA = caseInstance.findCaseExecution("A"); // a case execution associated with Task B CmmnActivityExecution taskB = caseInstance.findCaseExecution("B"); // when taskA.suspend(); // then assertTrue(caseInstance.Active); assertTrue(stageX.Active); assertTrue(taskA.Suspended); assertTrue(taskB.Enabled); }
protected internal override void startInstance(ActivityExecution execution, VariableMap variables, string businessKey) { CmmnCaseDefinition definition = getCaseDefinitionToCall(execution, CallableElement); CmmnCaseInstance caseInstance = execution.createSubCaseInstance(definition, businessKey); caseInstance.create(variables); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testOccurMilestone() public virtual void testOccurMilestone() { // given // a case definition CmmnCaseDefinition caseDefinition = (new CaseDefinitionBuilder("Case1")).createActivity("A").behavior(new MilestoneActivityBehavior()).endActivity().buildCaseDefinition(); CmmnActivity activity = caseDefinition.findActivity("A"); // a pseudo sentry CmmnSentryDeclaration sentryDeclaration = new CmmnSentryDeclaration("X"); caseDefinition.findActivity("Case1").addSentry(sentryDeclaration); activity.addEntryCriteria(sentryDeclaration); CmmnOnPartDeclaration onPartDeclaration = new CmmnOnPartDeclaration(); onPartDeclaration.Source = new CmmnActivity("B", caseDefinition); onPartDeclaration.StandardEvent = "complete"; sentryDeclaration.addOnPart(onPartDeclaration); // an active case instance CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance(); caseInstance.create(); // task A as a child of the case instance CmmnActivityExecution milestoneA = caseInstance.findCaseExecution("A"); // when // completing milestoneA.occur(); // then // task A is completed ... assertTrue(milestoneA.Completed); // ... and the case instance is also completed assertTrue(caseInstance.Completed); // task A is not part of the case instance anymore assertNull(caseInstance.findCaseExecution("A")); // the case instance has no children assertTrue(((CaseExecutionImpl)caseInstance).CaseExecutions.Count == 0); }