コード例 #1
0
        public virtual void testCatchErrorThrownBySignalOfDelegateExpression()
        {
            VariableMap variables = Variables.createVariables().putValue("myDelegate", new ThrowErrorDelegate());
            string      pi        = runtimeService.startProcessInstanceByKey("testProcess", variables).Id;

            assertTrue((bool?)runtimeService.getVariable(pi, "executed"));
            assertNull(runtimeService.getVariable(pi, "signaled"));

            Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult();

            assertNotNull(serviceTask);

            runtimeService.setVariables(pi, throwError());
            runtimeService.signal(serviceTask.Id);

            assertTrue((bool?)runtimeService.getVariable(pi, "executed"));
            assertTrue((bool?)runtimeService.getVariable(pi, "signaled"));

            Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();

            assertNotNull(userTask);
            assertEquals("userTaskError", userTask.TaskDefinitionKey);

            taskService.complete(userTask.Id);
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testDeletesOnlyVariablesFromRemovingScope()
        public virtual void testDeletesOnlyVariablesFromRemovingScope()
        {
            // given
            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.DOUBLE_SUBPROCESS_MODEL);
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.COMPENSATION_ONE_TASK_SUBPROCESS_MODEL);

            MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("innerSubProcess", "subProcess").mapActivities("userTask2", "userTask2").mapActivities("compensationBoundary", "compensationBoundary").build();

            ProcessInstance processInstance = rule.RuntimeService.startProcessInstanceById(sourceProcessDefinition.Id);

            Execution innerSubProcessExecution = rule.RuntimeService.createExecutionQuery().activityId("userTask1").singleResult();

            string outerSubProcessExecutionId = ((ExecutionEntity)innerSubProcessExecution).ParentId;

            rule.RuntimeService.setVariableLocal(outerSubProcessExecutionId, "outerVariable", "outerValue");
            rule.RuntimeService.setVariableLocal(innerSubProcessExecution.Id, "innerVariable", "innerValue");

            testHelper.completeTask("userTask1");

            // when
            testHelper.migrateProcessInstance(migrationPlan, processInstance);

            // then
            Assert.assertEquals(1, testHelper.snapshotAfterMigration.getVariables().Count);

            VariableInstance migratedVariable = testHelper.snapshotAfterMigration.getSingleVariable("innerVariable");

            Assert.assertNotNull(migratedVariable);
            Assert.assertEquals("innerValue", migratedVariable.Value);
        }
コード例 #3
0
        public virtual void testQueryWithReadPermissionOnProcessInstance()
        {
            // given
            startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
            startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
            string processInstanceId = startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).Id;

            startProcessInstanceByKey(MESSAGE_BOUNDARY_PROCESS_KEY);
            startProcessInstanceByKey(MESSAGE_BOUNDARY_PROCESS_KEY);
            startProcessInstanceByKey(MESSAGE_BOUNDARY_PROCESS_KEY);
            startProcessInstanceByKey(MESSAGE_BOUNDARY_PROCESS_KEY);

            createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);

            // when
            ExecutionQuery query = runtimeService.createExecutionQuery();

            // then
            verifyQueryResults(query, 1);

            Execution execution = query.singleResult();

            assertNotNull(execution);
            assertEquals(processInstanceId, execution.ProcessInstanceId);
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testVariablesInParentEventScopeStillAccessible()
        public virtual void testVariablesInParentEventScopeStillAccessible()
        {
            // given
            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.COMPENSATION_ONE_TASK_SUBPROCESS_MODEL);
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.DOUBLE_SUBPROCESS_MODEL);

            MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("subProcess", "outerSubProcess").mapActivities("compensationBoundary", "compensationBoundary").mapActivities("userTask2", "userTask2").build();

            ProcessInstance processInstance = rule.RuntimeService.startProcessInstanceById(sourceProcessDefinition.Id);

            Execution subProcessExecution = rule.RuntimeService.createExecutionQuery().activityId("userTask1").singleResult();

            rule.RuntimeService.setVariableLocal(subProcessExecution.Id, "foo", "bar");

            testHelper.completeTask("userTask1");

            testHelper.migrateProcessInstance(migrationPlan, processInstance);

            // when throwing compensation
            testHelper.completeAnyTask("userTask2");

            // then the variable snapshot is available
            Task compensationTask = rule.TaskService.createTaskQuery().singleResult();

            Assert.assertEquals("bar", rule.TaskService.getVariable(compensationTask.Id, "foo"));
        }
