use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesTest method shouldFailForNegativeRetriesAsync.
@Test
public void shouldFailForNegativeRetriesAsync() {
List<String> externalTaskIds = Arrays.asList("externalTaskId");
try {
Batch batch = externalTaskService.setRetriesAsync(externalTaskIds, null, -10);
executeSeedAndBatchJobs(batch);
fail("exception expected");
} catch (BadUserRequestException e) {
Assert.assertThat(e.getMessage(), containsString("The number of retries cannot be negative"));
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ExternalTaskServiceTest method testExtendLockTimeWithoutLock.
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testExtendLockTimeWithoutLock() {
// given
runtimeService.startProcessInstanceByKey("oneExternalTaskProcess");
ExternalTask externalTask = externalTaskService.createExternalTaskQuery().singleResult();
// when
try {
externalTaskService.extendLock(externalTask.getId(), WORKER_ID, 100);
fail("Exception expected");
} catch (BadUserRequestException e) {
assertTrue(e.getMessage().contains("The lock of the External Task " + externalTask.getId() + " cannot be extended by worker '" + WORKER_ID));
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testProcessInstanceSignalFailAfterSuspend.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testProcessInstanceSignalFailAfterSuspend() {
// Suspend process instance
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
runtimeService.suspendProcessInstanceById(processInstance.getId());
try {
runtimeService.signal(processInstance.getId());
fail();
} catch (SuspendedEntityInteractionException e) {
// This is expected
assertTextPresent("is suspended", e.getMessage());
assertTrue(e instanceof BadUserRequestException);
}
try {
runtimeService.signal(processInstance.getId(), new HashMap<String, Object>());
fail();
} catch (SuspendedEntityInteractionException e) {
// This is expected
assertTextPresent("is suspended", e.getMessage());
assertTrue(e instanceof BadUserRequestException);
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class RestartProcessInstanceAsyncTest method restartNotExistingProcessInstance.
@Test
public void restartNotExistingProcessInstance() {
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
Batch batch = runtimeService.restartProcessInstances(processDefinition.getId()).startBeforeActivity("bar").processInstanceIds("aaa").executeAsync();
helper.executeSeedJob(batch);
try {
helper.executeJobs(batch);
fail("exception expected");
} catch (BadUserRequestException e) {
Assert.assertThat(e.getMessage(), containsString("Historic process instance cannot be found"));
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class RepositoryServiceTest method testUpdateHistoryTimeToLiveNegative.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testUpdateHistoryTimeToLiveNegative() {
// given
// there exists a deployment containing a case definition with key "oneTaskCase"
CaseDefinition caseDefinition = findOnlyCaseDefinition();
// when
try {
repositoryService.updateCaseDefinitionHistoryTimeToLive(caseDefinition.getId(), -1);
fail("Exception is expected, that negative value is not allowed.");
} catch (BadUserRequestException ex) {
assertTrue(ex.getMessage().contains("greater than"));
}
}
Aggregations