Search in sources :

Example 11 with UserOperationLogEntry

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

the class UserOperationLogTaskTest method testCompleteCaseExecution.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testCompleteCaseExecution() {
    // given
    String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
    String caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().getId();
    String humanTaskId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
    // when
    caseService.withCaseExecution(humanTaskId).complete();
    // then
    UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_COMPLETE);
    assertEquals(1, query.count());
    UserOperationLogEntry entry = query.singleResult();
    assertNotNull(entry);
    assertEquals(caseDefinitionId, entry.getCaseDefinitionId());
    assertEquals(caseInstanceId, entry.getCaseInstanceId());
    assertEquals(humanTaskId, entry.getCaseExecutionId());
    assertEquals(deploymentId, entry.getDeploymentId());
    assertFalse(Boolean.valueOf(entry.getOrgValue()));
    assertTrue(Boolean.valueOf(entry.getNewValue()));
    assertEquals(DELETE, entry.getProperty());
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 12 with UserOperationLogEntry

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

the class UserOperationLogTaskTest method testCreateAndCompleteTask.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testCreateAndCompleteTask() {
    startTestProcess();
    // expect: no entry for the task creation by process engine
    UserOperationLogQuery query = historyService.createUserOperationLogQuery();
    assertEquals(0, query.count());
    completeTestProcess();
    // expect: one entry for the task completion
    query = queryOperationDetails(OPERATION_TYPE_COMPLETE);
    assertEquals(1, query.count());
    UserOperationLogEntry complete = query.singleResult();
    assertEquals(DELETE, complete.getProperty());
    assertTrue(Boolean.parseBoolean(complete.getNewValue()));
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 13 with UserOperationLogEntry

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

the class UserOperationLogTaskTest method testChangeTaskOwner.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testChangeTaskOwner() {
    startTestProcess();
    // then: change the task owner
    taskService.setOwner(task.getId(), "icke");
    // expect: one entry for the owner change
    UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_SET_OWNER);
    assertEquals(1, query.count());
    // assert: details
    UserOperationLogEntry change = query.singleResult();
    assertEquals(OWNER, change.getProperty());
    assertEquals("icke", change.getNewValue());
    completeTestProcess();
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 14 with UserOperationLogEntry

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

the class UserOperationLogTaskTest method testClaimTask.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testClaimTask() {
    startTestProcess();
    // then: claim a new the task
    taskService.claim(task.getId(), "icke");
    // expect: one entry for the claim
    UserOperationLogQuery query = queryOperationDetails(OPERATION_TYPE_CLAIM);
    assertEquals(1, query.count());
    // assert: details
    UserOperationLogEntry claim = query.singleResult();
    assertEquals(ASSIGNEE, claim.getProperty());
    assertEquals("icke", claim.getNewValue());
    completeTestProcess();
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) UserOperationLogQuery(org.camunda.bpm.engine.history.UserOperationLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 15 with UserOperationLogEntry

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

the class UserOperationLogDeploymentTest method testCreateDeployment.

public void testCreateDeployment() {
    // when
    Deployment deployment = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, createProcessWithServiceTask(PROCESS_KEY)).deploy();
    // then
    UserOperationLogEntry userOperationLogEntry = historyService.createUserOperationLogQuery().singleResult();
    assertNotNull(userOperationLogEntry);
    assertEquals(EntityTypes.DEPLOYMENT, userOperationLogEntry.getEntityType());
    assertEquals(deployment.getId(), userOperationLogEntry.getDeploymentId());
    assertEquals(UserOperationLogEntry.OPERATION_TYPE_CREATE, userOperationLogEntry.getOperationType());
    assertEquals("duplicateFilterEnabled", userOperationLogEntry.getProperty());
    assertNull(userOperationLogEntry.getOrgValue());
    assertFalse(Boolean.valueOf(userOperationLogEntry.getNewValue()));
    assertEquals(USER_ID, userOperationLogEntry.getUserId());
    assertNull(userOperationLogEntry.getJobDefinitionId());
    assertNull(userOperationLogEntry.getProcessInstanceId());
    assertNull(userOperationLogEntry.getProcessDefinitionId());
    assertNull(userOperationLogEntry.getProcessDefinitionKey());
    assertNull(userOperationLogEntry.getCaseInstanceId());
    assertNull(userOperationLogEntry.getCaseDefinitionId());
}
Also used : UserOperationLogEntry(org.camunda.bpm.engine.history.UserOperationLogEntry) Deployment(org.camunda.bpm.engine.repository.Deployment)

Aggregations

UserOperationLogEntry (org.camunda.bpm.engine.history.UserOperationLogEntry)59 Deployment (org.camunda.bpm.engine.test.Deployment)25 UserOperationLogQuery (org.camunda.bpm.engine.history.UserOperationLogQuery)20 Test (org.junit.Test)15 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)11 Deployment (org.camunda.bpm.engine.repository.Deployment)8 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)7 Date (java.util.Date)4 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)4 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)4 Batch (org.camunda.bpm.engine.batch.Batch)3 Job (org.camunda.bpm.engine.runtime.Job)3 ExternalTask (org.camunda.bpm.engine.externaltask.ExternalTask)2 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)2 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)2 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)2 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)2 ArrayList (java.util.ArrayList)1 EmbeddedProcessApplication (org.camunda.bpm.application.impl.EmbeddedProcessApplication)1 HistoryService (org.camunda.bpm.engine.HistoryService)1