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