Java Code Examples for org.camunda.bpm.engine.ProcessEngineConfiguration#HISTORY_FULL
The following examples show how to use
org.camunda.bpm.engine.ProcessEngineConfiguration#HISTORY_FULL .
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: ProcessTaskAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testUpdateVariablesLocalAdd() { // given runtimeService.startProcessInstanceByKey(PROCESS_KEY); String taskId = taskService.createTaskQuery().singleResult().getId(); // when authRule .init(scenario) .withUser("userId") .bindResource("taskId", taskId) .start(); ((TaskServiceImpl) taskService).updateVariablesLocal(taskId, getVariables(), null); // then if (authRule.assertScenario(scenario)) { verifySetVariables(); } }
Example 2
Source File: UserOperationLogWithoutUserTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"}) @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testQueryDeleteVariableHistoryOperationOnCase() { // given CaseInstance caseInstance = caseService.createCaseInstanceByKey("oneTaskCase"); caseService.setVariable(caseInstance.getId(), "myVariable", 1); caseService.setVariable(caseInstance.getId(), "myVariable", 2); caseService.setVariable(caseInstance.getId(), "myVariable", 3); HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery().singleResult(); // when historyService.deleteHistoricVariableInstance(variableInstance.getId()); // then verifyNoUserOperationLogged(); }
Example 3
Source File: StandaloneTaskAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testUpdateVariablesLocalRemove() { // given createTask(taskId); taskService.setVariableLocal(taskId, VARIABLE_NAME, VARIABLE_VALUE); // when authRule .init(scenario) .withUser("userId") .bindResource("taskId", taskId) .start(); ((TaskServiceImpl) taskService).updateVariablesLocal(taskId, null, Arrays.asList(VARIABLE_NAME)); // then if (authRule.assertScenario(scenario)) { verifyRemoveVariable(); } }
Example 4
Source File: ProcessTaskAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testRemoveVariable() { // given runtimeService.startProcessInstanceByKey(PROCESS_KEY, getVariables()); String taskId = taskService.createTaskQuery().singleResult().getId(); // when authRule .init(scenario) .withUser("userId") .bindResource("taskId", taskId) .start(); taskService.removeVariable(taskId, VARIABLE_NAME); // then if (authRule.assertScenario(scenario)) { verifyRemoveVariables(); } }
Example 5
Source File: RuntimeServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testCascadingDeleteSubprocessInstanceSkipIoMappings.Calling.bpmn20.xml", "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testCascadingDeleteSubprocessInstanceSkipIoMappings.Called.bpmn20.xml" }) @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) @Test public void testCascadingDeleteSubprocessInstanceWithoutSkipIoMappings() { // given a process instance ProcessInstance instance = runtimeService.startProcessInstanceByKey("callingProcess"); ProcessInstance instance2 = runtimeService.createProcessInstanceQuery().superProcessInstanceId(instance.getId()).singleResult(); // when the process instance is deleted and we do not skip the io mappings runtimeService.deleteProcessInstance(instance.getId(), "test_purposes", false, true, false); // then testRule.assertProcessEnded(instance.getId()); assertEquals(2, historyService.createHistoricVariableInstanceQuery().processInstanceId(instance2.getId()).list().size()); assertEquals(1, historyService.createHistoricVariableInstanceQuery().variableName("inputMappingExecuted").count()); assertEquals(1, historyService.createHistoricVariableInstanceQuery().variableName("outputMappingExecuted").count()); }
Example 6
Source File: HistoricTaskInstanceQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) @Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" }) public void testTaskHadCandidateGroup() { // given runtimeService.startProcessInstanceByKey("oneTaskProcess"); String taskId = taskService.createTaskQuery().singleResult().getId(); // if identityService.setAuthenticatedUserId("aAssignerId"); taskService.addCandidateGroup(taskId, "bGroupId"); taskService.deleteCandidateGroup(taskId, "bGroupId"); // query test assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskHadCandidateGroup("bGroupId").count()); assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskHadCandidateGroup("invalidGroupId").count()); // delete test taskService.deleteTask("newTask",true); }
Example 7
Source File: HistoricTaskInstanceQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) @Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" }) public void testWithoutCandidateGroups() { // given runtimeService.startProcessInstanceByKey("oneTaskProcess"); String taskId = taskService.createTaskQuery().singleResult().getId(); identityService.setAuthenticatedUserId("aAssignerId"); taskService.addCandidateGroup(taskId, "aGroupId"); // when runtimeService.startProcessInstanceByKey("oneTaskProcess"); // then assertEquals(historyService.createHistoricTaskInstanceQuery().count(), 2); assertEquals(historyService.createHistoricTaskInstanceQuery().withoutCandidateGroups().count(), 1); // cleanup taskService.deleteTask("newTask", true); }
Example 8
Source File: StandaloneTaskAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testUpdateVariablesAdd() { // given createTask(taskId); // when authRule .init(scenario) .withUser("userId") .bindResource("taskId", taskId) .start(); ((TaskServiceImpl) taskService).updateVariables(taskId, getVariables(), null); // then if (authRule.assertScenario(scenario)) { verifySetVariables(); } }
Example 9
Source File: StandaloneTaskAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testRemoveVariableLocal() { // given createTask(taskId); taskService.setVariableLocal(taskId, VARIABLE_NAME, VARIABLE_VALUE); // when authRule .init(scenario) .withUser("userId") .bindResource("taskId", taskId) .start(); taskService.removeVariableLocal(taskId, VARIABLE_NAME); // then if (authRule.assertScenario(scenario)) { verifyRemoveVariable(); } }
Example 10
Source File: UserOperationLogWithoutUserTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = PROCESS_PATH) @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testDeleteAllHistoricVariables() { // given String id = runtimeService.startProcessInstanceByKey(PROCESS_KEY).getId(); runtimeService.setVariable(id, "aVariable", "aValue"); runtimeService.deleteProcessInstance(id, "none"); assertEquals(1, historyService.createHistoricVariableInstanceQuery().count()); // when historyService.deleteHistoricVariableInstancesByProcessInstanceId(id); // then assertEquals(0, historyService.createHistoricVariableInstanceQuery().count()); verifyNoUserOperationLogged(); }
Example 11
Source File: MultiTenancyProcessInstantiationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testRestartProcessInstanceAsyncWithTenantId() { // given ProcessInstance processInstance = startAndDeleteProcessInstance(TENANT_ONE, PROCESS); identityService.setAuthentication("user", null, Collections.singletonList(TENANT_ONE)); // when Batch batch = runtimeService.restartProcessInstances(processInstance.getProcessDefinitionId()) .startBeforeActivity("userTask") .processInstanceIds(processInstance.getId()) .executeAsync(); batchHelper.completeBatch(batch); // then ProcessInstance restartedInstance = runtimeService.createProcessInstanceQuery().active() .processDefinitionId(processInstance.getProcessDefinitionId()).singleResult(); assertNotNull(restartedInstance); assertEquals(restartedInstance.getTenantId(), TENANT_ONE); }
Example 12
Source File: HistoricProcessInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testHistoricProcInstExecutedJobAfter() { // given BpmnModelInstance asyncModel = Bpmn.createExecutableProcess("async").startEvent().camundaAsyncBefore().endEvent().done(); deployment(asyncModel); BpmnModelInstance model = Bpmn.createExecutableProcess("proc").startEvent().endEvent().done(); deployment(model); Calendar now = Calendar.getInstance(); ClockUtil.setCurrentTime(now.getTime()); Calendar hourFromNow = (Calendar) now.clone(); hourFromNow.add(Calendar.HOUR_OF_DAY, 1); runtimeService.startProcessInstanceByKey("async"); Job job = managementService.createJobQuery().singleResult(); managementService.executeJob(job.getId()); runtimeService.startProcessInstanceByKey("proc"); //when query historic process instance which has executed an job after the start time HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .executedJobAfter(now.getTime()).singleResult(); //then query returns only a single process instance assertNotNull(historicProcessInstance); //when query historic proc inst with execute job after a hour of the starting time historicProcessInstance = historyService.createHistoricProcessInstanceQuery().executedJobAfter(hourFromNow.getTime()).singleResult(); //then query returns no result assertNull(historicProcessInstance); }
Example 13
Source File: HistoricProcessInstanceQueryOrTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) @Deployment(resources={"org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml"}) public void shouldReturnByProcessDefinitionIdOrIncidentType() { // given String processDefinitionId = runtimeService.startProcessInstanceByKey("oneTaskProcess") .getProcessDefinitionId(); BpmnModelInstance aProcessDefinition = Bpmn.createExecutableProcess("process") .startEvent().camundaAsyncBefore() .userTask("aUserTask") .endEvent() .done(); String deploymentId = repositoryService .createDeployment() .addModelInstance("foo.bpmn", aProcessDefinition) .deploy() .getId(); deploymentIds.add(deploymentId); runtimeService.startProcessInstanceByKey("process"); String jobId = managementService.createJobQuery().singleResult().getId(); managementService.setJobRetries(jobId, 0); // when List<HistoricProcessInstance> processInstances = historyService.createHistoricProcessInstanceQuery() .or() .incidentType("failedJob") .processDefinitionId(processDefinitionId) .endOr() .list(); // then assertThat(processInstances.size()).isEqualTo(2); }
Example 14
Source File: RepositoryServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) @Deployment(resources = { "org/camunda/bpm/engine/test/api/dmn/Example.dmn"}) public void testDecisionDefinitionUpdateTimeToLiveWithUserOperationLog() { //given identityService.setAuthenticatedUserId("userId"); DecisionDefinition decisionDefinition = findOnlyDecisionDefinition(); Integer orgTtl = decisionDefinition.getHistoryTimeToLive(); //when repositoryService.updateDecisionDefinitionHistoryTimeToLive(decisionDefinition.getId(), 6); //then decisionDefinition = findOnlyDecisionDefinition(); assertEquals(6, decisionDefinition.getHistoryTimeToLive().intValue()); UserOperationLogQuery operationLogQuery = historyService.createUserOperationLogQuery() .operationType(UserOperationLogEntry.OPERATION_TYPE_UPDATE_HISTORY_TIME_TO_LIVE) .entityType(EntityTypes.DECISION_DEFINITION); UserOperationLogEntry ttlEntry = operationLogQuery.property("historyTimeToLive").singleResult(); UserOperationLogEntry definitionIdEntry = operationLogQuery.property("decisionDefinitionId").singleResult(); UserOperationLogEntry definitionKeyEntry = operationLogQuery.property("decisionDefinitionKey").singleResult(); assertNotNull(ttlEntry); assertNotNull(definitionIdEntry); assertNotNull(definitionKeyEntry); assertEquals(orgTtl.toString(), ttlEntry.getOrgValue()); assertEquals("6", ttlEntry.getNewValue()); assertEquals(decisionDefinition.getId(), definitionIdEntry.getNewValue()); assertEquals(decisionDefinition.getKey(), definitionKeyEntry.getNewValue()); assertEquals(UserOperationLogEntry.CATEGORY_OPERATOR, ttlEntry.getCategory()); assertEquals(UserOperationLogEntry.CATEGORY_OPERATOR, definitionIdEntry.getCategory()); assertEquals(UserOperationLogEntry.CATEGORY_OPERATOR, definitionKeyEntry.getCategory()); }
Example 15
Source File: HistoricProcessInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testHistoricProcInstQueryWithExecutedActivityIds() { // given deployment(ProcessModels.TWO_TASKS_PROCESS); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process"); Task task = taskService.createTaskQuery().active().singleResult(); taskService.complete(task.getId()); // assume HistoricActivityInstance historicActivityInstance = historyService .createHistoricActivityInstanceQuery() .processInstanceId(processInstance.getId()) .activityId("userTask1") .singleResult(); assertNotNull(historicActivityInstance); // when List<HistoricProcessInstance> result = historyService .createHistoricProcessInstanceQuery() .executedActivityIdIn(historicActivityInstance.getActivityId()) .list(); // then assertNotNull(result); assertEquals(1, result.size()); assertEquals(result.get(0).getId(), processInstance.getId()); }
Example 16
Source File: HistoryServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) @Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testDeleteHistoricVariableAndDetailsOnRunningInstance() { // given ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(ONE_TASK_PROCESS); String executionId = processInstance.getId(); assertEquals(1, runtimeService.createProcessInstanceQuery().processDefinitionKey(ONE_TASK_PROCESS).count()); runtimeService.setVariable(executionId, "myVariable", "testValue1"); runtimeService.setVariable(executionId, "myVariable", "testValue2"); runtimeService.setVariable(executionId, "myVariable", "testValue3"); VariableInstanceQuery variableQuery = runtimeService.createVariableInstanceQuery() .processInstanceIdIn(executionId) .variableName("myVariable"); assertEquals(1, variableQuery.count()); assertEquals("testValue3", variableQuery.singleResult().getValue()); HistoricVariableInstanceQuery histVariableQuery = historyService.createHistoricVariableInstanceQuery() .processInstanceId(executionId) .variableName("myVariable"); assertEquals(1, histVariableQuery.count()); String variableInstanceId = histVariableQuery.singleResult().getId(); HistoricDetailQuery detailsQuery = historyService.createHistoricDetailQuery() .processInstanceId(executionId) .variableInstanceId(variableInstanceId); assertEquals(3, detailsQuery.count()); // when historyService.deleteHistoricVariableInstance(variableInstanceId); // then assertEquals(0, histVariableQuery.count()); assertEquals(0, detailsQuery.count()); assertEquals(1, variableQuery.count()); assertEquals("testValue3", variableQuery.singleResult().getValue()); }
Example 17
Source File: TriggerConditionalEventOnStartAtActivityTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testSubProcessInterruptingTriggerGlobalEventSubProcess() { // given BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY) .startEvent("start") .userTask("beforeSubProcess") .subProcess(SUB_PROCESS_ID) .embeddedSubProcess() .startEvent() .userTask(TASK_BEFORE_CONDITION_ID) .name(TASK_BEFORE_CONDITION) .endEvent() .subProcessDone() .endEvent() .done(); modelInstance = addConditionalEventSubProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, TASK_AFTER_CONDITION_ID, true); engine.manageDeployment(repositoryService.createDeployment().addModelInstance(CONDITIONAL_MODEL, modelInstance).deploy()); // when runtimeService.createProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY) .startBeforeActivity(TASK_BEFORE_CONDITION_ID) .setVariable(VARIABLE_NAME, "1") .executeWithVariablesInReturn(); // then assertEquals(1, historyService.createHistoricVariableInstanceQuery().count()); assertEquals("variable", historyService.createHistoricVariableInstanceQuery().singleResult().getName()); tasksAfterVariableIsSet = taskService.createTaskQuery().list(); assertEquals(1, tasksAfterVariableIsSet.size()); assertEquals(TASK_AFTER_CONDITION_ID, tasksAfterVariableIsSet.get(0).getTaskDefinitionKey()); }
Example 18
Source File: HistoricProcessInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testHistoricProcInstExecutedJobWithTwoProcInsts() { // given BpmnModelInstance asyncModel = Bpmn.createExecutableProcess("async").startEvent().camundaAsyncBefore().endEvent().done(); deployment(asyncModel); BpmnModelInstance model = Bpmn.createExecutableProcess("proc").startEvent().endEvent().done(); deployment(model); Calendar now = Calendar.getInstance(); ClockUtil.setCurrentTime(now.getTime()); Calendar hourBeforeNow = (Calendar) now.clone(); hourBeforeNow.add(Calendar.HOUR_OF_DAY, -1); ClockUtil.setCurrentTime(hourBeforeNow.getTime()); runtimeService.startProcessInstanceByKey("async"); Job job = managementService.createJobQuery().singleResult(); managementService.executeJob(job.getId()); ClockUtil.setCurrentTime(now.getTime()); runtimeService.startProcessInstanceByKey("async"); runtimeService.startProcessInstanceByKey("proc"); //when query executed job between now and an hour ago List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery() .executedJobAfter(hourBeforeNow.getTime()) .executedJobBefore(now.getTime()).list(); //then the two async historic process instance have to be returned assertEquals(2, list.size()); //when query execute activity after an half hour before now Calendar halfHour = (Calendar) now.clone(); halfHour.add(Calendar.MINUTE, -30); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .executedJobAfter(halfHour.getTime()).singleResult(); //then only the latest async historic process instance is returned assertNotNull(historicProcessInstance); }
Example 19
Source File: HistoricActivityStatisticsQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) @Deployment(resources="org/camunda/bpm/engine/test/history/HistoricActivityStatisticsQueryTest.testSingleTask.bpmn20.xml") public void testQueryCancelledIncludeIncidentsDeletedOnly() throws ParseException { try { // given String processDefinitionId = getProcessDefinitionId(); // start two instances with one incident and cancel them ClockUtil.setCurrentTime(sdf.parse("5.10.2019 12:00:00")); startProcessesByKey(2, "process"); List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery().list(); String firstInstance = processInstances.get(0).getId(); createIncident(firstInstance); cancelProcessInstances(); // start another two instances with two incidents and cancel them ClockUtil.setCurrentTime(sdf.parse("20.10.2019 12:00:00")); startProcessesByKey(2, "process"); processInstances = runtimeService.createProcessInstanceQuery().list(); String thirdInstance = processInstances.get(0).getId(); String fourthInstance = processInstances.get(1).getId(); createIncident(thirdInstance); createIncident(fourthInstance); cancelProcessInstances(); // when final HistoricActivityStatisticsQuery query = historyService .createHistoricActivityStatisticsQuery(processDefinitionId) .startedAfter(sdf.parse("01.10.2019 12:00:00")) .startedBefore(sdf.parse("10.10.2019 12:00:00")) .includeFinished() .includeCompleteScope() .includeCanceled() .includeIncidents() .orderByActivityId() .asc(); List<HistoricActivityStatistics> statistics = query.list(); // then results only from the first two instances assertEquals(2, statistics.size()); assertActivityStatistics(statistics.get(0), "start", 0, 0, 2, 0, 0, 0); assertActivityStatistics(statistics.get(1), "task", 0, 2, 2, 0, 0, 1); } finally { ClockUtil.reset(); } }
Example 20
Source File: ProcessEngineTestCaseTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public void testRequiredHistoryLevelFull() { assertThat(currentHistoryLevel(), is(ProcessEngineConfiguration.HISTORY_FULL)); }