コード例 #5
0
        public static ExecutionDto fromExecution(Execution execution)
        {
            ExecutionDto dto = new ExecutionDto();

            dto.id = execution.Id;
            dto.processInstanceId = execution.ProcessInstanceId;
            dto.ended             = execution.Ended;
            dto.tenantId          = execution.TenantId;

            return(dto);
        }
コード例 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testNonInterruptingWithUserTaskAndBoundaryEvent()
        public virtual void testNonInterruptingWithUserTaskAndBoundaryEvent()
        {
            // given
            string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

            // when (1)
            runtimeService.correlateMessage("firstMessage");

            // then (1)
            assertEquals(2, taskService.createTaskQuery().count());

            Task task1 = taskService.createTaskQuery().taskDefinitionKey("task1").singleResult();

            assertNotNull(task1);

            Execution task1Execution = runtimeService.createExecutionQuery().activityId("task1").singleResult();

            assertEquals(processInstanceId, ((ExecutionEntity)task1Execution).ParentId);

            Task task2 = taskService.createTaskQuery().taskDefinitionKey("innerTask").singleResult();

            assertNotNull(task2);

            Execution task2Execution = runtimeService.createExecutionQuery().activityId("innerTask").singleResult();

            assertFalse(processInstanceId.Equals(((ExecutionEntity)task2Execution).ParentId));

            // when (2)
            taskService.complete(task2.Id);

            // then (2)
            assertEquals(2, taskService.createTaskQuery().count());

            task1 = taskService.createTaskQuery().taskDefinitionKey("task1").singleResult();
            assertNotNull(task1);

            task1Execution = runtimeService.createExecutionQuery().activityId("task1").singleResult();

            assertEquals(processInstanceId, ((ExecutionEntity)task1Execution).ParentId);

            task2 = taskService.createTaskQuery().taskDefinitionKey("task2").singleResult();
            assertNotNull(task2);

            task2Execution = runtimeService.createExecutionQuery().activityId("tasks").singleResult();

            assertEquals(processInstanceId, ((ExecutionEntity)task1Execution).ParentId);

            assertEquals(0, runtimeService.createEventSubscriptionQuery().count());

            taskService.complete(task1.Id);
            taskService.complete(task2.Id);

            assertProcessEnded(processInstanceId);
        }
コード例 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testNonInterruptingEventInCombinationWithReceiveTaskInsideSubProcess()
        public virtual void testNonInterruptingEventInCombinationWithReceiveTaskInsideSubProcess()
        {
            // given
            ProcessInstance instance          = runtimeService.startProcessInstanceByKey("process");
            string          processInstanceId = instance.Id;

            // when (1)
            runtimeService.correlateMessage("firstMessage");

            // then (1)
            ActivityInstance activityInstance = runtimeService.getActivityInstance(instance.Id);

            assertThat(activityInstance).hasStructure(describeActivityInstanceTree(instance.ProcessDefinitionId).beginScope("subProcess").activity("task1").beginScope("innerSubProcess").activity("receiveTask").done());

            assertEquals(1, taskService.createTaskQuery().count());

            Task task1 = taskService.createTaskQuery().taskDefinitionKey("task1").singleResult();

            assertNotNull(task1);

            Execution task1Execution = runtimeService.createExecutionQuery().activityId("task1").singleResult();

            assertFalse(processInstanceId.Equals(((ExecutionEntity)task1Execution).ParentId));

            // when (2)
            runtimeService.correlateMessage("secondMessage");

            // then (2)
            assertEquals(2, taskService.createTaskQuery().count());

            task1 = taskService.createTaskQuery().taskDefinitionKey("task1").singleResult();
            assertNotNull(task1);

            task1Execution = runtimeService.createExecutionQuery().activityId("task1").singleResult();

            assertFalse(processInstanceId.Equals(((ExecutionEntity)task1Execution).ParentId));

            Task task2 = taskService.createTaskQuery().taskDefinitionKey("task2").singleResult();

            assertNotNull(task2);

            Execution task2Execution = runtimeService.createExecutionQuery().activityId("task1").singleResult();

            assertFalse(processInstanceId.Equals(((ExecutionEntity)task2Execution).ParentId));

            assertTrue(((ExecutionEntity)task1Execution).ParentId.Equals(((ExecutionEntity)task2Execution).ParentId));

            assertEquals(0, runtimeService.createEventSubscriptionQuery().count());

            taskService.complete(task1.Id);
            taskService.complete(task2.Id);

            assertProcessEnded(processInstanceId);
        }
