Search in sources :

Example 21 with ExternalTaskQuery

use of org.camunda.bpm.engine.externaltask.ExternalTaskQuery in project camunda-bpm-platform by camunda.

the class ExternalTaskQueryAuthorizationTest method testQueryWithReadInstanceOnProcessDefinition.

public void testQueryWithReadInstanceOnProcessDefinition() {
    // given
    createGrantAuthorization(PROCESS_DEFINITION, "oneExternalTaskProcess", userId, READ_INSTANCE);
    // when
    ExternalTaskQuery query = externalTaskService.createExternalTaskQuery();
    // then
    verifyQueryResults(query, 1);
    assertEquals(instance1Id, query.list().get(0).getProcessInstanceId());
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery)

Example 22 with ExternalTaskQuery

use of org.camunda.bpm.engine.externaltask.ExternalTaskQuery in project camunda-bpm-platform by camunda.

the class ExternalTaskQueryAuthorizationTest method testQueryWithReadInstanceWithMultiple.

public void testQueryWithReadInstanceWithMultiple() {
    // given
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_INSTANCE);
    createGrantAuthorization(PROCESS_DEFINITION, "oneExternalTaskProcess", userId, READ_INSTANCE);
    createGrantAuthorization(PROCESS_INSTANCE, instance1Id, userId, READ);
    // when
    ExternalTaskQuery query = externalTaskService.createExternalTaskQuery();
    // then
    verifyQueryResults(query, 2);
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery)

Example 23 with ExternalTaskQuery

use of org.camunda.bpm.engine.externaltask.ExternalTaskQuery in project camunda-bpm-platform by camunda.

the class ExternalTaskQueryAuthorizationTest method testQueryWithReadInstanceOnAnyProcessDefinition.

public void testQueryWithReadInstanceOnAnyProcessDefinition() {
    // given
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_INSTANCE);
    // when
    ExternalTaskQuery query = externalTaskService.createExternalTaskQuery();
    // then
    verifyQueryResults(query, 2);
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery)

Example 24 with ExternalTaskQuery

use of org.camunda.bpm.engine.externaltask.ExternalTaskQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyProcessInstanceSuspensionStateTest method suspendProcessInstanceIncludingExternalTaskForTenant.

@Test
public void suspendProcessInstanceIncludingExternalTaskForTenant() {
    // given activated external tasks
    ExternalTaskQuery query = engineRule.getExternalTaskService().createExternalTaskQuery();
    assertThat(query.active().count(), is(3L));
    assertThat(query.suspended().count(), is(0L));
    engineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).processDefinitionTenantId(TENANT_ONE).suspend();
    assertThat(query.active().count(), is(2L));
    assertThat(query.suspended().count(), is(1L));
    assertThat(query.suspended().tenantIdIn(TENANT_ONE).count(), is(1L));
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery) Test(org.junit.Test)

Example 25 with ExternalTaskQuery

use of org.camunda.bpm.engine.externaltask.ExternalTaskQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyProcessInstanceSuspensionStateTest method activateProcessInstanceIncludingExternalTaskForNonTenant.

@Test
public void activateProcessInstanceIncludingExternalTaskForNonTenant() {
    // given suspended external tasks
    engineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
    ExternalTaskQuery query = engineRule.getExternalTaskService().createExternalTaskQuery();
    assertThat(query.active().count(), is(0L));
    assertThat(query.suspended().count(), is(3L));
    engineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).processDefinitionWithoutTenantId().activate();
    assertThat(query.suspended().count(), is(2L));
    assertThat(query.active().count(), is(1L));
    assertThat(query.active().singleResult().getTenantId(), is(nullValue()));
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery) Test(org.junit.Test)

Aggregations

ExternalTaskQuery (org.camunda.bpm.engine.externaltask.ExternalTaskQuery)35 Test (org.junit.Test)13 ExternalTask (org.camunda.bpm.engine.externaltask.ExternalTask)10 Batch (org.camunda.bpm.engine.batch.Batch)6 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)6 ArrayList (java.util.ArrayList)3 LockedExternalTask (org.camunda.bpm.engine.externaltask.LockedExternalTask)3 HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)3 ExternalTaskQueryDto (org.camunda.bpm.engine.rest.dto.externaltask.ExternalTaskQueryDto)3 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)3 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 HashMap (java.util.HashMap)2 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 ExternalTaskQueryImpl (org.camunda.bpm.engine.impl.ExternalTaskQueryImpl)2 Deployment (org.camunda.bpm.engine.test.Deployment)2 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)2 Matchers.anyString (org.mockito.Matchers.anyString)2 ExternalTaskService (org.camunda.bpm.engine.ExternalTaskService)1 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1