Search in sources :

Example 26 with ProcessInstanceQuery

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

the class MultiTenancyProcessDefinitionSuspensionStateTest method suspendProcessDefinitionIncludeInstancesForTenant.

@Test
public void suspendProcessDefinitionIncludeInstancesForTenant() {
    // given activated process instances
    ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
    assertThat(query.active().count(), is(3L));
    assertThat(query.suspended().count(), is(0L));
    engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).processDefinitionTenantId(TENANT_ONE).includeProcessInstances(true).suspend();
    assertThat(query.active().count(), is(2L));
    assertThat(query.suspended().count(), is(1L));
    assertThat(query.suspended().tenantIdIn(TENANT_ONE).count(), is(1L));
}
Also used : ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) Test(org.junit.Test)

Example 27 with ProcessInstanceQuery

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

the class MultiTenancyProcessInstanceSuspensionStateTest method activateProcessInstanceForNonTenant.

@Test
public void activateProcessInstanceForNonTenant() {
    // given suspended process instances
    engineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
    ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
    assertThat(query.active().count(), is(0L));
    assertThat(query.suspended().count(), is(3L));
    engineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).processDefinitionWithoutTenantId().activate();
    assertThat(query.suspended().count(), is(2L));
    assertThat(query.active().count(), is(1L));
    assertThat(query.active().withoutTenantId().count(), is(1L));
}
Also used : ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) Test(org.junit.Test)

Example 28 with ProcessInstanceQuery

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

the class MultiTenancyProcessInstanceSuspensionStateTest method suspendProcessInstanceWithAuthenticatedTenant.

@Test
public void suspendProcessInstanceWithAuthenticatedTenant() {
    // given activated process instances
    ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
    assertThat(query.active().count(), is(3L));
    assertThat(query.suspended().count(), is(0L));
    engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    engineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
    engineRule.getIdentityService().clearAuthentication();
    assertThat(query.active().count(), is(1L));
    assertThat(query.suspended().count(), is(2L));
    assertThat(query.active().tenantIdIn(TENANT_TWO).count(), is(1L));
    assertThat(query.suspended().withoutTenantId().count(), is(1L));
    assertThat(query.suspended().tenantIdIn(TENANT_ONE).count(), is(1L));
}
Also used : ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) Test(org.junit.Test)

Example 29 with ProcessInstanceQuery

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

the class MultiTenancyProcessInstanceSuspensionStateTest method suspendProcessInstanceForNonTenant.

@Test
public void suspendProcessInstanceForNonTenant() {
    // given activated process instances
    ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
    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 : ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) Test(org.junit.Test)

Example 30 with ProcessInstanceQuery

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

the class MultiTenancyProcessInstanceSuspensionStateTest method activateProcessInstanceForTenant.

@Test
public void activateProcessInstanceForTenant() {
    // given suspended process instances
    engineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
    ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery();
    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 : ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) Test(org.junit.Test)

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