@Test public void testQueryByTaskDefinitionKeyAsPost() { String taskDefinitionKey = MockProvider.EXAMPLE_HISTORIC_TASK_INST_DEF_KEY; Map<String, Object> params = new HashMap<String, Object>(); params.put("taskDefinitionKey", taskDefinitionKey); given() .contentType(POST_JSON_CONTENT_TYPE) .body(params) .then().expect().statusCode(Status.OK.getStatusCode()) .when().post(HISTORIC_TASK_INSTANCE_RESOURCE_URL); verify(mockedQuery).taskDefinitionKey(taskDefinitionKey); }
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml") public void testQueryByTaskDefinitionKey() { // given runtimeService.startProcessInstanceByKey("oneTaskProcess"); // when HistoricTaskInstanceQuery query1 = historyService .createHistoricTaskInstanceQuery() .taskDefinitionKey("theTask"); HistoricTaskInstanceQuery query2 = historyService .createHistoricTaskInstanceQuery() .taskDefinitionKeyIn("theTask"); // then assertEquals(1, query1.count()); assertEquals(1, query2.count()); }
query.taskDefinitionKey(taskDefinitionKey);
@Test public void testQueryByTaskDefinitionKey() { String taskDefinitionKey = MockProvider.EXAMPLE_HISTORIC_TASK_INST_DEF_KEY; given() .queryParam("taskDefinitionKey", taskDefinitionKey) .then().expect().statusCode(Status.OK.getStatusCode()) .when().get(HISTORIC_TASK_INSTANCE_RESOURCE_URL); verify(mockedQuery).taskDefinitionKey(taskDefinitionKey); }
query.taskDefinitionKey(taskDefinitionKey);
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml") public void testProcessDefinitionKeyProperty() { // given String key = "oneTaskProcess"; String processInstanceId = runtimeService.startProcessInstanceByKey(key).getId(); // when HistoricTaskInstance task = historyService .createHistoricTaskInstanceQuery() .processInstanceId(processInstanceId) .taskDefinitionKey("theTask") .singleResult(); // then assertNotNull(task.getProcessDefinitionKey()); assertEquals(key, task.getProcessDefinitionKey()); assertNull(task.getCaseDefinitionKey()); }
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml") public void testQueryByTaskDefinitionKey() { // given runtimeService.startProcessInstanceByKey("oneTaskProcess"); // when HistoricTaskInstanceQuery query1 = historyService .createHistoricTaskInstanceQuery() .taskDefinitionKey("theTask"); HistoricTaskInstanceQuery query2 = historyService .createHistoricTaskInstanceQuery() .taskDefinitionKeyIn("theTask"); // then assertEquals(1, query1.count()); assertEquals(1, query2.count()); }
@Deployment(resources = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn") public void testCaseDefinitionKeyProperty() { // given String key = "oneTaskCase"; String caseInstanceId = caseService.createCaseInstanceByKey(key).getId(); // when HistoricTaskInstance task = historyService .createHistoricTaskInstanceQuery() .caseInstanceId(caseInstanceId) .taskDefinitionKey("PI_HumanTask_1") .singleResult(); // then assertNotNull(task.getCaseDefinitionKey()); assertEquals(key, task.getCaseDefinitionKey()); assertNull(task.getProcessDefinitionKey()); }
query.taskDefinitionKey(taskDefinitionKey);
assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskDefinitionKey("task").count()); assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskDefinitionKey("unexistingkey").count());
@Deployment(resources = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn") public void testCaseDefinitionKeyProperty() { // given String key = "oneTaskCase"; String caseInstanceId = caseService.createCaseInstanceByKey(key).getId(); // when HistoricTaskInstance task = historyService .createHistoricTaskInstanceQuery() .caseInstanceId(caseInstanceId) .taskDefinitionKey("PI_HumanTask_1") .singleResult(); // then assertNotNull(task.getCaseDefinitionKey()); assertEquals(key, task.getCaseDefinitionKey()); assertNull(task.getProcessDefinitionKey()); }
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml") public void testProcessDefinitionKeyProperty() { // given String key = "oneTaskProcess"; String processInstanceId = runtimeService.startProcessInstanceByKey(key).getId(); // when HistoricTaskInstance task = historyService .createHistoricTaskInstanceQuery() .processInstanceId(processInstanceId) .taskDefinitionKey("theTask") .singleResult(); // then assertNotNull(task.getProcessDefinitionKey()); assertEquals(key, task.getProcessDefinitionKey()); assertNull(task.getCaseDefinitionKey()); }
assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskDefinitionKey("task").count()); assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskDefinitionKey("unexistingkey").count());