use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method executeMigrationPlanWithNonExistingTargetProcessInstanceId.
@Test
public void executeMigrationPlanWithNonExistingTargetProcessInstanceId() {
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_URL);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method executeMigrationPlanAsyncWithNullSourceActivityId.
@Test
public void executeMigrationPlanAsyncWithNullSourceActivityId() {
String message = "sourceActivityId is null";
when(migrationPlanBuilderMock.mapActivities(isNull(String.class), anyString())).thenThrow(new BadUserRequestException(message));
Map<String, Object> migrationExecution = new MigrationExecutionDtoBuilder().migrationPlan(EXAMPLE_PROCESS_DEFINITION_ID, ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID).instruction(null, 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.BadUserRequestException in project camunda-bpm-platform by camunda.
the class MigrationRestServiceInteractionTest method generateMigrationPlanWithNonExistingSourceProcessDefinition.
@Test
public void generateMigrationPlanWithNonExistingSourceProcessDefinition() {
String message = "source process definition with id " + NON_EXISTING_PROCESS_DEFINITION_ID + " does not exist";
MigrationPlanBuilder migrationPlanBuilder = mock(MigrationPlanBuilder.class, Mockito.RETURNS_DEEP_STUBS);
when(runtimeServiceMock.createMigrationPlan(eq(NON_EXISTING_PROCESS_DEFINITION_ID), anyString())).thenReturn(migrationPlanBuilder);
when(migrationPlanBuilder.mapEqualActivities().build()).thenThrow(new BadUserRequestException(message));
Map<String, Object> initialMigrationPlan = new MigrationPlanDtoBuilder(NON_EXISTING_PROCESS_DEFINITION_ID, 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);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method testGetDeployedTaskFormWithWrongFormKey.
@Test
public void testGetDeployedTaskFormWithWrongFormKey() {
String message = "wrong key format";
when(formServiceMock.getDeployedTaskForm(anyString())).thenThrow(new BadUserRequestException(message));
given().pathParam("id", MockProvider.EXAMPLE_TASK_ID).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("message", equalTo(message)).when().get(DEPLOYED_TASK_FORM_URL);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class DecisionDefinitionRestServiceInteractionTest method testUpdateHistoryTimeToLiveNegativeValue.
@Test
public void testUpdateHistoryTimeToLiveNegativeValue() {
String expectedMessage = "expectedMessage";
doThrow(new BadUserRequestException(expectedMessage)).when(repositoryServiceMock).updateDecisionDefinitionHistoryTimeToLive(eq(MockProvider.EXAMPLE_DECISION_DEFINITION_ID), eq(-1));
given().pathParam("id", MockProvider.EXAMPLE_DECISION_DEFINITION_ID).content(new HistoryTimeToLiveDto(-1)).contentType(ContentType.JSON).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("type", is(BadUserRequestException.class.getSimpleName())).body("message", containsString(expectedMessage)).when().put(UPDATE_HISTORY_TIME_TO_LIVE_URL);
verify(repositoryServiceMock).updateDecisionDefinitionHistoryTimeToLive(MockProvider.EXAMPLE_DECISION_DEFINITION_ID, -1);
}
Aggregations