Search in sources :

Example 41 with UserOperationLogQuery

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

the class UserOperationLogQueryTest method testQueryProcessInstanceModificationOperation.

// ----- PROCESS INSTANCE MODIFICATION -----
@Deployment(resources = { ONE_TASK_PROCESS })
public void testQueryProcessInstanceModificationOperation() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
    String processInstanceId = processInstance.getId();
    ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().singleResult();
    runtimeService.createProcessInstanceModification(processInstance.getId()).startBeforeActivity("theTask").execute();
    UserOperationLogQuery logQuery = query().entityType(EntityTypes.PROCESS_INSTANCE).operationType(UserOperationLogEntry.OPERATION_TYPE_MODIFY_PROCESS_INSTANCE);
    assertEquals(1, logQuery.count());
    UserOperationLogEntry logEntry = logQuery.singleResult();
    assertEquals(processInstanceId, logEntry.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), logEntry.getProcessDefinitionId());
    assertEquals(definition.getKey(), logEntry.getProcessDefinitionKey());
    assertEquals(deploymentId, logEntry.getDeploymentId());
    assertEquals(UserOperationLogEntry.OPERATION_TYPE_MODIFY_PROCESS_INSTANCE, logEntry.getOperationType());
    assertEquals(EntityTypes.PROCESS_INSTANCE, logEntry.getEntityType());
    assertNull(logEntry.getProperty());
    assertNull(logEntry.getOrgValue());
    assertNull(logEntry.getNewValue());
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 42 with UserOperationLogQuery

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

the class UserOperationLogQueryTest method testQueryByEntityTypes.

@Deployment(resources = { ONE_TASK_PROCESS })
public void testQueryByEntityTypes() {
    // given
    process = runtimeService.startProcessInstanceByKey("oneTaskProcess");
    processTaskId = taskService.createTaskQuery().singleResult().getId();
    // when
    taskService.setAssignee(processTaskId, "foo");
    taskService.setVariable(processTaskId, "foo", "bar");
    // then
    UserOperationLogQuery query = historyService.createUserOperationLogQuery().entityTypeIn(EntityTypes.TASK, EntityTypes.VARIABLE);
    verifyQueryResults(query, 2);
}
Also used : UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 43 with UserOperationLogQuery

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

the class UserOperationLogQueryTest method testQueryByInvalidEntityTypes.

public void testQueryByInvalidEntityTypes() {
    UserOperationLogQuery query = historyService.createUserOperationLogQuery().entityTypeIn("foo");
    verifyQueryResults(query, 0);
    try {
        query.entityTypeIn(null);
        fail();
    } catch (ProcessEngineException e) {
    // expected
    }
    try {
        query.entityTypeIn(EntityTypes.TASK, null, EntityTypes.VARIABLE);
        fail();
    } catch (ProcessEngineException e) {
    // expected
    }
}
Also used : UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 44 with UserOperationLogQuery

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

the class UserOperationLogQueryTest method testQueryByDeploymentId.

public void testQueryByDeploymentId() {
    // given
    String deploymentId = repositoryService.createDeployment().addClasspathResource(ONE_TASK_PROCESS).deploy().getId();
    // when
    UserOperationLogQuery query = historyService.createUserOperationLogQuery().deploymentId(deploymentId);
    // then
    verifyQueryResults(query, 1);
    repositoryService.deleteDeployment(deploymentId, true);
}
Also used : UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 45 with UserOperationLogQuery

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

the class UserOperationLogQueryTest method testQueryByCaseInstanceId.

@Deployment(resources = { ONE_TASK_CASE })
public void testQueryByCaseInstanceId() {
    // given:
    // a deployed case definition
    String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
    // an active case instance
    String caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().getId();
    Task task = taskService.createTaskQuery().singleResult();
    assertNotNull(task);
    // when
    taskService.setAssignee(task.getId(), "demo");
    // then
    UserOperationLogQuery query = historyService.createUserOperationLogQuery().caseInstanceId(caseInstanceId);
    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)

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