Search in sources :

Example 1 with MigrationPlanDtoBuilder

use of org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder in project camunda-bpm-platform by camunda.

the class MigrationRestServiceInteractionTest method generateMigrationPlanWithNoInitialInstructions.

@Test
public void generateMigrationPlanWithNoInitialInstructions() {
    Map<String, Object> initialMigrationPlan = new MigrationPlanDtoBuilder(EXAMPLE_PROCESS_DEFINITION_ID, ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).build();
    Response response = given().contentType(POST_JSON_CONTENT_TYPE).body(initialMigrationPlan).then().statusCode(Status.OK.getStatusCode()).when().post(GENERATE_MIGRATION_URL);
    verifyGenerateMigrationPlanInteraction(migrationPlanBuilderMock, initialMigrationPlan);
    verifyGenerateMigrationPlanResponse(response);
}
Also used : Response(com.jayway.restassured.response.Response) MigrationPlanDtoBuilder(org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 2 with MigrationPlanDtoBuilder

use of org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder in project camunda-bpm-platform by camunda.

the class MigrationRestServiceInteractionTest method generateMigrationPlanWithInitialNullInstructions.

@Test
public void generateMigrationPlanWithInitialNullInstructions() {
    Map<String, Object> initialMigrationPlan = new MigrationPlanDtoBuilder(EXAMPLE_PROCESS_DEFINITION_ID, ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).instructions(null).build();
    Response response = given().contentType(POST_JSON_CONTENT_TYPE).body(initialMigrationPlan).then().expect().statusCode(Status.OK.getStatusCode()).when().post(GENERATE_MIGRATION_URL);
    verifyGenerateMigrationPlanInteraction(migrationPlanBuilderMock, initialMigrationPlan);
    verifyGenerateMigrationPlanResponse(response);
}
Also used : Response(com.jayway.restassured.response.Response) MigrationPlanDtoBuilder(org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 3 with MigrationPlanDtoBuilder

use of org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder in project camunda-bpm-platform by camunda.

the class MigrationRestServiceInteractionTest method generateMigrationPlanWithNullSourceProcessDefinition.

@Test
public void generateMigrationPlanWithNullSourceProcessDefinition() {
    String message = "source process definition id is null";
    MigrationPlanBuilder planBuilder = mock(MigrationPlanBuilder.class, Mockito.RETURNS_DEEP_STUBS);
    when(runtimeServiceMock.createMigrationPlan(isNull(String.class), anyString())).thenReturn(planBuilder);
    when(planBuilder.mapEqualActivities().build()).thenThrow(new BadUserRequestException(message));
    Map<String, Object> initialMigrationPlan = new MigrationPlanDtoBuilder(null, ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).build();
    given().contentType(POST_JSON_CONTENT_TYPE).body(initialMigrationPlan).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("message", is(message)).when().post(GENERATE_MIGRATION_URL);
}
Also used : MockMigrationPlanBuilder(org.camunda.bpm.engine.rest.helper.MockMigrationPlanBuilder) MigrationPlanBuilder(org.camunda.bpm.engine.migration.MigrationPlanBuilder) MigrationPlanDtoBuilder(org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder) Matchers.anyString(org.mockito.Matchers.anyString) BadUserRequestException(org.camunda.bpm.engine.BadUserRequestException) Test(org.junit.Test)

Example 4 with MigrationPlanDtoBuilder

use of org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder in project camunda-bpm-platform by camunda.

the class MigrationRestServiceInteractionTest method generateMigrationPlanWithNullTargetProcessDefinition.

@Test
public void generateMigrationPlanWithNullTargetProcessDefinition() {
    String message = "target process definition id is null";
    MigrationPlanBuilder migrationPlanBuilder = mock(MigrationPlanBuilder.class, Mockito.RETURNS_DEEP_STUBS);
    when(runtimeServiceMock.createMigrationPlan(anyString(), isNull(String.class))).thenReturn(migrationPlanBuilder);
    when(migrationPlanBuilder.mapEqualActivities().build()).thenThrow(new BadUserRequestException(message));
    Map<String, Object> initialMigrationPlan = new MigrationPlanDtoBuilder(EXAMPLE_PROCESS_DEFINITION_ID, null).build();
    given().contentType(POST_JSON_CONTENT_TYPE).body(initialMigrationPlan).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("message", is(message)).when().post(GENERATE_MIGRATION_URL);
}
Also used : MockMigrationPlanBuilder(org.camunda.bpm.engine.rest.helper.MockMigrationPlanBuilder) MigrationPlanBuilder(org.camunda.bpm.engine.migration.MigrationPlanBuilder) MigrationPlanDtoBuilder(org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder) Matchers.anyString(org.mockito.Matchers.anyString) BadUserRequestException(org.camunda.bpm.engine.BadUserRequestException) Test(org.junit.Test)

Example 5 with MigrationPlanDtoBuilder

use of org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder in project camunda-bpm-platform by camunda.

the class MigrationRestServiceInteractionTest method generateMigrationPlanWithInitialEmptyInstructions.

@Test
public void generateMigrationPlanWithInitialEmptyInstructions() {
    Map<String, Object> initialMigrationPlan = new MigrationPlanDtoBuilder(EXAMPLE_PROCESS_DEFINITION_ID, ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).instructions(Collections.<Map<String, Object>>emptyList()).build();
    Response response = given().contentType(POST_JSON_CONTENT_TYPE).body(initialMigrationPlan).then().expect().statusCode(Status.OK.getStatusCode()).when().post(GENERATE_MIGRATION_URL);
    verifyGenerateMigrationPlanInteraction(migrationPlanBuilderMock, initialMigrationPlan);
    verifyGenerateMigrationPlanResponse(response);
}
Also used : Response(com.jayway.restassured.response.Response) MigrationPlanDtoBuilder(org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder) Matchers.anyString(org.mockito.Matchers.anyString) Map(java.util.Map) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

MigrationPlanDtoBuilder (org.camunda.bpm.engine.rest.util.migration.MigrationPlanDtoBuilder)10 Test (org.junit.Test)10 Matchers.anyString (org.mockito.Matchers.anyString)10 Response (com.jayway.restassured.response.Response)4 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)4 MigrationPlanBuilder (org.camunda.bpm.engine.migration.MigrationPlanBuilder)4 MockMigrationPlanBuilder (org.camunda.bpm.engine.rest.helper.MockMigrationPlanBuilder)4 HashMap (java.util.HashMap)1 Map (java.util.Map)1 MigrationInstruction (org.camunda.bpm.engine.migration.MigrationInstruction)1 MigrationInstructionValidationReport (org.camunda.bpm.engine.migration.MigrationInstructionValidationReport)1 MigrationPlanValidationException (org.camunda.bpm.engine.migration.MigrationPlanValidationException)1 MigrationPlanValidationReport (org.camunda.bpm.engine.migration.MigrationPlanValidationReport)1