Search in sources :

Example 46 with DescribesScenario

use of org.camunda.bpm.qa.upgrade.DescribesScenario in project camunda-bpm-platform by camunda.

the class NonInterruptingEventSubProcessCompensationScenario method instantiateThrowCompensate.

@DescribesScenario("init.throwCompensate")
@Times(6)
public static ScenarioSetup instantiateThrowCompensate() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            engine.getRuntimeService().startProcessInstanceByKey("NonInterruptingEventSubProcessCompensationScenario", scenarioName);
            // trigger the event subprocess
            engine.getRuntimeService().correlateMessage("EventSubProcessMessage", scenarioName);
            // complete the task to compensate and then throw compensation
            Task eventSubProcessTask = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).taskDefinitionKey("eventSubProcessTask").singleResult();
            engine.getTaskService().complete(eventSubProcessTask.getId());
        }
    };
}
Also used : Task(org.camunda.bpm.engine.task.Task) ScenarioSetup(org.camunda.bpm.qa.upgrade.ScenarioSetup) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) DescribesScenario(org.camunda.bpm.qa.upgrade.DescribesScenario) Times(org.camunda.bpm.qa.upgrade.Times)

Example 47 with DescribesScenario

use of org.camunda.bpm.qa.upgrade.DescribesScenario in project camunda-bpm-platform by camunda.

the class SequentialMultiInstanceCompensationScenario method singleActivityHandlerThrowCompensate.

@DescribesScenario("singleActivityHandler.beforeCompensate.throwCompensate")
@ExtendsScenario("singleActivityHandler.beforeCompensate")
@Times(3)
public static ScenarioSetup singleActivityHandlerThrowCompensate() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            Task beforeCompensateTask = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).singleResult();
            engine.getTaskService().complete(beforeCompensateTask.getId());
        }
    };
}
Also used : Task(org.camunda.bpm.engine.task.Task) ScenarioSetup(org.camunda.bpm.qa.upgrade.ScenarioSetup) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) DescribesScenario(org.camunda.bpm.qa.upgrade.DescribesScenario) Times(org.camunda.bpm.qa.upgrade.Times) ExtendsScenario(org.camunda.bpm.qa.upgrade.ExtendsScenario)

Example 48 with DescribesScenario

use of org.camunda.bpm.qa.upgrade.DescribesScenario in project camunda-bpm-platform by camunda.

the class SequentialMultiInstanceCompensationScenario method subProcessHandlerBeforeCompensate.

@DescribesScenario("subProcessHandler.beforeCompensate")
@Times(3)
public static ScenarioSetup subProcessHandlerBeforeCompensate() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            engine.getRuntimeService().startProcessInstanceByKey("SequentialMultiInstanceCompensationSubProcessHandlerScenario", scenarioName);
            // complete all mi tasks
            Task miTask = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).singleResult();
            engine.getTaskService().complete(miTask.getId());
            miTask = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).singleResult();
            engine.getTaskService().complete(miTask.getId());
            miTask = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).singleResult();
            engine.getTaskService().complete(miTask.getId());
        }
    };
}
Also used : Task(org.camunda.bpm.engine.task.Task) ScenarioSetup(org.camunda.bpm.qa.upgrade.ScenarioSetup) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) DescribesScenario(org.camunda.bpm.qa.upgrade.DescribesScenario) Times(org.camunda.bpm.qa.upgrade.Times)

Example 49 with DescribesScenario

use of org.camunda.bpm.qa.upgrade.DescribesScenario in project camunda-bpm-platform by camunda.

the class SequentialMultiInstanceCompensationScenario method subProcessHandlerThrowCompensate.

@DescribesScenario("subProcessHandler.beforeCompensate.throwCompensate")
@ExtendsScenario("subProcessHandler.beforeCompensate")
@Times(3)
public static ScenarioSetup subProcessHandlerThrowCompensate() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            Task beforeCompensateTask = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).singleResult();
            engine.getTaskService().complete(beforeCompensateTask.getId());
        }
    };
}
Also used : Task(org.camunda.bpm.engine.task.Task) ScenarioSetup(org.camunda.bpm.qa.upgrade.ScenarioSetup) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) DescribesScenario(org.camunda.bpm.qa.upgrade.DescribesScenario) Times(org.camunda.bpm.qa.upgrade.Times) ExtendsScenario(org.camunda.bpm.qa.upgrade.ExtendsScenario)

Example 50 with DescribesScenario

use of org.camunda.bpm.qa.upgrade.DescribesScenario in project camunda-bpm-platform by camunda.

the class SequentialMultiInstanceCompensationScenario method subProcessHandlerMultiInstancePartial.

@DescribesScenario("subProcessHandler.multiInstancePartial")
@Times(3)
public static ScenarioSetup subProcessHandlerMultiInstancePartial() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            engine.getRuntimeService().startProcessInstanceByKey("SequentialMultiInstanceCompensationSubProcessHandlerScenario", scenarioName);
            // complete two out of three MI tasks
            Task miTask = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).singleResult();
            engine.getTaskService().complete(miTask.getId());
            miTask = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).singleResult();
            engine.getTaskService().complete(miTask.getId());
        }
    };
}
Also used : Task(org.camunda.bpm.engine.task.Task) ScenarioSetup(org.camunda.bpm.qa.upgrade.ScenarioSetup) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) DescribesScenario(org.camunda.bpm.qa.upgrade.DescribesScenario) Times(org.camunda.bpm.qa.upgrade.Times)

Aggregations

ProcessEngine (org.camunda.bpm.engine.ProcessEngine)60 DescribesScenario (org.camunda.bpm.qa.upgrade.DescribesScenario)60 ScenarioSetup (org.camunda.bpm.qa.upgrade.ScenarioSetup)60 Times (org.camunda.bpm.qa.upgrade.Times)52 Task (org.camunda.bpm.engine.task.Task)46 ExtendsScenario (org.camunda.bpm.qa.upgrade.ExtendsScenario)18 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)11 CaseService (org.camunda.bpm.engine.CaseService)4 Job (org.camunda.bpm.engine.runtime.Job)4 IdentityService (org.camunda.bpm.engine.IdentityService)3 User (org.camunda.bpm.engine.identity.User)3 Group (org.camunda.bpm.engine.identity.Group)2 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)2 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)2 Execution (org.camunda.bpm.engine.runtime.Execution)2 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1 SqlSession (org.apache.ibatis.session.SqlSession)1