use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogDeploymentTest method testDeleteDeploymentCascading.
public void testDeleteDeploymentCascading() {
// 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(), true);
// 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());
assertTrue(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.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogDeploymentTest method testPropertiesDuplicateFilteringAndDeployChangedOnly.
public void testPropertiesDuplicateFilteringAndDeployChangedOnly() {
// given
BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
// when
Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).enableDuplicateFiltering(true).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());
assertTrue(Boolean.valueOf(logDeployChangedOnlyProperty.getNewValue()));
// (3): operation id
assertEquals(logDuplicateFilterEnabledProperty.getOperationId(), logDeployChangedOnlyProperty.getOperationId());
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskServiceAndBeanTest method testMultipleValueChange.
public void testMultipleValueChange() {
// given: a single task
task = taskService.newTask();
taskService.saveTask(task);
// then: change a property twice
task.setName("a task");
task.setName("to do");
taskService.saveTask(task);
UserOperationLogEntry update = queryOperationDetails(OPERATION_TYPE_UPDATE).singleResult();
assertNull(update.getOrgValue());
assertEquals("to do", update.getNewValue());
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogDeletionTest method assertUserOperationLogs.
public void assertUserOperationLogs() {
List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().list();
UserOperationLogQuery userOperationLogQuery = historyService.createUserOperationLogQuery().operationType(UserOperationLogEntry.OPERATION_TYPE_DELETE);
List<UserOperationLogEntry> userOperationLogs = userOperationLogQuery.list();
assertEquals(3, userOperationLogs.size());
for (ProcessDefinition processDefinition : processDefinitions) {
UserOperationLogEntry userOperationLogEntry = userOperationLogQuery.deploymentId(processDefinition.getDeploymentId()).singleResult();
assertEquals(EntityTypes.PROCESS_DEFINITION, userOperationLogEntry.getEntityType());
assertEquals(processDefinition.getId(), userOperationLogEntry.getProcessDefinitionId());
assertEquals(processDefinition.getKey(), userOperationLogEntry.getProcessDefinitionKey());
assertEquals(processDefinition.getDeploymentId(), userOperationLogEntry.getDeploymentId());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_DELETE, userOperationLogEntry.getOperationType());
assertEquals("cascade", userOperationLogEntry.getProperty());
assertFalse(Boolean.valueOf(userOperationLogEntry.getOrgValue()));
assertTrue(Boolean.valueOf(userOperationLogEntry.getNewValue()));
assertEquals(USER_ID, userOperationLogEntry.getUserId());
assertNull(userOperationLogEntry.getJobDefinitionId());
assertNull(userOperationLogEntry.getProcessInstanceId());
assertNull(userOperationLogEntry.getCaseInstanceId());
assertNull(userOperationLogEntry.getCaseDefinitionId());
}
assertEquals(6, historyService.createUserOperationLogQuery().count());
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogJobDefinitionTest method testClearOverridingPriority.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/asyncTaskProcess.bpmn20.xml" })
public void testClearOverridingPriority() {
// given a job definition
JobDefinition jobDefinition = managementService.createJobDefinitionQuery().singleResult();
// with an overriding priority
ClockUtil.setCurrentTime(new Date(System.currentTimeMillis()));
managementService.setOverridingJobPriorityForJobDefinition(jobDefinition.getId(), 42);
// when I clear that priority
ClockUtil.setCurrentTime(new Date(System.currentTimeMillis() + 10000));
managementService.clearOverridingJobPriorityForJobDefinition(jobDefinition.getId());
// then this is accessible via the op log
UserOperationLogEntry userOperationLogEntry = historyService.createUserOperationLogQuery().orderByTimestamp().desc().listPage(0, 1).get(0);
assertNotNull(userOperationLogEntry);
assertEquals(EntityTypes.JOB_DEFINITION, userOperationLogEntry.getEntityType());
assertEquals(jobDefinition.getId(), userOperationLogEntry.getJobDefinitionId());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_SET_PRIORITY, userOperationLogEntry.getOperationType());
assertEquals("overridingPriority", userOperationLogEntry.getProperty());
assertNull(userOperationLogEntry.getNewValue());
assertEquals("42", userOperationLogEntry.getOrgValue());
assertEquals(USER_ID, userOperationLogEntry.getUserId());
assertEquals(jobDefinition.getProcessDefinitionId(), userOperationLogEntry.getProcessDefinitionId());
assertEquals(jobDefinition.getProcessDefinitionKey(), userOperationLogEntry.getProcessDefinitionKey());
assertEquals(deploymentId, userOperationLogEntry.getDeploymentId());
}
Aggregations