Search in sources :

Example 11 with ThrowBpmnErrorDelegateException

use of org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate.ThrowBpmnErrorDelegateException in project camunda-bpm-platform by camunda.

the class SequentialMultiInstanceScenarioTest method testInitUnhandledException.

@Test
@ScenarioUnderTest("init.5")
public void testInitUnhandledException() {
    // given
    ProcessInstance instance = rule.processInstance();
    Task miSubprocessTask = rule.taskQuery().taskDefinitionKey("subProcessTask").list().get(0);
    // when
    rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.EXCEPTION_INDICATOR_VARIABLE, true);
    rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.EXCEPTION_MESSAGE_VARIABLE, "unhandledException");
    // then
    try {
        rule.getTaskService().complete(miSubprocessTask.getId());
        Assert.fail("should throw a ThrowBpmnErrorDelegateException");
    } catch (ThrowBpmnErrorDelegateException e) {
        Assert.assertEquals("unhandledException", e.getMessage());
    }
}
Also used : Task(org.camunda.bpm.engine.task.Task) ThrowBpmnErrorDelegateException(org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate.ThrowBpmnErrorDelegateException) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Example 12 with ThrowBpmnErrorDelegateException

use of org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate.ThrowBpmnErrorDelegateException in project camunda-bpm-platform by camunda.

the class ParallelMultiInstanceScenarioTest method testInitNonInterruptingBoundaryEventThrowUnhandledException.

@Test
@ScenarioUnderTest("initNonInterruptingBoundaryEvent.7")
public void testInitNonInterruptingBoundaryEventThrowUnhandledException() {
    // given
    ProcessInstance instance = rule.processInstance();
    Task miSubprocessTask = rule.taskQuery().taskDefinitionKey("subProcessTask").list().get(0);
    // when
    rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.EXCEPTION_INDICATOR_VARIABLE, true);
    rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.EXCEPTION_MESSAGE_VARIABLE, "unhandledException");
    // then
    try {
        rule.getTaskService().complete(miSubprocessTask.getId());
        Assert.fail("should throw a ThrowBpmnErrorDelegateException");
    } catch (ThrowBpmnErrorDelegateException e) {
        Assert.assertEquals("unhandledException", e.getMessage());
    }
}
Also used : Task(org.camunda.bpm.engine.task.Task) ThrowBpmnErrorDelegateException(org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate.ThrowBpmnErrorDelegateException) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Example 13 with ThrowBpmnErrorDelegateException

use of org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate.ThrowBpmnErrorDelegateException in project camunda-bpm-platform by camunda.

the class NestedNonInterruptingBoundaryEventOnInnerSubprocessScenarioTest method testInitTimerThrowUnhandledException.

@Test
@ScenarioUnderTest("initTimer.7")
public void testInitTimerThrowUnhandledException() {
    // given
    ProcessInstance instance = rule.processInstance();
    // when
    rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.EXCEPTION_INDICATOR_VARIABLE, true);
    rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.EXCEPTION_MESSAGE_VARIABLE, "unhandledException");
    // then
    try {
        rule.messageCorrelation("ReceiveTaskMessage").correlate();
        Assert.fail("should throw a ThrowBpmnErrorDelegateException");
    } catch (ThrowBpmnErrorDelegateException e) {
        Assert.assertEquals("unhandledException", e.getMessage());
    }
}
Also used : ThrowBpmnErrorDelegateException(org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate.ThrowBpmnErrorDelegateException) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Example 14 with ThrowBpmnErrorDelegateException

use of org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate.ThrowBpmnErrorDelegateException in project camunda-bpm-platform by camunda.

the class NestedInterruptingErrorEventSubprocessScenarioTest method testInitThrowUnhandledException.

@Test
@ScenarioUnderTest("init.5")
public void testInitThrowUnhandledException() {
    // given
    ProcessInstance instance = rule.processInstance();
    Task innerEventSubProcessTask = rule.taskQuery().taskDefinitionKey("innerEventSubProcessTask").singleResult();
    // when
    rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.EXCEPTION_INDICATOR_VARIABLE, true);
    rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.EXCEPTION_MESSAGE_VARIABLE, "unhandledException");
    // then
    try {
        rule.getTaskService().complete(innerEventSubProcessTask.getId());
        Assert.fail("should throw a ThrowBpmnErrorDelegateException");
    } catch (ThrowBpmnErrorDelegateException e) {
        Assert.assertEquals("unhandledException", e.getMessage());
    }
}
Also used : Task(org.camunda.bpm.engine.task.Task) ThrowBpmnErrorDelegateException(org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate.ThrowBpmnErrorDelegateException) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Example 15 with ThrowBpmnErrorDelegateException

use of org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate.ThrowBpmnErrorDelegateException in project camunda-bpm-platform by camunda.

the class NestedNonInterruptingEventSubprocessNestedSubprocessTest method testInitThrowUnhandledException.

@Test
@ScenarioUnderTest("init.6")
public void testInitThrowUnhandledException() {
    // given
    ProcessInstance instance = rule.processInstance();
    Task eventSubProcessTask = rule.taskQuery().taskDefinitionKey("eventSubProcessTask").singleResult();
    // when
    rule.getTaskService().complete(eventSubProcessTask.getId());
    // and
    rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.EXCEPTION_INDICATOR_VARIABLE, true);
    rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.EXCEPTION_MESSAGE_VARIABLE, "unhandledException");
    Task innerSubProcessTask = rule.taskQuery().taskDefinitionKey("innerSubProcessTask").singleResult();
    Assert.assertNotNull(innerSubProcessTask);
    // then
    try {
        rule.getTaskService().complete(innerSubProcessTask.getId());
        Assert.fail("should throw a ThrowBpmnErrorDelegateException");
    } catch (ThrowBpmnErrorDelegateException e) {
        Assert.assertEquals("unhandledException", e.getMessage());
    }
}
Also used : Task(org.camunda.bpm.engine.task.Task) ThrowBpmnErrorDelegateException(org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate.ThrowBpmnErrorDelegateException) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Aggregations

ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)19 ScenarioUnderTest (org.camunda.bpm.qa.upgrade.ScenarioUnderTest)19 ThrowBpmnErrorDelegateException (org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate.ThrowBpmnErrorDelegateException)19 Test (org.junit.Test)19 Task (org.camunda.bpm.engine.task.Task)15