use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogRestServiceQueryTest method setUpMockHistoricIdentityLinkQuery.
private HistoricIdentityLinkLogQuery setUpMockHistoricIdentityLinkQuery(List<HistoricIdentityLinkLog> mockedHistoricIdentityLinks) {
HistoricIdentityLinkLogQuery mockedHistoricIdentityLinkQuery = mock(HistoricIdentityLinkLogQuery.class);
when(mockedHistoricIdentityLinkQuery.list()).thenReturn(mockedHistoricIdentityLinks);
when(mockedHistoricIdentityLinkQuery.count()).thenReturn((long) mockedHistoricIdentityLinks.size());
when(processEngine.getHistoryService().createHistoricIdentityLinkLogQuery()).thenReturn(mockedHistoricIdentityLinkQuery);
return mockedHistoricIdentityLinkQuery;
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricIdentityLinkLogQueryTest method singleQueryForMultipleTenant.
@Test
public void singleQueryForMultipleTenant() {
startProcessInstanceForTenant(TENANT_1);
startProcessInstanceForTenant(TENANT_2);
startProcessInstanceForTenant(TENANT_3);
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.tenantIdIn(TENANT_1, TENANT_2).count(), 2);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.tenantIdIn(TENANT_2, TENANT_3).count(), 2);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.tenantIdIn(TENANT_1, TENANT_2, TENANT_3).count(), 3);
}
use of org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery 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.HistoricIdentityLinkLogQuery 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.HistoricIdentityLinkLogQuery in project camunda-bpm-platform by camunda.
the class HistoricIdentityLinkLogAuthorizationTest method testQueryForStandaloneTaskHistoricIdentityLinkWithoutAuthrorization.
// historic identity link query (standalone task) - Authorization
public void testQueryForStandaloneTaskHistoricIdentityLinkWithoutAuthrorization() {
// given
disableAuthorization();
Task taskAssignee = taskService.newTask("newTask");
taskAssignee.setAssignee("aUserId");
taskService.saveTask(taskAssignee);
enableAuthorization();
// when
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
// then
verifyQueryResults(query, 1);
disableAuthorization();
taskService.deleteTask("newTask", true);
enableAuthorization();
}
Aggregations