Search in sources :

Example 26 with Times

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

the class SubprocessCompensationScenario method instantiate.

@DescribesScenario("init")
@Times(3)
public static ScenarioSetup instantiate() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            engine.getRuntimeService().startProcessInstanceByKey("SubprocessCompensationScenario", scenarioName);
            // create the compensation event subscription and wait before throwing compensation
            Task userTask = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).singleResult();
            engine.getTaskService().complete(userTask.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 27 with Times

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

the class SubprocessCompensationScenario method instantiateConcurrent.

@DescribesScenario("init.concurrent")
@Times(3)
public static ScenarioSetup instantiateConcurrent() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            engine.getRuntimeService().startProcessInstanceByKey("SubprocessConcurrentCompensationScenario", scenarioName);
            // create the compensation event subscriptions and wait before throwing compensation
            Task userTask1 = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).singleResult();
            engine.getTaskService().complete(userTask1.getId());
            Task userTask2 = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).singleResult();
            engine.getTaskService().complete(userTask2.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 28 with Times

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

the class SubprocessParallelThrowCompensationScenario method instantiateAndTriggerCompensation.

@DescribesScenario("init.triggerCompensation")
@ExtendsScenario("init")
@Times(3)
public static ScenarioSetup instantiateAndTriggerCompensation() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            // throw compensation; the compensation handler for userTask should then be active
            Task beforeCompensateTask = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).taskDefinitionKey("beforeCompensate").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 29 with Times

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

the class InterruptingEventSubProcessCompensationScenario method instantiateThrowCompensate.

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

        public void execute(ProcessEngine engine, String scenarioName) {
            engine.getRuntimeService().startProcessInstanceByKey("InterruptingEventSubProcessCompensationScenario", scenarioName);
            // trigger the event subprocess
            engine.getRuntimeService().correlateMessage("EventSubProcessMessage");
            // complete the task to compensate and then throw compensation
            Task eventSubProcessTask = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).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 30 with Times

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

the class NestedParallelNonInterruptingEventSubprocessScenario method completeSubprocessTask.

@DescribesScenario("init.innerTask")
@ExtendsScenario("init")
@Times(5)
public static ScenarioSetup completeSubprocessTask() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            Task task = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).taskDefinitionKey("innerTask").singleResult();
            engine.getTaskService().complete(task.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)

Aggregations

ProcessEngine (org.camunda.bpm.engine.ProcessEngine)52 DescribesScenario (org.camunda.bpm.qa.upgrade.DescribesScenario)52 ScenarioSetup (org.camunda.bpm.qa.upgrade.ScenarioSetup)52 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)9 Job (org.camunda.bpm.engine.runtime.Job)4 IdentityService (org.camunda.bpm.engine.IdentityService)2 User (org.camunda.bpm.engine.identity.User)2 AuthorizationService (org.camunda.bpm.engine.AuthorizationService)1 Authorization (org.camunda.bpm.engine.authorization.Authorization)1 Group (org.camunda.bpm.engine.identity.Group)1