use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class UserOperationLogTaskServiceAndBeanTest method testCompositeBeanInteraction.
public void testCompositeBeanInteraction() {
// given: a manually created task
task = taskService.newTask();
// then: save the task without any property change
taskService.saveTask(task);
// expect: no entry
UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_CREATE);
UserOperationLogEntry create = query.singleResult();
assertNotNull(create);
assertEquals(ENTITY_TYPE_TASK, create.getEntityType());
assertNull(create.getOrgValue());
assertNull(create.getNewValue());
assertNull(create.getProperty());
task.setAssignee("icke");
task.setName("to do");
// then: save the task again
taskService.saveTask(task);
// expect: two update entries with the same operation id
List<UserOperationLogEntry> entries = queryOperationDetails(OPERATION_TYPE_UPDATE).list();
assertEquals(2, entries.size());
assertEquals(entries.get(0).getOperationId(), entries.get(1).getOperationId());
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class RestartProcessInstanceUserOperationLogTest method testLogCreationAsync.
@Test
public void testLogCreationAsync() {
// given
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance);
rule.getIdentityService().setAuthenticatedUserId("userId");
ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("process1");
ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("process1");
runtimeService.deleteProcessInstance(processInstance1.getId(), "test");
runtimeService.deleteProcessInstance(processInstance2.getId(), "test");
// when
runtimeService.restartProcessInstances(processDefinition.getId()).startAfterActivity("user1").processInstanceIds(processInstance1.getId(), processInstance2.getId()).executeAsync();
rule.getIdentityService().clearAuthentication();
// then
List<UserOperationLogEntry> opLogEntries = rule.getHistoryService().createUserOperationLogQuery().operationType("RestartProcessInstance").list();
Assert.assertEquals(2, opLogEntries.size());
Map<String, UserOperationLogEntry> entries = asMap(opLogEntries);
UserOperationLogEntry asyncEntry = entries.get("async");
Assert.assertNotNull(asyncEntry);
Assert.assertEquals("ProcessInstance", asyncEntry.getEntityType());
Assert.assertEquals("RestartProcessInstance", asyncEntry.getOperationType());
Assert.assertEquals(processDefinition.getId(), asyncEntry.getProcessDefinitionId());
Assert.assertEquals(processDefinition.getKey(), asyncEntry.getProcessDefinitionKey());
Assert.assertNull(asyncEntry.getProcessInstanceId());
Assert.assertNull(asyncEntry.getOrgValue());
Assert.assertEquals("true", asyncEntry.getNewValue());
UserOperationLogEntry numInstancesEntry = entries.get("nrOfInstances");
Assert.assertNotNull(numInstancesEntry);
Assert.assertEquals("ProcessInstance", numInstancesEntry.getEntityType());
Assert.assertEquals("RestartProcessInstance", numInstancesEntry.getOperationType());
Assert.assertEquals(processDefinition.getId(), numInstancesEntry.getProcessDefinitionId());
Assert.assertEquals(processDefinition.getKey(), numInstancesEntry.getProcessDefinitionKey());
Assert.assertNull(numInstancesEntry.getProcessInstanceId());
Assert.assertNull(numInstancesEntry.getOrgValue());
Assert.assertEquals("2", numInstancesEntry.getNewValue());
Assert.assertEquals(asyncEntry.getOperationId(), numInstancesEntry.getOperationId());
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class SetExternalTaskRetriesUserOperationLogTest method testLogCreationAsync.
@Test
public void testLogCreationAsync() {
// given
rule.getIdentityService().setAuthenticatedUserId("userId");
// when
externalTaskService.setRetriesAsync(null, externalTaskService.createExternalTaskQuery(), 5);
rule.getIdentityService().clearAuthentication();
// then
List<UserOperationLogEntry> opLogEntries = rule.getHistoryService().createUserOperationLogQuery().list();
Assert.assertEquals(3, opLogEntries.size());
Map<String, UserOperationLogEntry> entries = asMap(opLogEntries);
UserOperationLogEntry asyncEntry = entries.get("async");
Assert.assertNotNull(asyncEntry);
Assert.assertEquals("ProcessInstance", asyncEntry.getEntityType());
Assert.assertEquals("SetExternalTaskRetries", asyncEntry.getOperationType());
Assert.assertNull(asyncEntry.getProcessDefinitionId());
Assert.assertNull(asyncEntry.getProcessDefinitionKey());
Assert.assertNull(asyncEntry.getProcessInstanceId());
Assert.assertNull(asyncEntry.getOrgValue());
Assert.assertEquals("true", asyncEntry.getNewValue());
UserOperationLogEntry numInstancesEntry = entries.get("nrOfInstances");
Assert.assertNotNull(numInstancesEntry);
Assert.assertEquals("ProcessInstance", numInstancesEntry.getEntityType());
Assert.assertEquals("SetExternalTaskRetries", numInstancesEntry.getOperationType());
Assert.assertNull(numInstancesEntry.getProcessDefinitionId());
Assert.assertNull(numInstancesEntry.getProcessDefinitionKey());
Assert.assertNull(numInstancesEntry.getProcessInstanceId());
Assert.assertNull(numInstancesEntry.getOrgValue());
Assert.assertEquals("6", numInstancesEntry.getNewValue());
UserOperationLogEntry retriesEntry = entries.get("retries");
Assert.assertNotNull(retriesEntry);
Assert.assertEquals("ProcessInstance", retriesEntry.getEntityType());
Assert.assertEquals("SetExternalTaskRetries", retriesEntry.getOperationType());
Assert.assertNull(retriesEntry.getProcessDefinitionId());
Assert.assertNull(retriesEntry.getProcessDefinitionKey());
Assert.assertNull(retriesEntry.getProcessInstanceId());
Assert.assertNull(retriesEntry.getOrgValue());
Assert.assertEquals("5", retriesEntry.getNewValue());
Assert.assertEquals(asyncEntry.getOperationId(), retriesEntry.getOperationId());
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class SetExternalTaskRetriesUserOperationLogTest method testLogCreationForOneExternalTaskId.
@Test
public void testLogCreationForOneExternalTaskId() {
// given
rule.getIdentityService().setAuthenticatedUserId("userId");
// when
ExternalTask externalTask = externalTaskService.createExternalTaskQuery().processInstanceId(processInstanceIds.get(0)).singleResult();
externalTaskService.setRetries(externalTask.getId(), 5);
rule.getIdentityService().clearAuthentication();
// then
List<UserOperationLogEntry> opLogEntries = rule.getHistoryService().createUserOperationLogQuery().list();
Assert.assertEquals(1, opLogEntries.size());
Map<String, UserOperationLogEntry> entries = asMap(opLogEntries);
UserOperationLogEntry retriesEntry = entries.get("retries");
Assert.assertNotNull(retriesEntry);
Assert.assertEquals("ProcessInstance", retriesEntry.getEntityType());
Assert.assertEquals("SetExternalTaskRetries", retriesEntry.getOperationType());
Assert.assertEquals(externalTask.getProcessInstanceId(), retriesEntry.getProcessInstanceId());
Assert.assertEquals(externalTask.getProcessDefinitionId(), retriesEntry.getProcessDefinitionId());
Assert.assertEquals(externalTask.getProcessDefinitionKey(), retriesEntry.getProcessDefinitionKey());
Assert.assertNull(retriesEntry.getOrgValue());
Assert.assertEquals("5", retriesEntry.getNewValue());
}
use of org.camunda.bpm.engine.history.UserOperationLogEntry in project camunda-bpm-platform by camunda.
the class SetExternalTaskRetriesUserOperationLogTest method testLogCreationSync.
@Test
public void testLogCreationSync() {
// given
rule.getIdentityService().setAuthenticatedUserId("userId");
List<ExternalTask> list = externalTaskService.createExternalTaskQuery().list();
List<String> externalTaskIds = new ArrayList<String>();
for (ExternalTask task : list) {
externalTaskIds.add(task.getId());
}
// when
externalTaskService.setRetries(externalTaskIds, 5);
rule.getIdentityService().clearAuthentication();
// then
List<UserOperationLogEntry> opLogEntries = rule.getHistoryService().createUserOperationLogQuery().list();
Assert.assertEquals(3, opLogEntries.size());
Map<String, UserOperationLogEntry> entries = asMap(opLogEntries);
UserOperationLogEntry asyncEntry = entries.get("async");
Assert.assertNotNull(asyncEntry);
Assert.assertEquals("ProcessInstance", asyncEntry.getEntityType());
Assert.assertEquals("SetExternalTaskRetries", asyncEntry.getOperationType());
Assert.assertNull(asyncEntry.getProcessDefinitionId());
Assert.assertNull(asyncEntry.getProcessDefinitionKey());
Assert.assertNull(asyncEntry.getProcessInstanceId());
Assert.assertNull(asyncEntry.getOrgValue());
Assert.assertEquals("false", asyncEntry.getNewValue());
UserOperationLogEntry numInstancesEntry = entries.get("nrOfInstances");
Assert.assertNotNull(numInstancesEntry);
Assert.assertEquals("ProcessInstance", numInstancesEntry.getEntityType());
Assert.assertEquals("SetExternalTaskRetries", numInstancesEntry.getOperationType());
Assert.assertNull(numInstancesEntry.getProcessDefinitionId());
Assert.assertNull(numInstancesEntry.getProcessDefinitionKey());
Assert.assertNull(numInstancesEntry.getProcessInstanceId());
Assert.assertNull(numInstancesEntry.getOrgValue());
Assert.assertEquals("6", numInstancesEntry.getNewValue());
UserOperationLogEntry retriesEntry = entries.get("retries");
Assert.assertNotNull(retriesEntry);
Assert.assertEquals("ProcessInstance", retriesEntry.getEntityType());
Assert.assertEquals("SetExternalTaskRetries", retriesEntry.getOperationType());
Assert.assertNull(retriesEntry.getProcessDefinitionId());
Assert.assertNull(retriesEntry.getProcessDefinitionKey());
Assert.assertNull(retriesEntry.getProcessInstanceId());
Assert.assertNull(retriesEntry.getOrgValue());
Assert.assertEquals("5", retriesEntry.getNewValue());
Assert.assertEquals(asyncEntry.getOperationId(), retriesEntry.getOperationId());
}
Aggregations