use of org.camunda.bpm.engine.rest.helper.FluentAnswer in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method executeMigrationPlanAsyncWithNullTargetProcessDefinitionId.
@Test
public void executeMigrationPlanAsyncWithNullTargetProcessDefinitionId() {
String message = "target process definition id is null";
JoinedMigrationPlanBuilderMock migrationPlanBuilder = mock(JoinedMigrationPlanBuilderMock.class, new FluentAnswer());
when(runtimeServiceMock.createMigrationPlan(anyString(), isNull(String.class))).thenReturn(migrationPlanBuilder);
when(migrationPlanBuilder.build()).thenThrow(new BadUserRequestException(message));
Map<String, Object> migrationExecution = new MigrationExecutionDtoBuilder().migrationPlan(EXAMPLE_PROCESS_DEFINITION_ID, null).instruction(EXAMPLE_ACTIVITY_ID, ANOTHER_EXAMPLE_ACTIVITY_ID).instruction(ANOTHER_EXAMPLE_ACTIVITY_ID, EXAMPLE_ACTIVITY_ID).done().processInstances(EXAMPLE_PROCESS_INSTANCE_ID, ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID).build();
given().contentType(POST_JSON_CONTENT_TYPE).body(migrationExecution).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("message", is(message)).when().post(EXECUTE_MIGRATION_ASYNC_URL);
}
use of org.camunda.bpm.engine.rest.helper.FluentAnswer in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method executeMigrationPlanAsyncWithNullSourceProcessDefinitionId.
@Test
public void executeMigrationPlanAsyncWithNullSourceProcessDefinitionId() {
String message = "source process definition id is null";
JoinedMigrationPlanBuilderMock migrationPlanBuilder = mock(JoinedMigrationPlanBuilderMock.class, new FluentAnswer());
when(runtimeServiceMock.createMigrationPlan(isNull(String.class), anyString())).thenReturn(migrationPlanBuilder);
when(migrationPlanBuilder.build()).thenThrow(new BadUserRequestException(message));
Map<String, Object> migrationExecution = new MigrationExecutionDtoBuilder().migrationPlan(null, ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).instruction(EXAMPLE_ACTIVITY_ID, ANOTHER_EXAMPLE_ACTIVITY_ID).instruction(ANOTHER_EXAMPLE_ACTIVITY_ID, EXAMPLE_ACTIVITY_ID).done().processInstances(EXAMPLE_PROCESS_INSTANCE_ID, ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID).build();
given().contentType(POST_JSON_CONTENT_TYPE).body(migrationExecution).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("message", is(message)).when().post(EXECUTE_MIGRATION_ASYNC_URL);
}
use of org.camunda.bpm.engine.rest.helper.FluentAnswer in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method executeMigrationPlanWithNullTargetProcessInstanceId.
@Test
public void executeMigrationPlanWithNullTargetProcessInstanceId() {
String message = "target process definition id is null";
JoinedMigrationPlanBuilderMock migrationPlanBuilder = mock(JoinedMigrationPlanBuilderMock.class, new FluentAnswer());
when(runtimeServiceMock.createMigrationPlan(anyString(), isNull(String.class))).thenReturn(migrationPlanBuilder);
when(migrationPlanBuilder.build()).thenThrow(new BadUserRequestException(message));
Map<String, Object> migrationExecution = new MigrationExecutionDtoBuilder().migrationPlan(EXAMPLE_PROCESS_DEFINITION_ID, null).instruction(EXAMPLE_ACTIVITY_ID, ANOTHER_EXAMPLE_ACTIVITY_ID).instruction(ANOTHER_EXAMPLE_ACTIVITY_ID, EXAMPLE_ACTIVITY_ID).done().processInstances(EXAMPLE_PROCESS_INSTANCE_ID, ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID).build();
given().contentType(POST_JSON_CONTENT_TYPE).body(migrationExecution).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("message", is(message)).when().post(EXECUTE_MIGRATION_URL);
}
use of org.camunda.bpm.engine.rest.helper.FluentAnswer in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method executeMigrationPlanAsyncWithNonExistingTargetProcessDefinitionId.
@Test
public void executeMigrationPlanAsyncWithNonExistingTargetProcessDefinitionId() {
String message = "target process definition with id " + NON_EXISTING_PROCESS_DEFINITION_ID + " does not exist";
JoinedMigrationPlanBuilderMock migrationPlanBuilder = mock(JoinedMigrationPlanBuilderMock.class, new FluentAnswer());
when(runtimeServiceMock.createMigrationPlan(anyString(), eq(NON_EXISTING_PROCESS_DEFINITION_ID))).thenReturn(migrationPlanBuilder);
when(migrationPlanBuilder.build()).thenThrow(new BadUserRequestException(message));
Map<String, Object> migrationExecution = new MigrationExecutionDtoBuilder().migrationPlan(EXAMPLE_PROCESS_DEFINITION_ID, NON_EXISTING_PROCESS_DEFINITION_ID).instruction(EXAMPLE_ACTIVITY_ID, ANOTHER_EXAMPLE_ACTIVITY_ID).instruction(ANOTHER_EXAMPLE_ACTIVITY_ID, EXAMPLE_ACTIVITY_ID).done().processInstances(EXAMPLE_PROCESS_INSTANCE_ID, ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID).build();
given().contentType(POST_JSON_CONTENT_TYPE).body(migrationExecution).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("message", is(message)).when().post(EXECUTE_MIGRATION_ASYNC_URL);
}
use of org.camunda.bpm.engine.rest.helper.FluentAnswer in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method executeMigrationPlanWithNullSourceProcessInstanceId.
@Test
public void executeMigrationPlanWithNullSourceProcessInstanceId() {
String message = "source process definition id is null";
JoinedMigrationPlanBuilderMock migrationPlanBuilder = mock(JoinedMigrationPlanBuilderMock.class, new FluentAnswer());
when(runtimeServiceMock.createMigrationPlan(isNull(String.class), anyString())).thenReturn(migrationPlanBuilder);
when(migrationPlanBuilder.build()).thenThrow(new BadUserRequestException(message));
Map<String, Object> migrationExecution = new MigrationExecutionDtoBuilder().migrationPlan(null, ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).instruction(EXAMPLE_ACTIVITY_ID, ANOTHER_EXAMPLE_ACTIVITY_ID).instruction(ANOTHER_EXAMPLE_ACTIVITY_ID, EXAMPLE_ACTIVITY_ID).done().processInstances(EXAMPLE_PROCESS_INSTANCE_ID, ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID).build();
given().contentType(POST_JSON_CONTENT_TYPE).body(migrationExecution).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("message", is(message)).when().post(EXECUTE_MIGRATION_URL);
}
Aggregations