use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.
the class DecisionDefinitionQueryTest method queryByInvalidVersion.
@Test
public void queryByInvalidVersion() {
DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery();
query.decisionDefinitionVersion(3);
verifyQueryResults(query, 0);
try {
query.decisionDefinitionVersion(-1);
fail();
} catch (NotValidException e) {
// Expected exception
}
try {
query.decisionDefinitionVersion(null);
fail();
} catch (NotValidException e) {
// Expected exception
}
}
use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.
the class TaskServiceTest method testSaveTaskWithNonExistingParentTask.
@Test
public void testSaveTaskWithNonExistingParentTask() {
// given
Task task = taskService.newTask();
// when
task.setParentTaskId("non-existing");
// then
try {
taskService.saveTask(task);
fail("It should not be possible to save a task with a non existing parent task.");
} catch (NotValidException e) {
}
}
use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationTest method testStartBeforeWithInvalidAncestorInstanceId.
@Deployment(resources = DOUBLE_NESTED_SUB_PROCESS)
public void testStartBeforeWithInvalidAncestorInstanceId() {
// given two instances of the outer subprocess
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("doubleNestedSubprocess");
String processInstanceId = processInstance.getId();
try {
runtimeService.createProcessInstanceModification(processInstance.getId()).startBeforeActivity("subProcess", "noValidActivityInstanceId").execute();
fail();
} catch (NotValidException e) {
// happy path
assertTextPresent("Cannot perform instruction: " + "Start before activity 'subProcess' with ancestor activity instance 'noValidActivityInstanceId'; " + "Ancestor activity instance 'noValidActivityInstanceId' does not exist", e.getMessage());
}
try {
runtimeService.createProcessInstanceModification(processInstance.getId()).startBeforeActivity("subProcess", null).execute();
fail();
} catch (NotValidException e) {
// happy path
assertTextPresent("ancestorActivityInstanceId is null", e.getMessage());
}
ActivityInstance tree = runtimeService.getActivityInstance(processInstanceId);
String subProcessTaskId = getInstanceIdForActivity(tree, "subProcessTask");
try {
runtimeService.createProcessInstanceModification(processInstance.getId()).startBeforeActivity("subProcess", subProcessTaskId).execute();
fail("should not succeed because subProcessTask is a child of subProcess");
} catch (NotValidException e) {
// happy path
assertTextPresent("Cannot perform instruction: " + "Start before activity 'subProcess' with ancestor activity instance '" + subProcessTaskId + "'; " + "Scope execution for '" + subProcessTaskId + "' cannot be found in parent hierarchy of flow element 'subProcess'", e.getMessage());
}
}
use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationAsyncTest method testCancelTransitionInstanceTwiceFailsCase2.
/**
* CAM-4090
*/
@Deployment(resources = NESTED_ASYNC_BEFORE_TASK_PROCESS)
public void testCancelTransitionInstanceTwiceFailsCase2() {
// given there are two transition instances in an inner scope
// and an active activity instance in an outer scope
ProcessInstance instance = runtimeService.createProcessInstanceByKey("nestedOneTaskProcess").startBeforeActivity("innerTask").startBeforeActivity("innerTask").execute();
ActivityInstance tree = runtimeService.getActivityInstance(instance.getId());
// when i cancel both transition instances
TransitionInstance[] transitionInstances = tree.getTransitionInstances("innerTask");
try {
runtimeService.createProcessInstanceModification(instance.getId()).cancelTransitionInstance(// compacts the tree;
transitionInstances[0].getId()).startBeforeActivity(// expand tree again
"innerTask").startBeforeActivity("innerTask").cancelTransitionInstance(// does not trigger compaction
transitionInstances[1].getId()).cancelTransitionInstance(// should fail
transitionInstances[1].getId()).execute();
fail("should not be possible to cancel the first instance twice");
} catch (NotValidException e) {
String transitionInstanceId = transitionInstances[1].getId();
assertTextPresentIgnoreCase("Cannot perform instruction: Cancel transition instance '" + transitionInstanceId + "'; Transition instance '" + transitionInstanceId + "' does not exist: transitionInstance is null", e.getMessage());
}
}
use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.
the class CaseExecutionQueryTest method testQueryByNullCaseInstanceVariableValueGreaterThan.
public void testQueryByNullCaseInstanceVariableValueGreaterThan() {
caseService.withCaseDefinitionByKey(CASE_DEFINITION_KEY).setVariable("aNullValue", null).create();
CaseExecutionQuery query = caseService.createCaseExecutionQuery();
try {
query.caseInstanceVariableValueGreaterThan("aNullValue", null).list();
fail();
} catch (NotValidException e) {
}
}
Aggregations