use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogQueryTest method testInvalidIndividualQueryTaskCandidateForAddAndDeleteIdentityLink.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testInvalidIndividualQueryTaskCandidateForAddAndDeleteIdentityLink() {
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.addCandidateUser(taskId, A_USER_ID);
taskService.deleteCandidateUser(taskId, A_USER_ID);
// Invalid Individual Query test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.taskId(INVALID_TASK_ID).count(), 0);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.type(INVALID_IDENTITY_LINK_TYPE).count(), 0);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.userId(INVALID_USER_ID).count(), 0);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.groupId(INVALID_GROUP_ID).count(), 0);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.assignerId(INVALID_ASSIGNER_ID).count(), 0);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.operationType(INVALID_HISTORY_EVENT_TYPE).count(), 0);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogQueryTest method testInvalidGroupQueryTaskCandidateForAddAndDeleteIdentityLink.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testInvalidGroupQueryTaskCandidateForAddAndDeleteIdentityLink() {
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.addCandidateUser(taskId, A_USER_ID);
taskService.deleteCandidateUser(taskId, A_USER_ID);
// Invalid Individual Query test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.taskId(INVALID_TASK_ID).count(), 0);
assertEquals(query.type(INVALID_IDENTITY_LINK_TYPE).count(), 0);
assertEquals(query.userId(INVALID_USER_ID).count(), 0);
assertEquals(query.groupId(INVALID_GROUP_ID).count(), 0);
assertEquals(query.assignerId(INVALID_ASSIGNER_ID).count(), 0);
assertEquals(query.operationType(INVALID_HISTORY_EVENT_TYPE).count(), 0);
assertEquals(query.processDefinitionId(INVALID_PROCESS_DEFINITION_ID).count(), 0);
assertEquals(query.processDefinitionKey(INVALID_PROCESS_DEFINITION_KEY).count(), 0);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogTestByXml method testShouldAddProcessCandidateStarterGroupforAddIdentityLinkUsingXml.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/OneTaskProcessWithCandidateStarterGroups.bpmn20.xml" })
public void testShouldAddProcessCandidateStarterGroupforAddIdentityLinkUsingXml() {
// Pre test - Historical identity link is added as part of deployment
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 1);
// given
ProcessDefinition latestProcessDef = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY_CANDIDATE_STARTER_GROUP).singleResult();
assertNotNull(latestProcessDef);
List<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(latestProcessDef.getId());
assertEquals(1, links.size());
historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 1);
// query Test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.groupId(XML_GROUP).count(), 1);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogTestByXml method testShouldAddTaskCandidateforAddIdentityLinkUsingXml.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/OneTaskProcessWithCandidateUser.bpmn20.xml" })
public void testShouldAddTaskCandidateforAddIdentityLinkUsingXml() {
// Pre test
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 0);
// given
startProcessInstance(PROCESS_DEFINITION_KEY_CANDIDATE_USER);
historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 1);
// query Test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.userId(XML_USER).count(), 1);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery 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