Search in sources :

Example 51 with HistoricProcessInstanceQuery

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

the class MultiTenancyHistoricProcessInstanceQueryTest method testQueryByTenantId.

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

Example 52 with HistoricProcessInstanceQuery

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

the class MultiTenancyHistoricProcessInstanceQueryTest method testQueryByTenantIds.

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

Example 53 with HistoricProcessInstanceQuery

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

the class MultiTenancyHistoricProcessInstanceQueryTest method testQueryAuthenticatedTenants.

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

Example 54 with HistoricProcessInstanceQuery

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

the class MultiTenancyHistoricProcessInstanceQueryTest method testQueryDisabledTenantCheck.

public void testQueryDisabledTenantCheck() {
    processEngineConfiguration.setTenantCheckEnabled(false);
    identityService.setAuthentication("user", null, null);
    HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
    assertThat(query.count(), is(2L));
}
Also used : HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)

Example 55 with HistoricProcessInstanceQuery

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

the class SetExternalTasksRetriesTest method shouldSetExternalTaskRetriesWithLargeList.

@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void shouldSetExternalTaskRetriesWithLargeList() {
    // given
    engineRule.getProcessEngineConfiguration().setBatchJobsPerSeed(1010);
    List<String> processIds = startProcessInstance(PROCESS_DEFINITION_KEY, 1100);
    HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery();
    // when
    Batch batch = externalTaskService.updateRetries().historicProcessInstanceQuery(processInstanceQuery).setAsync(3);
    createAndExecuteSeedJobs(batch.getSeedJobDefinitionId(), 2);
    executeBatchJobs(batch);
    // then no error is thrown
    assertHistoricBatchExists();
    // cleanup
    if (!testHelper.isHistoryLevelNone()) {
        batch = historyService.deleteHistoricProcessInstancesAsync(processIds, null);
        createAndExecuteSeedJobs(batch.getSeedJobDefinitionId(), 2);
        executeBatchJobs(batch);
    }
}
Also used : HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test) RequiredHistoryLevel(org.camunda.bpm.engine.test.RequiredHistoryLevel)

Aggregations

HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)71 Test (org.junit.Test)29 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)25 Batch (org.camunda.bpm.engine.batch.Batch)16 HistoricProcessInstanceQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto)14 HashMap (java.util.HashMap)12 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)11 Deployment (org.camunda.bpm.engine.test.Deployment)11 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)10 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)9 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)8 Matchers.anyString (org.mockito.Matchers.anyString)8 ArrayList (java.util.ArrayList)7 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)7 Response (com.jayway.restassured.response.Response)6 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)6 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)6 ExternalTask (org.camunda.bpm.engine.externaltask.ExternalTask)4 HistoricProcessInstanceQueryImpl (org.camunda.bpm.engine.impl.HistoricProcessInstanceQueryImpl)4 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)4