コード例 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testForkWithThreeBranchesAndJoinOfTwoBranchesInclusiveGateway()
        public virtual void testForkWithThreeBranchesAndJoinOfTwoBranchesInclusiveGateway()
        {
            // given
            runtimeService.startProcessInstanceByKey("process");

            Execution task2Execution = runtimeService.createExecutionQuery().activityId("task2").singleResult();

            // when
            runtimeService.setVariableLocal(task2Execution.Id, "foo", "bar");
            taskService.complete(taskService.createTaskQuery().taskDefinitionKey("task1").singleResult().Id);
            taskService.complete(taskService.createTaskQuery().taskDefinitionKey("task2").singleResult().Id);

            // then
            assertEquals(0, runtimeService.createVariableInstanceQuery().count());
        }
コード例 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void failToSignalIntermediateCatchEventNoAuthenticatedTenants()
        public virtual void failToSignalIntermediateCatchEventNoAuthenticatedTenants()
        {
            testRule.deployForTenant(TENANT_ONE, SIGNAL_CATCH_PROCESS);

            engineRule.RuntimeService.createProcessInstanceByKey("signalCatch").execute();

            Execution execution = engineRule.RuntimeService.createExecutionQuery().processDefinitionKey("signalCatch").signalEventSubscriptionName("signal").singleResult();

            // declared expected exception
            thrown.expect(typeof(ProcessEngineException));
            thrown.expectMessage("Cannot update the process instance");

            engineRule.IdentityService.setAuthentication("user", null, null);

            engineRule.RuntimeService.signal(execution.Id, "signal", null, null);
        }
コード例 #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void failToCorrelateReceivedMessageToIntermediateCatchEventNoAuthenticatedTenants()
        public virtual void failToCorrelateReceivedMessageToIntermediateCatchEventNoAuthenticatedTenants()
        {
            testRule.deployForTenant(TENANT_ONE, MESSAGE_CATCH_PROCESS);

            engineRule.RuntimeService.createProcessInstanceByKey("messageCatch").processDefinitionTenantId(TENANT_ONE).execute();

            Execution execution = engineRule.RuntimeService.createExecutionQuery().processDefinitionKey("messageCatch").messageEventSubscriptionName("message").tenantIdIn(TENANT_ONE).singleResult();

            // declare expected exception
            thrown.expect(typeof(ProcessEngineException));
            thrown.expectMessage("Cannot update the process instance");

            engineRule.IdentityService.setAuthentication("user", null, null);

            engineRule.RuntimeService.messageEventReceived("message", execution.Id);
        }
コード例 #11
0
        public virtual void testSimpleQueryWithReadInstancesPermissionOnAnyProcessDefinition()
        {
            // given
            string processInstanceId = startProcessInstanceByKey(ONE_TASK_PROCESS_KEY).Id;

            createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_INSTANCE);

            // when
            ExecutionQuery query = runtimeService.createExecutionQuery();

            // then
            verifyQueryResults(query, 1);

            Execution execution = query.singleResult();

            assertNotNull(execution);
            assertEquals(processInstanceId, execution.ProcessInstanceId);
        }
