use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationMessageCatchEventTest method testMigrateEventSubscriptionUpdateMessageName.
@Test
public void testMigrateEventSubscriptionUpdateMessageName() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(MessageReceiveModels.ONE_MESSAGE_CATCH_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(MessageReceiveModels.ONE_MESSAGE_CATCH_PROCESS).renameMessage(MessageReceiveModels.MESSAGE_NAME, "new" + MessageReceiveModels.MESSAGE_NAME));
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("messageCatch", "messageCatch").updateEventTrigger().build();
// when
ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then the message event subscription's event name has changed
testHelper.assertEventSubscriptionMigrated("messageCatch", MessageReceiveModels.MESSAGE_NAME, "messageCatch", "new" + MessageReceiveModels.MESSAGE_NAME);
// and it is possible to trigger the event
rule.getRuntimeService().correlateMessage("new" + MessageReceiveModels.MESSAGE_NAME);
testHelper.completeTask("userTask");
testHelper.assertProcessEnded(processInstance.getId());
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationMessageCatchEventTest method testMigrateEventSubscriptionChangeActivityId.
@Test
public void testMigrateEventSubscriptionChangeActivityId() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(MessageReceiveModels.ONE_MESSAGE_CATCH_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(MessageReceiveModels.ONE_MESSAGE_CATCH_PROCESS).changeElementId("messageCatch", "newMessageCatch"));
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("messageCatch", "newMessageCatch").build();
// when
ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);
testHelper.assertEventSubscriptionMigrated("messageCatch", "newMessageCatch", MessageReceiveModels.MESSAGE_NAME);
// and it is possible to trigger the receive task
rule.getRuntimeService().correlateMessage(MessageReceiveModels.MESSAGE_NAME);
testHelper.completeTask("userTask");
testHelper.assertProcessEnded(processInstance.getId());
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationSignallableServiceTaskTest method testCannotMigrateActivityInstance.
@Test
public void testCannotMigrateActivityInstance() {
// given
BpmnModelInstance model = ProcessModels.newModel().startEvent().serviceTask("serviceTask").camundaClass(SignallableServiceTaskDelegate.class.getName()).endEvent().done();
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("serviceTask", "serviceTask").build();
// when
try {
testHelper.createProcessInstanceAndMigrate(migrationPlan);
Assert.fail("should fail");
} catch (MigratingProcessInstanceValidationException e) {
// then
assertThat(e.getValidationReport()).hasActivityInstanceFailures("serviceTask", "The type of the source activity is not supported for activity instance migration");
}
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationTimerCatchEventTest method testMigrateJobAddParentScope.
@Test
public void testMigrateJobAddParentScope() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(TimerCatchModels.ONE_TIMER_CATCH_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(TimerCatchModels.SUBPROCESS_TIMER_CATCH_PROCESS);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("timerCatch", "timerCatch").build();
// when
ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);
// then
testHelper.assertJobMigrated(testHelper.snapshotBeforeMigration.getJobs().get(0), "timerCatch");
testHelper.assertExecutionTreeAfterMigration().hasProcessDefinitionId(targetProcessDefinition.getId()).matches(describeExecutionTree(null).scope().id(testHelper.snapshotBeforeMigration.getProcessInstanceId()).child(null).scope().child("timerCatch").scope().id(testHelper.getSingleExecutionIdForActivityBeforeMigration("timerCatch")).done());
testHelper.assertActivityTreeAfterMigration().hasStructure(describeActivityInstanceTree(targetProcessDefinition.getId()).beginScope("subProcess").activity("timerCatch", testHelper.getSingleActivityInstanceBeforeMigration("timerCatch").getId()).done());
// and it is possible to trigger the event
Job jobAfterMigration = testHelper.snapshotAfterMigration.getJobs().get(0);
rule.getManagementService().executeJob(jobAfterMigration.getId());
testHelper.completeTask("userTask");
testHelper.assertProcessEnded(processInstance.getId());
}
use of org.camunda.bpm.engine.migration.MigrationPlan in project camunda-bpm-platform by camunda.
the class MigrationTimerCatchEventTest method testMigrateJobChangeProcessKey.
@Test
public void testMigrateJobChangeProcessKey() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(TimerCatchModels.ONE_TIMER_CATCH_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(TimerCatchModels.ONE_TIMER_CATCH_PROCESS).changeElementId(ProcessModels.PROCESS_KEY, "new" + ProcessModels.PROCESS_KEY));
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("timerCatch", "timerCatch").build();
// when
ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan);
testHelper.assertJobMigrated(testHelper.snapshotBeforeMigration.getJobs().get(0), "timerCatch");
// and it is possible to trigger the event
Job jobAfterMigration = testHelper.snapshotAfterMigration.getJobs().get(0);
rule.getManagementService().executeJob(jobAfterMigration.getId());
testHelper.completeTask("userTask");
testHelper.assertProcessEnded(processInstance.getId());
}
Aggregations