public virtual void testMigrateGatewayWithMessageEvent()
        {
            // given
            var sourceProcessDefinition =
                testHelper.DeployAndGetDefinition(EventBasedGatewayModels.MESSAGE_EVENT_BASED_GW_PROCESS);
            var targetProcessDefinition =
                testHelper.DeployAndGetDefinition(EventBasedGatewayModels.MESSAGE_EVENT_BASED_GW_PROCESS);

            var migrationPlan =
                rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id)
                .MapActivities("eventBasedGateway", "eventBasedGateway")
                .Build();

            // when
            var processInstance = testHelper.CreateProcessInstanceAndMigrate(migrationPlan);

            // then
            testHelper.AssertEventSubscriptionRemoved("messageCatch", EventBasedGatewayModels.MESSAGE_NAME);
            testHelper.AssertEventSubscriptionCreated("messageCatch", EventBasedGatewayModels.MESSAGE_NAME);

            rule.RuntimeService.CorrelateMessage(EventBasedGatewayModels.MESSAGE_NAME);

            testHelper.CompleteTask("afterMessageCatch");
            testHelper.AssertProcessEnded(processInstance.Id);
        }
        public virtual void testMigrateActiveEventSubProcess()
        {
            // given
            var sourceProcessDefinition =
                testHelper.DeployAndGetDefinition(EventSubProcessModels.MESSAGE_EVENT_SUBPROCESS_PROCESS);
            var targetProcessDefinition =
                testHelper.DeployAndGetDefinition(EventSubProcessModels.MESSAGE_EVENT_SUBPROCESS_PROCESS);

            var processInstance = rule.RuntimeService.CreateProcessInstanceById(sourceProcessDefinition.Id)
                                  .StartBeforeActivity(EVENT_SUB_PROCESS_TASK_ID)
                                  .Execute();

            var migrationPlan =
                rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id)
                .MapActivities("eventSubProcess", "eventSubProcess")
                .MapActivities(EVENT_SUB_PROCESS_TASK_ID, EVENT_SUB_PROCESS_TASK_ID)
                .Build();

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

            // then
            testHelper.AssertExecutionTreeAfterMigration()
            .HasProcessDefinitionId(targetProcessDefinition.Id)
            .Matches(ExecutionAssert.DescribeExecutionTree(null)
                     .Scope()
                     .Id(processInstance.Id)
                     .Child(EVENT_SUB_PROCESS_TASK_ID)
                     .Scope()
                     .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("eventSubProcess"))
                     .Done());

            testHelper.AssertActivityTreeAfterMigration()
            .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id)
                          .BeginScope("eventSubProcess",
                                      testHelper.GetSingleActivityInstanceBeforeMigration("eventSubProcess")
                                      .Id)
                          .Activity(EVENT_SUB_PROCESS_TASK_ID,
                                    testHelper.GetSingleActivityInstanceBeforeMigration(EVENT_SUB_PROCESS_TASK_ID)
                                    .Id)
                          .Done());

            testHelper.AssertEventSubscriptionRemoved(EVENT_SUB_PROCESS_START_ID, EventSubProcessModels.MESSAGE_NAME);
            testHelper.AssertEventSubscriptionCreated(EVENT_SUB_PROCESS_START_ID, EventSubProcessModels.MESSAGE_NAME);

            // and it is possible to complete the process instance
            testHelper.CompleteTask(EVENT_SUB_PROCESS_TASK_ID);
            testHelper.AssertProcessEnded(processInstance.Id);
        }
        public virtual void testMigrateMultipleBoundaryEvents()
        {
            // given
            IBpmnModelInstance testProcess = ModifiableBpmnModelInstance.Modify(ProcessModels.SubprocessProcess)
                                             //.ActivityBuilder("subProcess")
                                             //.BoundaryEvent("timerBoundary1")
                                             //.TimerWithDate(TIMER_DATE)
                                             //.MoveToActivity("subProcess")
                                             //.BoundaryEvent("messageBoundary1")
                                             ////.Message(MESSAGE_NAME)
                                             //.MoveToActivity("subProcess")
                                             //.BoundaryEvent("signalBoundary1")
                                             //.Signal(SIGNAL_NAME)
                                             //.MoveToActivity("subProcess")
                                             //.BoundaryEvent("conditionalBoundary1")
                                             //.Condition(VAR_CONDITION)
                                             //.MoveToActivity(USER_TASK_ID)
                                             //.BoundaryEvent("timerBoundary2")
                                             //.TimerWithDate(TIMER_DATE)
                                             //.MoveToActivity(USER_TASK_ID)
                                             //.BoundaryEvent("messageBoundary2")
                                             ////.Message(MESSAGE_NAME)
                                             //.MoveToActivity(USER_TASK_ID)
                                             //.BoundaryEvent("signalBoundary2")
                                             //.Signal(SIGNAL_NAME)
                                             //.MoveToActivity(USER_TASK_ID)
                                             //.BoundaryEvent("conditionalBoundary2")
                                             //.Condition(VAR_CONDITION)
                                             //.Done()
            ;

            var sourceProcessDefinition = testHelper.DeployAndGetDefinition(testProcess);
            var targetProcessDefinition = testHelper.DeployAndGetDefinition(testProcess);

            var migrationPlan =
                rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id)
                .MapActivities("subProcess", "subProcess")
                .MapActivities("timerBoundary1", "timerBoundary1")
                .MapActivities("signalBoundary1", "signalBoundary1")
                .MapActivities("conditionalBoundary1", "conditionalBoundary1")
                .UpdateEventTrigger()
                .MapActivities(USER_TASK_ID, USER_TASK_ID)
                .MapActivities("messageBoundary2", "messageBoundary2")
                .Build();

            // when
            testHelper.CreateProcessInstanceAndMigrate(migrationPlan);

            // then
            testHelper.AssertEventSubscriptionRemoved("messageBoundary1", MESSAGE_NAME);
            testHelper.AssertEventSubscriptionRemoved("signalBoundary2", SIGNAL_NAME);
            testHelper.AssertEventSubscriptionRemoved("conditionalBoundary2", null);
            testHelper.AssertEventSubscriptionMigrated("signalBoundary1", "signalBoundary1", SIGNAL_NAME);
            testHelper.AssertEventSubscriptionMigrated("messageBoundary2", "messageBoundary2", MESSAGE_NAME);
            testHelper.AssertEventSubscriptionMigrated("conditionalBoundary1", "conditionalBoundary1", null);
            testHelper.AssertEventSubscriptionCreated("messageBoundary1", MESSAGE_NAME);
            testHelper.AssertEventSubscriptionCreated("signalBoundary2", SIGNAL_NAME);
            testHelper.AssertEventSubscriptionCreated("conditionalBoundary2", null);
            testHelper.AssertBoundaryTimerJobRemoved("timerBoundary2");
            testHelper.AssertBoundaryTimerJobMigrated("timerBoundary1", "timerBoundary1");
            testHelper.AssertBoundaryTimerJobCreated("timerBoundary2");

            // and it is possible to successfully complete the migrated instance
            testHelper.CompleteTask(USER_TASK_ID);
            testHelper.AssertProcessEnded(testHelper.SnapshotBeforeMigration.ProcessInstanceId);
        }
예제 #4
0
 public virtual void AssertMigration(MigrationTestRule testHelper)
 {
     testHelper.AssertEventSubscriptionRemoved(EVENT_SUB_PROCESS_START_ID, EventName);
     testHelper.AssertEventSubscriptionCreated(EVENT_SUB_PROCESS_START_ID, EventName);
 }