use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog in project camunda-bpm-platform by camunda.
the class MockProvider method createMockHistoricIdentityLink.
public static HistoricIdentityLinkLog createMockHistoricIdentityLink(String tenantId) {
HistoricIdentityLinkLog identityLink = mock(HistoricIdentityLinkLog.class);
when(identityLink.getAssignerId()).thenReturn(EXAMPLE_HIST_IDENTITY_LINK_ASSIGNER_ID);
when(identityLink.getTenantId()).thenReturn(tenantId);
when(identityLink.getGroupId()).thenReturn(EXAMPLE_HIST_IDENTITY_LINK_GROUP_ID);
when(identityLink.getTaskId()).thenReturn(EXAMPLE_HIST_IDENTITY_LINK_TASK_ID);
when(identityLink.getUserId()).thenReturn(EXAMPLE_HIST_IDENTITY_LINK_USER_ID);
when(identityLink.getGroupId()).thenReturn(EXAMPLE_HIST_IDENTITY_LINK_GROUP_ID);
when(identityLink.getType()).thenReturn(EXAMPLE_HIST_IDENTITY_LINK_TYPE);
when(identityLink.getOperationType()).thenReturn(EXAMPLE_HIST_IDENTITY_LINK_OPERATION_TYPE);
when(identityLink.getProcessDefinitionId()).thenReturn(EXAMPLE_HIST_IDENTITY_LINK_PROC_DEFINITION_ID);
when(identityLink.getProcessDefinitionKey()).thenReturn(EXAMPLE_HIST_IDENTITY_LINK_PROC_DEFINITION_KEY);
when(identityLink.getTime()).thenReturn(DateTimeUtil.parseDate(EXAMPLE_HIST_IDENTITY_LINK_TIME));
return identityLink;
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricIdentityLinkLogQueryTest method addAndRemoveHistoricIdentityLinksForProcessDefinitionWithTenantId.
@Test
public void addAndRemoveHistoricIdentityLinksForProcessDefinitionWithTenantId() throws Exception {
String resourceName = "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml";
testRule.deployForTenant(TENANT_1, resourceName);
testRule.deployForTenant(TENANT_2, resourceName);
ProcessDefinition processDefinition1 = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).list().get(0);
ProcessDefinition processDefinition2 = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).list().get(1);
assertNotNull(processDefinition1);
assertNotNull(processDefinition2);
testTenantsByProcessDefinition(processDefinition1.getId());
testTenantsByProcessDefinition(processDefinition2.getId());
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 8);
// Query test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.tenantIdIn(TENANT_1).count(), 4);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.tenantIdIn(TENANT_2).count(), 4);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricIdentityLinkLogQueryTest method addandDeleteHistoricIdentityLinkForSingleTenant.
@Test
public void addandDeleteHistoricIdentityLinkForSingleTenant() {
startProcessInstanceForTenant(TENANT_1);
HistoricIdentityLinkLog historicIdentityLink = historyService.createHistoricIdentityLinkLogQuery().singleResult();
taskService.deleteCandidateUser(historicIdentityLink.getTaskId(), A_USER_ID);
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.tenantIdIn(TENANT_1).count(), 2);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog in project camunda-bpm-platform by camunda.
the class BulkHistoryDeleteTest method testCleanupHistoryCaseInstanceTaskIdentityLink.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testCleanupHistoryCaseInstanceTaskIdentityLink() {
// given
// create case instance
String caseInstanceId = caseService.createCaseInstanceByKey("oneTaskCase").getId();
Task task = taskService.createTaskQuery().singleResult();
// assume
taskService.addGroupIdentityLink(task.getId(), "accounting", IdentityLinkType.CANDIDATE);
int identityLinksForTask = taskService.getIdentityLinksForTask(task.getId()).size();
assertEquals(1, identityLinksForTask);
terminateAndCloseCaseInstance(caseInstanceId, null);
// when
historyService.deleteHistoricCaseInstancesBulk(Arrays.asList(caseInstanceId));
// then
List<HistoricIdentityLinkLog> historicIdentityLinkLog = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(0, historicIdentityLinkLog.size());
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLog in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogQueryTest method testValidGroupQueryTaskCandidateForAddAndDeleteIdentityLink.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/oneTaskProcess.bpmn20.xml" })
public void testValidGroupQueryTaskCandidateForAddAndDeleteIdentityLink() {
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.addCandidateUser(taskId, A_USER_ID);
taskService.deleteCandidateUser(taskId, A_USER_ID);
// Valid group query test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.taskId(taskId).count(), 2);
assertEquals(query.type(IdentityLinkType.CANDIDATE).count(), 2);
assertEquals(query.userId(A_USER_ID).count(), 2);
assertEquals(query.assignerId(A_ASSIGNER_ID).count(), 2);
assertEquals(query.processDefinitionId(processInstance.getProcessDefinitionId()).count(), 2);
assertEquals(query.processDefinitionKey(PROCESS_DEFINITION_KEY).count(), 2);
assertEquals(query.operationType(IDENTITY_LINK_DELETE).count(), 1);
assertEquals(query.operationType(IDENTITY_LINK_ADD).count(), 1);
}
Aggregations