示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testStage()
        public virtual void testStage()
        {
            // given
            string caseInstanceId = createCaseInstanceByKey(CASE_DEFINITION_KEY).Id;

            CaseExecutionQuery query = caseService.createCaseExecutionQuery().activityId("PI_Stage_1");

            string stageId = query.singleResult().Id;

            // when
            caseService.manuallyStartCaseExecution(stageId);

            // then

            // the instance is still active (contains
            // a further human task)
            CaseInstance caseInstance = caseService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult();

            assertNotNull(caseInstance);
            assertTrue(caseInstance.Active);

            // humanTask1 is still available
            assertNotNull(query.activityId("PI_HumanTask_1").singleResult());

            // stage, humanTask2, humanTask3 are not available
            assertNull(query.activityId("PI_Stage_1").singleResult());
            assertNull(query.activityId("PI_HumanTask_2").singleResult());
            assertNull(query.activityId("PI_HumanTask_3").singleResult());
        }
示例#2
0
        public virtual void testDisableAnEnabledStage()
        {
            // given:
            // a deployed case definition
            string caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().Id;

            // an active case instance and the containing
            // human task is enabled
            caseService.withCaseDefinition(caseDefinitionId).create();

            CaseExecutionQuery caseExecutionQuery = caseService.createCaseExecutionQuery();

            string caseExecutionId = caseExecutionQuery.activityId("PI_Stage_1").singleResult().Id;

            // when
            caseService.withCaseExecution(caseExecutionId).disable();

            // then
            CaseExecution caseExecution = caseExecutionQuery.singleResult();

            // the human task is disabled
            assertTrue(caseExecution.Disabled);
            assertFalse(caseExecution.Active);
            assertFalse(caseExecution.Enabled);
        }
示例#3
0
        public virtual void testManualStart()
        {
            // given:
            // a deployed case definition
            string caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().Id;

            // an active case instance
            caseService.withCaseDefinition(caseDefinitionId).create();

            CaseExecutionQuery caseExecutionQuery = caseService.createCaseExecutionQuery();

            // an enabled child case execution of
            // the case instance
            string caseExecutionId = caseExecutionQuery.activityId("PI_Stage_1").singleResult().Id;

            // when
            // activate child case execution
            caseService.withCaseExecution(caseExecutionId).manualStart();

            // then

            // the child case execution is active...
            CaseExecution caseExecution = caseExecutionQuery.singleResult();

            assertTrue(caseExecution.Active);
            // ... and not enabled
            assertFalse(caseExecution.Enabled);

            // there exists two new case execution:

            // (1) one case case execution representing "PI_HumanTask_1"
            verifyTasksState(caseExecutionQuery);
        }
示例#4
0
        public virtual void testManualStartWithLocalVariables()
        {
            // given:
            // a deployed case definition
            string caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().Id;

            // an active case instance
            string caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().Id;

            CaseExecutionQuery caseExecutionQuery = caseService.createCaseExecutionQuery();

            // an enabled child case execution of
            // the case instance
            string caseExecutionId = caseExecutionQuery.activityId("PI_Stage_1").singleResult().Id;

            // variables
            IDictionary <string, object> variables = new Dictionary <string, object>();

            variables["aVariableName"]       = "abc";
            variables["anotherVariableName"] = 999;

            // when
            // activate child case execution
            caseService.withCaseExecution(caseExecutionId).setVariablesLocal(variables).manualStart();

            // then

            // the child case execution is active...
            CaseExecution caseExecution = caseExecutionQuery.singleResult();

            assertTrue(caseExecution.Active);
            // ... and not enabled
            assertFalse(caseExecution.Enabled);

            // (1) one case case execution representing "PI_HumanTask_1"
            verifyTasksState(caseExecutionQuery);

            // the case instance has two variables:
            // - aVariableName
            // - anotherVariableName
            IList <VariableInstance> result = runtimeService.createVariableInstanceQuery().list();

            verifyVariables(caseInstanceId, caseExecutionId, result);
        }