use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionSuspensionStateTest method delayedSuspendProcessDefinitionsForAllTenants.
@Test
public void delayedSuspendProcessDefinitionsForAllTenants() {
// given activated process definitions
engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).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 definitions
Job job = engineRule.getManagementService().createJobQuery().timers().singleResult();
assertThat(job, is(notNullValue()));
engineRule.getManagementService().executeJob(job.getId());
assertThat(query.active().count(), is(0L));
assertThat(query.suspended().count(), is(3L));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessDefinitionSuspensionStateTest method suspendProcessDefinitionForNonTenant.
@Test
public void suspendProcessDefinitionForNonTenant() {
// 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).processDefinitionWithoutTenantId().suspend();
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 delayedActivateProcessDefinitionsForTenant.
@Test
public void delayedActivateProcessDefinitionsForTenant() {
// given suspended process definitions
engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).processDefinitionTenantId(TENANT_ONE).executionDate(tomorrow()).activate();
ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery();
assertThat(query.suspended().count(), is(3L));
assertThat(query.active().count(), is(0L));
// when execute the job to activate the process definition
Job job = engineRule.getManagementService().createJobQuery().timers().singleResult();
assertThat(job, is(notNullValue()));
engineRule.getManagementService().executeJob(job.getId());
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 delayedSuspendProcessDefinitionsForTenant.
@Test
public void delayedSuspendProcessDefinitionsForTenant() {
// given activated process definitions
engineRule.getRepositoryService().updateProcessDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).processDefinitionTenantId(TENANT_ONE).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().tenantIdIn(TENANT_ONE).count(), is(1L));
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class ProcessDefinitionAuthorizationTest method testQueryWithReadPermissionOnOneTaskProcess.
public void testQueryWithReadPermissionOnOneTaskProcess() {
// given
// given user gets read permission on "oneTaskProcess" process definition
createGrantAuthorization(PROCESS_DEFINITION, ONE_TASK_PROCESS_KEY, userId, READ);
// when
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
// then
verifyQueryResults(query, 1);
ProcessDefinition definition = query.singleResult();
assertNotNull(definition);
assertEquals(ONE_TASK_PROCESS_KEY, definition.getKey());
}
Aggregations