Ejemplo n.º 1
0
        public virtual Batch cancelAllAsync(string key, int numberOfProcessInstances, string activityId, string processDefinitionId)
        {
            RuntimeService runtimeService = engineRule.RuntimeService;

            IList <string> processInstanceIds = startInstances(key, numberOfProcessInstances);

            return(runtimeService.createModification(processDefinitionId).cancelAllForActivity(activityId).processInstanceIds(processInstanceIds).executeAsync());
        }
Ejemplo n.º 2
0
        public virtual Batch startTransitionAsync(string key, int numberOfProcessInstances, string transitionId, string processDefinitionId)
        {
            RuntimeService runtimeService = engineRule.RuntimeService;

            IList <string> processInstanceIds = startInstances(key, numberOfProcessInstances);

            return(runtimeService.createModification(processDefinitionId).startTransition(transitionId).processInstanceIds(processInstanceIds).executeAsync());
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testNoCreationOnSyncBatchJobExecution()
        public virtual void testNoCreationOnSyncBatchJobExecution()
        {
            // given
            ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);

            ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.Id);

            Batch batch = runtimeService.createModification(processDefinition.Id).startAfterActivity("user2").processInstanceIds(Arrays.asList(processInstance.Id)).executeAsync();

            helper.executeSeedJob(batch);

            // when
            rule.IdentityService.AuthenticatedUserId = "userId";
            helper.executeJobs(batch);
            rule.IdentityService.clearAuthentication();

            // then
            Assert.assertEquals(0, rule.HistoryService.createUserOperationLogQuery().entityType(EntityTypes.PROCESS_INSTANCE).count());
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Ignore("CAM-9354") @Test public void shouldHaveEqualParentActivityInstanceId()
        public virtual void shouldHaveEqualParentActivityInstanceId()
        {
            // given
            testHelper.deploy(Bpmn.createExecutableProcess("process").startEvent().subProcess("subprocess").embeddedSubProcess().startEvent().scriptTask("scriptTaskInSubprocess").scriptFormat("groovy").scriptText("throw new org.camunda.bpm.engine.delegate.BpmnError(\"anErrorCode\");").userTask().endEvent().subProcessDone().endEvent().moveToActivity("subprocess").boundaryEvent("boundary").error("anErrorCode").userTask("userTaskAfterBoundaryEvent").endEvent().done());

            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");

            // when
            runtimeService.createModification(processInstance.ProcessDefinitionId).startAfterActivity("scriptTaskInSubprocess").processInstanceIds(processInstance.Id).execute();

            ActivityInstance activityInstance = runtimeService.getActivityInstance(processInstance.Id).getActivityInstances("subprocess")[0];

            HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().activityId("subprocess").unfinished().singleResult();

            // assume
            assertNotNull(activityInstance);
            assertNotNull(historicActivityInstance);

            // then
            assertEquals(historicActivityInstance.ParentActivityInstanceId, activityInstance.ParentActivityInstanceId);
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpRuntimeData()
        public virtual void setUpRuntimeData()
        {
            runtimeServiceMock = mock(typeof(RuntimeService));
            when(processEngine.RuntimeService).thenReturn(runtimeServiceMock);

            modificationBuilderMock = mock(typeof(ModificationBuilder));
            when(modificationBuilderMock.cancelAllForActivity(anyString())).thenReturn(modificationBuilderMock);
            when(modificationBuilderMock.startAfterActivity(anyString())).thenReturn(modificationBuilderMock);
            when(modificationBuilderMock.startBeforeActivity(anyString())).thenReturn(modificationBuilderMock);
            when(modificationBuilderMock.startTransition(anyString())).thenReturn(modificationBuilderMock);
            when(modificationBuilderMock.processInstanceIds(anyListOf(typeof(string)))).thenReturn(modificationBuilderMock);

            Batch batchMock = createMockBatch();

            when(modificationBuilderMock.executeAsync()).thenReturn(batchMock);

            when(runtimeServiceMock.createModification(anyString())).thenReturn(modificationBuilderMock);
        }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void createSimpleModificationPlan()
        public virtual void createSimpleModificationPlan()
        {
            ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
            IList <string>    instances         = helper.startInstances("process1", 2);

            runtimeService.createModification(processDefinition.Id).startBeforeActivity("user2").cancelAllForActivity("user1").processInstanceIds(instances).execute();

            foreach (string instanceId in instances)
            {
                IList <string> activeActivityIds = runtimeService.getActiveActivityIds(instanceId);
                assertEquals(1, activeActivityIds.Count);
                assertEquals(activeActivityIds.GetEnumerator().next(), "user2");
            }
        }