Search in sources :

Example 61 with ProcessEngine

use of org.camunda.bpm.engine.ProcessEngine 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 62 with ProcessEngine

use of org.camunda.bpm.engine.ProcessEngine 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 63 with ProcessEngine

use of org.camunda.bpm.engine.ProcessEngine 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 64 with ProcessEngine

use of org.camunda.bpm.engine.ProcessEngine 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)

Example 65 with ProcessEngine

use of org.camunda.bpm.engine.ProcessEngine 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)

Aggregations

ProcessEngine (org.camunda.bpm.engine.ProcessEngine)162 DescribesScenario (org.camunda.bpm.qa.upgrade.DescribesScenario)60 ScenarioSetup (org.camunda.bpm.qa.upgrade.ScenarioSetup)60 Task (org.camunda.bpm.engine.task.Task)52 Times (org.camunda.bpm.qa.upgrade.Times)52 Test (org.junit.Test)26 ExtendsScenario (org.camunda.bpm.qa.upgrade.ExtendsScenario)18 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)17 ArrayList (java.util.ArrayList)16 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)15 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)14 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)14 RepositoryService (org.camunda.bpm.engine.RepositoryService)13 PooledDataSource (org.apache.ibatis.datasource.pooled.PooledDataSource)7 StandaloneInMemProcessEngineConfiguration (org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration)6 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)5 Job (org.camunda.bpm.engine.runtime.Job)5 Connection (java.sql.Connection)4 CaseService (org.camunda.bpm.engine.CaseService)4 StandaloneProcessEngineConfiguration (org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration)4