use of org.camunda.bpm.engine.rest.helper.MockMigrationPlanBuilder in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method generatePlanUpdateEventTriggerResponse.
@Test
public void generatePlanUpdateEventTriggerResponse() {
migrationPlanBuilderMock = new MockMigrationPlanBuilder().sourceProcessDefinitionId(EXAMPLE_PROCESS_DEFINITION_ID).targetProcessDefinitionId(ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).instruction(EXAMPLE_ACTIVITY_ID, ANOTHER_EXAMPLE_ACTIVITY_ID, true).builder();
when(runtimeServiceMock.createMigrationPlan(anyString(), anyString())).thenReturn(migrationPlanBuilderMock);
Map<String, Object> generationRequest = new HashMap<String, Object>();
generationRequest.put("sourceProcessDefinitionId", EXAMPLE_PROCESS_DEFINITION_ID);
generationRequest.put("targetProcessDefinitionId", ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID);
given().contentType(POST_JSON_CONTENT_TYPE).body(generationRequest).then().expect().statusCode(Status.OK.getStatusCode()).body("instructions[0].sourceActivityIds[0]", equalTo(EXAMPLE_ACTIVITY_ID)).body("instructions[0].targetActivityIds[0]", equalTo(ANOTHER_EXAMPLE_ACTIVITY_ID)).body("instructions[0].updateEventTrigger", equalTo(true)).when().post(GENERATE_MIGRATION_URL);
}
use of org.camunda.bpm.engine.rest.helper.MockMigrationPlanBuilder in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method generatePlanUpdateEventTriggers.
@Test
public void generatePlanUpdateEventTriggers() {
migrationPlanBuilderMock = new MockMigrationPlanBuilder().sourceProcessDefinitionId(EXAMPLE_PROCESS_DEFINITION_ID).targetProcessDefinitionId(ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).instruction(EXAMPLE_ACTIVITY_ID, ANOTHER_EXAMPLE_ACTIVITY_ID, true).builder();
Map<String, Object> generationRequest = new HashMap<String, Object>();
generationRequest.put("sourceProcessDefinitionId", EXAMPLE_PROCESS_DEFINITION_ID);
generationRequest.put("targetProcessDefinitionId", ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID);
generationRequest.put("updateEventTriggers", true);
when(runtimeServiceMock.createMigrationPlan(anyString(), anyString())).thenReturn(migrationPlanBuilderMock);
given().contentType(POST_JSON_CONTENT_TYPE).body(generationRequest).then().expect().statusCode(Status.OK.getStatusCode()).when().post(GENERATE_MIGRATION_URL);
verify(runtimeServiceMock).createMigrationPlan(eq(EXAMPLE_PROCESS_DEFINITION_ID), eq(ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID));
InOrder inOrder = Mockito.inOrder(migrationPlanBuilderMock);
// the map equal activities method should be called
inOrder.verify(migrationPlanBuilderMock).mapEqualActivities();
inOrder.verify(migrationPlanBuilderMock, immediatelyAfter()).updateEventTriggers();
verify(migrationPlanBuilderMock, never()).mapActivities(anyString(), anyString());
}
Aggregations