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());
}
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());
}
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());
}
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());
}
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()));
}
Aggregations