Search in sources :

Example 11 with ScenarioSetup

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

the class ProcessWithParallelGatewayScenario method startProcessCompleteOneUserTask.

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

        @Override
        public void execute(ProcessEngine engine, String scenarioName) {
            ProcessInstance procInst = engine.getRuntimeService().startProcessInstanceByKey(PROCESS_DEF_KEY, scenarioName);
            List<Task> tasks = engine.getTaskService().createTaskQuery().processInstanceId(procInst.getId()).list();
            if (tasks.size() > 0) {
                engine.getTaskService().complete(tasks.get(0).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 12 with ScenarioSetup

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

the class ProcessWithCallActivityScenario 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 13 with ScenarioSetup

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

the class ProcessWithEventSubProcessScenario method startProcessWithThrowedBpmnError.

@DescribesScenario("init.error")
@Times(1)
public static ScenarioSetup startProcessWithThrowedBpmnError() {
    return new ScenarioSetup() {

        @Override
        public void execute(ProcessEngine engine, String scenarioName) {
            ProcessInstance procInstance = engine.getRuntimeService().startProcessInstanceByKey(PROCESS_DEF_KEY, scenarioName);
            Job job = engine.getManagementService().createJobQuery().processInstanceId(procInstance.getId()).singleResult();
            engine.getManagementService().executeJob(job.getId());
        }
    };
}
Also used : ScenarioSetup(org.camunda.bpm.qa.upgrade.ScenarioSetup) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Job(org.camunda.bpm.engine.runtime.Job) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) DescribesScenario(org.camunda.bpm.qa.upgrade.DescribesScenario) Times(org.camunda.bpm.qa.upgrade.Times)

Example 14 with ScenarioSetup

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

the class ProcessWithParallelGatewayAndServiceTaskScenario method startProcessAsyncServiceTaskCompleteUserTask.

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

        @Override
        public void execute(ProcessEngine engine, String scenarioName) {
            ProcessInstance procInst = engine.getRuntimeService().startProcessInstanceByKey(PROCESS_DEF_KEY_2, 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 15 with ScenarioSetup

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

the class CreateProcessInstanceWithJsonVariablesScenario method initProcessInstance.

@DescribesScenario("initProcessInstanceWithDifferentVariables")
public static ScenarioSetup initProcessInstance() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            // given
            ProcessInstance processInstance = engine.getRuntimeService().startProcessInstanceByKey("Process", "processWithJsonVariables");
            // when
            Execution execution = engine.getRuntimeService().createExecutionQuery().processInstanceId(processInstance.getId()).singleResult();
            engine.getRuntimeService().setVariable(execution.getId(), "objectVariable", createObjectVariable());
            engine.getRuntimeService().setVariable(execution.getId(), "plainTypeArrayVariable", createPlainTypeArray());
            engine.getRuntimeService().setVariable(execution.getId(), "notGenericObjectListVariable", createNotGenericObjectList());
            engine.getRuntimeService().setVariable(execution.getId(), "serializedMapVariable", createSerializedMap());
        }
    };
}
Also used : Execution(org.camunda.bpm.engine.runtime.Execution) 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)

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