Search in sources :

Example 26 with NotValidException

use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.

the class ProcessInstanceModificationAsyncTest method testCancelTransitionInstanceTwiceFails.

/**
 * CAM-4090
 */
@Deployment(resources = NESTED_ASYNC_BEFORE_TASK_PROCESS)
public void testCancelTransitionInstanceTwiceFails() {
    // 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");
    // this test ensures that the replacedBy link of executions is not followed
    // in case the original execution was actually removed/cancelled
    String transitionInstanceId = transitionInstances[0].getId();
    try {
        runtimeService.createProcessInstanceModification(instance.getId()).cancelTransitionInstance(transitionInstanceId).cancelTransitionInstance(transitionInstanceId).execute();
        fail("should not be possible to cancel the first instance twice");
    } catch (NotValidException e) {
        assertTextPresentIgnoreCase("Cannot perform instruction: Cancel transition instance '" + transitionInstanceId + "'; Transition instance '" + transitionInstanceId + "' does not exist: transitionInstance is null", e.getMessage());
    }
}
Also used : TransitionInstance(org.camunda.bpm.engine.runtime.TransitionInstance) NotValidException(org.camunda.bpm.engine.exception.NotValidException) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 27 with NotValidException

use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.

the class CaseInstanceQueryTest method testQueryByInvalidCaseDefinitionKey.

public void testQueryByInvalidCaseDefinitionKey() {
    CaseInstanceQuery query = caseService.createCaseInstanceQuery();
    query.caseDefinitionKey("invalid");
    verifyQueryResults(query, 0);
    try {
        query.caseDefinitionKey(null);
        fail();
    } catch (NotValidException e) {
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Example 28 with NotValidException

use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.

the class CaseInstanceQueryTest method testQueryByInvalidCaseInstanceBusinessKey.

public void testQueryByInvalidCaseInstanceBusinessKey() {
    CaseInstanceQuery query = caseService.createCaseInstanceQuery();
    query.caseInstanceBusinessKey("invalid");
    verifyQueryResults(query, 0);
    try {
        query.caseInstanceBusinessKey(null);
        fail();
    } catch (NotValidException e) {
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Example 29 with NotValidException

use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.

the class CaseInstanceQueryTest method testQueryByInvalidCaseInstanceId.

public void testQueryByInvalidCaseInstanceId() {
    CaseInstanceQuery query = caseService.createCaseInstanceQuery();
    query.caseInstanceId("invalid");
    verifyQueryResults(query, 0);
    try {
        query.caseInstanceId(null);
        fail();
    } catch (NotValidException e) {
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Example 30 with NotValidException

use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.

the class CaseInstanceQueryTest method testQueryByInvalidDeploymentId.

public void testQueryByInvalidDeploymentId() {
    CaseInstanceQuery query = caseService.createCaseInstanceQuery().deploymentId("invalid");
    verifyQueryResults(query, 0);
    try {
        query.deploymentId(null);
        fail();
    } catch (NotValidException e) {
    // expected
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) CaseInstanceQuery(org.camunda.bpm.engine.runtime.CaseInstanceQuery)

Aggregations

NotValidException (org.camunda.bpm.engine.exception.NotValidException)121 Test (org.junit.Test)28 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)24 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)24 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)18 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)17 Deployment (org.camunda.bpm.engine.test.Deployment)12 CaseDefinitionQuery (org.camunda.bpm.engine.repository.CaseDefinitionQuery)10 DecisionDefinitionQuery (org.camunda.bpm.engine.repository.DecisionDefinitionQuery)10 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)10 CaseService (org.camunda.bpm.engine.CaseService)9 NotAllowedException (org.camunda.bpm.engine.exception.NotAllowedException)9 RestException (org.camunda.bpm.engine.rest.exception.RestException)8 CaseExecutionCommandBuilder (org.camunda.bpm.engine.runtime.CaseExecutionCommandBuilder)8 CaseInstanceQuery (org.camunda.bpm.engine.runtime.CaseInstanceQuery)8 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)6 HashMap (java.util.HashMap)5 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 InputStream (java.io.InputStream)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3