Search in sources :

Example 21 with ScenarioSetup

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

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

Example 23 with ScenarioSetup

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

the class SentryScenario method newSentryInstance.

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

        public void execute(ProcessEngine engine, String scenarioName) {
            CaseService caseService = engine.getCaseService();
            CaseInstance caseInstance = caseService.createCaseInstanceByKey("case", scenarioName);
            String caseInstanceId = caseInstance.getId();
            CaseExecutionQuery query = caseService.createCaseExecutionQuery().caseInstanceId(caseInstanceId);
            String firstHumanTaskId = query.activityId("PI_HumanTask_1").singleResult().getId();
            caseService.manuallyStartCaseExecution(firstHumanTaskId);
            caseService.completeCaseExecution(firstHumanTaskId);
            String secondHumanTaskId = query.activityId("PI_HumanTask_2").singleResult().getId();
            caseService.manuallyStartCaseExecution(secondHumanTaskId);
            caseService.completeCaseExecution(secondHumanTaskId);
        }
    };
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) ScenarioSetup(org.camunda.bpm.qa.upgrade.ScenarioSetup) CaseService(org.camunda.bpm.engine.CaseService) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) CaseExecutionQuery(org.camunda.bpm.engine.runtime.CaseExecutionQuery) DescribesScenario(org.camunda.bpm.qa.upgrade.DescribesScenario)

Example 24 with ScenarioSetup

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

the class SentryScenario method triggerEntryCriterion.

@DescribesScenario("triggerTaskEntryCriterion")
public static ScenarioSetup triggerEntryCriterion() {
    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 25 with ScenarioSetup

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

the class SentryScenario method completeStage.

@DescribesScenario("triggerStageEntryCriterion")
public static ScenarioSetup completeStage() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            CaseService caseService = engine.getCaseService();
            CaseInstance caseInstance = caseService.createCaseInstanceByKey("case", scenarioName);
            String caseInstanceId = caseInstance.getId();
            CaseExecutionQuery query = caseService.createCaseExecutionQuery().caseInstanceId(caseInstanceId);
            String firstHumanTaskId = query.activityId("PI_HumanTask_1").singleResult().getId();
            caseService.manuallyStartCaseExecution(firstHumanTaskId);
            caseService.completeCaseExecution(firstHumanTaskId);
            String secondHumanTaskId = query.activityId("PI_HumanTask_2").singleResult().getId();
            caseService.manuallyStartCaseExecution(secondHumanTaskId);
        }
    };
}
Also used : CaseInstance(org.camunda.bpm.engine.runtime.CaseInstance) ScenarioSetup(org.camunda.bpm.qa.upgrade.ScenarioSetup) CaseService(org.camunda.bpm.engine.CaseService) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) CaseExecutionQuery(org.camunda.bpm.engine.runtime.CaseExecutionQuery) 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