use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class RepositoryServiceTest method testProcessDefinitionUpdateTimeToLiveNegative.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testProcessDefinitionUpdateTimeToLiveNegative() {
// given
ProcessDefinition processDefinition = findOnlyProcessDefinition();
// when
try {
repositoryService.updateProcessDefinitionHistoryTimeToLive(processDefinition.getId(), -1);
fail("Exception is expected, that negative value is not allowed.");
} catch (BadUserRequestException ex) {
assertTrue(ex.getMessage().contains("greater than"));
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ModificationRestServiceInteractionTest method executeModificationWithNullProcessDefinitionIdSync.
@Test
public void executeModificationWithNullProcessDefinitionIdSync() {
doThrow(new BadUserRequestException("processDefinitionId must be set")).when(modificationBuilderMock).execute();
Map<String, Object> json = new HashMap<String, Object>();
json.put("skipCustomListeners", true);
json.put("skipIoMappings", true);
json.put("processInstanceIds", Arrays.asList("100", "20"));
List<Map<String, Object>> instructions = new ArrayList<Map<String, Object>>();
instructions.add(ModificationInstructionBuilder.cancellation().activityId("activityId").getJson());
instructions.add(ModificationInstructionBuilder.startBefore().activityId("activityId").getJson());
instructions.add(ModificationInstructionBuilder.startAfter().activityId("activityId").getJson());
instructions.add(ModificationInstructionBuilder.startTransition().transitionId("transitionId").getJson());
json.put("instructions", instructions);
given().contentType(ContentType.JSON).body(json).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(EXECUTE_MODIFICATION_SYNC_URL);
verify(runtimeServiceMock).createModification(null);
verify(modificationBuilderMock).processInstanceIds(eq(Arrays.asList("100", "20")));
verify(modificationBuilderMock).cancelAllForActivity("activityId");
verify(modificationBuilderMock).startBeforeActivity("activityId");
verify(modificationBuilderMock).startAfterActivity("activityId");
verify(modificationBuilderMock).startTransition("transitionId");
verify(modificationBuilderMock).skipCustomListeners();
verify(modificationBuilderMock).skipIoMappings();
verify(modificationBuilderMock).execute();
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSetRetriesByProcessAsyncHistoricQueryBasedWithBadRequestQuery.
@Test
public void testSetRetriesByProcessAsyncHistoricQueryBasedWithBadRequestQuery() {
doThrow(new BadUserRequestException("jobIds is empty")).when(mockManagementService).setJobRetriesAsync(eq(new ArrayList<String>()), eq((ProcessInstanceQuery) null), anyInt());
SetJobRetriesByProcessDto body = new SetJobRetriesByProcessDto();
body.setRetries(MockProvider.EXAMPLE_JOB_RETRIES);
given().contentType(ContentType.JSON).body(body).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(SET_JOB_RETRIES_ASYNC_HIST_QUERY_URL);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSetRetriesByProcessAsyncHistoricQueryBasedWithNegativeRetries.
@Test
public void testSetRetriesByProcessAsyncHistoricQueryBasedWithNegativeRetries() {
doThrow(new BadUserRequestException("retries are negative")).when(mockManagementService).setJobRetriesAsync(anyListOf(String.class), eq((ProcessInstanceQuery) null), eq(MockProvider.EXAMPLE_NEGATIVE_JOB_RETRIES));
HistoricProcessInstanceQuery mockedHistoricProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
when(historyServiceMock.createHistoricProcessInstanceQuery()).thenReturn(mockedHistoricProcessInstanceQuery);
List<HistoricProcessInstance> historicProcessInstances = MockProvider.createMockRunningHistoricProcessInstances();
when(mockedHistoricProcessInstanceQuery.list()).thenReturn(historicProcessInstances);
SetJobRetriesByProcessDto body = new SetJobRetriesByProcessDto();
body.setRetries(MockProvider.EXAMPLE_NEGATIVE_JOB_RETRIES);
body.setHistoricProcessInstanceQuery(new HistoricProcessInstanceQueryDto());
given().contentType(ContentType.JSON).body(body).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(SET_JOB_RETRIES_ASYNC_HIST_QUERY_URL);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSetRetriesByProcessWithBadRequestQuery.
@Test
public void testSetRetriesByProcessWithBadRequestQuery() {
doThrow(new BadUserRequestException("job ids are empty")).when(mockManagementService).setJobRetriesAsync(eq((List<String>) null), eq((ProcessInstanceQuery) null), anyInt());
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put(RETRIES, 5);
given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(SET_JOB_RETRIES_ASYNC_URL);
}
Aggregations