@Test public void testHistoricVariableQueryByProcessInstanceIdInAsPOST() { String aProcessInstanceId = "aProcessInstanceId"; String anotherProcessInstanceId = "anotherProcessInstanceId"; List<String> processInstanceIdIn= new ArrayList<String>(); processInstanceIdIn.add(aProcessInstanceId); processInstanceIdIn.add(anotherProcessInstanceId); processInstanceIdIn.add(null); Map<String, Object> json = new HashMap<String, Object>(); json.put("processInstanceIdIn", processInstanceIdIn); given().contentType(POST_JSON_CONTENT_TYPE).body(json) .then().expect().statusCode(Status.OK.getStatusCode()) .when().post(HISTORIC_VARIABLE_INSTANCE_RESOURCE_URL); verify(mockedQuery).processInstanceIdIn(aProcessInstanceId, anotherProcessInstanceId,null); }
@Deployment(resources={"org/camunda/bpm/engine/test/history/HistoricVariableInstanceTest.testParallel.bpmn20.xml"}) public void testHistoricVariableInstanceQueryByInvalidProcessIdIn() { // given Map<String, Object> vars = new HashMap<String, Object>(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc",vars); // check existing variables for task ID try { historyService.createHistoricVariableInstanceQuery().processInstanceIdIn(processInstance.getProcessInstanceId(),null); fail("Search by process instance ID was finished"); } catch (ProcessEngineException e) { } try { historyService.createHistoricVariableInstanceQuery().processInstanceIdIn(null,processInstance.getProcessInstanceId()); fail("Search by process instance ID was finished"); } catch (ProcessEngineException e) { } }
@Test public void testHistoricVariableQueryByProcessInstanceIdIn () { String aProcessInstanceId = "aProcessInstanceId"; String anotherProcessInstanceId = "anotherProcessInstanceId"; given() .queryParam("processInstanceIdIn", aProcessInstanceId + "," + anotherProcessInstanceId) .then().expect().statusCode(Status.OK.getStatusCode()) .when().get(HISTORIC_VARIABLE_INSTANCE_RESOURCE_URL); verify(mockedQuery).processInstanceIdIn(aProcessInstanceId, anotherProcessInstanceId); }
@Deployment(resources={"org/camunda/bpm/engine/test/history/HistoricVariableInstanceTest.testParallel.bpmn20.xml"}) public void testHistoricVariableInstanceQueryByProcessIdIn() { // given Map<String, Object> vars = new HashMap<String, Object>(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc",vars); ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("myProc",vars); // check existing variables for process instance ID assertEquals(4, historyService.createHistoricVariableInstanceQuery().processInstanceIdIn(processInstance.getProcessInstanceId(),processInstance2.getProcessInstanceId()).count()); assertEquals(4, historyService.createHistoricVariableInstanceQuery().processInstanceIdIn(processInstance.getProcessInstanceId(),processInstance2.getProcessInstanceId()).list().size()); //add check with not existing search String notExistingSearch = processInstance.getProcessInstanceId() + "-notExisting"; assertEquals(2, historyService.createHistoricVariableInstanceQuery().processInstanceIdIn(notExistingSearch,processInstance2.getProcessInstanceId()).count()); }
query.processInstanceIdIn(processInstanceIdIn);
query.processInstanceIdIn(processInstanceIdIn);
@Deployment(resources={"org/camunda/bpm/engine/test/history/HistoricVariableInstanceTest.testParallel.bpmn20.xml"}) public void testHistoricVariableInstanceQueryByInvalidProcessIdIn() { // given Map<String, Object> vars = new HashMap<String, Object>(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc",vars); // check existing variables for task ID try { historyService.createHistoricVariableInstanceQuery().processInstanceIdIn(processInstance.getProcessInstanceId(),null); fail("Search by process instance ID was finished"); } catch (ProcessEngineException e) { } try { historyService.createHistoricVariableInstanceQuery().processInstanceIdIn(null,processInstance.getProcessInstanceId()); fail("Search by process instance ID was finished"); } catch (ProcessEngineException e) { } }
@Deployment(resources={"org/camunda/bpm/engine/test/history/HistoricVariableInstanceTest.testParallel.bpmn20.xml"}) public void testHistoricVariableInstanceQueryByProcessIdIn() { // given Map<String, Object> vars = new HashMap<String, Object>(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc",vars); ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("myProc",vars); // check existing variables for process instance ID assertEquals(4, historyService.createHistoricVariableInstanceQuery().processInstanceIdIn(processInstance.getProcessInstanceId(),processInstance2.getProcessInstanceId()).count()); assertEquals(4, historyService.createHistoricVariableInstanceQuery().processInstanceIdIn(processInstance.getProcessInstanceId(),processInstance2.getProcessInstanceId()).list().size()); //add check with not existing search String notExistingSearch = processInstance.getProcessInstanceId() + "-notExisting"; assertEquals(2, historyService.createHistoricVariableInstanceQuery().processInstanceIdIn(notExistingSearch,processInstance2.getProcessInstanceId()).count()); }
query.processInstanceIdIn(processInstanceIdIn);