Search in sources :

Example 26 with DescribesScenario

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

the class SentryScenario method completeInstance.

@DescribesScenario("completeInstance")
public static ScenarioSetup completeInstance() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            CaseService caseService = engine.getCaseService();
            caseService.createCaseInstanceByKey("case", scenarioName);
        }
    };
}
Also used : ScenarioSetup(org.camunda.bpm.qa.upgrade.ScenarioSetup) CaseService(org.camunda.bpm.engine.CaseService) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) DescribesScenario(org.camunda.bpm.qa.upgrade.DescribesScenario)

Example 27 with DescribesScenario

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

the class DeployUserWithoutSaltForPasswordHashingScenario method initUser.

@DescribesScenario("initUser")
@Times(1)
public static ScenarioSetup initUser() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            // given
            IdentityService identityService = engine.getIdentityService();
            User user = identityService.newUser(USER_NAME);
            user.setPassword(USER_PWD);
            // when
            identityService.saveUser(user);
        }
    };
}
Also used : IdentityService(org.camunda.bpm.engine.IdentityService) User(org.camunda.bpm.engine.identity.User) 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 DescribesScenario

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

the class CreateProcessInstanceWithVariableScenario method initProcessInstance.

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

        public void execute(ProcessEngine engine, String scenarioName) {
            // given
            ProcessInstance processInstance = engine.getRuntimeService().startProcessInstanceByKey("Process", "process");
            // when
            Execution execution = engine.getRuntimeService().createExecutionQuery().processInstanceId(processInstance.getId()).singleResult();
            engine.getRuntimeService().setVariable(execution.getId(), "foo", "bar");
        }
    };
}
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)

Example 29 with DescribesScenario

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

the class NestedNonInterruptingBoundaryEventOnOuterSubprocessScenario method initTimer.

@DescribesScenario("initTimer")
@Times(7)
public static ScenarioSetup initTimer() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            ProcessInstance instance = engine.getRuntimeService().startProcessInstanceByKey("NestedNonInterruptingTimerBoundaryEventOnOuterSubprocessScenario", scenarioName);
            Job job = engine.getManagementService().createJobQuery().processInstanceId(instance.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 30 with DescribesScenario

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

the class InterruptingEventSubprocessCompensationScenario 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).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)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