use of org.camunda.bpm.engine.task.IdentityLink 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);
}
Aggregations