use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.
the class JobAuthorizationTest method testQueryWithReadPermissionOnAnyProcessInstance.
public void testQueryWithReadPermissionOnAnyProcessInstance() {
// given
startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY);
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, READ);
// when
JobQuery query = managementService.createJobQuery();
// then
verifyQueryResults(query, 2);
}
use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyTimerStartEventTest method deleteJobsWhileUndeployment.
@Test
public void deleteJobsWhileUndeployment() {
Deployment deploymentForTenantOne = testRule.deployForTenant(TENANT_ONE, PROCESS);
Deployment deploymentForTenantTwo = testRule.deployForTenant(TENANT_TWO, PROCESS);
JobQuery query = managementService.createJobQuery();
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
repositoryService.deleteDeployment(deploymentForTenantOne.getId(), true);
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(0L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
repositoryService.deleteDeployment(deploymentForTenantTwo.getId(), true);
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(0L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
}
use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyTimerStartEventTest method dontCreateNewJobsWhileReDeployment.
@Test
public void dontCreateNewJobsWhileReDeployment() {
testRule.deployForTenant(TENANT_ONE, PROCESS);
testRule.deployForTenant(TENANT_TWO, PROCESS);
testRule.deployForTenant(TENANT_ONE, PROCESS);
JobQuery query = managementService.createJobQuery();
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
}
use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyProcessInstanceSuspensionStateTest method activateProcessInstanceIncludingJobForTenant.
@Test
public void activateProcessInstanceIncludingJobForTenant() {
// given suspended job
engineRule.getRuntimeService().updateProcessInstanceSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).suspend();
JobQuery query = engineRule.getManagementService().createJobQuery();
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));
}
use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyJobDefinitionSuspensionStateTest method suspendAndActivateJobDefinitionsIncludingJobsForAllTenants.
@Test
public void suspendAndActivateJobDefinitionsIncludingJobsForAllTenants() {
// given activated job definitions
JobQuery query = engineRule.getManagementService().createJobQuery();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
// first suspend
engineRule.getManagementService().updateJobDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).includeJobs(true).suspend();
assertThat(query.active().count(), is(0L));
assertThat(query.suspended().count(), is(3L));
// then activate
engineRule.getManagementService().updateJobDefinitionSuspensionState().byProcessDefinitionKey(PROCESS_DEFINITION_KEY).includeJobs(true).activate();
assertThat(query.active().count(), is(3L));
assertThat(query.suspended().count(), is(0L));
}
Aggregations