use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogJobDefinitionTest method testOverwriteOverridingPriority.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/asyncTaskProcess.bpmn20.xml" })
public void testOverwriteOverridingPriority() {
// 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 overwrite that priority
ClockUtil.setCurrentTime(new Date(System.currentTimeMillis() + 10000));
managementService.setOverridingJobPriorityForJobDefinition(jobDefinition.getId(), 43);
// 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());
assertEquals("43", userOperationLogEntry.getNewValue());
assertEquals("42", userOperationLogEntry.getOrgValue());
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class MockProvider method createUserOperationLogEntry.
private static UserOperationLogEntry createUserOperationLogEntry() {
UserOperationLogEntry entry = mock(UserOperationLogEntry.class);
when(entry.getId()).thenReturn(EXAMPLE_USER_OPERATION_LOG_ID);
when(entry.getDeploymentId()).thenReturn(EXAMPLE_DEPLOYMENT_ID);
when(entry.getProcessDefinitionId()).thenReturn(EXAMPLE_PROCESS_DEFINITION_ID);
when(entry.getProcessDefinitionKey()).thenReturn(EXAMPLE_PROCESS_DEFINITION_KEY);
when(entry.getProcessInstanceId()).thenReturn(EXAMPLE_PROCESS_INSTANCE_ID);
when(entry.getExecutionId()).thenReturn(EXAMPLE_EXECUTION_ID);
when(entry.getCaseDefinitionId()).thenReturn(EXAMPLE_CASE_DEFINITION_ID);
when(entry.getCaseInstanceId()).thenReturn(EXAMPLE_CASE_INSTANCE_ID);
when(entry.getCaseExecutionId()).thenReturn(EXAMPLE_CASE_EXECUTION_ID);
when(entry.getTaskId()).thenReturn(EXAMPLE_TASK_ID);
when(entry.getJobId()).thenReturn(EXAMPLE_JOB_ID);
when(entry.getJobDefinitionId()).thenReturn(EXAMPLE_JOB_DEFINITION_ID);
when(entry.getBatchId()).thenReturn(EXAMPLE_BATCH_ID);
when(entry.getUserId()).thenReturn(EXAMPLE_USER_ID);
when(entry.getTimestamp()).thenReturn(DateTimeUtil.parseDate(EXAMPLE_USER_OPERATION_TIMESTAMP));
when(entry.getOperationId()).thenReturn(EXAMPLE_USER_OPERATION_ID);
when(entry.getOperationType()).thenReturn(EXAMPLE_USER_OPERATION_TYPE);
when(entry.getEntityType()).thenReturn(EXAMPLE_USER_OPERATION_ENTITY);
when(entry.getProperty()).thenReturn(EXAMPLE_USER_OPERATION_PROPERTY);
when(entry.getOrgValue()).thenReturn(EXAMPLE_USER_OPERATION_ORG_VALUE);
when(entry.getNewValue()).thenReturn(EXAMPLE_USER_OPERATION_NEW_VALUE);
return entry;
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class DeleteUserOperationLogEntryCmd method execute.
public Void execute(CommandContext commandContext) {
ensureNotNull(NotValidException.class, "entryId", entryId);
UserOperationLogEntry entry = commandContext.getOperationLogManager().findOperationLogById(entryId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkDeleteUserOperationLog(entry);
}
commandContext.getOperationLogManager().deleteOperationLogEntryById(entryId);
return null;
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class TestHelper method clearUserOperationLog.
public static void clearUserOperationLog(ProcessEngineConfigurationImpl processEngineConfiguration) {
if (processEngineConfiguration.getHistoryLevel().equals(HistoryLevel.HISTORY_LEVEL_FULL)) {
HistoryService historyService = processEngineConfiguration.getHistoryService();
List<UserOperationLogEntry> logs = historyService.createUserOperationLogQuery().list();
for (UserOperationLogEntry log : logs) {
historyService.deleteUserOperationLogEntry(log.getId());
}
}
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class BatchSuspensionTest method shouldCreateUserOperationLogForBatchActivation.
@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void shouldCreateUserOperationLogForBatchActivation() {
// given
Batch batch = helper.migrateProcessInstancesAsync(1);
managementService.suspendBatchById(batch.getId());
// when
identityService.setAuthenticatedUserId(USER_ID);
managementService.activateBatchById(batch.getId());
identityService.clearAuthentication();
// then
UserOperationLogEntry entry = historyService.createUserOperationLogQuery().singleResult();
assertNotNull(entry);
assertEquals(batch.getId(), entry.getBatchId());
assertEquals(AbstractSetBatchStateCmd.SUSPENSION_STATE_PROPERTY, entry.getProperty());
assertNull(entry.getOrgValue());
assertEquals(SuspensionState.ACTIVE.getName(), entry.getNewValue());
}
Aggregations