use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyMessageCorrelationCmdTenantCheckTest method correlateMessageToStartEventWithAuthenticatedTenant.
@Test
public void correlateMessageToStartEventWithAuthenticatedTenant() {
testRule.deployForTenant(TENANT_ONE, MESSAGE_START_PROCESS);
testRule.deployForTenant(TENANT_TWO, MESSAGE_START_PROCESS);
engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE));
engineRule.getRuntimeService().createMessageCorrelation("message").correlateStartMessage();
engineRule.getIdentityService().clearAuthentication();
ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyMessageCorrelationCmdTenantCheckTest method correlateMessageToStartEventDisabledTenantCheck.
@Test
public void correlateMessageToStartEventDisabledTenantCheck() {
testRule.deployForTenant(TENANT_ONE, MESSAGE_START_PROCESS);
testRule.deployForTenant(TENANT_TWO, MESSAGE_START_PROCESS);
engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false);
engineRule.getIdentityService().setAuthentication("user", null, null);
engineRule.getRuntimeService().createMessageCorrelation("message").tenantId(TENANT_ONE).correlateStartMessage();
ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancySignalReceiveCmdTenantCheckTest method sendSignalToStartEventDisabledTenantCheck.
@Test
public void sendSignalToStartEventDisabledTenantCheck() {
testRule.deployForTenant(TENANT_ONE, SIGNAL_START_PROCESS);
testRule.deployForTenant(TENANT_TWO, SIGNAL_START_PROCESS);
engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false);
engineRule.getIdentityService().setAuthentication("user", null, null);
engineRule.getRuntimeService().createSignalEvent("signal").send();
ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
assertThat(query.count(), is(2L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancySignalReceiveCmdTenantCheckTest method sendSignalToStartEventWithAuthenticatedTenant.
@Test
public void sendSignalToStartEventWithAuthenticatedTenant() {
testRule.deployForTenant(TENANT_ONE, SIGNAL_START_PROCESS);
testRule.deployForTenant(TENANT_TWO, SIGNAL_START_PROCESS);
engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE));
engineRule.getRuntimeService().createSignalEvent("signal").send();
engineRule.getIdentityService().clearAuthentication();
ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyStartProcessInstanceByConditionCmdTenantCheckTest method testWithAuthenticatedTenant.
@Test
public void testWithAuthenticatedTenant() throws Exception {
// given
testRule.deployForTenant(TENANT_ONE, PROCESS);
testRule.deployForTenant(TENANT_TWO, PROCESS);
ensureEventSubscriptions(2);
engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE));
Map<String, Object> variableMap = new HashMap<String, Object>();
variableMap.put("foo", "bar");
// when
List<ProcessInstance> processInstances = engineRule.getRuntimeService().createConditionEvaluation().setVariables(variableMap).tenantId(TENANT_ONE).evaluateStartConditions();
// then
assertNotNull(processInstances);
assertEquals(1, processInstances.size());
engineRule.getIdentityService().clearAuthentication();
ProcessInstanceQuery processInstanceQuery = engineRule.getRuntimeService().createProcessInstanceQuery();
assertEquals(1, processInstanceQuery.tenantIdIn(TENANT_ONE).count());
assertEquals(0, processInstanceQuery.tenantIdIn(TENANT_TWO).count());
}
Aggregations