Search in sources :

Example 1 with HistoricIdentityLinkLogQuery

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;
}
Also used : HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery)

Example 2 with HistoricIdentityLinkLogQuery

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);
}
Also used : HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery) Test(org.junit.Test)

Example 3 with HistoricIdentityLinkLogQuery

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);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery) Test(org.junit.Test)

Example 4 with HistoricIdentityLinkLogQuery

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);
}
Also used : HistoricIdentityLinkLog(org.camunda.bpm.engine.history.HistoricIdentityLinkLog) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery) Test(org.junit.Test)

Example 5 with HistoricIdentityLinkLogQuery

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();
}
Also used : Task(org.camunda.bpm.engine.task.Task) HistoricIdentityLinkLogQuery(org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery)

Aggregations

HistoricIdentityLinkLogQuery (org.camunda.bpm.engine.history.HistoricIdentityLinkLogQuery)33 HistoricIdentityLinkLog (org.camunda.bpm.engine.history.HistoricIdentityLinkLog)23 Deployment (org.camunda.bpm.engine.test.Deployment)19 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)4 Test (org.junit.Test)4 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)3 IdentityLink (org.camunda.bpm.engine.task.IdentityLink)3 Task (org.camunda.bpm.engine.task.Task)3 HistoricIdentityLinkLogQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricIdentityLinkLogQueryDto)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricIdentityLinkLogDto (org.camunda.bpm.engine.rest.dto.history.HistoricIdentityLinkLogDto)1