Search in sources :

Example 36 with Times

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

the class ProcessWithMultiInstanceCallActivityScenario method startProcessAndCompleteFirstTask.

@DescribesScenario("init.complete.one")
@Times(1)
public static ScenarioSetup startProcessAndCompleteFirstTask() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            ProcessInstance procInst = engine.getRuntimeService().startProcessInstanceByKey(PROCESS_DEF_KEY, scenarioName);
            Task task = engine.getTaskService().createTaskQuery().processInstanceId(procInst.getId()).singleResult();
            engine.getTaskService().complete(task.getId());
        }
    };
}
Also used : Task(org.camunda.bpm.engine.task.Task) ScenarioSetup(org.camunda.bpm.qa.upgrade.ScenarioSetup) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) DescribesScenario(org.camunda.bpm.qa.upgrade.DescribesScenario) Times(org.camunda.bpm.qa.upgrade.Times)

Example 37 with Times

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

the class NestedCompensationScenario method instantiate.

@DescribesScenario("init.throwCompensate")
@Times(1)
public static ScenarioSetup instantiate() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            engine.getRuntimeService().startProcessInstanceByKey("NestedCompensationScenario", 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 38 with Times

use of org.camunda.bpm.qa.upgrade.Times 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 39 with Times

use of org.camunda.bpm.qa.upgrade.Times 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 40 with Times

use of org.camunda.bpm.qa.upgrade.Times 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)

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