Search in sources :

Example 26 with TaskQuery

use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyFilterServiceTest method testFilterTasksWithAuthenticatedTenant.

public void testFilterTasksWithAuthenticatedTenant() {
    TaskQuery query = taskService.createTaskQuery();
    filterId = createFilter(query);
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    assertThat(filterService.count(filterId), is(2L));
}
Also used : TaskQuery(org.camunda.bpm.engine.task.TaskQuery)

Example 27 with TaskQuery

use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyFilterServiceTest method testFilterTasksByTenantIds.

public void testFilterTasksByTenantIds() {
    TaskQuery query = taskService.createTaskQuery().tenantIdIn(TENANT_IDS);
    filterId = createFilter(query);
    assertThat(filterService.count(filterId), is(2L));
    TaskQuery extendingQuery = taskService.createTaskQuery().taskName("testTask");
    assertThat(filterService.count(filterId, extendingQuery), is(2L));
}
Also used : TaskQuery(org.camunda.bpm.engine.task.TaskQuery)

Example 28 with TaskQuery

use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyFilterServiceTest method testFilterTasksWithAuthenticatedTenants.

public void testFilterTasksWithAuthenticatedTenants() {
    TaskQuery query = taskService.createTaskQuery();
    filterId = createFilter(query);
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));
    assertThat(filterService.count(filterId), is(3L));
}
Also used : TaskQuery(org.camunda.bpm.engine.task.TaskQuery)

Example 29 with TaskQuery

use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyMessageCorrelationTest method correlateMessageToStartAndIntermediateCatchEventWithTenantId.

@Test
public void correlateMessageToStartAndIntermediateCatchEventWithTenantId() {
    testRule.deployForTenant(TENANT_ONE, MESSAGE_START_PROCESS, MESSAGE_CATCH_PROCESS);
    testRule.deployForTenant(TENANT_TWO, MESSAGE_START_PROCESS, MESSAGE_CATCH_PROCESS);
    engineRule.getRuntimeService().createProcessInstanceByKey("messageCatch").processDefinitionTenantId(TENANT_ONE).execute();
    engineRule.getRuntimeService().createProcessInstanceByKey("messageCatch").processDefinitionTenantId(TENANT_TWO).execute();
    engineRule.getRuntimeService().createMessageCorrelation("message").tenantId(TENANT_ONE).correlateAll();
    TaskQuery query = engineRule.getTaskService().createTaskQuery();
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
}
Also used : TaskQuery(org.camunda.bpm.engine.task.TaskQuery) Test(org.junit.Test)

Example 30 with TaskQuery

use of org.camunda.bpm.engine.task.TaskQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyMessageCorrelationTest method correlateMessageToIntermediateCatchEventWithoutTenantId.

@Test
public void correlateMessageToIntermediateCatchEventWithoutTenantId() {
    testRule.deploy(MESSAGE_CATCH_PROCESS);
    testRule.deployForTenant(TENANT_ONE, MESSAGE_CATCH_PROCESS);
    engineRule.getRuntimeService().createProcessInstanceByKey("messageCatch").processDefinitionWithoutTenantId().execute();
    engineRule.getRuntimeService().createProcessInstanceByKey("messageCatch").processDefinitionTenantId(TENANT_ONE).execute();
    engineRule.getRuntimeService().createMessageCorrelation("message").withoutTenantId().correlate();
    TaskQuery query = engineRule.getTaskService().createTaskQuery();
    assertThat(query.count(), is(1L));
    assertThat(query.singleResult().getTenantId(), is(nullValue()));
}
Also used : TaskQuery(org.camunda.bpm.engine.task.TaskQuery) Test(org.junit.Test)

Aggregations

TaskQuery (org.camunda.bpm.engine.task.TaskQuery)517 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)230 Task (org.camunda.bpm.engine.task.Task)227 Test (org.junit.Test)224 Deployment (org.camunda.bpm.engine.test.Deployment)195 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)124 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)86 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)55 Filter (org.camunda.bpm.engine.filter.Filter)26 TaskQueryImpl (org.camunda.bpm.engine.impl.TaskQueryImpl)24 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)23 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)22 Execution (org.camunda.bpm.engine.runtime.Execution)22 Job (org.camunda.bpm.engine.runtime.Job)20 ExecutionQuery (org.camunda.bpm.engine.runtime.ExecutionQuery)17 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)15 Date (java.util.Date)12 HashMap (java.util.HashMap)12 SequenceFlow (org.camunda.bpm.model.bpmn.instance.SequenceFlow)12 CamundaExecutionListener (org.camunda.bpm.model.bpmn.instance.camunda.CamundaExecutionListener)12