コード例 #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testNonInterruptingEventInCombinationWithReceiveTaskInConcurrentSubprocess()
        public virtual void testNonInterruptingEventInCombinationWithReceiveTaskInConcurrentSubprocess()
        {
            // given
            string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

            // when (1)
            runtimeService.correlateMessage("firstMessage");

            // then (1)
            assertEquals(2, taskService.createTaskQuery().count());

            Task task1 = taskService.createTaskQuery().taskDefinitionKey("task1").singleResult();

            assertNotNull(task1);

            Execution task1Execution = runtimeService.createExecutionQuery().activityId("task1").singleResult();

            assertEquals(processInstanceId, ((ExecutionEntity)task1Execution).ParentId);


            // when (2)
            runtimeService.correlateMessage("secondMessage");

            // then (2)
            assertEquals(3, taskService.createTaskQuery().count());
            assertEquals(0, runtimeService.createEventSubscriptionQuery().count());

            Task afterFork = taskService.createTaskQuery().taskDefinitionKey("afterFork").singleResult();

            taskService.complete(afterFork.Id);

            Task task2 = taskService.createTaskQuery().taskDefinitionKey("task2").singleResult();

            assertNotNull(task2);

            Execution task2Execution = runtimeService.createExecutionQuery().activityId("task2").singleResult();

            assertEquals(processInstanceId, ((ExecutionEntity)task2Execution).ParentId);

            taskService.complete(task2.Id);
            taskService.complete(task1.Id);

            assertProcessEnded(processInstanceId);
        }
コード例 #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void correlateReceivedMessageToIntermediateCatchEventWithAuthenticatedTenant()
        public virtual void correlateReceivedMessageToIntermediateCatchEventWithAuthenticatedTenant()
        {
            testRule.deployForTenant(TENANT_ONE, MESSAGE_CATCH_PROCESS);

            engineRule.RuntimeService.createProcessInstanceByKey("messageCatch").execute();

            Execution execution = engineRule.RuntimeService.createExecutionQuery().processDefinitionKey("messageCatch").messageEventSubscriptionName("message").singleResult();

            engineRule.IdentityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));

            engineRule.RuntimeService.messageEventReceived("message", execution.Id);

            engineRule.IdentityService.clearAuthentication();

            TaskQuery query = engineRule.TaskService.createTaskQuery();

            assertThat(query.count(), @is(1L));
            assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L));
        }
コード例 #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void signalIntermediateCatchEventWithAuthenticatedTenant()
        public virtual void signalIntermediateCatchEventWithAuthenticatedTenant()
        {
            testRule.deployForTenant(TENANT_ONE, SIGNAL_CATCH_PROCESS);

            engineRule.RuntimeService.createProcessInstanceByKey("signalCatch").processDefinitionTenantId(TENANT_ONE).execute();

            Execution execution = engineRule.RuntimeService.createExecutionQuery().processDefinitionKey("signalCatch").signalEventSubscriptionName("signal").singleResult();

            engineRule.IdentityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));

            engineRule.RuntimeService.signal(execution.Id, "signal", null, null);

            engineRule.IdentityService.clearAuthentication();

            TaskQuery query = engineRule.TaskService.createTaskQuery();

            assertThat(query.count(), @is(1L));
            assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L));
        }
コード例 #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void test()
        public virtual void test()
        {
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess");

            long eventSubscriptionCount = runtimeService.createEventSubscriptionQuery().count();

            assertEquals(1, eventSubscriptionCount);

            Execution execution = runtimeService.createExecutionQuery().messageEventSubscriptionName("Test Message").singleResult();

            assertNotNull(execution);

            //runtimeService.messageEventReceived("Test Message", execution.getId());
            runtimeService.createMessageCorrelation("Test Message").correlate();

            eventSubscriptionCount = runtimeService.createEventSubscriptionQuery().count();
            assertEquals(0, eventSubscriptionCount);

            assertEquals(0, runtimeService.createExecutionQuery().count());
        }
コード例 #16
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);
        }
コード例 #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testTreeCompactionForkParallelGateway()
        public virtual void testTreeCompactionForkParallelGateway()
        {
            // given
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");

            Task task1 = taskService.createTaskQuery().taskDefinitionKey("task1").singleResult();

            Execution task2Execution = runtimeService.createExecutionQuery().activityId("task2").singleResult();

            // when
            runtimeService.setVariableLocal(task2Execution.Id, "foo", "bar");
            // and completing the other task, thereby pruning the concurrent execution
            taskService.complete(task1.Id);

            // then the variable still exists
            VariableInstance variable = runtimeService.createVariableInstanceQuery().singleResult();

            assertNotNull(variable);
            assertEquals("foo", variable.Name);
            assertEquals(processInstance.Id, variable.ExecutionId);
        }
