Search in sources :

Example 1 with ThrowBpmnErrorDelegateException

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

the class NestedNonInterruptingEventSubprocessScenarioTest method testInitThrowUnhandledException.

@Test
@ScenarioUnderTest("init.6")
public void testInitThrowUnhandledException() {
    // given
    ProcessInstance instance = rule.processInstance();
    Task eventSubprocessTask = rule.taskQuery().taskDefinitionKey("eventSubProcessTask").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(eventSubprocessTask.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 2 with ThrowBpmnErrorDelegateException

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

the class NestedNonInterruptingEventSubprocessScenarioTest method testInitTask1ThrowUnhandledException.

@Test
@ScenarioUnderTest("init.innerTask.5")
public void testInitTask1ThrowUnhandledException() {
    // given
    ProcessInstance instance = rule.processInstance();
    Task eventSubprocessTask = rule.taskQuery().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(eventSubprocessTask.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 3 with ThrowBpmnErrorDelegateException

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

the class TwoLevelNestedNonInterruptingEventSubprocessScenarioTest method testInitLevel1ThrowUnhandledException.

@Test
@ScenarioUnderTest("initLevel1.7")
public void testInitLevel1ThrowUnhandledException() {
    // given
    ProcessInstance instance = rule.processInstance();
    rule.messageCorrelation("InnerEventSubProcessMessage").correlate();
    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 4 with ThrowBpmnErrorDelegateException

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

the class TwoLevelNestedNonInterruptingEventSubprocessScenarioTest method testInitLevel1InitLevel2ThrowUnhandledException.

@Test
@ScenarioUnderTest("initLevel1.initLevel2.7")
public void testInitLevel1InitLevel2ThrowUnhandledException() {
    // 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 5 with ThrowBpmnErrorDelegateException

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

the class NestedNonInterruptingBoundaryEventOnOuterSubprocessScenarioTest 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)

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