Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testDeleteProcessInstancesAsyncWithoutSkipSubprocesses()
        public virtual void testDeleteProcessInstancesAsyncWithoutSkipSubprocesses()
        {
            // given
            BpmnModelInstance callingInstance = ProcessModels.newModel(ONE_TASK_PROCESS).startEvent().callActivity().calledElement("called").endEvent().done();

            BpmnModelInstance calledInstance = ProcessModels.newModel("called").startEvent().userTask().endEvent().done();

            testRule.deploy(callingInstance, calledInstance);
            IList <string> processIds = startTestProcesses(1);

            // when
            Batch batch = runtimeService.deleteProcessInstancesAsync(processIds, null, TESTING_INSTANCE_DELETE, false, false);

            executeSeedJob(batch);
            executeBatchJobs(batch);

            // then
            ProcessInstance superInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processIds[0]).singleResult();

            assertNull(superInstance);

            ProcessInstance subInstance = runtimeService.createProcessInstanceQuery().processDefinitionKey("called").singleResult();

            assertNull(subInstance);
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testInvokeListenersWhenDeletingProcessInstancesAsync()
        public virtual void testInvokeListenersWhenDeletingProcessInstancesAsync()
        {
            // given
            IncrementCounterListener.counter = 0;

//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            BpmnModelInstance instance = ProcessModels.newModel(ONE_TASK_PROCESS).startEvent().userTask().camundaExecutionListenerClass([email protected]_Fields.EVENTNAME_END, typeof(IncrementCounterListener).FullName).endEvent().done();

            migrationRule.deploy(instance);
            IList <string> processIds = startTestProcesses(1);

            // when
            Batch batch = runtimeService.deleteProcessInstancesAsync(processIds, TESTING_INSTANCE_DELETE);

            executeSeedJob(batch);
            executeBatchJobs(batch);

            // then
            assertThat(IncrementCounterListener.counter, @is(1));
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMigrateJobUpdateTimerConfiguration()
        public virtual void testMigrateJobUpdateTimerConfiguration()
        {
            // given
            ClockTestUtil.setClockToDateWithoutMilliseconds();

            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(TimerCatchModels.ONE_TIMER_CATCH_PROCESS);
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.newModel().startEvent().intermediateCatchEvent("timerCatch").timerWithDuration("PT50M").userTask("userTask").endEvent().done());

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

            // when
            ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);

            // then
            DateTime newDueDate = (new DateTime(ClockUtil.CurrentTime)).plusMinutes(50).toDate();

            testHelper.assertJobMigrated(testHelper.snapshotBeforeMigration.Jobs[0], "timerCatch", newDueDate);

            // and it is possible to trigger the event
            Job jobAfterMigration = testHelper.snapshotAfterMigration.Jobs[0];

            rule.ManagementService.executeJob(jobAfterMigration.Id);

            testHelper.completeTask("userTask");
            testHelper.assertProcessEnded(processInstance.Id);
        }
Esempio n. 4
0
 public virtual BpmnModelInstance build()
 {
     return(ProcessModels.newModel(processKey_Renamed).startEvent().serviceTask(externalTaskName_Renamed).camundaType(externalTaskType_Renamed).camundaTopic(topic_Renamed).camundaTaskPriority(priority_Renamed.ToString()).endEvent().done());
 }
Esempio n. 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMigrateEventSubscriptionPreserveMessageName()
        public virtual void testMigrateEventSubscriptionPreserveMessageName()
        {
            // given
            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(MessageReceiveModels.ONE_MESSAGE_CATCH_PROCESS);
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.newModel().startEvent().intermediateCatchEvent("messageCatch").message("new" + MessageReceiveModels.MESSAGE_NAME).userTask("userTask").endEvent().done());

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

            // when
            ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);

            // then the message event subscription's event name has not changed
            testHelper.assertEventSubscriptionMigrated("messageCatch", "messageCatch", MessageReceiveModels.MESSAGE_NAME);

            // and it is possible to trigger the receive task
            rule.RuntimeService.correlateMessage(MessageReceiveModels.MESSAGE_NAME);

            testHelper.completeTask("userTask");
            testHelper.assertProcessEnded(processInstance.Id);
        }
Esempio n. 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testChangeTaskType()
        public virtual void testChangeTaskType()
        {
            // given
            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS);
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.newModel().startEvent().businessRuleTask("externalBusinessRuleTask").camundaType(ExternalTaskModels.EXTERNAL_TASK_TYPE).camundaTopic(ExternalTaskModels.TOPIC).camundaTaskPriority(ExternalTaskModels.PRIORITY.ToString()).endEvent().done());

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

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

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

            // then the task and process can be completed
            LockedExternalTask task = fetchAndLockSingleTask(ExternalTaskModels.TOPIC);

            rule.ExternalTaskService.complete(task.Id, WORKER_ID);

            testHelper.assertProcessEnded(processInstance.Id);
        }
Esempio n. 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMigrateEventSubscriptionUpdateSignalExpressionNameWithVariables()
        public virtual void testMigrateEventSubscriptionUpdateSignalExpressionNameWithVariables()
        {
            // given
            string            newSignalName           = "new" + SignalCatchModels.SIGNAL_NAME + "-${var}";
            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(SignalCatchModels.ONE_SIGNAL_CATCH_PROCESS);
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.newModel().startEvent().intermediateCatchEvent("signalCatch").signal(newSignalName).userTask("userTask").endEvent().done());

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

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

            variables["var"] = "foo";


            // when
            ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan, variables);

            // then there should be a variable
            VariableInstance beforeMigration = testHelper.snapshotBeforeMigration.getSingleVariable("var");

            Assert.assertEquals(1, testHelper.snapshotAfterMigration.getVariables().Count);
            testHelper.assertVariableMigratedToExecution(beforeMigration, beforeMigration.ExecutionId);

            // and the signal event subscription's event name has changed
            string resolvedSignalName = "new" + SignalCatchModels.SIGNAL_NAME + "-foo";

            testHelper.assertEventSubscriptionMigrated("signalCatch", SignalCatchModels.SIGNAL_NAME, "signalCatch", resolvedSignalName);

            // and it is possible to trigger the event and complete the task afterwards
            rule.RuntimeService.signalEventReceived(resolvedSignalName);

            testHelper.completeTask("userTask");
            testHelper.assertProcessEnded(processInstance.Id);
        }
Esempio n. 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMigrateEventSubscriptionUpdateSignalName()
        public virtual void testMigrateEventSubscriptionUpdateSignalName()
        {
            // given
            ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(SignalCatchModels.ONE_SIGNAL_CATCH_PROCESS);
            ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.newModel().startEvent().intermediateCatchEvent("signalCatch").signal("new" + SignalCatchModels.SIGNAL_NAME).userTask("userTask").endEvent().done());

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

            // when
            ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);

            // then the message event subscription's event name has not changed
            testHelper.assertEventSubscriptionMigrated("signalCatch", SignalCatchModels.SIGNAL_NAME, "signalCatch", "new" + SignalCatchModels.SIGNAL_NAME);

            // and it is possible to trigger the event
            rule.RuntimeService.signalEventReceived("new" + SignalCatchModels.SIGNAL_NAME);

            testHelper.completeTask("userTask");
            testHelper.assertProcessEnded(processInstance.Id);
        }