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 testTrees() { // given var sourceProcessDefinition = testHelper.DeployAndGetDefinition(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS); var targetProcessDefinition = testHelper.DeployAndGetDefinition(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS); var migrationPlan = rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id) .MapActivities("externalTask", "externalTask") .Build(); var processInstance = rule.RuntimeService.StartProcessInstanceById(sourceProcessDefinition.Id); // when testHelper.MigrateProcessInstance(migrationPlan, processInstance); // then the execution and activity instance tree are exactly as before migration testHelper.AssertExecutionTreeAfterMigration() .HasProcessDefinitionId(targetProcessDefinition.Id) .Matches(ExecutionAssert.DescribeExecutionTree(null) .Scope() .Id(testHelper.SnapshotBeforeMigration.ProcessInstanceId) .Child("externalTask") .Scope() .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("externalTask")) .Done()); testHelper.AssertActivityTreeAfterMigration() .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id) .Activity("externalTask", testHelper.GetSingleActivityInstanceBeforeMigration("externalTask") .Id) .Done()); }
public virtual void testAssertTrees() { // given var sourceProcessDefinition = testHelper.DeployAndGetDefinition(TransactionModels.ONE_TASK_TRANSACTION); var targetProcessDefinition = testHelper.DeployAndGetDefinition(TransactionModels.ONE_TASK_TRANSACTION); var migrationPlan = rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id) .MapActivities("transaction", "transaction") .MapActivities("userTask", "userTask") .Build(); // when testHelper.CreateProcessInstanceAndMigrate(migrationPlan); // then testHelper.AssertExecutionTreeAfterMigration() .HasProcessDefinitionId(targetProcessDefinition.Id) .Matches(ExecutionAssert.DescribeExecutionTree(null) .Scope() .Id(testHelper.SnapshotBeforeMigration.ProcessInstanceId) .Child("userTask") .Scope() .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("userTask")) .Up() .Done()); testHelper.AssertActivityTreeAfterMigration() .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id) .BeginScope("transaction", testHelper.GetSingleActivityInstanceBeforeMigration("transaction") .Id) .Activity("userTask", testHelper.GetSingleActivityInstanceBeforeMigration("userTask") .Id) .Done()); }
public virtual void testMigrateGatewayExecutionTree() { // given var sourceProcessDefinition = testHelper.DeployAndGetDefinition(EventBasedGatewayModels.TIMER_EVENT_BASED_GW_PROCESS); var targetProcessDefinition = testHelper.DeployAndGetDefinition(EventBasedGatewayModels.TIMER_EVENT_BASED_GW_PROCESS); var migrationPlan = rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id) .MapActivities("eventBasedGateway", "eventBasedGateway") .Build(); // when testHelper.CreateProcessInstanceAndMigrate(migrationPlan); // then testHelper.AssertExecutionTreeAfterMigration() .HasProcessDefinitionId(targetProcessDefinition.Id) .Matches(ExecutionAssert.DescribeExecutionTree(null) .Scope() .Id(testHelper.SnapshotBeforeMigration.ProcessInstanceId) .Child("eventBasedGateway") .Scope() .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("eventBasedGateway")) .Done()); testHelper.AssertActivityTreeAfterMigration() .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id) .Activity("eventBasedGateway", testHelper.GetSingleActivityInstanceBeforeMigration("eventBasedGateway") .Id) .Done()); }
public virtual void testParallelGatewayAssertTrees() { // given var sourceProcessDefinition = testHelper.DeployAndGetDefinition(GatewayModels.PARALLEL_GW); var targetProcessDefinition = testHelper.DeployAndGetDefinition(GatewayModels.PARALLEL_GW); var migrationPlan = rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id) .MapActivities("parallel1", "parallel1") .MapActivities("join", "join") .Build(); var processInstance = rule.RuntimeService.StartProcessInstanceById(sourceProcessDefinition.Id); testHelper.CompleteTask("parallel2"); // when testHelper.MigrateProcessInstance(migrationPlan, processInstance); // then testHelper.AssertExecutionTreeAfterMigration() .HasProcessDefinitionId(targetProcessDefinition.Id) .Matches(ExecutionAssert.DescribeExecutionTree(null) .Scope() .Id(testHelper.SnapshotBeforeMigration.ProcessInstanceId) .Child("parallel1") .NoScope() .Concurrent() .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("parallel1")) .Up() .Child("join") .NoScope() .Concurrent() .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("join")) .Done()); testHelper.AssertActivityTreeAfterMigration() .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id) .Activity("parallel1", testHelper.GetSingleActivityInstanceBeforeMigration("parallel1") .Id) .Activity("join", testHelper.GetSingleActivityInstanceBeforeMigration("join") .Id) .Done()); }
public virtual void testMigrateJob() { // given var sourceProcessDefinition = testHelper.DeployAndGetDefinition(TimerCatchModels.ONE_TIMER_CATCH_PROCESS); var targetProcessDefinition = testHelper.DeployAndGetDefinition(TimerCatchModels.ONE_TIMER_CATCH_PROCESS); var migrationPlan = rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id) .MapActivities("timerCatch", "timerCatch") .Build(); // when var processInstance = testHelper.CreateProcessInstanceAndMigrate(migrationPlan); testHelper.AssertJobMigrated(testHelper.SnapshotBeforeMigration.Jobs[0], "timerCatch"); testHelper.AssertExecutionTreeAfterMigration() .HasProcessDefinitionId(targetProcessDefinition.Id) .Matches(ExecutionAssert.DescribeExecutionTree(null) .Scope() .Id(testHelper.SnapshotBeforeMigration.ProcessInstanceId) .Child("timerCatch") .Scope() .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("timerCatch")) .Done()); testHelper.AssertActivityTreeAfterMigration() .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id) .Activity("timerCatch", testHelper.GetSingleActivityInstanceBeforeMigration("timerCatch") .Id) .Done()); // and it is possible to trigger the event var jobAfterMigration = testHelper.SnapshotAfterMigration.Jobs[0]; rule.ManagementService.ExecuteJob(jobAfterMigration.Id); testHelper.CompleteTask("userTask"); testHelper.AssertProcessEnded(processInstance.Id); }
public virtual void testMigrateEventSubscription() { // given var sourceProcessDefinition = testHelper.DeployAndGetDefinition(SignalCatchModels.ONE_SIGNAL_CATCH_PROCESS); var targetProcessDefinition = testHelper.DeployAndGetDefinition(SignalCatchModels.ONE_SIGNAL_CATCH_PROCESS); var migrationPlan = rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id) .MapActivities("signalCatch", "signalCatch") .Build(); // when var processInstance = testHelper.CreateProcessInstanceAndMigrate(migrationPlan); // then testHelper.AssertEventSubscriptionMigrated("signalCatch", "signalCatch", SignalCatchModels.SIGNAL_NAME); testHelper.AssertExecutionTreeAfterMigration() .HasProcessDefinitionId(targetProcessDefinition.Id) .Matches(ExecutionAssert.DescribeExecutionTree(null) .Scope() .Id(testHelper.SnapshotBeforeMigration.ProcessInstanceId) .Child("signalCatch") .Scope() .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("signalCatch")) .Done()); testHelper.AssertActivityTreeAfterMigration() .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id) .Activity("signalCatch", testHelper.GetSingleActivityInstanceBeforeMigration("signalCatch") .Id) .Done()); // and it is possible to trigger the event rule.RuntimeService.SignalEventReceived(SignalCatchModels.SIGNAL_NAME); testHelper.CompleteTask("userTask"); testHelper.AssertProcessEnded(processInstance.Id); }
public virtual void testRemovSequentialMultiInstanceBodyScope() { // given var sourceProcessDefinition = testHelper.DeployAndGetDefinition(MultiInstanceProcessModels.SEQ_MI_SUBPROCESS_PROCESS); var targetProcessDefinition = testHelper.DeployAndGetDefinition(ProcessModels.SubprocessProcess); var migrationPlan = rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id) .MapActivities("subProcess", "subProcess") .MapActivities("userTask", "userTask") .Build(); // when testHelper.CreateProcessInstanceAndMigrate(migrationPlan); // then var subProcessInstance = testHelper.GetSingleActivityInstanceBeforeMigration("subProcess"); testHelper.AssertExecutionTreeAfterMigration() .HasProcessDefinitionId(targetProcessDefinition.Id) .Matches(ExecutionAssert.DescribeExecutionTree(null) .Scope() .Id(testHelper.SnapshotBeforeMigration.ProcessInstanceId) .Child("userTask") .Scope() .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("subProcess")) .Done()); testHelper.AssertActivityTreeAfterMigration() .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id) .BeginScope("subProcess", subProcessInstance.Id) .Activity("userTask", subProcessInstance.GetActivityInstances("userTask")[0].Id) .Done()); var migratedTask = testHelper.SnapshotAfterMigration.GetTaskForKey("userTask"); Assert.NotNull(migratedTask); // and it is possible to successfully complete the migrated instance rule.TaskService.Complete(migratedTask.Id); testHelper.AssertProcessEnded(testHelper.SnapshotBeforeMigration.ProcessInstanceId); }
public virtual void testCallBpmnProcessSimpleMigration() { // given var model = CallActivityModels.oneBpmnCallActivityProcess("oneTaskProcess"); var sourceProcessDefinition = testHelper.DeployAndGetDefinition(model); var targetProcessDefinition = testHelper.DeployAndGetDefinition(model); var migrationPlan = rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id) .MapActivities("callActivity", "callActivity") .Build(); // when var processInstance = testHelper.CreateProcessInstanceAndMigrate(migrationPlan); // then testHelper.AssertExecutionTreeAfterMigration() .HasProcessDefinitionId(targetProcessDefinition.Id) .Matches(ExecutionAssert.DescribeExecutionTree(null) .Scope() .Id(testHelper.SnapshotBeforeMigration.ProcessInstanceId) .Child("callActivity") .Scope() .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration("callActivity")) .Done()); testHelper.AssertActivityTreeAfterMigration() .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id) .Activity("callActivity", testHelper.GetSingleActivityInstanceBeforeMigration("callActivity") .Id) .Done()); // and it is possible to complete the called process instance testHelper.CompleteTask("userTask"); // and the calling process instance testHelper.CompleteTask("userTask"); testHelper.AssertProcessEnded(processInstance.Id); }
public virtual void testMigrateParallelMultiInstanceTask() { // given var sourceProcessDefinition = testHelper.DeployAndGetDefinition(MultiInstanceProcessModels.PAR_MI_ONE_TASK_PROCESS); var targetProcessDefinition = testHelper.DeployAndGetDefinition(MultiInstanceProcessModels.PAR_MI_ONE_TASK_PROCESS); var migrationPlan = rule.RuntimeService.CreateMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id) .MapActivities(miBodyOf("userTask"), miBodyOf("userTask")) .MapActivities("userTask", "userTask") .Build(); // when testHelper.CreateProcessInstanceAndMigrate(migrationPlan); // then testHelper.AssertExecutionTreeAfterMigration() .HasProcessDefinitionId(targetProcessDefinition.Id) .Matches(ExecutionAssert.DescribeExecutionTree(null) .Scope() .Id(testHelper.SnapshotBeforeMigration.ProcessInstanceId) .Child(null) .Scope() .Id(testHelper.GetSingleExecutionIdForActivityBeforeMigration(miBodyOf("userTask"))) .Child("userTask") .Concurrent() .NoScope() .Up() .Child("userTask") .Concurrent() .NoScope() .Up() .Child("userTask") .Concurrent() .NoScope() .Up() .Done()); var userTaskInstances = testHelper.SnapshotBeforeMigration.ActivityTree.GetActivityInstances("userTask"); testHelper.AssertActivityTreeAfterMigration() .HasStructure(ActivityInstanceAssert.DescribeActivityInstanceTree(targetProcessDefinition.Id) .BeginMiBody("userTask", testHelper.GetSingleActivityInstanceBeforeMigration(miBodyOf("userTask")) .Id) .Activity("userTask", userTaskInstances[0].Id) .Activity("userTask", userTaskInstances[1].Id) .Activity("userTask", userTaskInstances[2].Id) .Done()); var migratedTasks = testHelper.SnapshotAfterMigration.Tasks; Assert.AreEqual(3, migratedTasks.Count); foreach (var migratedTask in migratedTasks) { Assert.AreEqual(targetProcessDefinition.Id, migratedTask.ProcessDefinitionId); } // and it is possible to successfully complete the migrated instance foreach (var migratedTask in migratedTasks) { rule.TaskService.Complete(migratedTask.Id); } testHelper.AssertProcessEnded(testHelper.SnapshotBeforeMigration.ProcessInstanceId); }