@Test public void testQueryByRootProcessInstancesAsPost() { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("rootProcessInstances", true); given() .contentType(POST_JSON_CONTENT_TYPE) .body(parameters) .then() .expect() .statusCode(Status.OK.getStatusCode()) .when() .post(HISTORIC_PROCESS_INSTANCE_RESOURCE_URL); verify(mockedQuery).rootProcessInstances(); }
@Test public void testQueryByRootProcessInstances() { given() .queryParam("rootProcessInstances", true) .then() .expect() .statusCode(Status.OK.getStatusCode()) .when() .get(HISTORIC_PROCESS_INSTANCE_RESOURCE_URL); verify(mockedQuery).rootProcessInstances(); }
public void testQueryByRootProcessInstancesAndSuperProcess() { // when try { historyService.createHistoricProcessInstanceQuery() .rootProcessInstances() .superProcessInstanceId("processInstanceId"); fail("expected exception"); } catch (BadUserRequestException e) { // then assertTrue(e.getMessage().contains("Invalid query usage: cannot set both rootProcessInstances and superProcessInstanceId")); } // when try { historyService.createHistoricProcessInstanceQuery() .superProcessInstanceId("processInstanceId") .rootProcessInstances(); fail("expected exception"); } catch (BadUserRequestException e) { // then assertTrue(e.getMessage().contains("Invalid query usage: cannot set both rootProcessInstances and superProcessInstanceId")); } }
public void testQueryByRootProcessInstances() { // given String superProcess = "calling"; String subProcess = "called"; BpmnModelInstance callingInstance = ProcessModels.newModel(superProcess) .startEvent() .callActivity() .calledElement(subProcess) .endEvent() .done(); BpmnModelInstance calledInstance = ProcessModels.newModel(subProcess) .startEvent() .userTask() .endEvent() .done(); deployment(callingInstance, calledInstance); String processInstanceId1 = runtimeService.startProcessInstanceByKey(superProcess).getProcessInstanceId(); // when List<HistoricProcessInstance> list = historyService .createHistoricProcessInstanceQuery() .rootProcessInstances() .list(); // then assertEquals(1, list.size()); assertEquals(processInstanceId1, list.get(0).getId()); }
public void testQueryByRootProcessInstancesAndSuperProcess() { // when try { historyService.createHistoricProcessInstanceQuery() .rootProcessInstances() .superProcessInstanceId("processInstanceId"); fail("expected exception"); } catch (BadUserRequestException e) { // then assertTrue(e.getMessage().contains("Invalid query usage: cannot set both rootProcessInstances and superProcessInstanceId")); } // when try { historyService.createHistoricProcessInstanceQuery() .superProcessInstanceId("processInstanceId") .rootProcessInstances(); fail("expected exception"); } catch (BadUserRequestException e) { // then assertTrue(e.getMessage().contains("Invalid query usage: cannot set both rootProcessInstances and superProcessInstanceId")); } }
public void testQueryByRootProcessInstances() { // given String superProcess = "calling"; String subProcess = "called"; BpmnModelInstance callingInstance = ProcessModels.newModel(superProcess) .startEvent() .callActivity() .calledElement(subProcess) .endEvent() .done(); BpmnModelInstance calledInstance = ProcessModels.newModel(subProcess) .startEvent() .userTask() .endEvent() .done(); deployment(callingInstance, calledInstance); String processInstanceId1 = runtimeService.startProcessInstanceByKey(superProcess).getProcessInstanceId(); // when List<HistoricProcessInstance> list = historyService .createHistoricProcessInstanceQuery() .rootProcessInstances() .list(); // then assertEquals(1, list.size()); assertEquals(processInstanceId1, list.get(0).getId()); }