Search in sources :

Example 26 with JobQuery

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));
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery)

Example 27 with JobQuery

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));
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery)

Example 28 with JobQuery

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);
    }
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) Job(org.camunda.bpm.engine.runtime.Job) ParseException(java.text.ParseException)

Example 29 with JobQuery

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);
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery)

Example 30 with JobQuery

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);
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery)

Aggregations

JobQuery (org.camunda.bpm.engine.runtime.JobQuery)255 Deployment (org.camunda.bpm.engine.test.Deployment)143 Job (org.camunda.bpm.engine.runtime.Job)115 HashMap (java.util.HashMap)105 JobDefinitionQuery (org.camunda.bpm.engine.management.JobDefinitionQuery)88 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)73 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)55 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)41 Test (org.junit.Test)32 Date (java.util.Date)30 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)23 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)17 ExecutionQuery (org.camunda.bpm.engine.runtime.ExecutionQuery)14 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)9 Task (org.camunda.bpm.engine.task.Task)8 Batch (org.camunda.bpm.engine.batch.Batch)5 AbstractAsyncOperationsTest (org.camunda.bpm.engine.test.api.AbstractAsyncOperationsTest)5 ActivitySequenceCounterMap (org.camunda.bpm.engine.test.standalone.entity.ExecutionOrderListener.ActivitySequenceCounterMap)5 Matchers.anyString (org.mockito.Matchers.anyString)5 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)3