コード例 #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void correlateReceivedMessageToIntermediateCatchEventDisabledTenantCheck()
        public virtual void correlateReceivedMessageToIntermediateCatchEventDisabledTenantCheck()
        {
            testRule.deployForTenant(TENANT_ONE, MESSAGE_CATCH_PROCESS);
            testRule.deployForTenant(TENANT_TWO, MESSAGE_CATCH_PROCESS);

            engineRule.ProcessEngineConfiguration.TenantCheckEnabled = false;
            engineRule.IdentityService.setAuthentication("user", null, null);

            engineRule.RuntimeService.createProcessInstanceByKey("messageCatch").processDefinitionTenantId(TENANT_ONE).execute();
            engineRule.RuntimeService.createProcessInstanceByKey("messageCatch").processDefinitionTenantId(TENANT_TWO).execute();

            Execution execution = engineRule.RuntimeService.createExecutionQuery().processDefinitionKey("messageCatch").messageEventSubscriptionName("message").tenantIdIn(TENANT_ONE).singleResult();

            engineRule.RuntimeService.messageEventReceived("message", execution.Id);

            TaskQuery query = engineRule.TaskService.createTaskQuery();

            assertThat(query.count(), @is(1L));
            assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L));
            assertThat(query.tenantIdIn(TENANT_TWO).count(), @is(0L));
        }
コード例 #19
0
        public virtual void testStableVariableInstanceIdsOnCompaction()
        {
            runtimeService.startProcessInstanceByKey("process");

            Execution innerTaskExecution = runtimeService.createExecutionQuery().activityId("innerTask").singleResult();

            Execution subProcessConcurrentExecution = runtimeService.createExecutionQuery().executionId(((ExecutionEntity)innerTaskExecution).ParentId).singleResult();

            Task task = taskService.createTaskQuery().taskDefinitionKey("task").singleResult();

            // when
            runtimeService.setVariableLocal(subProcessConcurrentExecution.Id, "foo", "bar");
            VariableInstance variableBeforeCompaction = runtimeService.createVariableInstanceQuery().singleResult();

            // and completing the concurrent task, thereby pruning the sub process concurrent execution
            taskService.complete(task.Id);

            // then the variable still exists
            VariableInstance variableAfterCompaction = runtimeService.createVariableInstanceQuery().singleResult();

            assertEquals(variableBeforeCompaction.Id, variableAfterCompaction.Id);
        }
コード例 #20
0
        public virtual void testTreeCompactionAndExpansionWithConcurrentLocalVariables()
        {
            // given
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");

            Execution task1Execution = runtimeService.createExecutionQuery().activityId("task1").singleResult();
            Task      task2          = taskService.createTaskQuery().taskDefinitionKey("task2").singleResult();

            runtimeService.setVariableLocal(task1Execution.Id, "var", "value");

            // when compacting the tree
            taskService.complete(task2.Id);

            // and expanding again
            runtimeService.createProcessInstanceModification(processInstance.Id).startBeforeActivity("task2").execute();

            // then the variable is again assigned to task1's concurrent execution
            Task             task1    = taskService.createTaskQuery().taskDefinitionKey("task1").singleResult();
            VariableInstance variable = runtimeService.createVariableInstanceQuery().singleResult();

            assertEquals(task1.ExecutionId, variable.ExecutionId);
        }
コード例 #21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testCanRemoveEventScopeWithVariables()
        public virtual void testCanRemoveEventScopeWithVariables()
        {
            // given
            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.COMPENSATION_ONE_TASK_SUBPROCESS_MODEL);
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(CompensationModels.ONE_COMPENSATION_TASK_MODEL);

            MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("userTask2", "userTask2").mapActivities("compensationBoundary", "compensationBoundary").build();

            ProcessInstance processInstance = rule.RuntimeService.startProcessInstanceById(sourceProcessDefinition.Id);

            Execution subProcessExecution = rule.RuntimeService.createExecutionQuery().activityId("userTask1").singleResult();

            rule.RuntimeService.setVariableLocal(subProcessExecution.Id, "foo", "bar");

            testHelper.completeTask("userTask1");

            // when
            testHelper.migrateProcessInstance(migrationPlan, processInstance);

            // then
            Assert.assertEquals(0, rule.RuntimeService.createVariableInstanceQuery().count());
        }
