Search in sources :

Example 56 with UserOperationLogQuery

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

the class UserOperationLogDeploymentTest method testDeleteDeployment.

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

Example 57 with UserOperationLogQuery

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

the class UserOperationLogDeploymentTest method testDeleteProcessDefinitionCascading.

public void testDeleteProcessDefinitionCascading() {
    // 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(), true);
    // 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()));
    assertTrue(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 58 with UserOperationLogQuery

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

the class UserOperationLogDeploymentTest method testDeleteDeploymentCascadingShouldKeepCreateUserOperationLog.

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

Example 59 with UserOperationLogQuery

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

the class UserOperationLogDeploymentTest method testDeleteProcessDefinitiontWithoutCascadingShouldKeepCreateUserOperationLog.

public void testDeleteProcessDefinitiontWithoutCascadingShouldKeepCreateUserOperationLog() {
    // 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());
    // 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 60 with UserOperationLogQuery

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

the class UserOperationLogTaskServiceAndBeanTest method testDeleteTask.

public void testDeleteTask() {
    // given: a single task
    task = taskService.newTask();
    taskService.saveTask(task);
    // then: delete the task
    taskService.deleteTask(task.getId(), "duplicated");
    // expect: one entry for the deletion
    UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_DELETE);
    assertEquals(1, query.count());
    // assert: details
    UserOperationLogEntry delete = query.singleResult();
    assertEquals(DELETE, delete.getProperty());
    assertFalse(Boolean.parseBoolean(delete.getOrgValue()));
    assertTrue(Boolean.parseBoolean(delete.getNewValue()));
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) 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