Search in sources :

Example 16 with Times

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

the class SequentialMultiInstanceCompensationScenario method singleActivityHandlerBeforeCompensate.

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

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

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

the class SequentialMultiInstanceCompensationScenario method singleActivityHandlerMultiInstancePartial.

@DescribesScenario("singleActivityHandler.multiInstancePartial")
@Times(3)
public static ScenarioSetup singleActivityHandlerMultiInstancePartial() {
    return new ScenarioSetup() {

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

Example 18 with Times

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

the class SequentialMultiInstanceCompensationScenario method defaultHandlerBeforeCompensate.

@DescribesScenario("defaultHandler.beforeCompensate")
@Times(3)
public static ScenarioSetup defaultHandlerBeforeCompensate() {
    return new ScenarioSetup() {

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

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

the class SingleActivityConcurrentCompensationScenario method instantiate.

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

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

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

the class SingleActivityConcurrentCompensationScenario 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().taskDefinitionKey("beforeCompensate").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)

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