use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogQueryTest method testGroupQueryTaskCandidateForAddAndDeleteIdentityLink.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testGroupQueryTaskCandidateForAddAndDeleteIdentityLink() {
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 0);
// given
ProcessInstance processInstance = startProcessInstance(PROCESS_DEFINITION_KEY);
String taskId = taskService.createTaskQuery().singleResult().getId();
// if
identityService.setAuthenticatedUserId(A_ASSIGNER_ID);
taskService.addCandidateGroup(taskId, A_GROUP_ID);
// Query test
HistoricIdentityLinkLog historicIdentityLink = historyService.createHistoricIdentityLinkLogQuery().singleResult();
assertEquals(historicIdentityLink.getUserId(), null);
assertEquals(historicIdentityLink.getTaskId(), taskId);
assertEquals(historicIdentityLink.getType(), IdentityLinkType.CANDIDATE);
assertEquals(historicIdentityLink.getAssignerId(), A_ASSIGNER_ID);
assertEquals(historicIdentityLink.getGroupId(), A_GROUP_ID);
assertEquals(historicIdentityLink.getOperationType(), IDENTITY_LINK_ADD);
assertEquals(historicIdentityLink.getProcessDefinitionId(), processInstance.getProcessDefinitionId());
assertEquals(historicIdentityLink.getProcessDefinitionKey(), PROCESS_DEFINITION_KEY);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog 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.HistoricIdentityLinkLog 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.HistoricIdentityLinkLog 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.HistoricIdentityLinkLog 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);
}
Aggregations