Search in sources :

Example 81 with IdentityLink

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);
}
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)

Aggregations

IdentityLink (org.camunda.bpm.engine.task.IdentityLink)81 Task (org.camunda.bpm.engine.task.Task)13 Deployment (org.camunda.bpm.engine.test.Deployment)13 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)12 Test (org.junit.Test)12 ArrayList (java.util.ArrayList)7 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)5 InputStream (java.io.InputStream)4 HashSet (java.util.HashSet)4 Expression (org.camunda.bpm.engine.delegate.Expression)4 HistoricIdentityLinkLog (org.camunda.bpm.engine.history.HistoricIdentityLinkLog)4 DeploymentBuilder (org.camunda.bpm.engine.repository.DeploymentBuilder)4 VariableMap (org.camunda.bpm.engine.variable.VariableMap)4 TaskService (org.camunda.bpm.engine.TaskService)3 HistoricIdentityLinkLogQuery (org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery)3 List (java.util.List)2 HalResource (org.camunda.bpm.engine.rest.hal.HalResource)2 Job (org.camunda.bpm.engine.runtime.Job)2 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)2 Matchers.anyString (org.mockito.Matchers.anyString)2