コード例 #22
0
        public virtual void testStableVariableInstanceIdsOnCompactionAndExpansion()
        {
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");

            Execution task1Execution = runtimeService.createExecutionQuery().activityId("task1").singleResult();

            Task task2 = taskService.createTaskQuery().taskDefinitionKey("task2").singleResult();

            // when
            runtimeService.setVariableLocal(task1Execution.Id, "foo", "bar");
            VariableInstance variableBeforeCompaction = runtimeService.createVariableInstanceQuery().singleResult();

            // compacting the tree
            taskService.complete(task2.Id);

            // expanding the tree
            runtimeService.createProcessInstanceModification(processInstance.Id).startBeforeActivity("task2").execute();

            // then the variable still exists
            VariableInstance variableAfterCompaction = runtimeService.createVariableInstanceQuery().singleResult();

            assertEquals(variableBeforeCompaction.Id, variableAfterCompaction.Id);
        }
コード例 #23
0
        public virtual void testCatchErrorThrownBySignalOfAbstractBpmnActivityBehavior()
        {
            string pi = runtimeService.startProcessInstanceByKey("testProcess").Id;

            assertTrue((bool?)runtimeService.getVariable(pi, "executed"));
            assertNull(runtimeService.getVariable(pi, "signaled"));

            Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult();

            assertNotNull(serviceTask);

            runtimeService.setVariables(pi, throwError());
            runtimeService.signal(serviceTask.Id);

            assertTrue((bool?)runtimeService.getVariable(pi, "executed"));
            assertTrue((bool?)runtimeService.getVariable(pi, "signaled"));

            Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();

            assertNotNull(userTask);
            assertEquals("userTaskError", userTask.TaskDefinitionKey);

            taskService.complete(userTask.Id);
        }
コード例 #24
0
	  public override void execute(PerfTestRunContext context)
	  {
		Execution execution = runtimeService.createExecutionQuery().messageEventSubscriptionName(message).processInstanceId((string)context.getVariable(processInstanceKey)).singleResult();

		runtimeService.messageEventReceived(message, execution.Id);
	  }
コード例 #25
0
        public virtual void testNestedEventsAnotherExecutionOrder()
        {
            // given
            string processInstanceId = runtimeService.startProcessInstanceByKey("process").Id;

            // when (1)
            runtimeService.correlateMessage("secondMessage");

            // then (1)
            assertEquals(1, taskService.createTaskQuery().count());

            Task task1 = taskService.createTaskQuery().taskDefinitionKey("task1").singleResult();

            assertNotNull(task1);

            Execution task1Execution = runtimeService.createExecutionQuery().activityId("task1").singleResult();

            assertNotNull(task1Execution);

            assertEquals(processInstanceId, ((ExecutionEntity)task1Execution).ParentId);

            // when (2)
            runtimeService.correlateMessage("firstMessage");

            // then (2)
            assertEquals(2, taskService.createTaskQuery().count());

            Task innerTask = taskService.createTaskQuery().taskDefinitionKey("innerTask").singleResult();

            assertNotNull(innerTask);

            Execution innerTaskExecution = runtimeService.createExecutionQuery().activityId("innerTask").singleResult();

            assertFalse(processInstanceId.Equals(((ExecutionEntity)innerTaskExecution).ParentId));

            task1 = taskService.createTaskQuery().taskDefinitionKey("task1").singleResult();
            assertNotNull(task1);

            task1Execution = runtimeService.createExecutionQuery().activityId("task1").singleResult();
            assertNotNull(task1Execution);

            assertEquals(processInstanceId, ((ExecutionEntity)task1Execution).ParentId);

            // when (3)
            runtimeService.correlateMessage("thirdMessage");

            // then (3)
            assertEquals(2, taskService.createTaskQuery().count());

            task1 = taskService.createTaskQuery().taskDefinitionKey("task1").singleResult();
            assertNotNull(task1);

            task1Execution = runtimeService.createExecutionQuery().activityId("task1").singleResult();
            assertNotNull(task1Execution);

            assertEquals(processInstanceId, ((ExecutionEntity)task1Execution).ParentId);

            Task task2 = taskService.createTaskQuery().taskDefinitionKey("task2").singleResult();

            assertNotNull(task2);

            Execution task2Execution = runtimeService.createExecutionQuery().activityId("task2").singleResult();

            assertNotNull(task2Execution);

            assertEquals(processInstanceId, ((ExecutionEntity)task2Execution).ParentId);

            assertEquals(0, runtimeService.createEventSubscriptionQuery().count());

            taskService.complete(task1.Id);
            taskService.complete(task2.Id);

            assertProcessEnded(processInstanceId);
        }
