Search in sources :

Example 56 with JobQuery

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

the class JobQueryTest method testQueryByInvalidExecutionId.

public void testQueryByInvalidExecutionId() {
    JobQuery query = managementService.createJobQuery().executionId("invalid");
    verifyQueryResults(query, 0);
    try {
        managementService.createJobQuery().executionId(null).list();
        fail();
    } catch (ProcessEngineException e) {
    }
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 57 with JobQuery

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

the class JobQueryTest method testQueryByExecutable.

public void testQueryByExecutable() {
    // all jobs should be executable at t3 + 1hour.1second
    ClockUtil.setCurrentTime(new Date(timerThreeFireTime.getTime() + ONE_SECOND));
    JobQuery query = managementService.createJobQuery().executable();
    verifyQueryResults(query, 4);
    // Setting retries of one job to 0, makes it non-executable
    setRetries(processInstanceIdOne, 0);
    verifyQueryResults(query, 3);
    // Setting the clock before the start of the process instance, makes none of the jobs executable
    ClockUtil.setCurrentTime(testStartTime);
    // 1, since a message is always executable when retries > 0
    verifyQueryResults(query, 1);
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) Date(java.util.Date)

Example 58 with JobQuery

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

the class JobQueryTest method testQueryByDuedateCombinations.

public void testQueryByDuedateCombinations() {
    JobQuery query = managementService.createJobQuery().duedateHigherThan(testStartTime).duedateLowerThan(new Date(timerThreeFireTime.getTime() + ONE_SECOND));
    verifyQueryResults(query, 3);
    query = managementService.createJobQuery().duedateHigherThan(new Date(timerThreeFireTime.getTime() + ONE_SECOND)).duedateLowerThan(testStartTime);
    verifyQueryResults(query, 0);
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) Date(java.util.Date)

Example 59 with JobQuery

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

the class JobQueryTest method testQueryByInvalidProcessDefinitionId.

public void testQueryByInvalidProcessDefinitionId() {
    JobQuery query = managementService.createJobQuery().processDefinitionId("invalid");
    verifyQueryResults(query, 0);
    try {
        managementService.createJobQuery().processDefinitionId(null).list();
        fail();
    } catch (ProcessEngineException e) {
    }
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 60 with JobQuery

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

the class JobQueryTest method testQueryByProcessDefinitionId.

public void testQueryByProcessDefinitionId() {
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().list().get(0);
    JobQuery query = managementService.createJobQuery().processDefinitionId(processDefinition.getId());
    verifyQueryResults(query, 3);
}
Also used : ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) 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