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));
}
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));
}
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));
}
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));
}
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());
}
}
}
Aggregations