コード例 #26
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testSingleNonInterruptingBoundaryMessageEvent()
        public virtual void testSingleNonInterruptingBoundaryMessageEvent()
        {
            runtimeService.startProcessInstanceByKey("process");

            assertEquals(2, runtimeService.createExecutionQuery().count());

            Task userTask = taskService.createTaskQuery().taskDefinitionKey("task").singleResult();

            assertNotNull(userTask);

            Execution execution = runtimeService.createExecutionQuery().messageEventSubscriptionName("messageName").singleResult();

            assertNotNull(execution);

            // 1. case: message received before completing the task

            runtimeService.messageEventReceived("messageName", execution.Id);
            // event subscription not removed
            execution = runtimeService.createExecutionQuery().messageEventSubscriptionName("messageName").singleResult();
            assertNotNull(execution);

            assertEquals(2, taskService.createTaskQuery().count());

            userTask = taskService.createTaskQuery().taskDefinitionKey("taskAfterMessage").singleResult();
            assertNotNull(userTask);
            assertEquals("taskAfterMessage", userTask.TaskDefinitionKey);
            taskService.complete(userTask.Id);
            assertEquals(1, runtimeService.createProcessInstanceQuery().count());

            // send a message a second time
            runtimeService.messageEventReceived("messageName", execution.Id);
            // event subscription not removed
            execution = runtimeService.createExecutionQuery().messageEventSubscriptionName("messageName").singleResult();
            assertNotNull(execution);

            assertEquals(2, taskService.createTaskQuery().count());

            userTask = taskService.createTaskQuery().taskDefinitionKey("taskAfterMessage").singleResult();
            assertNotNull(userTask);
            assertEquals("taskAfterMessage", userTask.TaskDefinitionKey);
            taskService.complete(userTask.Id);
            assertEquals(1, runtimeService.createProcessInstanceQuery().count());

            // now complete the user task with the message boundary event
            userTask = taskService.createTaskQuery().taskDefinitionKey("task").singleResult();
            assertNotNull(userTask);

            taskService.complete(userTask.Id);

            // event subscription removed
            execution = runtimeService.createExecutionQuery().messageEventSubscriptionName("messageName").singleResult();
            assertNull(execution);

            userTask = taskService.createTaskQuery().taskDefinitionKey("taskAfterTask").singleResult();
            assertNotNull(userTask);

            taskService.complete(userTask.Id);

            assertEquals(0, runtimeService.createProcessInstanceQuery().count());

            // 2nd. case: complete the user task cancels the message subscription

            runtimeService.startProcessInstanceByKey("process");

            userTask = taskService.createTaskQuery().taskDefinitionKey("task").singleResult();
            assertNotNull(userTask);
            taskService.complete(userTask.Id);

            execution = runtimeService.createExecutionQuery().messageEventSubscriptionName("messageName").singleResult();
            assertNull(execution);

            userTask = taskService.createTaskQuery().taskDefinitionKey("taskAfterTask").singleResult();
            assertNotNull(userTask);
            assertEquals("taskAfterTask", userTask.TaskDefinitionKey);
            taskService.complete(userTask.Id);
            assertEquals(0, runtimeService.createProcessInstanceQuery().count());
        }
コード例 #27
0
 public MessageCorrelationResultImpl(CorrelationHandlerResult handlerResult)
 {
     this.execution  = handlerResult.Execution;
     this.resultType = handlerResult.ResultType;
 }