Search in sources :

Example 11 with UserOperationLogQuery

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

the class UserOperationLogQueryTest method verifyVariableOperationAsserts.

private void verifyVariableOperationAsserts(int countAssertValue, String operationType) {
    UserOperationLogQuery logQuery = query().entityType(EntityTypes.VARIABLE).operationType(operationType);
    assertEquals(countAssertValue, logQuery.count());
    if (countAssertValue > 1) {
        List<UserOperationLogEntry> logEntryList = logQuery.list();
        for (UserOperationLogEntry logEntry : logEntryList) {
            assertEquals(process.getProcessDefinitionId(), logEntry.getProcessDefinitionId());
            assertEquals(process.getProcessInstanceId(), logEntry.getProcessInstanceId());
            assertEquals(deploymentId, logEntry.getDeploymentId());
        }
    } else {
        UserOperationLogEntry logEntry = logQuery.singleResult();
        assertEquals(process.getProcessDefinitionId(), logEntry.getProcessDefinitionId());
        assertEquals(process.getProcessInstanceId(), logEntry.getProcessInstanceId());
        assertEquals(deploymentId, logEntry.getDeploymentId());
    }
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 12 with UserOperationLogQuery

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

the class UserOperationLogQueryTest method testQueryByInvalidDeploymentId.

public void testQueryByInvalidDeploymentId() {
    UserOperationLogQuery query = historyService.createUserOperationLogQuery().deploymentId("invalid");
    verifyQueryResults(query, 0);
    try {
        query.deploymentId(null);
        fail();
    } catch (ProcessEngineException e) {
    // expected
    }
}
Also used : UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 13 with UserOperationLogQuery

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

the class UserOperationLogQueryTest method testQueryByCaseDefinitionId.

// --------------- CMMN --------------------
@Deployment(resources = { ONE_TASK_CASE })
public void testQueryByCaseDefinitionId() {
    // given:
    // a deployed case definition
    String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
    // an active case instance
    caseService.withCaseDefinition(caseDefinitionId).create();
    Task task = taskService.createTaskQuery().singleResult();
    assertNotNull(task);
    // when
    taskService.setAssignee(task.getId(), "demo");
    // then
    UserOperationLogQuery query = historyService.createUserOperationLogQuery().caseDefinitionId(caseDefinitionId);
    verifyQueryResults(query, 1);
}
Also used : Task(org.camunda.bpm.engine.task.Task) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 14 with UserOperationLogQuery

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

the class UserOperationLogTaskTest method testCompleteCaseExecution.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testCompleteCaseExecution() {
    // given
    String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
    String caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().getId();
    String humanTaskId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
    // when
    caseService.withCaseExecution(humanTaskId).complete();
    // then
    UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_COMPLETE);
    assertEquals(1, query.count());
    UserOperationLogEntry entry = query.singleResult();
    assertNotNull(entry);
    assertEquals(caseDefinitionId, entry.getCaseDefinitionId());
    assertEquals(caseInstanceId, entry.getCaseInstanceId());
    assertEquals(humanTaskId, entry.getCaseExecutionId());
    assertEquals(deploymentId, entry.getDeploymentId());
    assertFalse(Boolean.valueOf(entry.getOrgValue()));
    assertTrue(Boolean.valueOf(entry.getNewValue()));
    assertEquals(DELETE, entry.getProperty());
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 15 with UserOperationLogQuery

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

the class UserOperationLogTaskTest method testCreateAndCompleteTask.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testCreateAndCompleteTask() {
    startTestProcess();
    // expect: no entry for the task creation by process engine
    UserOperationLogQuery query = historyService.createUserOperationLogQuery();
    assertEquals(0, query.count());
    completeTestProcess();
    // expect: one entry for the task completion
    query = queryOperationDetails(OPERATION_TYPE_COMPLETE);
    assertEquals(1, query.count());
    UserOperationLogEntry complete = query.singleResult();
    assertEquals(DELETE, complete.getProperty());
    assertTrue(Boolean.parseBoolean(complete.getNewValue()));
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

UserOperationLogQuery (org.camunda.bpm.engine.history.UserOperationLogQuery)67 Deployment (org.camunda.bpm.engine.test.Deployment)25 UserOperationLogEntry (org.camunda.bpm.engine.history.UserOperationLogEntry)20 Deployment (org.camunda.bpm.engine.repository.Deployment)10 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)6 Task (org.camunda.bpm.engine.task.Task)4 Date (java.util.Date)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 Batch (org.camunda.bpm.engine.batch.Batch)2 UserOperationLogQueryDto (org.camunda.bpm.engine.rest.dto.history.UserOperationLogQueryDto)2 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)2 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)2 Test (org.junit.Test)2 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)1