Search in sources :

Example 36 with TaskQuery

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

the class MultiTenancySignalReceiveTest method throwEndSignalForNonTenant.

@Test
public void throwEndSignalForNonTenant() {
    testRule.deploy(SIGNAL_START_PROCESS, SIGNAL_CATCH_PROCESS, SIGNAL_END_THROW_PROCESS);
    testRule.deployForTenant(TENANT_ONE, SIGNAL_START_PROCESS, SIGNAL_CATCH_PROCESS);
    engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").processDefinitionWithoutTenantId().execute();
    engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").processDefinitionTenantId(TENANT_ONE).execute();
    engineRule.getRuntimeService().startProcessInstanceByKey("signalThrow");
    TaskQuery query = engineRule.getTaskService().createTaskQuery();
    assertThat(query.withoutTenantId().count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(0L));
}
Also used : TaskQuery(org.camunda.bpm.engine.task.TaskQuery) Test(org.junit.Test)

Example 37 with TaskQuery

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

the class MultiTenancySignalReceiveTest method sendSignalToStartAndIntermediateCatchEventForMultipleTenants.

@Test
public void sendSignalToStartAndIntermediateCatchEventForMultipleTenants() {
    testRule.deployForTenant(TENANT_ONE, SIGNAL_CATCH_PROCESS);
    testRule.deployForTenant(TENANT_TWO, SIGNAL_START_PROCESS);
    engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").execute();
    engineRule.getRuntimeService().createSignalEvent("signal").send();
    TaskQuery query = engineRule.getTaskService().createTaskQuery();
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
}
Also used : TaskQuery(org.camunda.bpm.engine.task.TaskQuery) Test(org.junit.Test)

Example 38 with TaskQuery

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

the class MultiTenancySignalReceiveTest method sendSignalToStartAndIntermediateCatchEventForTenant.

@Test
public void sendSignalToStartAndIntermediateCatchEventForTenant() {
    testRule.deployForTenant(TENANT_ONE, SIGNAL_START_PROCESS, SIGNAL_CATCH_PROCESS);
    testRule.deployForTenant(TENANT_TWO, SIGNAL_START_PROCESS, SIGNAL_CATCH_PROCESS);
    engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").processDefinitionTenantId(TENANT_ONE).execute();
    engineRule.getRuntimeService().createProcessInstanceByKey("signalCatch").processDefinitionTenantId(TENANT_TWO).execute();
    engineRule.getRuntimeService().createSignalEvent("signal").tenantId(TENANT_ONE).send();
    engineRule.getRuntimeService().createSignalEvent("signal").tenantId(TENANT_TWO).send();
    TaskQuery query = engineRule.getTaskService().createTaskQuery();
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(2L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(2L));
}
Also used : TaskQuery(org.camunda.bpm.engine.task.TaskQuery) Test(org.junit.Test)

Example 39 with TaskQuery

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

the class MultiTenancyProcessInstanceSuspensionStateTest method activateProcessInstanceIncludingUserTaskForTenant.

@Test
public void activateProcessInstanceIncludingUserTaskForTenant() {
    // given suspended user tasks
    engineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
    TaskQuery query = engineRule.getTaskService().createTaskQuery();
    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 : TaskQuery(org.camunda.bpm.engine.task.TaskQuery) ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery) Test(org.junit.Test)

Example 40 with TaskQuery

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

the class MultiTenancyProcessInstanceSuspensionStateTest method suspendProcessInstanceIncludingUserTaskForNonTenant.

@Test
public void suspendProcessInstanceIncludingUserTaskForNonTenant() {
    // given activated user tasks
    TaskQuery query = engineRule.getTaskService().createTaskQuery();
    assertThat(query.active().count(), is(3L));
    assertThat(query.suspended().count(), is(0L));
    engineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).processDefinitionWithoutTenantId().suspend();
    assertThat(query.active().count(), is(2L));
    assertThat(query.suspended().count(), is(1L));
    assertThat(query.suspended().withoutTenantId().count(), is(1L));
}
Also used : TaskQuery(org.camunda.bpm.engine.task.TaskQuery) ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery) 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