use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionQueryTest method testQueryByTenantIdsIncludeDefinitionsWithoutTenantId.
public void testQueryByTenantIdsIncludeDefinitionsWithoutTenantId() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().tenantIdIn(TENANT_ONE).includeProcessDefinitionsWithoutTenantId();
assertThat(query.count(), is(2L));
query = repositoryService.createProcessDefinitionQuery().tenantIdIn(TENANT_TWO).includeProcessDefinitionsWithoutTenantId();
assertThat(query.count(), is(2L));
query = repositoryService.createProcessDefinitionQuery().tenantIdIn(TENANT_ONE, TENANT_TWO).includeProcessDefinitionsWithoutTenantId();
assertThat(query.count(), is(3L));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionQueryTest method testQueryNoAuthenticatedTenants.
public void testQueryNoAuthenticatedTenants() {
identityService.setAuthentication("user", null, null);
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
assertThat(query.count(), is(1L));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionQueryTest method testQueryByTenantId.
public void testQueryByTenantId() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().tenantIdIn(TENANT_ONE);
assertThat(query.count(), is(1L));
query = repositoryService.createProcessDefinitionQuery().tenantIdIn(TENANT_TWO);
assertThat(query.count(), is(1L));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionSuspensionStateTest method delayedSuspendProcessDefinitionsForNonTenant.
@Test
public void delayedSuspendProcessDefinitionsForNonTenant() {
// given activated process definitions
engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).processDefinitionWithoutTenantId().executionDate(tomorrow()).suspend();
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
// when execute the job to suspend the process definition
Job job = engineRule.getManagementService().createJobQuery().timers().singleResult();
assertThat(job, is(notNullValue()));
engineRule.getManagementService().executeJob(job.getId());
assertThat(query.active().count(), is(2L));
assertThat(query.suspended().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 activateProcessDefinitionForNonTenant.
@Test
public void activateProcessDefinitionForNonTenant() {
// 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).processDefinitionWithoutTenantId().activate();
assertThat(query.suspended().count(), is(2L));
assertThat(query.active().count(), is(1L));
assertThat(query.active().withoutTenantId().count(), is(1L));
}
Aggregations