Search in sources :

Example 1 with MockMigrationPlanBuilder

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);
}
Also used : HashMap(java.util.HashMap) Matchers.anyString(org.mockito.Matchers.anyString) MockMigrationPlanBuilder(org.camunda.bpm.engine.rest.helper.MockMigrationPlanBuilder) Test(org.junit.Test)

Example 2 with MockMigrationPlanBuilder

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());
}
Also used : InOrder(org.mockito.InOrder) HashMap(java.util.HashMap) Matchers.anyString(org.mockito.Matchers.anyString) MockMigrationPlanBuilder(org.camunda.bpm.engine.rest.helper.MockMigrationPlanBuilder) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)2 MockMigrationPlanBuilder (org.camunda.bpm.engine.rest.helper.MockMigrationPlanBuilder)2 Test (org.junit.Test)2 Matchers.anyString (org.mockito.Matchers.anyString)2 InOrder (org.mockito.InOrder)1