Search in sources :

Example 31 with Times

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

the class InterruptingEventSubprocessCompensationScenario method instantiate.

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

        public void execute(ProcessEngine engine, String scenarioName) {
            engine.getRuntimeService().startProcessInstanceByKey("InterruptingEventSubprocessCompensationScenario", scenarioName);
            // enter the event subprocess
            engine.getRuntimeService().correlateMessage("Message", 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 32 with Times

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

the class SubprocessParallelThrowCompensationScenario method instantiate.

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

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

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

the class NestedNonInterruptingEventSubprocessScenario method completeSubprocessTask.

@DescribesScenario("init.innerTask")
@ExtendsScenario("init")
@Times(5)
public static ScenarioSetup completeSubprocessTask() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            Task task = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).taskDefinitionKey("innerTask").singleResult();
            engine.getTaskService().complete(task.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 34 with Times

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

the class NonInterruptingEventSubprocessScenario method completeSubprocessTask.

@DescribesScenario("init.outerTask")
@ExtendsScenario("init")
@Times(3)
public static ScenarioSetup completeSubprocessTask() {
    return new ScenarioSetup() {

        public void execute(ProcessEngine engine, String scenarioName) {
            Task task = engine.getTaskService().createTaskQuery().processInstanceBusinessKey(scenarioName).taskDefinitionKey("outerTask").singleResult();
            engine.getTaskService().complete(task.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 35 with Times

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

the class AuthorizationScenario method startProcessInstance.

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

        public void execute(ProcessEngine engine, String scenarioName) {
            IdentityService identityService = engine.getIdentityService();
            String userId = USER_ID + scenarioName;
            String groupid = GROUP_ID + scenarioName;
            // create an user
            User user = identityService.newUser(userId);
            identityService.saveUser(user);
            // create group
            Group group = identityService.newGroup(groupid);
            identityService.saveGroup(group);
            // create membership
            identityService.createMembership(userId, groupid);
            // create full authorization
            AuthorizationService authorizationService = engine.getAuthorizationService();
            // authorization for process definition
            Authorization authProcDef = createAuthorization(authorizationService, Permissions.ALL, Resources.PROCESS_DEFINITION, userId);
            engine.getAuthorizationService().saveAuthorization(authProcDef);
            // authorization for deployment
            Authorization authDeployment = createAuthorization(authorizationService, Permissions.ALL, Resources.DEPLOYMENT, userId);
            engine.getAuthorizationService().saveAuthorization(authDeployment);
            // authorization for process instance create
            Authorization authProcessInstance = createAuthorization(authorizationService, Permissions.CREATE, Resources.PROCESS_INSTANCE, userId);
            engine.getAuthorizationService().saveAuthorization(authProcessInstance);
            // start a process instance
            engine.getRuntimeService().startProcessInstanceByKey(PROCESS_DEF_KEY, scenarioName);
        }
    };
}
Also used : IdentityService(org.camunda.bpm.engine.IdentityService) Authorization(org.camunda.bpm.engine.authorization.Authorization) Group(org.camunda.bpm.engine.identity.Group) User(org.camunda.bpm.engine.identity.User) AuthorizationService(org.camunda.bpm.engine.AuthorizationService) 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)

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