use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyJobQueryTest method testQueryNoAuthenticatedTenants.
public void testQueryNoAuthenticatedTenants() {
identityService.setAuthentication("user", null, null);
JobQuery query = managementService.createJobQuery();
assertThat(query.count(), is(1L));
}
use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyJobQueryTest method testQueryByTenantIdsIncludeJobsWithoutTenantId.
public void testQueryByTenantIdsIncludeJobsWithoutTenantId() {
JobQuery query = managementService.createJobQuery().tenantIdIn(TENANT_ONE).includeJobsWithoutTenantId();
assertThat(query.count(), is(2L));
query = managementService.createJobQuery().tenantIdIn(TENANT_TWO).includeJobsWithoutTenantId();
assertThat(query.count(), is(2L));
query = managementService.createJobQuery().tenantIdIn(TENANT_ONE, TENANT_TWO).includeJobsWithoutTenantId();
assertThat(query.count(), is(3L));
}
use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.
the class FoxJobRetryCmdTest method waitForExecutedJobWithRetriesLeft.
protected void waitForExecutedJobWithRetriesLeft(int retriesLeft, String jobId) {
JobQuery jobQuery = managementService.createJobQuery();
if (jobId != null) {
jobQuery.jobId(jobId);
}
Job job = jobQuery.singleResult();
try {
managementService.executeJob(job.getId());
} catch (Exception e) {
}
// update job
job = jobQuery.singleResult();
if (job.getRetries() != retriesLeft) {
waitForExecutedJobWithRetriesLeft(retriesLeft, jobId);
}
}
use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.
the class JobAuthorizationTest method testQueryWithoutAuthorization.
// job query (jobs associated to a process) //////////////////////////////////////////////////
public void testQueryWithoutAuthorization() {
// given
startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY);
// when
JobQuery query = managementService.createJobQuery();
// then
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.
the class JobAuthorizationTest method testQueryWithReadInstancePermissionOnAnyProcessDefinition.
public void testQueryWithReadInstancePermissionOnAnyProcessDefinition() {
// given
startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_INSTANCE);
// when
JobQuery query = managementService.createJobQuery();
// then
verifyQueryResults(query, 2);
}
Aggregations