Search in sources :

Example 26 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogTestByXml method testPropagateTenantIdToCandidateStarterUsers.

public void testPropagateTenantIdToCandidateStarterUsers() {
    // when
    org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment().addClasspathResource(CANDIDATE_STARTER_USERS).tenantId(TENANT_ONE).deploy();
    // then
    List<HistoricIdentityLinkLog> historicLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(3, historicLinks.size());
    for (HistoricIdentityLinkLog historicLink : historicLinks) {
        assertNotNull(historicLink.getTenantId());
        assertEquals(TENANT_ONE, historicLink.getTenantId());
    }
    repositoryService.deleteDeployment(deployment.getId(), true);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog)

Example 27 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogTestByXml method testPropagateTenantIdToCandidateStarterGroups.

public void testPropagateTenantIdToCandidateStarterGroups() {
    // when
    org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment().addClasspathResource(CANDIDATE_STARTER_GROUPS).tenantId(TENANT_ONE).deploy();
    // then
    List<HistoricIdentityLinkLog> historicLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(3, historicLinks.size());
    for (HistoricIdentityLinkLog historicLink : historicLinks) {
        assertNotNull(historicLink.getTenantId());
        assertEquals(TENANT_ONE, historicLink.getTenantId());
    }
    repositoryService.deleteDeployment(deployment.getId(), true);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog)

Example 28 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogTest method testShouldNotDeleteIdentityLinkForTaskCompletion.

// CAM-7456
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testShouldNotDeleteIdentityLinkForTaskCompletion() {
    // given
    List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 0);
    startProcessInstance(PROCESS_DEFINITION_KEY);
    Task task = taskService.createTaskQuery().singleResult();
    taskService.addCandidateUser(task.getId(), "demo");
    // when
    taskService.complete(task.getId());
    // then
    List<HistoricIdentityLinkLog> historicIdentityLinkLogs = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(1, historicIdentityLinkLogs.size());
    assertNotEquals(IDENTITY_LINK_DELETE, historicIdentityLinkLogs.get(0).getOperationType());
}
Also used : Task(org.camunda.bpm.engine.task.Task) HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 29 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogTest method testShouldAddAndRemoveIdentityLinksForProcessDefinition.

@SuppressWarnings("deprecation")
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testShouldAddAndRemoveIdentityLinksForProcessDefinition() throws Exception {
    // Pre test
    List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 0);
    // Given
    ProcessDefinition latestProcessDef = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).singleResult();
    assertNotNull(latestProcessDef);
    List<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(latestProcessDef.getId());
    assertEquals(0, links.size());
    // Add candiate group with process definition
    repositoryService.addCandidateStarterGroup(latestProcessDef.getId(), GROUP_1);
    historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 1);
    // Add candidate user for process definition
    repositoryService.addCandidateStarterUser(latestProcessDef.getId(), USER_1);
    historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 2);
    // Delete candiate group with process definition
    repositoryService.deleteCandidateStarterGroup(latestProcessDef.getId(), GROUP_1);
    historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 3);
    // Delete candidate user for process definition
    repositoryService.deleteCandidateStarterUser(latestProcessDef.getId(), USER_1);
    historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 4);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) IdentityLink(org.camunda.bpm.engine.task.IdentityLink) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 30 with HistoricIdentityLinkLog

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

the class HistoricIdentityLinkLogTest method testShouldAddIdentityLinkByProcessDefinitionAndStandalone.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testShouldAddIdentityLinkByProcessDefinitionAndStandalone() {
    String taskAssigneeId = "Assigneee";
    // Pre test
    List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 0);
    ProcessInstance processInstance = startProcessInstance(PROCESS_DEFINITION_KEY);
    String taskId = taskService.createTaskQuery().singleResult().getId();
    // given
    Task taskAssignee = taskService.newTask(taskAssigneeId);
    taskAssignee.setAssignee(USER_1);
    taskService.saveTask(taskAssignee);
    // if
    addAndDeleteUserWithAssigner(taskId, IdentityLinkType.ASSIGNEE);
    // then
    historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
    assertEquals(historicIdentityLinks.size(), 3);
    // Basic Query test
    HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.type(IdentityLinkType.ASSIGNEE).count(), 3);
    query = historyService.createHistoricIdentityLinkLogQuery();
    assertEquals(query.processDefinitionId(processInstance.getProcessDefinitionId()).count(), 2);
    assertEquals(query.processDefinitionKey(PROCESS_DEFINITION_KEY).count(), 2);
    taskService.deleteTask(taskAssigneeId, true);
}
Also used : Task(org.camunda.bpm.engine.task.Task) HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) 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