Search in sources :

Example 51 with UserOperationLogQuery

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

the class UserOperationLogTaskTest method testOnlyTaskCompletionIsLogged.

@Deployment
public void testOnlyTaskCompletionIsLogged() {
    // given
    String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
    String taskId = taskService.createTaskQuery().singleResult().getId();
    // when
    taskService.complete(taskId);
    // then
    assertTrue((Boolean) runtimeService.getVariable(processInstanceId, "taskListenerCalled"));
    assertTrue((Boolean) runtimeService.getVariable(processInstanceId, "serviceTaskCalled"));
    UserOperationLogQuery query = historyService.createUserOperationLogQuery();
    assertEquals(1, query.count());
    UserOperationLogEntry log = query.singleResult();
    assertEquals("process", log.getProcessDefinitionKey());
    assertEquals(processInstanceId, log.getProcessInstanceId());
    assertEquals(deploymentId, log.getDeploymentId());
    assertEquals(taskId, log.getTaskId());
    assertEquals(UserOperationLogEntry.OPERATION_TYPE_COMPLETE, log.getOperationType());
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 52 with UserOperationLogQuery

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

the class UserOperationLogTaskTest method testResolveTask.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testResolveTask() {
    startTestProcess();
    // then: resolve the task
    taskService.resolveTask(task.getId());
    // expect: one entry for the resolving
    UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_RESOLVE);
    assertEquals(1, query.count());
    // assert: details
    assertEquals(DelegationState.RESOLVED.toString(), query.singleResult().getNewValue());
    completeTestProcess();
}
Also used : UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 53 with UserOperationLogQuery

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

the class UserOperationLogDeploymentTest method testDeleteProcessDefinition.

public void testDeleteProcessDefinition() {
    // given
    Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, createProcessWithServiceTask(PROCESS_KEY)).deploy();
    ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult();
    UserOperationLogQuery query = historyService.createUserOperationLogQuery().operationType(UserOperationLogEntry.OPERATION_TYPE_DELETE);
    // when
    repositoryService.deleteProcessDefinition(procDef.getId(), false);
    // then
    assertEquals(1, query.count());
    UserOperationLogEntry log = query.singleResult();
    assertNotNull(log);
    assertEquals(EntityTypes.PROCESS_DEFINITION, log.getEntityType());
    assertEquals(procDef.getId(), log.getProcessDefinitionId());
    assertEquals(procDef.getKey(), log.getProcessDefinitionKey());
    assertEquals(deployment.getId(), log.getDeploymentId());
    assertEquals(UserOperationLogEntry.OPERATION_TYPE_DELETE, log.getOperationType());
    assertEquals("cascade", log.getProperty());
    assertFalse(Boolean.valueOf(log.getOrgValue()));
    assertFalse(Boolean.valueOf(log.getNewValue()));
    assertEquals(USER_ID, log.getUserId());
    assertNull(log.getJobDefinitionId());
    assertNull(log.getProcessInstanceId());
    assertNull(log.getCaseInstanceId());
    assertNull(log.getCaseDefinitionId());
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) Deployment(org.camunda.bpm.engine.repository.Deployment) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 54 with UserOperationLogQuery

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

the class UserOperationLogDeploymentTest method testDeleteProcessDefinitionCascadingShouldKeepCreateUserOperationLog.

public void testDeleteProcessDefinitionCascadingShouldKeepCreateUserOperationLog() {
    // given
    Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, createProcessWithServiceTask(PROCESS_KEY)).deploy();
    ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult();
    UserOperationLogQuery query = historyService.createUserOperationLogQuery().operationType(UserOperationLogEntry.OPERATION_TYPE_CREATE);
    assertEquals(1, query.count());
    // when
    repositoryService.deleteProcessDefinition(procDef.getId(), true);
    // then
    assertEquals(1, query.count());
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

Example 55 with UserOperationLogQuery

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

the class UserOperationLogDeploymentTest method testPropertyDuplicateFiltering.

public void testPropertyDuplicateFiltering() {
    // given
    BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
    // when
    Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).enableDuplicateFiltering(false).deploy();
    // then
    UserOperationLogQuery query = historyService.createUserOperationLogQuery();
    assertEquals(2, query.count());
    // (1): duplicate filter enabled property
    UserOperationLogEntry logDuplicateFilterEnabledProperty = query.property("duplicateFilterEnabled").singleResult();
    assertNotNull(logDuplicateFilterEnabledProperty);
    assertEquals(EntityTypes.DEPLOYMENT, logDuplicateFilterEnabledProperty.getEntityType());
    assertEquals(deployment.getId(), logDuplicateFilterEnabledProperty.getDeploymentId());
    assertEquals(UserOperationLogEntry.OPERATION_TYPE_CREATE, logDuplicateFilterEnabledProperty.getOperationType());
    assertEquals(USER_ID, logDuplicateFilterEnabledProperty.getUserId());
    assertEquals("duplicateFilterEnabled", logDuplicateFilterEnabledProperty.getProperty());
    assertNull(logDuplicateFilterEnabledProperty.getOrgValue());
    assertTrue(Boolean.valueOf(logDuplicateFilterEnabledProperty.getNewValue()));
    // (2): deploy changed only
    UserOperationLogEntry logDeployChangedOnlyProperty = query.property("deployChangedOnly").singleResult();
    assertNotNull(logDeployChangedOnlyProperty);
    assertEquals(EntityTypes.DEPLOYMENT, logDeployChangedOnlyProperty.getEntityType());
    assertEquals(deployment.getId(), logDeployChangedOnlyProperty.getDeploymentId());
    assertEquals(UserOperationLogEntry.OPERATION_TYPE_CREATE, logDeployChangedOnlyProperty.getOperationType());
    assertEquals(USER_ID, logDeployChangedOnlyProperty.getUserId());
    assertEquals("deployChangedOnly", logDeployChangedOnlyProperty.getProperty());
    assertNull(logDeployChangedOnlyProperty.getOrgValue());
    assertFalse(Boolean.valueOf(logDeployChangedOnlyProperty.getNewValue()));
    // (3): operation id
    assertEquals(logDuplicateFilterEnabledProperty.getOperationId(), logDeployChangedOnlyProperty.getOperationId());
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) Deployment(org.camunda.bpm.engine.repository.Deployment) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery)

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