use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogTest method testShouldAddDelegateTaskCandidateforAddIdentityLink.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testShouldAddDelegateTaskCandidateforAddIdentityLink() {
// Pre test
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 0);
// given
startProcessInstance(PROCESS_DEFINITION_KEY);
String taskId = taskService.createTaskQuery().singleResult().getId();
identityService.setAuthenticatedUserId(A_ASSIGNER_ID);
taskService.addUserIdentityLink(taskId, A_USER_ID, IdentityLinkType.ASSIGNEE);
taskService.delegateTask(taskId, B_USER_ID);
taskService.deleteUserIdentityLink(taskId, B_USER_ID, IdentityLinkType.ASSIGNEE);
historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
// Addition of A_USER, Deletion of A_USER, Addition of A_USER as owner, Addition of B_USER and deletion of B_USER
assertEquals(historicIdentityLinks.size(), 5);
// Query test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.userId(A_USER_ID).count(), 3);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.userId(B_USER_ID).count(), 2);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.operationType(IDENTITY_LINK_ADD).count(), 3);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.operationType(IDENTITY_LINK_DELETE).count(), 2);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.type(IdentityLinkType.ASSIGNEE).count(), 4);
assertEquals(query.type(IdentityLinkType.OWNER).count(), 1);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogTest method testShouldAddGroupCandidateForAddAndDeleteIdentityLink.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testShouldAddGroupCandidateForAddAndDeleteIdentityLink() {
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.addCandidateGroup(taskId, A_GROUP_ID);
taskService.deleteCandidateGroup(taskId, A_GROUP_ID);
// then
historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 2);
// Basic Query test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.groupId(A_GROUP_ID).count(), 2);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogTest method testShouldAddMultipleDelegateTaskCandidateforAddIdentityLink.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testShouldAddMultipleDelegateTaskCandidateforAddIdentityLink() {
// Pre test
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 0);
// given
startProcessInstance(PROCESS_DEFINITION_KEY);
String taskId = taskService.createTaskQuery().singleResult().getId();
identityService.setAuthenticatedUserId(A_ASSIGNER_ID);
taskService.addUserIdentityLink(taskId, A_USER_ID, IdentityLinkType.ASSIGNEE);
taskService.delegateTask(taskId, B_USER_ID);
taskService.delegateTask(taskId, C_USER_ID);
taskService.deleteUserIdentityLink(taskId, C_USER_ID, IdentityLinkType.ASSIGNEE);
historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
// Addition of A_USER, Deletion of A_USER, Addition of A_USER as owner,
// Addition of B_USER, Deletion of B_USER, Addition of C_USER, Deletion of C_USER
assertEquals(historicIdentityLinks.size(), 7);
// Query test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.userId(A_USER_ID).count(), 3);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.userId(B_USER_ID).count(), 2);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.userId(C_USER_ID).count(), 2);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.operationType(IDENTITY_LINK_ADD).count(), 4);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.operationType(IDENTITY_LINK_DELETE).count(), 3);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.type(IdentityLinkType.ASSIGNEE).count(), 6);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.type(IdentityLinkType.OWNER).count(), 1);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogRestServiceImpl method getHistoricIdentityLinks.
@Override
public List<HistoricIdentityLinkLogDto> getHistoricIdentityLinks(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
HistoricIdentityLinkLogQueryDto queryDto = new HistoricIdentityLinkLogQueryDto(objectMapper, uriInfo.getQueryParameters());
HistoricIdentityLinkLogQuery query = queryDto.toQuery(processEngine);
List<HistoricIdentityLinkLog> queryResult;
if (firstResult != null || maxResults != null) {
queryResult = executePaginatedQuery(query, firstResult, maxResults);
} else {
queryResult = query.list();
}
List<HistoricIdentityLinkLogDto> result = new ArrayList<HistoricIdentityLinkLogDto>();
for (HistoricIdentityLinkLog historicIdentityLink : queryResult) {
HistoricIdentityLinkLogDto dto = HistoricIdentityLinkLogDto.fromHistoricIdentityLink(historicIdentityLink);
result.add(dto);
}
return result;
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricIdentityLinkLogQueryTest method historicIdentityLinkForMultipleTenant.
@Test
public void historicIdentityLinkForMultipleTenant() {
startProcessInstanceForTenant(TENANT_1);
// Query test
HistoricIdentityLinkLog historicIdentityLink = historyService.createHistoricIdentityLinkLogQuery().singleResult();
assertEquals(historicIdentityLink.getTenantId(), TENANT_1);
// start process instance for another tenant
startProcessInstanceForTenant(TENANT_2);
// Query test
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 2);
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.tenantIdIn(TENANT_1).count(), 1);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.tenantIdIn(TENANT_2).count(), 1);
}
Aggregations