use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogTest method testShouldAddClaimTaskCandidateforAddIdentityLink.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testShouldAddClaimTaskCandidateforAddIdentityLink() {
// Pre test
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 0);
// given
startProcessInstance(PROCESS_DEFINITION_KEY);
String taskId = taskService.createTaskQuery().singleResult().getId();
taskService.claim(taskId, A_USER_ID);
historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 1);
// Query test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.userId(A_USER_ID).count(), 1);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.operationType(IDENTITY_LINK_ADD).count(), 1);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.operationType(IDENTITY_LINK_DELETE).count(), 0);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.type(IdentityLinkType.ASSIGNEE).count(), 1);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogTest method testShouldAddTaskAssigneeForAddandDeleteIdentityLink.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testShouldAddTaskAssigneeForAddandDeleteIdentityLink() {
// Pre test
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 0);
// given
startProcessInstance(PROCESS_DEFINITION_KEY);
String taskId = taskService.createTaskQuery().singleResult().getId();
// if
addAndDeleteUserWithAssigner(taskId, IdentityLinkType.ASSIGNEE);
// then
historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 2);
// Basic Query test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.type(IdentityLinkType.ASSIGNEE).count(), 2);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogTest method testShouldAddIdentityLinkForTaskCreationWithAssigneeAndOwner.
public void testShouldAddIdentityLinkForTaskCreationWithAssigneeAndOwner() {
String taskAssigneeId = "Assigneee";
String taskOwnerId = "Owner";
// Pre test
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 0);
Task taskAssignee = taskService.newTask(taskAssigneeId);
taskAssignee.setAssignee(USER_1);
taskService.saveTask(taskAssignee);
Task taskOwner = taskService.newTask(taskOwnerId);
taskOwner.setOwner(OWNER_1);
taskService.saveTask(taskOwner);
Task taskEmpty = taskService.newTask();
taskService.saveTask(taskEmpty);
// then
historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 2);
// Basic Query test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.type(IdentityLinkType.ASSIGNEE).count(), 1);
assertEquals(query.userId(USER_1).count(), 1);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.type(IdentityLinkType.OWNER).count(), 1);
assertEquals(query.userId(OWNER_1).count(), 1);
taskService.deleteTask(taskAssigneeId, true);
taskService.deleteTask(taskOwnerId, true);
taskService.deleteTask(taskEmpty.getId(), true);
}
Aggregations