Search in sources :

Example 21 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogQueryTest method testGroupQueryTaskCandidateForAddAndDeleteIdentityLink.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testGroupQueryTaskCandidateForAddAndDeleteIdentityLink() {
    List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 0);
    // given
    ProcessInstance processInstance = startProcessInstance(PROCESS_DEFINITION_KEY);
    String taskId = taskService.createTaskQuery().singleResult().getId();
    // if
    identityService.setAuthenticatedUserId(A_ASSIGNER_ID);
    taskService.addCandidateGroup(taskId, A_GROUP_ID);
    // Query test
    HistoricIdentityLinkLog historicIdentityLink = historyService.createHistoricIdentityLinkLogQuery().singleResult();
    assertEquals(historicIdentityLink.getUserId(), null);
    assertEquals(historicIdentityLink.getTaskId(), taskId);
    assertEquals(historicIdentityLink.getType(), IdentityLinkType.CANDIDATE);
    assertEquals(historicIdentityLink.getAssignerId(), A_ASSIGNER_ID);
    assertEquals(historicIdentityLink.getGroupId(), A_GROUP_ID);
    assertEquals(historicIdentityLink.getOperationType(), IDENTITY_LINK_ADD);
    assertEquals(historicIdentityLink.getProcessDefinitionId(), processInstance.getProcessDefinitionId());
    assertEquals(historicIdentityLink.getProcessDefinitionKey(), PROCESS_DEFINITION_KEY);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 22 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogQueryTest method testInvalidIndividualQueryTaskCandidateForAddAndDeleteIdentityLink.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testInvalidIndividualQueryTaskCandidateForAddAndDeleteIdentityLink() {
    List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 0);
    // given
    startProcessInstance(PROCESS_DEFINITION_KEY);
    String taskId = taskService.createTaskQuery().singleResult().getId();
    // if
    identityService.setAuthenticatedUserId(A_ASSIGNER_ID);
    taskService.addCandidateUser(taskId, A_USER_ID);
    taskService.deleteCandidateUser(taskId, A_USER_ID);
    // Invalid Individual Query test
    HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.taskId(INVALID_TASK_ID).count(), 0);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.type(INVALID_IDENTITY_LINK_TYPE).count(), 0);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.userId(INVALID_USER_ID).count(), 0);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.groupId(INVALID_GROUP_ID).count(), 0);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.assignerId(INVALID_ASSIGNER_ID).count(), 0);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.operationType(INVALID_HISTORY_EVENT_TYPE).count(), 0);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 23 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogQueryTest method testInvalidGroupQueryTaskCandidateForAddAndDeleteIdentityLink.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testInvalidGroupQueryTaskCandidateForAddAndDeleteIdentityLink() {
    List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 0);
    // given
    startProcessInstance(PROCESS_DEFINITION_KEY);
    String taskId = taskService.createTaskQuery().singleResult().getId();
    // if
    identityService.setAuthenticatedUserId(A_ASSIGNER_ID);
    taskService.addCandidateUser(taskId, A_USER_ID);
    taskService.deleteCandidateUser(taskId, A_USER_ID);
    // Invalid Individual Query test
    HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.taskId(INVALID_TASK_ID).count(), 0);
    assertEquals(query.type(INVALID_IDENTITY_LINK_TYPE).count(), 0);
    assertEquals(query.userId(INVALID_USER_ID).count(), 0);
    assertEquals(query.groupId(INVALID_GROUP_ID).count(), 0);
    assertEquals(query.assignerId(INVALID_ASSIGNER_ID).count(), 0);
    assertEquals(query.operationType(INVALID_HISTORY_EVENT_TYPE).count(), 0);
    assertEquals(query.processDefinitionId(INVALID_PROCESS_DEFINITION_ID).count(), 0);
    assertEquals(query.processDefinitionKey(INVALID_PROCESS_DEFINITION_KEY).count(), 0);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 24 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogTestByXml method testShouldAddProcessCandidateStarterGroupforAddIdentityLinkUsingXml.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/OneTaskProcessWithCandidateStarterGroups.bpmn20.xml" })
public void testShouldAddProcessCandidateStarterGroupforAddIdentityLinkUsingXml() {
    // Pre test - Historical identity link is added as part of deployment
    List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 1);
    // given
    ProcessDefinition latestProcessDef = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY_CANDIDATE_STARTER_GROUP).singleResult();
    assertNotNull(latestProcessDef);
    List<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(latestProcessDef.getId());
    assertEquals(1, links.size());
    historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 1);
    // query Test
    HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.groupId(XML_GROUP).count(), 1);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) IdentityLink(org.camunda.bpm.engine.task.IdentityLink) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 25 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogTestByXml method testShouldAddTaskCandidateforAddIdentityLinkUsingXml.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/OneTaskProcessWithCandidateUser.bpmn20.xml" })
public void testShouldAddTaskCandidateforAddIdentityLinkUsingXml() {
    // Pre test
    List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 0);
    // given
    startProcessInstance(PROCESS_DEFINITION_KEY_CANDIDATE_USER);
    historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 1);
    // query Test
    HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.userId(XML_USER).count(), 1);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricIdentityLinkLog (org.camunda.bpm.engine.history.HistoricIdentityLinkLog)33 HistoricIdentityLinkLogQuery (org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery)23 Deployment (org.camunda.bpm.engine.test.Deployment)23 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)5 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)5 IdentityLink (org.camunda.bpm.engine.task.IdentityLink)4 Task (org.camunda.bpm.engine.task.Task)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 LockedExternalTask (org.camunda.bpm.engine.externaltask.LockedExternalTask)1 HistoricIdentityLinkLogDto (org.camunda.bpm.engine.rest.dto.history.HistoricIdentityLinkLogDto)1 HistoricIdentityLinkLogQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricIdentityLinkLogQueryDto)1