Search in sources :

Example 6 with MigrationPlanValidationException

use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.

the class MigrationCompensationTest method testCannotMapCompensateStartEventWithoutMappingEventScopeCase2.

@Test
public void testCannotMapCompensateStartEventWithoutMappingEventScopeCase2() {
    // given
    BpmnModelInstance model = modify(CompensationModels.COMPENSATION_EVENT_SUBPROCESS_MODEL).removeFlowNode("compensationBoundary");
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model);
    try {
        // when
        rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("eventSubProcessStart", "eventSubProcessStart").build();
        Assert.fail("exception expected");
    } catch (MigrationPlanValidationException e) {
        // then
        assertThat(e.getValidationReport()).hasInstructionFailures("eventSubProcessStart", "The source activity's event scope (subProcess) must be mapped to the target activity's event scope (subProcess)");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 7 with MigrationPlanValidationException

use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.

the class MigrationExternalTaskTest method cannotMigrateFromExternalToClassDelegateServiceTask.

@Test
public void cannotMigrateFromExternalToClassDelegateServiceTask() {
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ServiceTaskModels.oneClassDelegateServiceTask("foo.Bar"));
    try {
        rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("externalTask", "serviceTask").build();
        Assert.fail("exception expected");
    } catch (MigrationPlanValidationException e) {
        // then
        assertThat(e.getValidationReport()).hasInstructionFailures("externalTask", "Activities have incompatible types (ExternalTaskActivityBehavior is not compatible with" + " ClassDelegateActivityBehavior)");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 8 with MigrationPlanValidationException

use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.

the class MigrationGatewayTest method testCannotRemoveParentScope.

/**
 * Ensures that situations are avoided in which more tokens end up at the target gateway
 * than it has incoming flows
 */
@Test
public void testCannotRemoveParentScope() {
    // given
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(GatewayModels.PARALLEL_GW_IN_SUBPROCESS);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(GatewayModels.PARALLEL_GW);
    try {
        rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("join", "join").build();
        Assert.fail("exception expected");
    } catch (MigrationPlanValidationException e) {
        // then
        assertThat(e.getValidationReport()).hasInstructionFailures("join", "The gateway's flow scope 'subProcess' must be mapped");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 9 with MigrationPlanValidationException

use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.

the class MigrationGatewayTest method testCannotMigrateParallelToInclusiveGateway.

@Test
public void testCannotMigrateParallelToInclusiveGateway() {
    // given
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(GatewayModels.PARALLEL_GW);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(GatewayModels.INCLUSIVE_GW);
    try {
        rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("join", "join").build();
        Assert.fail("exception expected");
    } catch (MigrationPlanValidationException e) {
        // then
        assertThat(e.getValidationReport()).hasInstructionFailures("join", "Activities have incompatible types " + "(ParallelGatewayActivityBehavior is not compatible with InclusiveGatewayActivityBehavior)");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 10 with MigrationPlanValidationException

use of org.camunda.bpm.engine.migration.MigrationPlanValidationException in project camunda-bpm-platform by camunda.

the class MigrationGatewayTest method testCannotMigrateInclusiveToParallelGateway.

@Test
public void testCannotMigrateInclusiveToParallelGateway() {
    // given
    ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(GatewayModels.INCLUSIVE_GW);
    ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(GatewayModels.PARALLEL_GW);
    try {
        rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("join", "join").build();
        Assert.fail("exception expected");
    } catch (MigrationPlanValidationException e) {
        // then
        assertThat(e.getValidationReport()).hasInstructionFailures("join", "Activities have incompatible types " + "(InclusiveGatewayActivityBehavior is not compatible with ParallelGatewayActivityBehavior)");
    }
}
Also used : MigrationPlanValidationException(org.camunda.bpm.engine.migration.MigrationPlanValidationException) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Test(org.junit.Test)

Aggregations

MigrationPlanValidationException (org.camunda.bpm.engine.migration.MigrationPlanValidationException)46 Test (org.junit.Test)46 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)39 MigrationInstructionValidationReport (org.camunda.bpm.engine.migration.MigrationInstructionValidationReport)7 MigrationPlanValidationReport (org.camunda.bpm.engine.migration.MigrationPlanValidationReport)7 Matchers.anyString (org.mockito.Matchers.anyString)7 MigrationExecutionDtoBuilder (org.camunda.bpm.engine.rest.util.migration.MigrationExecutionDtoBuilder)6 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)5 MigrationInstruction (org.camunda.bpm.engine.migration.MigrationInstruction)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 MigrationPlanDtoBuilder (org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder)1 UserTaskBuilder (org.camunda.bpm.model.bpmn.builder.UserTaskBuilder)1