org.camunda.bpm.engine.task.Task Java Examples
The following examples show how to use
org.camunda.bpm.engine.task.Task.
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: HistoricVariableInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testErrorMessage() { Task newTask = taskService.newTask(); taskService.saveTask(newTask); String variableName = "failingSerializable"; taskService.setVariable(newTask.getId(), variableName, new FailingSerializable()); HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery() .variableName(variableName) .singleResult(); assertNull(variableInstance.getValue()); assertNotNull(variableInstance.getErrorMessage()); taskService.deleteTask(newTask.getId(), true); }
Example #2
Source File: SequentialMultiInstanceScenarioTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @ScenarioUnderTest("initNonInterruptingBoundaryEvent.6") public void testInitNonInterruptingBoundaryEventThrowError() { // given ProcessInstance instance = rule.processInstance(); Task miSubprocessTask = rule.taskQuery().taskDefinitionKey("subProcessTask").singleResult(); Task afterBoundaryTask = rule.taskQuery().taskDefinitionKey("afterBoundaryTask").singleResult(); // when rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.ERROR_INDICATOR_VARIABLE, true); rule.getTaskService().complete(miSubprocessTask.getId()); // then Assert.assertEquals(2, rule.taskQuery().count()); Task escalatedTask = rule.taskQuery().taskDefinitionKey("escalatedTask").singleResult(); Assert.assertNotNull(escalatedTask); // and rule.getTaskService().complete(escalatedTask.getId()); rule.getTaskService().complete(afterBoundaryTask.getId()); rule.assertScenarioEnded(); }
Example #3
Source File: MultiInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment( resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testCatchErrorThrownByParallelDelegateExpression.bpmn20.xml" }) public void testCatchErrorThrownBySignalOfParallelDelegateExpression() { VariableMap variables = Variables.createVariables().putValue("myDelegate", new ThrowErrorDelegate()); String pi = runtimeService.startProcessInstanceByKey("testProcess", variables).getId(); assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); assertNull(runtimeService.getVariable(pi, "signaled")); Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").list().get(3); assertNotNull(serviceTask); runtimeService.setVariables(pi, throwError()); runtimeService.signal(serviceTask.getId()); assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); assertNotNull(userTask); assertEquals("userTaskError", userTask.getTaskDefinitionKey()); taskService.complete(userTask.getId()); }
Example #4
Source File: FormDataTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testMissingFormVariables() { // given process definition with defined form varaibles // when start process instance with no variables ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("date-form-property-test"); Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); // then taskFormData contains form variables with null as values TaskFormData taskFormData = formService.getTaskFormData(task.getId()); assertNotNull(taskFormData); assertEquals(5, taskFormData.getFormFields().size()); for (FormField field : taskFormData.getFormFields()) { assertNotNull(field); assertNull(field.getValue().getValue()); } }
Example #5
Source File: TaskReadVariablePermissionAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml") public void testProcessTaskSetOwnerAndCheckOwnerPermissions() { // given startProcessInstanceByKey(PROCESS_KEY); String taskId = selectSingleTask().getId(); authRule.createGrantAuthorization(TASK, taskId, userId, UPDATE); // when taskService.setOwner(taskId, DEMO); // then Task task = selectSingleTask(); assertNotNull(task); assertEquals(DEMO, task.getOwner()); verifyUserAuthorization(DEMO); }
Example #6
Source File: CompetingProcessCompletionTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
/** * This test requires a minimum of three concurrent executions to avoid * that all threads attempt compaction by which synchronization happens "by accident" */ @Deployment public void testCompetingEnd() throws Exception { runtimeService.startProcessInstanceByKey("CompetingEndProcess"); List<Task> tasks = taskService.createTaskQuery().list(); assertEquals(3, tasks.size()); LOG.debug("test thread starts thread one"); CompleteTaskThread threadOne = new CompleteTaskThread(tasks.get(0).getId()); threadOne.startAndWaitUntilControlIsReturned(); LOG.debug("test thread continues to start thread two"); CompleteTaskThread threadTwo = new CompleteTaskThread(tasks.get(1).getId()); threadTwo.startAndWaitUntilControlIsReturned(); LOG.debug("test thread notifies thread 1"); threadOne.proceedAndWaitTillDone(); assertNull(threadOne.exception); LOG.debug("test thread notifies thread 2"); threadTwo.proceedAndWaitTillDone(); assertNotNull(threadTwo.exception); assertTextPresent("was updated by another transaction concurrently", threadTwo.exception.getMessage()); }
Example #7
Source File: TerminateEndEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={ "org/camunda/bpm/engine/test/bpmn/event/end/TerminateEndEventTest.testTerminateInCallActivityMulitInstance.bpmn", "org/camunda/bpm/engine/test/bpmn/event/end/TerminateEndEventTest.subProcessTerminate.bpmn" }) public void testTerminateInCallActivityMulitInstance() throws Exception { ProcessInstance pi = runtimeService.startProcessInstanceByKey("terminateEndEventExample"); // should terminate the called process and continue the parent long executionEntities = runtimeService.createExecutionQuery().count(); assertEquals(1, executionEntities); Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).taskDefinitionKey("preNormalEnd").singleResult(); taskService.complete(task.getId()); assertProcessEnded(pi.getId()); }
Example #8
Source File: TaskAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testProcessTaskSetOwner() { // given startProcessInstanceByKey(PROCESS_KEY); String taskId = selectSingleTask().getId(); createGrantAuthorization(TASK, taskId, userId, UPDATE); createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, UPDATE_TASK); // when taskService.setOwner(taskId, "demo"); // then Task task = selectSingleTask(); assertNotNull(task); assertEquals("demo", task.getOwner()); }
Example #9
Source File: HistoryServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml"}) public void testHistoricProcessInstanceQueryOrderBy() { // With a clean ProcessEngine, no instances should be available assertTrue(historyService.createHistoricProcessInstanceQuery().count() == 0); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(ONE_TASK_PROCESS); List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list(); assertEquals(1, tasks.size()); taskService.complete(tasks.get(0).getId()); historyService.createHistoricTaskInstanceQuery().orderByDeleteReason().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByExecutionId().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByHistoricActivityInstanceId().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByHistoricActivityInstanceStartTime().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByHistoricTaskInstanceDuration().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByHistoricTaskInstanceEndTime().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByProcessDefinitionId().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByProcessInstanceId().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByTaskAssignee().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByTaskDefinitionKey().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByTaskDescription().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByTaskId().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByTaskName().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByTaskOwner().asc().list(); historyService.createHistoricTaskInstanceQuery().orderByTaskPriority().asc().list(); }
Example #10
Source File: InterruptingEventSubProcessNestedCompensationSenarioTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @ScenarioUnderTest("init.throwCompensate.1") public void testInitThrowCompensateCompletionCase1() { // given Task undoTask = rule.taskQuery().singleResult(); // when rule.getTaskService().complete(undoTask.getId()); // then it is possible to complete the process successfully // by completing the sub process regularly Task afterCompensateTask = rule.taskQuery().singleResult(); Assert.assertNotNull(afterCompensateTask); Assert.assertEquals("afterCompensate", afterCompensateTask.getTaskDefinitionKey()); rule.getTaskService().complete(afterCompensateTask.getId()); rule.assertScenarioEnded(); }
Example #11
Source File: HistoricVariableInstanceAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testQueryAfterDeletingDeployment() { // given startProcessInstanceByKey(PROCESS_KEY, getVariables()); startProcessInstanceByKey(PROCESS_KEY, getVariables()); startProcessInstanceByKey(PROCESS_KEY, getVariables()); createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY); disableAuthorization(); List<Task> tasks = taskService.createTaskQuery().list(); for (Task task : tasks) { taskService.complete(task.getId()); } enableAuthorization(); disableAuthorization(); repositoryService.deleteDeployment(deploymentId); enableAuthorization(); // when HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery(); // then verifyQueryResults(query, 3); cleanUpAfterDeploymentDeletion(); }
Example #12
Source File: MultiInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment( resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testCatchErrorThrownBySequentialDelegateExpression.bpmn20.xml" }) public void testCatchExceptionThrownByExecuteOfSequentialDelegateExpression() { VariableMap variables = Variables.createVariables().putValue("myDelegate", new ThrowErrorDelegate()); variables.putAll(throwException()); String pi = runtimeService.startProcessInstanceByKey("testProcess", variables).getId(); assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); assertNull(runtimeService.getVariable(pi, "signaled")); Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); assertNotNull(userTask); assertEquals("userTaskException", userTask.getTaskDefinitionKey()); taskService.complete(userTask.getId()); }
Example #13
Source File: UserOperationLogDeletionTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testDeleteStandaloneTaskKeepUserOperationLog() { // given String taskId = "my-task"; Task task = taskService.newTask(taskId); taskService.saveTask(task); taskService.setAssignee(taskId, "demo"); taskService.complete(taskId); UserOperationLogQuery query = historyService .createUserOperationLogQuery() .taskId(taskId); assertEquals(3, query.count()); // when historyService.deleteHistoricTaskInstance(taskId); // then assertEquals(5, query.count()); }
Example #14
Source File: ProcessInstanceSuspensionTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/api/runtime/ProcessInstanceSuspensionTest.callSimpleProcess.bpmn20.xml", "org/camunda/bpm/engine/test/api/runtime/subProcess.bpmn20.xml"}) public void testCallActivityReturnAfterProcessInstanceSuspendByProcessDefinitionId() { ProcessInstance instance = runtimeService.startProcessInstanceByKey("callSimpleProcess"); runtimeService.suspendProcessInstanceByProcessDefinitionId(instance.getProcessDefinitionId()); Task task = taskService.createTaskQuery().singleResult(); try { taskService.complete(task.getId()); fail("this should not be successful, as the execution of a suspended instance is resumed"); } catch (SuspendedEntityInteractionException e) { // this is expected to fail } // should be successful after reactivation runtimeService.activateProcessInstanceByProcessDefinitionId(instance.getProcessDefinitionId()); taskService.complete(task.getId()); assertEquals(1, runtimeService.createProcessInstanceQuery().count()); }
Example #15
Source File: NestedParallelNonInterruptingEventSubprocessScenarioTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @ScenarioUnderTest("init.2") public void testInitCompletionCase2() { // given Task innerTask = rule.taskQuery().taskDefinitionKey("innerTask").singleResult(); Task eventSubprocessTask1 = rule.taskQuery().taskDefinitionKey("eventSubProcessTask1").singleResult(); Task eventSubprocessTask2 = rule.taskQuery().taskDefinitionKey("eventSubProcessTask2").singleResult(); // when rule.getTaskService().complete(eventSubprocessTask1.getId()); rule.getTaskService().complete(eventSubprocessTask2.getId()); rule.getTaskService().complete(innerTask.getId()); // then rule.assertScenarioEnded(); }
Example #16
Source File: BoundaryConditionalEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment public void testCleanUpConditionalEventSubscriptions() { //given process with boundary conditional event ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId()); Task task = taskQuery.singleResult(); assertEquals(1, conditionEventSubscriptionQuery.list().size()); //when task is completed taskService.complete(task.getId()); //then conditional subscription should be deleted tasksAfterVariableIsSet = taskQuery.list(); assertEquals(1, tasksAfterVariableIsSet.size()); assertEquals(0, conditionEventSubscriptionQuery.list().size()); }
Example #17
Source File: ErrorEventSubProcessTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/event/error/ErrorEventSubProcessTest.testCatchErrorThrownByDelegateExpression.bpmn20.xml" }) public void testCatchErrorThrownBySignalOfDelegateExpression() { VariableMap variables = Variables.createVariables().putValue("myDelegate", new ThrowErrorDelegate()); String pi = runtimeService.startProcessInstanceByKey("testProcess", variables).getId(); assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); assertNull(runtimeService.getVariable(pi, "signaled")); Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult(); assertNotNull(serviceTask); runtimeService.setVariables(pi, throwError()); runtimeService.signal(serviceTask.getId()); assertTrue((Boolean) runtimeService.getVariable(pi, "executed")); assertTrue((Boolean) runtimeService.getVariable(pi, "signaled")); Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult(); assertNotNull(userTask); assertEquals("userTaskError", userTask.getTaskDefinitionKey()); taskService.complete(userTask.getId()); }
Example #18
Source File: SingleActivityCompensationScenarioTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @ScenarioUnderTest("init.3") public void testInitActivityInstanceTree() { // given ProcessInstance instance = rule.processInstance(); // when compensation is thrown Task beforeCompensationTask = rule.taskQuery().singleResult(); rule.getTaskService().complete(beforeCompensationTask.getId()); // then the activity instance tree is meaningful ActivityInstance activityInstance = rule.getRuntimeService().getActivityInstance(instance.getId()); Assert.assertNotNull(activityInstance); assertThat(activityInstance).hasStructure( describeActivityInstanceTree(instance.getProcessDefinitionId()) .activity("throwCompensate") .activity("undoTask") .done()); }
Example #19
Source File: TriggerConditionalEventFromDelegationCodeTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testSetVariableInEndListener() { BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY) .startEvent() .userTask(TASK_BEFORE_CONDITION_ID) .name(TASK_BEFORE_CONDITION) .camundaExecutionListenerClass(ExecutionListener.EVENTNAME_END, specifier.getDelegateClass().getName()) .userTask(TASK_WITH_CONDITION_ID) .endEvent() .done(); deployConditionalEventSubProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, specifier.getCondition(), true); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId()); Task task = taskQuery.singleResult(); //when task is completed taskService.complete(task.getId()); //then end listener sets variable //conditional event is triggered tasksAfterVariableIsSet = taskQuery.list(); assertEquals(specifier.getExpectedInterruptingCount(), taskQuery.taskName(TASK_AFTER_CONDITION).count()); }
Example #20
Source File: SubprocessCompensationScenario.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@DescribesScenario("init.concurrent") @Times(3) public static ScenarioSetup instantiateConcurrent() { return new ScenarioSetup() { public void execute(ProcessEngine engine, String scenarioName) { engine .getRuntimeService() .startProcessInstanceByKey("SubprocessConcurrentCompensationScenario", scenarioName); // create the compensation event subscriptions and wait before throwing compensation Task userTask1 = engine.getTaskService().createTaskQuery() .processInstanceBusinessKey(scenarioName).singleResult(); engine.getTaskService().complete(userTask1.getId()); Task userTask2 = engine.getTaskService().createTaskQuery() .processInstanceBusinessKey(scenarioName).singleResult(); engine.getTaskService().complete(userTask2.getId()); } }; }
Example #21
Source File: UnhandledBpmnErrorTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/event/error/UnhandledBpmnErrorTest.testUncaughtErrorOnCallActivity.bpmn20.xml", "org/camunda/bpm/engine/test/bpmn/event/error/UnhandledBpmnErrorTest.subprocess.bpmn20.xml" }) public void testUncaughtErrorOnCallActivity() { // expect thrown.expect(ProcessEngineException.class); thrown.expectMessage(containsString("no error handler")); // given runtimeService.startProcessInstanceByKey("uncaughtErrorOnCallActivity"); // assume Task task = taskService.createTaskQuery().singleResult(); assertEquals("Task in subprocess", task.getName()); // when // Completing the task will reach the end error event, // which is never caught in the process taskService.complete(task.getId()); }
Example #22
Source File: EscalationEventSubprocessTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testReThrowEscalationEventToBoundaryEventWithoutEscalationCode() { runtimeService.startProcessInstanceByKey("escalationProcess"); // when throw an escalation event inside the subprocess // the non-interrupting event subprocess inside the subprocess should catch the escalation event Task task = taskService.createTaskQuery().taskName("task after catched escalation inside subprocess").singleResult(); assertNotNull(task); // when re-throw the escalation event from the escalation event subprocess taskService.complete(task.getId()); assertEquals(2, taskService.createTaskQuery().count()); // the non-interrupting boundary event on subprocess without escalationCode should catch the escalation event (and all other escalation events) assertEquals(1, taskService.createTaskQuery().taskName("task after catched escalation on boundary event").count()); // and continue the process assertEquals(1, taskService.createTaskQuery().taskName("task in subprocess").count()); }
Example #23
Source File: ParallelMultiInstanceCompensationScenarioTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @ScenarioUnderTest("defaultHandler.beforeCompensate.3") public void testDefaultHandlerBeforeCompensateActivityInstanceTree() { // given ProcessInstance instance = rule.processInstance(); // when throwing compensation Task beforeCompensateTask = rule.taskQuery().singleResult(); rule.getTaskService().complete(beforeCompensateTask.getId()); // then the activity instance tree is meaningful ActivityInstance activityInstance = rule.getRuntimeService().getActivityInstance(instance.getId()); Assert.assertNotNull(activityInstance); assertThat(activityInstance).hasStructure( describeActivityInstanceTree(instance.getProcessDefinitionId()) .activity("throwCompensate") // missing mi body execution as there was no event subscription for it // .beginMiBody("subProcess") // there is only one sub process scope although there are three subprocess executions // due to the differences in activity instance id assignment with >= 7.4 .beginScope("subProcess") .activity("undoTask") .activity("undoTask") .activity("undoTask") .done()); }
Example #24
Source File: BoundaryConditionalEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment public void testVariableCondition() { //given process with boundary conditional event ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.getId()); Task task = taskQuery.singleResult(); assertNotNull(task); assertEquals(TASK_WITH_CONDITION, task.getName()); //when local variable is set on task with condition taskService.setVariableLocal(task.getId(), VARIABLE_NAME, 1); //then execution should remain on task tasksAfterVariableIsSet = taskQuery.list(); assertEquals(TASK_WITH_CONDITION, tasksAfterVariableIsSet.get(0).getName()); }
Example #25
Source File: TaskAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testStandaloneTaskCompleteWithTaskWorkPermission() { // given String taskId = "myTask"; createTask(taskId); createGrantAuthorization(TASK, taskId, userId, TASK_WORK); // when taskService.complete(taskId); // then Task task = selectSingleTask(); assertNull(task); if (!processEngineConfiguration.getHistoryLevel().equals(HistoryLevel.HISTORY_LEVEL_NONE)) { historyService.deleteHistoricTaskInstance(taskId); } }
Example #26
Source File: ParallelMultiInstanceCompensationScenarioTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @ScenarioUnderTest("defaultHandler.multiInstancePartial.2") public void testDefaultHandlerMultiInstancePartialDeletion() { // when throwing compensation Task lastMiTask = rule.taskQuery().singleResult(); rule.getTaskService().complete(lastMiTask.getId()); Task beforeCompensateTask = rule.taskQuery().singleResult(); rule.getTaskService().complete(beforeCompensateTask.getId()); // then it is possible to delete the process instance rule.getRuntimeService().deleteProcessInstance(rule.processInstance().getId(), null); // and the process is ended rule.assertScenarioEnded(); }
Example #27
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 #28
Source File: MultiInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testSequentialMITasksExecutionListener() { RecordInvocationListener.reset(); Map<String, Object> vars = new HashMap<String, Object>(); vars.put("nrOfLoops", 2); runtimeService.startProcessInstanceByKey("miSequentialListener", vars); assertEquals(1, (int) RecordInvocationListener.INVOCATIONS.get(ExecutionListener.EVENTNAME_START)); assertNull(RecordInvocationListener.INVOCATIONS.get(ExecutionListener.EVENTNAME_END)); Task task = taskService.createTaskQuery().singleResult(); taskService.complete(task.getId()); assertEquals(2, (int) RecordInvocationListener.INVOCATIONS.get(ExecutionListener.EVENTNAME_START)); assertEquals(1, (int) RecordInvocationListener.INVOCATIONS.get(ExecutionListener.EVENTNAME_END)); task = taskService.createTaskQuery().singleResult(); taskService.complete(task.getId()); assertEquals(2, (int) RecordInvocationListener.INVOCATIONS.get(ExecutionListener.EVENTNAME_START)); assertEquals(2, (int) RecordInvocationListener.INVOCATIONS.get(ExecutionListener.EVENTNAME_END)); }
Example #29
Source File: ResourceAuthorizationProviderTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testDeleteGroupIdentityLink() { // given MyResourceAuthorizationProvider.clearProperties(); createGrantAuthorization(TASK, ANY, ALL, userId); String taskId = "myTask"; Task newTask = taskService.newTask(taskId); taskService.saveTask(newTask); taskService.addCandidateGroup(taskId, "management"); // when taskService.deleteCandidateGroup(taskId, "management"); // then assertEquals(IdentityLinkType.CANDIDATE, MyResourceAuthorizationProvider.DELETE_GROUP_IDENTITY_LINK_TYPE); assertEquals("management", MyResourceAuthorizationProvider.DELETE_GROUP_IDENTITY_LINK_GROUP); taskService.deleteTask(taskId, true); }
Example #30
Source File: TaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
/** * @see http://jira.codehaus.org/browse/ACT-1059 */ @Test public void testSetDelegationState() { Task task = taskService.newTask(); task.setOwner("wuzh"); task.delegate("other"); taskService.saveTask(task); String taskId = task.getId(); task = taskService.createTaskQuery().taskId(taskId).singleResult(); assertEquals("wuzh", task.getOwner()); assertEquals("other", task.getAssignee()); assertEquals(DelegationState.PENDING, task.getDelegationState()); task.setDelegationState(DelegationState.RESOLVED); taskService.saveTask(task); task = taskService.createTaskQuery().taskId(taskId).singleResult(); assertEquals("wuzh", task.getOwner()); assertEquals("other", task.getAssignee()); assertEquals(DelegationState.RESOLVED, task.getDelegationState()); taskService.deleteTask(taskId, true); }