Search in sources :

Example 21 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class HistoricDetailAuthorizationTest method testFormFieldQueryWithoutAuthorization.

// historic variable update query (multiple process instances) ///////////////////////////////////////////
public void testFormFieldQueryWithoutAuthorization() {
    // given
    startProcessInstanceByKey(PROCESS_KEY, getVariables());
    startProcessInstanceByKey(PROCESS_KEY, getVariables());
    startProcessInstanceByKey(PROCESS_KEY, getVariables());
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY, getVariables());
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY, getVariables());
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY, getVariables());
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY, getVariables());
    // when
    HistoricDetailQuery query = historyService.createHistoricDetailQuery().formFields();
    // then
    verifyQueryResults(query, 0);
}
Also used : HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery)

Example 22 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class HistoricDetailQueryTest method testQueryByUserOperationId.

@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testQueryByUserOperationId() {
    startProcessInstance(PROCESS_KEY);
    identityService.setAuthenticatedUserId("demo");
    String taskId = taskService.createTaskQuery().singleResult().getId();
    // when
    taskService.resolveTask(taskId, getVariables());
    // then
    String userOperationId = historyService.createHistoricDetailQuery().singleResult().getUserOperationId();
    HistoricDetailQuery query = historyService.createHistoricDetailQuery().userOperationId(userOperationId);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
}
Also used : HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 23 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class HistoricDetailQueryTest method testQueryByExecutionId.

@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testQueryByExecutionId() {
    startProcessInstance(PROCESS_KEY);
    String taskId = taskService.createTaskQuery().singleResult().getId();
    // when
    taskService.resolveTask(taskId, getVariables());
    // then
    String executionId = historyService.createHistoricDetailQuery().singleResult().getExecutionId();
    HistoricDetailQuery query = historyService.createHistoricDetailQuery().executionId(executionId);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
}
Also used : HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 24 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class FullHistoryTest method testHistoricDetailQueryByVariableInstanceId.

@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testHistoricDetailQueryByVariableInstanceId() throws Exception {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("testVar", "testValue");
    runtimeService.startProcessInstanceByKey("oneTaskProcess", params);
    HistoricVariableInstance testVariable = historyService.createHistoricVariableInstanceQuery().variableName("testVar").singleResult();
    HistoricDetailQuery query = historyService.createHistoricDetailQuery();
    query.variableInstanceId(testVariable.getId());
    assertEquals(1, query.count());
    assertEquals(1, query.list().size());
}
Also used : HashMap(java.util.HashMap) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance) HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 25 with HistoricDetailQuery

use of org.camunda.bpm.engine.history.HistoricDetailQuery in project camunda-bpm-platform by camunda.

the class HistoricDetailRestServiceQueryTest method setUpMockedDetailsQuery.

protected HistoricDetailQuery setUpMockedDetailsQuery(List<HistoricDetail> detailMocks) {
    HistoricDetailQuery mock = mock(HistoricDetailQuery.class);
    when(mock.list()).thenReturn(detailMocks);
    when(mock.count()).thenReturn((long) detailMocks.size());
    when(processEngine.getHistoryService().createHistoricDetailQuery()).thenReturn(mock);
    return mock;
}
Also used : HistoricDetailQuery(org.camunda.bpm.engine.history.HistoricDetailQuery)

Aggregations

HistoricDetailQuery (org.camunda.bpm.engine.history.HistoricDetailQuery)49 Test (org.junit.Test)7 Deployment (org.camunda.bpm.engine.test.Deployment)5 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)2 HistoricDetailQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricDetailQueryDto)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)1 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)1 HistoricVariableUpdate (org.camunda.bpm.engine.history.HistoricVariableUpdate)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricDetailDto (org.camunda.bpm.engine.rest.dto.history.HistoricDetailDto)1 Task (org.camunda.bpm.engine.task.Task)1 FileValue (org.camunda.bpm.engine.variable.value.FileValue)1 Ignore (org.junit.Ignore)1 Matchers.anyString (org.mockito.Matchers.anyString)1