Search in sources :

Example 66 with JobQuery

use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.

the class JobQueryTest method testQueryByActive.

public void testQueryByActive() {
    JobQuery query = managementService.createJobQuery().active();
    verifyQueryResults(query, 4);
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery)

Example 67 with JobQuery

use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.

the class JobQueryTest method testQueryByActivityId.

public void testQueryByActivityId() {
    JobDefinition jobDefinition = managementService.createJobDefinitionQuery().singleResult();
    JobQuery query = managementService.createJobQuery().activityId(jobDefinition.getActivityId());
    verifyQueryResults(query, 3);
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) JobDefinition(org.camunda.bpm.engine.management.JobDefinition)

Example 68 with JobQuery

use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.

the class JobQueryTest method testQueryByDuedateLowerThenOrEqual.

public void testQueryByDuedateLowerThenOrEqual() {
    JobQuery query = managementService.createJobQuery().duedateLowerThenOrEquals(testStartTime);
    verifyQueryResults(query, 0);
    query = managementService.createJobQuery().duedateLowerThenOrEquals(timerOneFireTime);
    verifyQueryResults(query, 1);
    query = managementService.createJobQuery().duedateLowerThenOrEquals(timerTwoFireTime);
    verifyQueryResults(query, 2);
    query = managementService.createJobQuery().duedateLowerThenOrEquals(timerThreeFireTime);
    verifyQueryResults(query, 3);
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery)

Example 69 with JobQuery

use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.

the class JobQueryTest method testTimeCycleQueryByProcessDefinitionId.

@Deployment
public void testTimeCycleQueryByProcessDefinitionId() {
    String processDefinitionId = repositoryService.createProcessDefinitionQuery().processDefinitionKey("process").singleResult().getId();
    JobQuery query = managementService.createJobQuery().processDefinitionId(processDefinitionId);
    verifyQueryResults(query, 1);
    String jobId = query.singleResult().getId();
    managementService.executeJob(jobId);
    verifyQueryResults(query, 1);
    String anotherJobId = query.singleResult().getId();
    assertFalse(jobId.equals(anotherJobId));
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 70 with JobQuery

use of org.camunda.bpm.engine.runtime.JobQuery in project camunda-bpm-platform by camunda.

the class JobQueryTest method testQueryByNoRetriesLeft.

public void testQueryByNoRetriesLeft() {
    JobQuery query = managementService.createJobQuery().noRetriesLeft();
    verifyQueryResults(query, 0);
    setRetries(processInstanceIdOne, 0);
    // Re-running the query should give only one jobs now, since three job has retries>0
    verifyQueryResults(query, 1);
}
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