Search in sources :

Example 11 with ExternalTaskQuery

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

the class MultiTenancyExternalTaskQueryTest method testQueryByTenantId.

public void testQueryByTenantId() {
    ExternalTaskQuery query = externalTaskService.createExternalTaskQuery().tenantIdIn(TENANT_ONE);
    assertThat(query.count(), is(1L));
    query = externalTaskService.createExternalTaskQuery().tenantIdIn(TENANT_TWO);
    assertThat(query.count(), is(1L));
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery)

Example 12 with ExternalTaskQuery

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

the class MultiTenancyExternalTaskQueryTest method testQueryNoAuthenticatedTenants.

public void testQueryNoAuthenticatedTenants() {
    identityService.setAuthentication("user", null, null);
    ExternalTaskQuery query = externalTaskService.createExternalTaskQuery();
    assertThat(query.count(), is(0L));
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery)

Example 13 with ExternalTaskQuery

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

the class MultiTenancyExternalTaskQueryTest method testQueryByNonExistingTenantId.

public void testQueryByNonExistingTenantId() {
    ExternalTaskQuery query = externalTaskService.createExternalTaskQuery().tenantIdIn("nonExisting");
    assertThat(query.count(), is(0L));
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery)

Example 14 with ExternalTaskQuery

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

the class MultiTenancyProcessInstanceSuspensionStateTest method activateProcessInstanceIncludingExternalTaskForTenant.

@Test
public void activateProcessInstanceIncludingExternalTaskForTenant() {
    // 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).processDefinitionTenantId(TENANT_ONE).activate();
    assertThat(query.suspended().count(), is(2L));
    assertThat(query.active().count(), is(1L));
    assertThat(query.active().tenantIdIn(TENANT_ONE).count(), is(1L));
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery) Test(org.junit.Test)

Example 15 with ExternalTaskQuery

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

the class SetExternalTasksRetriesBatchAuthorizationTest method testSetRetriesWithQueryAsync.

@Test
public void testSetRetriesWithQueryAsync() {
    // given
    ProcessDefinition processDefinition = testRule.deployAndGetDefinition(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS);
    ProcessInstance processInstance1 = engineRule.getRuntimeService().startProcessInstanceByKey("Process");
    List<ExternalTask> externalTasks;
    ExternalTaskQuery externalTaskQuery = engineRule.getExternalTaskService().createExternalTaskQuery();
    // when
    authRule.init(scenario).withUser("userId").bindResource("batchId", "*").bindResource("processInstance1", processInstance1.getId()).bindResource("processDefinition", processDefinition.getKey()).start();
    Batch batch = engineRule.getExternalTaskService().setRetriesAsync(null, externalTaskQuery, 5);
    if (batch != null) {
        executeSeedAndBatchJobs(batch);
    }
    // then
    if (authRule.assertScenario(scenario)) {
        externalTasks = engineRule.getExternalTaskService().createExternalTaskQuery().list();
        for (ExternalTask task : externalTasks) {
            Assert.assertEquals(5, (int) task.getRetries());
        }
    }
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery) HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) ExternalTask(org.camunda.bpm.engine.externaltask.ExternalTask) 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