Search in sources :

Example 16 with ProcessInstanceQuery

use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyMessageCorrelationTest method correlateStartMessageWithoutTenantId.

@Test
public void correlateStartMessageWithoutTenantId() {
    testRule.deploy(MESSAGE_START_PROCESS);
    testRule.deployForTenant(TENANT_ONE, MESSAGE_START_PROCESS);
    engineRule.getRuntimeService().createMessageCorrelation("message").withoutTenantId().correlateStartMessage();
    ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
    assertThat(query.count(), is(1L));
    assertThat(query.singleResult().getTenantId(), is(nullValue()));
}
Also used : ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) Test(org.junit.Test)

Example 17 with ProcessInstanceQuery

use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyMessageCorrelationTest method correlateMessageToStartEventWithTenantId.

@Test
public void correlateMessageToStartEventWithTenantId() {
    testRule.deployForTenant(TENANT_ONE, MESSAGE_START_PROCESS);
    testRule.deployForTenant(TENANT_TWO, MESSAGE_START_PROCESS);
    engineRule.getRuntimeService().createMessageCorrelation("message").tenantId(TENANT_ONE).correlate();
    ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
}
Also used : ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) Test(org.junit.Test)

Example 18 with ProcessInstanceQuery

use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyMessageCorrelationTest method correlateMessageToStartEventNoTenantIdSetForTenant.

@Test
public void correlateMessageToStartEventNoTenantIdSetForTenant() {
    testRule.deployForTenant(TENANT_ONE, MESSAGE_START_PROCESS);
    engineRule.getRuntimeService().createMessageCorrelation("message").correlate();
    ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
}
Also used : ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) Test(org.junit.Test)

Example 19 with ProcessInstanceQuery

use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyProcessInstantiationTest method testStartProcessInstanceByIdAuthenticatedTenant.

public void testStartProcessInstanceByIdAuthenticatedTenant() {
    deploymentForTenant(TENANT_ONE, PROCESS);
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    runtimeService.createProcessInstanceById(processDefinition.getId()).execute();
    ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
    assertThat(query.count(), is(1L));
    assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
}
Also used : HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition)

Example 20 with ProcessInstanceQuery

use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.

the class MultiTenancyProcessInstantiationTest method testStartProcessInstanceByKeyWithoutTenantId.

public void testStartProcessInstanceByKeyWithoutTenantId() {
    deployment(PROCESS);
    deploymentForTenant(TENANT_ONE, PROCESS);
    runtimeService.createProcessInstanceByKey("testProcess").processDefinitionWithoutTenantId().execute();
    ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
    assertThat(query.count(), is(1L));
    assertThat(query.singleResult().getTenantId(), is(nullValue()));
}
Also used : HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery)

Aggregations

ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)201 Test (org.junit.Test)127 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)59 Deployment (org.camunda.bpm.engine.test.Deployment)42 HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)34 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)27 HashMap (java.util.HashMap)24 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)19 Batch (org.camunda.bpm.engine.batch.Batch)18 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)17 ArrayList (java.util.ArrayList)16 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)15 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)15 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)14 ExecutionQuery (org.camunda.bpm.engine.runtime.ExecutionQuery)12 HistoricProcessInstanceQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto)9 Job (org.camunda.bpm.engine.runtime.Job)9 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)8 AbstractAsyncOperationsTest (org.camunda.bpm.engine.test.api.AbstractAsyncOperationsTest)8 Response (com.jayway.restassured.response.Response)7