Java Code Examples for org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl#HISTORYLEVEL_NONE
The following examples show how to use
org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl#HISTORYLEVEL_NONE .
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: BoundaryErrorEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testDeeplyNestedErrorThrownOnlyAutomaticSteps() { // input == 1 -> error2 is thrown -> caught on subprocess2 -> end event in subprocess -> proc inst end 1 String procId = runtimeService.startProcessInstanceByKey("deeplyNestedErrorThrown", CollectionUtil.singletonMap("input", 1)).getId(); assertProcessEnded(procId); HistoricProcessInstance hip; int historyLevel = processEngineConfiguration.getHistoryLevel().getId(); if (historyLevel> ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { hip = historyService.createHistoricProcessInstanceQuery().processInstanceId(procId).singleResult(); assertEquals("processEnd1", hip.getEndActivityId()); } // input == 2 -> error2 is thrown -> caught on subprocess1 -> proc inst end 2 procId = runtimeService.startProcessInstanceByKey("deeplyNestedErrorThrown", CollectionUtil.singletonMap("input", 1)).getId(); assertProcessEnded(procId); if (historyLevel> ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { hip = historyService.createHistoricProcessInstanceQuery().processInstanceId(procId).singleResult(); assertEquals("processEnd1", hip.getEndActivityId()); } }
Example 2
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.testParallelUserTasksBasedOnCollection.bpmn20.xml") public void testEmptyCollectionInMI() { List<String> assigneeList = new ArrayList<String>(); String procId = runtimeService.startProcessInstanceByKey("miParallelUserTasksBasedOnCollection", CollectionUtil.singletonMap("assigneeList", assigneeList)).getId(); assertEquals(0, taskService.createTaskQuery().count()); assertProcessEnded(procId); if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { List<HistoricActivityInstance> activities = historyService .createHistoricActivityInstanceQuery() .processInstanceId(procId) .orderByActivityId() .asc().list(); assertEquals(3, activities.size()); assertEquals("miTasks#multiInstanceBody", activities.get(0).getActivityId()); assertEquals("theEnd", activities.get(1).getActivityId()); assertEquals("theStart", activities.get(2).getActivityId()); } }
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.testSequentialScriptTasks.bpmn20.xml"}) public void testSequentialScriptTasksHistory() { Map<String, Object> vars = new HashMap<String, Object>(); vars.put("sum", 0); vars.put("nrOfLoops", 7); runtimeService.startProcessInstanceByKey("miSequentialScriptTask", vars); // Validate history if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { List<HistoricActivityInstance> historicInstances = historyService.createHistoricActivityInstanceQuery().activityType("scriptTask").orderByActivityId().asc().list(); assertEquals(7, historicInstances.size()); for (int i=0; i<7; i++) { HistoricActivityInstance hai = historicInstances.get(i); assertEquals("scriptTask", hai.getActivityType()); assertNotNull(hai.getStartTime()); assertNotNull(hai.getEndTime()); } } }
Example 4
Source File: TaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testGetTaskAttachmentContentByTaskIdAndAttachmentId() { int historyLevel = processEngineConfiguration.getHistoryLevel().getId(); if (historyLevel> ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { // create and save task Task task = taskService.newTask(); taskService.saveTask(task); String taskId = task.getId(); // Fetch the task again and update // add attachment Attachment attachment = taskService.createAttachment("web page", taskId, "someprocessinstanceid", "weatherforcast", "temperatures and more", new ByteArrayInputStream("someContent".getBytes())); String attachmentId = attachment.getId(); // get attachment for taskId and attachmentId InputStream taskAttachmentContent = taskService.getTaskAttachmentContent(taskId, attachmentId); assertNotNull(taskAttachmentContent); byte[] byteContent = IoUtil.readInputStream(taskAttachmentContent, "weatherforcast"); assertEquals("someContent", new String(byteContent)); taskService.deleteTask(taskId, true); } }
Example 5
Source File: TerminateEndEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
/** * CAM-4067 */ @Deployment(resources = "org/camunda/bpm/engine/test/bpmn/event/end/TerminateEndEventTest.testTerminateInSubProcess.bpmn") public void testTerminateInSubProcessShouldNotEndProcessInstanceInHistory() throws Exception { // when process instance is started and terminate end event in subprocess executed ProcessInstance pi = runtimeService.startProcessInstanceByKey("terminateEndEventExample"); // then the historic process instance should not appear ended assertProcessNotEnded(pi.getId()); if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { HistoricProcessInstance hpi = historyService.createHistoricProcessInstanceQuery().singleResult(); assertNotNull(hpi); assertNull(hpi.getEndTime()); assertNull(hpi.getDurationInMillis()); assertNull(hpi.getDeleteReason()); } }
Example 6
Source File: TerminateEndEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
/** * CAM-4067 */ @Deployment(resources = "org/camunda/bpm/engine/test/bpmn/event/end/TerminateEndEventTest.testTerminateInSubProcessConcurrent.bpmn") public void testTerminateInSubProcessConcurrentShouldNotEndProcessInstanceInHistory() throws Exception { // when process instance is started and terminate end event in subprocess executed ProcessInstance pi = runtimeService.startProcessInstanceByKey("terminateEndEventExample"); // then the historic process instance should not appear ended assertProcessNotEnded(pi.getId()); if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { HistoricProcessInstance hpi = historyService.createHistoricProcessInstanceQuery().singleResult(); assertNotNull(hpi); assertNull(hpi.getEndTime()); assertNull(hpi.getDurationInMillis()); assertNull(hpi.getDeleteReason()); } }
Example 7
Source File: TaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment(resources = { "org/camunda/bpm/engine/test/api/twoParallelTasksProcess.bpmn20.xml" }) public void testProcessAttachmentsTwoProcessExecutions() { int historyLevel = processEngineConfiguration.getHistoryLevel().getId(); if (historyLevel > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("twoParallelTasksProcess"); // create attachment Attachment attachment = taskService.createAttachment("web page", null, processInstance.getId(), "weatherforcast", "temperatures and more", "http://weather.com"); assertEquals("weatherforcast", attachment.getName()); assertEquals("temperatures and more", attachment.getDescription()); assertEquals("web page", attachment.getType()); assertNull(attachment.getTaskId()); assertEquals(processInstance.getId(), attachment.getProcessInstanceId()); assertEquals("http://weather.com", attachment.getUrl()); assertNull(taskService.getAttachmentContent(attachment.getId())); } }
Example 8
Source File: TaskServiceTest.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 testProcessAttachmentsOneProcessExecution() { int historyLevel = processEngineConfiguration.getHistoryLevel().getId(); if (historyLevel > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess"); // create attachment Attachment attachment = taskService.createAttachment("web page", null, processInstance.getId(), "weatherforcast", "temperatures and more", "http://weather.com"); assertEquals("weatherforcast", attachment.getName()); assertEquals("temperatures and more", attachment.getDescription()); assertEquals("web page", attachment.getType()); assertNull(attachment.getTaskId()); assertEquals(processInstance.getId(), attachment.getProcessInstanceId()); assertEquals("http://weather.com", attachment.getUrl()); assertNull(taskService.getAttachmentContent(attachment.getId())); } }
Example 9
Source File: MessageBoundaryEventTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testBoundaryMessageEventOnSubprocessWithIntermediateMessageCatch() { // given // a process instance waiting inside the intermediate message catch inside the subprocess ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess"); // when // I cancel the subprocess runtimeService.correlateMessage("cancelMessage"); // then // the process instance is ended assertProcessEnded(processInstance.getId()); if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { // and all activity instances in history have an end time set List<HistoricActivityInstance> hais = historyService.createHistoricActivityInstanceQuery().list(); for (HistoricActivityInstance historicActivityInstance : hais) { assertNotNull(historicActivityInstance.getEndTime()); } } }
Example 10
Source File: TaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void testAddTaskCommentNull() { int historyLevel = processEngineConfiguration.getHistoryLevel().getId(); if (historyLevel> ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { Task task = taskService.newTask("testId"); taskService.saveTask(task); try { taskService.createComment(task.getId(), null, null); fail("Expected process engine exception"); } catch (ProcessEngineException e) {} finally { taskService.deleteTask(task.getId(), true); } } }
Example 11
Source File: TaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void testTaskAttachments() { int historyLevel = processEngineConfiguration.getHistoryLevel().getId(); if (historyLevel> ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { Task task = taskService.newTask(); task.setOwner("johndoe"); taskService.saveTask(task); String taskId = task.getId(); identityService.setAuthenticatedUserId("johndoe"); // Fetch the task again and update taskService.createAttachment("web page", taskId, "someprocessinstanceid", "weatherforcast", "temperatures and more", "http://weather.com"); Attachment attachment = taskService.getTaskAttachments(taskId).get(0); assertEquals("weatherforcast", attachment.getName()); assertEquals("temperatures and more", attachment.getDescription()); assertEquals("web page", attachment.getType()); assertEquals(taskId, attachment.getTaskId()); assertEquals("someprocessinstanceid", attachment.getProcessInstanceId()); assertEquals("http://weather.com", attachment.getUrl()); assertNull(taskService.getAttachmentContent(attachment.getId())); // Finally, clean up taskService.deleteTask(taskId); assertEquals(0, taskService.getTaskComments(taskId).size()); assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskId(taskId).list().size()); taskService.deleteTask(taskId, true); } }
Example 12
Source File: MessageEventSubprocessTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment public void testEventSubprocessBoundaryListenersInvoked() { runtimeService.startProcessInstanceByKey("testProcess"); runtimeService.correlateMessage("message"); Task taskInEventSubProcess = taskService.createTaskQuery().singleResult(); assertEquals("taskInEventSubProcess", taskInEventSubProcess.getTaskDefinitionKey()); runtimeService.correlateMessage("message2"); List<String> collectedEvents = TestExecutionListener.collectedEvents; assertEquals("taskInMainFlow-start", collectedEvents.get(0)); assertEquals("taskInMainFlow-end", collectedEvents.get(1)); assertEquals("eventSubProcess-start", collectedEvents.get(2)); assertEquals("startEventInSubProcess-start", collectedEvents.get(3)); assertEquals("startEventInSubProcess-end", collectedEvents.get(4)); assertEquals("taskInEventSubProcess-start", collectedEvents.get(5)); assertEquals("taskInEventSubProcess-end", collectedEvents.get(6)); assertEquals("eventSubProcess-end", collectedEvents.get(7)); if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("taskInMainFlow").finished().count()); assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("taskInMainFlow").canceled().count()); assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("startEventInSubProcess").finished().count()); assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("taskInEventSubProcess").canceled().count()); assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("eventSubProcess").finished().count()); } }
Example 13
Source File: TaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void testGetTaskAttachmentContentWithNullParameters() { int historyLevel = processEngineConfiguration.getHistoryLevel().getId(); if (historyLevel> ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { InputStream content = taskService.getTaskAttachmentContent(null, null); assertNull(content); } }
Example 14
Source File: TaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void testDeleteTaskAttachmentWithNullParameters() { int historyLevel = processEngineConfiguration.getHistoryLevel().getId(); if (historyLevel> ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { try { taskService.deleteTaskAttachment(null, null); fail("expected process engine exception"); } catch (ProcessEngineException e) {} } }
Example 15
Source File: TaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void testDeleteTaskAttachmentWithTaskIdNull() { int historyLevel = processEngineConfiguration.getHistoryLevel().getId(); if (historyLevel> ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { try { taskService.deleteTaskAttachment(null, "myAttachmentId"); fail("expected process engine exception"); } catch(ProcessEngineException e) {} } }
Example 16
Source File: TaskCommentResourceImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
private boolean isHistoryEnabled() { IdentityService identityService = engine.getIdentityService(); Authentication currentAuthentication = identityService.getCurrentAuthentication(); try { identityService.clearAuthentication(); int historyLevel = engine.getManagementService().getHistoryLevel(); return historyLevel > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE; } finally { identityService.setAuthentication(currentAuthentication); } }
Example 17
Source File: MultiInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = {"org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelScriptTasks.bpmn20.xml"}) public void testParallelScriptTasksHistory() { Map<String, Object> vars = new HashMap<String, Object>(); vars.put("sum", 0); vars.put("nrOfLoops", 4); runtimeService.startProcessInstanceByKey("miParallelScriptTask", vars); if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().activityType("scriptTask").list(); assertEquals(4, historicActivityInstances.size()); for (HistoricActivityInstance hai : historicActivityInstances) { assertNotNull(hai.getStartTime()); assertNotNull(hai.getStartTime()); } } }
Example 18
Source File: TaskServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void testTaskComments() { int historyLevel = processEngineConfiguration.getHistoryLevel().getId(); if (historyLevel> ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { Task task = taskService.newTask(); task.setOwner("johndoe"); taskService.saveTask(task); String taskId = task.getId(); identityService.setAuthenticatedUserId("johndoe"); // Fetch the task again and update Comment comment = taskService.createComment(taskId, null, "look at this \n isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd"); assertNotNull(comment.getId()); assertEquals("johndoe", comment.getUserId()); assertEquals(taskId, comment.getTaskId()); assertNull(comment.getProcessInstanceId()); assertEquals("look at this isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg ...", ((Event)comment).getMessage()); assertEquals("look at this \n isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd", comment.getFullMessage()); assertNotNull(comment.getTime()); taskService.createComment(taskId, "pid", "one"); taskService.createComment(taskId, "pid", "two"); Set<String> expectedComments = new HashSet<>(); expectedComments.add("one"); expectedComments.add("two"); Set<String> comments = new HashSet<>(); for (Comment cmt: taskService.getProcessInstanceComments("pid")) { comments.add(cmt.getFullMessage()); } assertEquals(expectedComments, comments); // Finally, delete task taskService.deleteTask(taskId, true); } }
Example 19
Source File: TaskAttachmentResourceImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
private boolean isHistoryEnabled() { IdentityService identityService = engine.getIdentityService(); Authentication currentAuthentication = identityService.getCurrentAuthentication(); try { identityService.clearAuthentication(); int historyLevel = engine.getManagementService().getHistoryLevel(); return historyLevel > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE; } finally { identityService.setAuthentication(currentAuthentication); } }
Example 20
Source File: SetProcessDefinitionVersionCmdTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment public void testSetProcessDefinitionVersion() { // start process instance ProcessInstance pi = runtimeService.startProcessInstanceByKey("receiveTask"); // check that receive task has been reached Execution execution = runtimeService.createExecutionQuery() .processInstanceId(pi.getId()) .activityId("waitState1") .singleResult(); assertNotNull(execution); // deploy new version of the process definition org.camunda.bpm.engine.repository.Deployment deployment = repositoryService .createDeployment() .addClasspathResource(TEST_PROCESS) .deploy(); assertEquals(2, repositoryService.createProcessDefinitionQuery().count()); // migrate process instance to new process definition version CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired(); commandExecutor.execute(new SetProcessDefinitionVersionCmd(pi.getId(), 2)); // signal process instance runtimeService.signal(execution.getId()); // check that the instance now uses the new process definition version ProcessDefinition newProcessDefinition = repositoryService .createProcessDefinitionQuery() .processDefinitionVersion(2) .singleResult(); pi = runtimeService .createProcessInstanceQuery() .processInstanceId(pi.getId()) .singleResult(); assertEquals(newProcessDefinition.getId(), pi.getProcessDefinitionId()); // check history if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) { HistoricProcessInstance historicPI = historyService .createHistoricProcessInstanceQuery() .processInstanceId(pi.getId()) .singleResult(); // assertEquals(newProcessDefinition.getId(), historicPI.getProcessDefinitionId()); } // undeploy "manually" deployed process definition repositoryService.deleteDeployment(deployment.getId(), true); }