Search in sources :

Example 6 with HistoricActivityInstanceQuery

use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyHistoricActivityInstanceQueryTest method testQueryByTenantId.

public void testQueryByTenantId() {
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().tenantIdIn(TENANT_ONE);
    assertThat(query.count(), is(2L));
    query = historyService.createHistoricActivityInstanceQuery().tenantIdIn(TENANT_TWO);
    assertThat(query.count(), is(2L));
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery)

Example 7 with HistoricActivityInstanceQuery

use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyHistoricActivityInstanceQueryTest method testQueryNoAuthenticatedTenants.

public void testQueryNoAuthenticatedTenants() {
    identityService.setAuthentication("user", null, null);
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    assertThat(query.count(), is(0L));
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery)

Example 8 with HistoricActivityInstanceQuery

use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyHistoricActivityInstanceQueryTest method testQueryAuthenticatedTenants.

public void testQueryAuthenticatedTenants() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    assertThat(query.count(), is(4L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(2L));
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery)

Example 9 with HistoricActivityInstanceQuery

use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceAuthorizationTest method testQueryAfterDeletingDeployment.

// delete deployment (cascade = false)
public void testQueryAfterDeletingDeployment() {
    // given
    startProcessInstanceByKey(PROCESS_KEY);
    startProcessInstanceByKey(PROCESS_KEY);
    startProcessInstanceByKey(PROCESS_KEY);
    createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
    disableAuthorization();
    List<Task> tasks = taskService.createTaskQuery().list();
    for (Task task : tasks) {
        taskService.complete(task.getId());
    }
    enableAuthorization();
    disableAuthorization();
    repositoryService.deleteDeployment(deploymentId);
    enableAuthorization();
    // when
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    // then
    verifyQueryResults(query, 9);
    disableAuthorization();
    List<HistoricProcessInstance> instances = historyService.createHistoricProcessInstanceQuery().list();
    for (HistoricProcessInstance instance : instances) {
        historyService.deleteHistoricProcessInstance(instance.getId());
    }
    enableAuthorization();
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery) Task(org.camunda.bpm.engine.task.Task) HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance)

Example 10 with HistoricActivityInstanceQuery

use of org.camunda.bpm.engine.history.HistoricActivityInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceAuthorizationTest method testSimpleQueryWithReadHistoryPermissionOnProcessDefinition.

public void testSimpleQueryWithReadHistoryPermissionOnProcessDefinition() {
    // given
    startProcessInstanceByKey(PROCESS_KEY);
    createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
    // when
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    // then
    verifyQueryResults(query, 2);
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery)

Aggregations

HistoricActivityInstanceQuery (org.camunda.bpm.engine.history.HistoricActivityInstanceQuery)59 Deployment (org.camunda.bpm.engine.test.Deployment)35 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)18 Task (org.camunda.bpm.engine.task.Task)18 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)17 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)13 Execution (org.camunda.bpm.engine.runtime.Execution)4 Test (org.junit.Test)4 Job (org.camunda.bpm.engine.runtime.Job)3 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)3 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)3 Response (com.jayway.restassured.response.Response)2 ArrayList (java.util.ArrayList)2 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 InOrder (org.mockito.InOrder)2 HashMap (java.util.HashMap)1 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)1 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)1 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)1