org.camunda.bpm.engine.runtime.ProcessInstance Java Examples
The following examples show how to use
org.camunda.bpm.engine.runtime.ProcessInstance.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageCorrelationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/MessageCorrelationTest.testCatchingMessageEventCorrelation.bpmn20.xml") @Test public void testCorrelationByProcessInstanceIdOnly() { runtimeService.startProcessInstanceByKey("process"); ProcessInstance instance = runtimeService.startProcessInstanceByKey("process"); runtimeService .createMessageCorrelation(null) .processInstanceId(instance.getId()) .correlate(); List<Execution> correlatedExecutions = runtimeService .createExecutionQuery() .activityId("task") .list(); assertEquals(1, correlatedExecutions.size()); assertEquals(instance.getId(), correlatedExecutions.get(0).getId()); }
Example #2
Source File: TaskListenerErrorThrowTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testThrowErrorOnDeleteAndCatchOnUserTaskShouldNotTriggerPropagation() { // given BpmnModelInstance model = createModelThrowErrorInListenerAndCatchOnUserTask(TaskListener.EVENTNAME_DELETE); DeploymentWithDefinitions deployment = testRule.deploy(model); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); // when try { runtimeService.deleteProcessInstance(processInstance.getId(), "invoke delete listener"); } catch (Exception e) { // then assertTrue(e.getMessage().contains("business error")); assertEquals(1, ThrowBPMNErrorListener.INVOCATIONS); assertEquals(0, RecorderTaskListener.getEventCount(TaskListener.EVENTNAME_DELETE)); } // cleanup engineRule.getRepositoryService().deleteDeployment(deployment.getId(), true, true); }
Example #3
Source File: AsyncEndEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/async/AsyncEndEventTest.testCallActivity-super.bpmn20.xml", "org/camunda/bpm/engine/test/bpmn/async/AsyncEndEventTest.testCallActivity-sub.bpmn20.xml" }) public void testCallActivity() { runtimeService.startProcessInstanceByKey("super"); ProcessInstance pi = runtimeService .createProcessInstanceQuery() .processDefinitionKey("sub") .singleResult(); assertTrue(pi instanceof ExecutionEntity); assertEquals("theSubEnd", ((ExecutionEntity)pi).getActivityId()); }
Example #4
Source File: TaskDueDateExtensionsTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testRelativeDueDate() { Map<String, Object> variables = new HashMap<String, Object>(); variables.put("dateVariable", "P2DT2H30M"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dueDateExtension", variables); Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); Date dueDate = task.getDueDate(); assertNotNull(dueDate); Period period = new Period(task.getCreateTime().getTime(), dueDate.getTime()); assertEquals(period.getDays(), 2); assertEquals(period.getHours(), 2); assertEquals(period.getMinutes(), 30); }
Example #5
Source File: CaseServiceProcessTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={ "org/camunda/bpm/engine/test/api/cmmn/oneProcessTaskCaseWithManualActivation.cmmn" }) public void testReenableAnEnabledProcessTask() { // given createCaseInstance(DEFINITION_KEY); String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK_KEY).getId(); ProcessInstance processInstance = queryProcessInstance(); assertNull(processInstance); try { // when caseService .withCaseExecution(processTaskId) .reenable(); fail("It should not be possible to re-enable an enabled process task."); } catch (NotAllowedException e) { } }
Example #6
Source File: DelegateTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testGetFollowUpDate() { // given BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("process") .startEvent() .userTask() .camundaFollowUpDate(FOLLOW_UP_DATE_STRING) .camundaTaskListenerClass("create", GetFollowUpDateListener.class) .endEvent() .done(); testRule.deploy(modelInstance); // when ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); // then String processInstanceId = processInstance.getId(); Date followUpDate = (Date) runtimeService.getVariable(processInstanceId, "followUp"); assertThat(followUpDate, notNullValue()); assertThat(followUpDate, is(FOLLOW_UP_DATE)); }
Example #7
Source File: OptimizeServiceAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
private void generateTestData() { engineRule.getProcessEngineConfiguration().setAuthorizationEnabled(false); // completed activity/task/process instance data final ProcessDefinition process = selectProcessDefinitionByKey("process"); runtimeService.startProcessInstanceById( process.getId(), // variable update data Variables.createVariables() .putValue("foo", "bar") ); // running activity/task/process instance data final ProcessDefinition process2 = selectProcessDefinitionByKey("userTaskProcess"); ProcessInstance processInstance = runtimeService.startProcessInstanceById(process2.getId()); // op log data runtimeService.suspendProcessInstanceById(processInstance.getId()); runtimeService.activateProcessInstanceById(processInstance.getId()); // identity link log data completeAllUserTasks(); // decision instance data final DecisionDefinition decision = selectDecisionDefinitionByKey(); decisionService.evaluateDecisionById(decision.getId()) .variables(Variables.createVariables().putValue("input1", "a")).evaluate(); engineRule.getProcessEngineConfiguration().setAuthorizationEnabled(true); }
Example #8
Source File: OneTaskScenarioTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @ScenarioUnderTest("init.nested.1") public void testInitNestedActivityInstance() { // given ProcessInstance instance = rule.processInstance(); // when ActivityInstance activityInstance = rule.getRuntimeService().getActivityInstance(instance.getId()); // then Assert.assertNotNull(activityInstance); assertThat(activityInstance).hasStructure( describeActivityInstanceTree(instance.getProcessDefinitionId()) .beginScope("subProcess") .activity("task") .done()); }
Example #9
Source File: ExecutionQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={"org/camunda/bpm/engine/test/api/runtime/failingProcessCreateOneIncident.bpmn20.xml"}) public void testQueryByIncidentType() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess"); executeAvailableJobs(); List<Incident> incidentList = runtimeService.createIncidentQuery().list(); assertEquals(1, incidentList.size()); Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult(); List<Execution> executionList = runtimeService .createExecutionQuery() .incidentType(incident.getIncidentType()).list(); assertEquals(1, executionList.size()); }
Example #10
Source File: HistoricRootProcessInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldResolveHistoricProcessInstance() { // given testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); // when ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .activeActivityIdIn("userTask") .singleResult(); // assume assertThat(historicProcessInstance, notNullValue()); // then assertThat(historicProcessInstance.getRootProcessInstanceId(), is(processInstance.getProcessInstanceId())); }
Example #11
Source File: ReceiveTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/receivetask/ReceiveTaskTest.multiSubProcessReceiveTask.bpmn20.xml") public void testSupportsMessageEventReceivedOnMultiSubProcessReceiveTask() { // given: a process instance waiting in two parallel sub-process receive tasks ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess"); // expect: there are two message event subscriptions List<EventSubscription> subscriptions = getEventSubscriptionList(); assertEquals(2, subscriptions.size()); // then: we can trigger both receive task event subscriptions runtimeService.messageEventReceived(subscriptions.get(0).getEventName(), subscriptions.get(0).getExecutionId()); runtimeService.messageEventReceived(subscriptions.get(1).getEventName(), subscriptions.get(1).getExecutionId()); // expect: subscriptions are removed assertEquals(0, getEventSubscriptionList().size()); // expect: this ends the process instance assertProcessEnded(processInstance.getId()); }
Example #12
Source File: ProcessInstanceModificationAsyncTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
/** * CAM-4090 */ @Deployment(resources = NESTED_PARALLEL_ASYNC_BEFORE_SCOPE_TASK_PROCESS) public void testRepeatedStartAndCancellationForTransitionInstance() { // given there is one transition instance in a scope ProcessInstance instance = runtimeService.createProcessInstanceByKey("nestedConcurrentTasksProcess") .startBeforeActivity("innerTask1") .execute(); ActivityInstance tree = runtimeService.getActivityInstance(instance.getId()); TransitionInstance transitionInstance = tree.getTransitionInstances("innerTask1")[0]; // when I start an activity in the same scope // and cancel the first transition instance runtimeService.createProcessInstanceModification(instance.getId()) .startBeforeActivity("innerTask2") // expand tree .cancelAllForActivity("innerTask2") // compact tree .startBeforeActivity("innerTask2") // expand tree .cancelAllForActivity("innerTask2") // compact tree .startBeforeActivity("innerTask2") // expand tree .cancelAllForActivity("innerTask2") // compact tree .cancelTransitionInstance(transitionInstance.getId()) .execute(); // then the process has ended assertProcessEnded(instance.getId()); }
Example #13
Source File: CompleteProcessWithUserTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @ScenarioUnderTest("init.1") public void testCompleteProcessWithUserTask() { //given an already started process instance ProcessInstance oldInstance = rule.processInstance(); Assert.assertNotNull(oldInstance); //which waits on an user task TaskService taskService = rule.getTaskService(); Task userTask = taskService.createTaskQuery().processInstanceId(oldInstance.getId()).singleResult(); Assert.assertNotNull(userTask); //when completing the user task taskService.complete(userTask.getId()); //then there exists no more tasks //and the process instance is also completed Assert.assertEquals(0, rule.taskQuery().count()); rule.assertScenarioEnded(); }
Example #14
Source File: ProcessInstanceQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment(resources={"org/camunda/bpm/engine/test/api/runtime/failingProcessCreateOneIncident.bpmn20.xml"}) public void testQueryByIncidentMessageLike() { runtimeService.startProcessInstanceByKey("failingProcess"); testHelper.executeAvailableJobs(); List<Incident> incidentList = runtimeService.createIncidentQuery().list(); assertEquals(1, incidentList.size()); List<ProcessInstance> processInstanceList = runtimeService .createProcessInstanceQuery() .incidentMessageLike("%\\_exception%").list(); assertEquals(1, processInstanceList.size()); }
Example #15
Source File: MultiTenancyStartProcessInstanceByConditionCmdTenantCheckTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testDisabledTenantCheck() throws Exception { // given testRule.deployForTenant(TENANT_ONE, PROCESS); testRule.deployForTenant(TENANT_TWO, PROCESS); ensureEventSubscriptions(2); engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false); identityService.setAuthentication("user", null, null); Map<String, Object> variableMap = new HashMap<String, Object>(); variableMap.put("foo", "bar"); // when List<ProcessInstance> evaluateStartConditions = engineRule.getRuntimeService() .createConditionEvaluation() .setVariables(variableMap) .evaluateStartConditions(); assertEquals(2, evaluateStartConditions.size()); identityService.clearAuthentication(); }
Example #16
Source File: ProcessDataLoggingContextTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @WatchLogger(loggerNames = CONTEXT_LOGGER, level = "ERROR") public void shouldLogFailureFromMessageCorrelationListenerInEventContext() { // given manageDeployment(Bpmn.createExecutableProcess(PROCESS) .startEvent("start") .intermediateCatchEvent("message") .message("testMessage") .camundaExecutionListenerClass("end", FailingExecutionListener.class) .endEvent("end") .done()); ProcessInstance instance = runtimeService.startProcessInstanceByKey(PROCESS, B_KEY); // when try { runtimeService.correlateMessage("testMessage"); fail("Exception expected"); } catch (Exception e) { // expected exception in the task listener that is not caught } // then assertFailureLogPresent(instance, "message"); }
Example #17
Source File: ExclusiveTimerEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testCatchingTimerEvent() throws Exception { // Set the clock fixed Date startTime = new Date(); // After process start, there should be 3 timers created ProcessInstance pi = runtimeService.startProcessInstanceByKey("exclusiveTimers"); JobQuery jobQuery = managementService.createJobQuery().processInstanceId(pi.getId()); assertEquals(3, jobQuery.count()); // After setting the clock to time '50minutes and 5 seconds', the timers should fire ClockUtil.setCurrentTime(new Date(startTime.getTime() + ((50 * 60 * 1000) + 5000))); waitForJobExecutorToProcessAllJobs(5000L); assertEquals(0, jobQuery.count()); assertProcessEnded(pi.getProcessInstanceId()); }
Example #18
Source File: StartByTest.java From camunda-bpm-assert-scenario with Apache License 2.0 | 6 votes |
@Test @Deployment(resources = {"org/camunda/bpm/scenario/test/processes/StartByTest.bpmn"}) public void testStartByStarterMessage1() { when(scenario.waitsAtReceiveTask("ReceiveTask")).thenReturn(new ReceiveTaskAction() { @Override public void execute(EventSubscriptionDelegate message) throws Exception { message.receive(); } }); Scenario.run(scenario).startBy(new ProcessStarter() { @Override public ProcessInstance start() { return rule.getRuntimeService().startProcessInstanceByMessage("msg_StartEvent1"); } }).execute(); verify(scenario, times(1)).hasFinished("StartEvent1"); verify(scenario, times(1)).hasFinished("EndEvent"); }
Example #19
Source File: HistoryServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") // deprecated method is tested here @Deployment(resources = {"org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml"}) public void testHistoricProcessInstanceUserIdAndActivityId() { identityService.setAuthenticatedUserId("johndoe"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(ONE_TASK_PROCESS); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().singleResult(); assertEquals("johndoe", historicProcessInstance.getStartUserId()); assertEquals("theStart", historicProcessInstance.getStartActivityId()); List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list(); assertEquals(1, tasks.size()); taskService.complete(tasks.get(0).getId()); historicProcessInstance = historyService.createHistoricProcessInstanceQuery().singleResult(); assertEquals("theEnd", historicProcessInstance.getEndActivityId()); }
Example #20
Source File: LinkEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testEventLinkMultipleSources() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("linkEventValid"); List<String> activeActivities = runtimeService.getActiveActivityIds(pi.getId()); // assert that the link event was triggered and that we are assertEquals(Arrays.asList(new String []{"WaitAfterLink", "WaitAfterLink"}), activeActivities); runtimeService.deleteProcessInstance(pi.getId(), "test done"); // validate history if(processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) { List<HistoricActivityInstance> activities = historyService.createHistoricActivityInstanceQuery().processInstanceId(pi.getId()).orderByActivityId().asc().list(); assertEquals(5, activities.size()); assertEquals("ManualTask_1", activities.get(0).getActivityId()); assertEquals("ParallelGateway_1", activities.get(1).getActivityId()); assertEquals("StartEvent_1", activities.get(2).getActivityId()); assertEquals("WaitAfterLink", activities.get(3).getActivityId()); assertEquals("WaitAfterLink", activities.get(4).getActivityId()); } }
Example #21
Source File: HistoricRootProcessInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldResolveExternalTaskLog() { // given testRule.deploy(Bpmn.createExecutableProcess("calledProcess") .startEvent() .serviceTask().camundaExternalTask("anExternalTaskTopic") .endEvent().done()); testRule.deploy(Bpmn.createExecutableProcess("callingProcess") .startEvent() .callActivity() .calledElement("calledProcess") .endEvent().done()); // when ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("callingProcess"); HistoricExternalTaskLog ExternalTaskLog = historyService.createHistoricExternalTaskLogQuery().singleResult(); // assume assertThat(ExternalTaskLog, notNullValue()); // then assertThat(ExternalTaskLog.getRootProcessInstanceId(), is(processInstance.getRootProcessInstanceId())); }
Example #22
Source File: ProcessInstanceModificationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testNoCompensationCreatedOnCancellation() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("compensationProcess"); ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId()); // one on outerTask, one on innerTask assertEquals(2, taskService.createTaskQuery().count()); // when inner task is cancelled runtimeService.createProcessInstanceModification(processInstance.getId()).cancelActivityInstance(getInstanceIdForActivity(tree, "innerTask")).execute(); // then no compensation event subscription exists assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); // and the compensation throw event does not trigger compensation handlers Task task = taskService.createTaskQuery().singleResult(); assertNotNull(task); assertEquals("outerTask", task.getTaskDefinitionKey()); taskService.complete(task.getId()); assertProcessEnded(processInstance.getId()); }
Example #23
Source File: RestartProcessInstanceAsyncTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldRetainTenantIdOfSharedProcessDefinition() { // given engineRule.getProcessEngineConfiguration() .setTenantIdProvider(new TestTenantIdProvider()); ProcessDefinition processDefinition = testRule.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId()); assertEquals(processInstance.getTenantId(), TestTenantIdProvider.TENANT_ID); runtimeService.deleteProcessInstance(processInstance.getId(), "test"); // when Batch batch = runtimeService.restartProcessInstances(processDefinition.getId()) .startBeforeActivity(ProcessModels.USER_TASK_ID) .processInstanceIds(processInstance.getId()) .executeAsync(); helper.completeBatch(batch); // then ProcessInstance restartedInstance = runtimeService.createProcessInstanceQuery().active() .processDefinitionId(processDefinition.getId()).singleResult(); assertNotNull(restartedInstance); assertEquals(restartedInstance.getTenantId(), TestTenantIdProvider.TENANT_ID); }
Example #24
Source File: ExecutionQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={"org/camunda/bpm/engine/test/api/runtime/failingProcessCreateOneIncident.bpmn20.xml"}) public void testQueryByIncidentId() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess"); executeAvailableJobs(); List<Incident> incidentList = runtimeService.createIncidentQuery().list(); assertEquals(1, incidentList.size()); Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult(); List<Execution> executionList = runtimeService .createExecutionQuery() .incidentId(incident.getId()).list(); assertEquals(1, executionList.size()); }
Example #25
Source File: MigrationTimerCatchEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testMigrateJobChangeProcessKey() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(TimerCatchModels.ONE_TIMER_CATCH_PROCESS); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(TimerCatchModels.ONE_TIMER_CATCH_PROCESS) .changeElementId(ProcessModels.PROCESS_KEY, "new" + ProcessModels.PROCESS_KEY)); MigrationPlan migrationPlan = rule.getRuntimeService() .createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()) .mapActivities("timerCatch", "timerCatch") .build(); // when ProcessInstance processInstance = testHelper.createProcessInstanceAndMigrate(migrationPlan); testHelper.assertJobMigrated( testHelper.snapshotBeforeMigration.getJobs().get(0), "timerCatch"); // and it is possible to trigger the event Job jobAfterMigration = testHelper.snapshotAfterMigration.getJobs().get(0); rule.getManagementService().executeJob(jobAfterMigration.getId()); testHelper.completeTask("userTask"); testHelper.assertProcessEnded(processInstance.getId()); }
Example #26
Source File: TaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment(resources = { "org/camunda/bpm/engine/test/api/task/TaskServiceTest.handleUserTaskEscalation.bpmn20.xml" }) public void testHandleEscalationInterruptInEventSubprocess() { // given ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_KEY); Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); assertEquals(USER_TASK_THROW_ESCALATION, task.getTaskDefinitionKey()); // when taskService.handleEscalation(task.getId(), "304", Variables.createVariables().putValue("foo", "bar")); // then Task taskAfterThrow = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); assertEquals("after-304", taskAfterThrow.getTaskDefinitionKey()); assertEquals("bar",runtimeService.createVariableInstanceQuery().variableName("foo").singleResult().getValue()); }
Example #27
Source File: JobQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
private ProcessInstance startProcessInstanceWithFailingJob() { // start a process with a failing job ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("exceptionInJobExecution"); // The execution is waiting in the first usertask. This contains a boundary // timer event which we will execute manual for testing purposes. Job timerJob = managementService.createJobQuery() .processInstanceId(processInstance.getId()) .singleResult(); assertNotNull("No job found for process instance", timerJob); try { managementService.executeJob(timerJob.getId()); fail("RuntimeException from within the script task expected"); } catch(RuntimeException re) { assertThat(re.getMessage(), containsString(EXCEPTION_MESSAGE)); } return processInstance; }
Example #28
Source File: ProcessInstanceModificationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = PARALLEL_GATEWAY_PROCESS) public void testCancellationWithWrongProcessInstanceId() { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("parallelGateway"); ActivityInstance tree = runtimeService.getActivityInstance(processInstance.getId()); try { runtimeService.createProcessInstanceModification("foo") .cancelActivityInstance(getInstanceIdForActivity(tree, "task1")) .cancelActivityInstance(getInstanceIdForActivity(tree, "task2")) .execute(); assertProcessEnded(processInstance.getId()); } catch (ProcessEngineException e) { assertThat(e.getMessage(), startsWith("ENGINE-13036")); assertThat(e.getMessage(), containsString("Process instance '" + "foo" + "' cannot be modified")); } }
Example #29
Source File: BoundaryTimerEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testMultipleOutgoingSequenceFlowsOnSubprocessMi() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("interruptingTimer"); Job job = managementService.createJobQuery().singleResult(); assertNotNull(job); managementService.executeJob(job.getId()); TaskQuery taskQuery = taskService.createTaskQuery(); assertEquals(2, taskQuery.count()); List<Task> tasks = taskQuery.list(); for (Task task : tasks) { taskService.complete(task.getId()); } assertProcessEnded(pi.getId()); }
Example #30
Source File: SampleCamundaRestApplicationIT.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void startProcessInstanceByCustomResource() throws Exception { ResponseEntity<ProcessInstanceDto> entity = testRestTemplate.postForEntity("/engine-rest/process/start", HttpEntity.EMPTY, ProcessInstanceDto.class); assertEquals(HttpStatus.OK, entity.getStatusCode()); assertNotNull(entity.getBody()); // find the process instance final ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(entity.getBody().getId()).singleResult(); assertEquals(processInstance.getProcessInstanceId(), entity.getBody().getId()); }