Search in sources :

Example 11 with CaseService

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

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

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

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

use of org.camunda.bpm.engine.CaseService in project camunda-bpm-platform by camunda.

the class MockedProcessEngineProvider method mockServices.

private void mockServices(ProcessEngine engine) {
    RepositoryService repoService = mock(RepositoryService.class);
    IdentityService identityService = mock(IdentityService.class);
    TaskService taskService = mock(TaskService.class);
    RuntimeService runtimeService = mock(RuntimeService.class);
    FormService formService = mock(FormService.class);
    HistoryService historyService = mock(HistoryService.class);
    ManagementService managementService = mock(ManagementService.class);
    CaseService caseService = mock(CaseService.class);
    FilterService filterService = mock(FilterService.class);
    ExternalTaskService externalTaskService = mock(ExternalTaskService.class);
    when(engine.getRepositoryService()).thenReturn(repoService);
    when(engine.getIdentityService()).thenReturn(identityService);
    when(engine.getTaskService()).thenReturn(taskService);
    when(engine.getRuntimeService()).thenReturn(runtimeService);
    when(engine.getFormService()).thenReturn(formService);
    when(engine.getHistoryService()).thenReturn(historyService);
    when(engine.getManagementService()).thenReturn(managementService);
    when(engine.getCaseService()).thenReturn(caseService);
    when(engine.getFilterService()).thenReturn(filterService);
    when(engine.getExternalTaskService()).thenReturn(externalTaskService);
}
Also used : IdentityService(org.camunda.bpm.engine.IdentityService) ManagementService(org.camunda.bpm.engine.ManagementService) RuntimeService(org.camunda.bpm.engine.RuntimeService) TaskService(org.camunda.bpm.engine.TaskService) ExternalTaskService(org.camunda.bpm.engine.ExternalTaskService) ExternalTaskService(org.camunda.bpm.engine.ExternalTaskService) FormService(org.camunda.bpm.engine.FormService) FilterService(org.camunda.bpm.engine.FilterService) HistoryService(org.camunda.bpm.engine.HistoryService) CaseService(org.camunda.bpm.engine.CaseService) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Aggregations

CaseService (org.camunda.bpm.engine.CaseService)22 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)9 NotAllowedException (org.camunda.bpm.engine.exception.NotAllowedException)9 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)9 NotValidException (org.camunda.bpm.engine.exception.NotValidException)9 CaseExecutionCommandBuilder (org.camunda.bpm.engine.runtime.CaseExecutionCommandBuilder)8 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)4 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)4 DescribesScenario (org.camunda.bpm.qa.upgrade.DescribesScenario)4 ScenarioSetup (org.camunda.bpm.qa.upgrade.ScenarioSetup)4 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)3 CaseInstanceDto (org.camunda.bpm.engine.rest.dto.runtime.CaseInstanceDto)2 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)2 URI (java.net.URI)1 ExternalTaskService (org.camunda.bpm.engine.ExternalTaskService)1 FilterService (org.camunda.bpm.engine.FilterService)1 FormService (org.camunda.bpm.engine.FormService)1 HistoryService (org.camunda.bpm.engine.HistoryService)1 IdentityService (org.camunda.bpm.engine.IdentityService)1 ManagementService (org.camunda.bpm.engine.ManagementService)1