use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionSuspensionStateTest method suspendAndActivateProcessDefinitionsForAllTenants.
@Test
public void suspendAndActivateProcessDefinitionsForAllTenants() {
// given activated process definitions
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
// first suspend
engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
assertThat(query.active().count(), is(0L));
assertThat(query.suspended().count(), is(3L));
// then activate
engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).activate();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionSuspensionStateTest method suspendProcessDefinitionDisabledTenantCheck.
@Test
public void suspendProcessDefinitionDisabledTenantCheck() {
// given activated process definitions
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
ProcessEngineConfigurationImpl processEngineConfiguration = engineRule.getProcessEngineConfiguration();
processEngineConfiguration.setTenantCheckEnabled(false);
engineRule.getIdentityService().setAuthentication("user", null, null);
engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
assertThat(query.active().count(), is(0L));
assertThat(query.suspended().count(), is(3L));
assertThat(query.suspended().tenantIdIn(TENANT_ONE, TENANT_TWO).includeProcessDefinitionsWithoutTenantId().count(), is(3L));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionSuspensionStateTest method activateProcessDefinitionForTenant.
@Test
public void activateProcessDefinitionForTenant() {
// given suspend process definitions
engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.suspended().count(), is(3L));
assertThat(query.active().count(), is(0L));
engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().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));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionSuspensionStateTest method suspendProcessDefinitionWithAuthenticatedTenant.
@Test
public void suspendProcessDefinitionWithAuthenticatedTenant() {
// given activated process definitions
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE));
engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().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().tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.suspended().withoutTenantId().count(), is(1L));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionSuspensionStateTest method suspendProcessDefinitionForTenant.
@Test
public void suspendProcessDefinitionForTenant() {
// given activated process definitions
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).processDefinitionTenantId(TENANT_ONE).suspend();
assertThat(query.active().count(), is(2L));
assertThat(query.suspended().count(), is(1L));
assertThat(query.suspended().tenantIdIn(TENANT_ONE).count(), is(1L));
}
Aggregations