Search in sources :

Example 31 with JobQuery

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

the class SetJobRetriesBatchAuthorizationTest method setupAndExecuteJobsQueryBasedTest.

protected void setupAndExecuteJobsQueryBasedTest() {
    // given
    JobQuery jobQuery = managementService.createJobQuery();
    authRule.init(scenario).withUser("userId").bindResource("Process", sourceDefinition.getKey()).bindResource("processInstance1", processInstance.getId()).bindResource("processInstance2", processInstance2.getId()).start();
    // when
    batch = managementService.setJobRetriesAsync(jobQuery, RETRIES);
    executeSeedAndBatchJobs();
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery)

Example 32 with JobQuery

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

the class ManagementServiceAsyncOperationsTest method testSetJobsRetryAsyncWithNegativeRetries.

@Test
public void testSetJobsRetryAsyncWithNegativeRetries() throws Exception {
    // given
    JobQuery query = managementService.createJobQuery();
    // when
    thrown.expect(ProcessEngineException.class);
    managementService.setJobRetriesAsync(query, -1);
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) Test(org.junit.Test) AbstractAsyncOperationsTest(org.camunda.bpm.engine.test.api.AbstractAsyncOperationsTest)

Example 33 with JobQuery

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

the class ManagementServiceAsyncOperationsTest method testSetJobsRetryAsyncWithJobQueryAndList.

@Test
public void testSetJobsRetryAsyncWithJobQueryAndList() throws Exception {
    // given
    List<String> extraPi = startTestProcesses(1);
    JobQuery query = managementService.createJobQuery().processInstanceId(extraPi.get(0));
    // when
    Batch batch = managementService.setJobRetriesAsync(ids, query, RETRIES);
    executeSeedJob(batch);
    List<Exception> exceptions = executeBatchJobs(batch);
    // then
    assertThat(exceptions.size(), is(0));
    assertRetries(getAllJobIds(), RETRIES);
    assertHistoricBatchExists(testRule);
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) JobQuery(org.camunda.bpm.engine.runtime.JobQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) ExpectedException(org.junit.rules.ExpectedException) Test(org.junit.Test) AbstractAsyncOperationsTest(org.camunda.bpm.engine.test.api.AbstractAsyncOperationsTest)

Example 34 with JobQuery

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

the class ManagementServiceAsyncOperationsTest method testSetJobsRetryAsyncWithNonExistingIDAsJobQuery.

@Test
public void testSetJobsRetryAsyncWithNonExistingIDAsJobQuery() throws Exception {
    // expect
    thrown.expect(ProcessEngineException.class);
    // given
    JobQuery query = managementService.createJobQuery().jobId(ids.get(0)).jobId("aFake");
    // when
    managementService.setJobRetriesAsync(query, RETRIES);
}
Also used : JobQuery(org.camunda.bpm.engine.runtime.JobQuery) Test(org.junit.Test) AbstractAsyncOperationsTest(org.camunda.bpm.engine.test.api.AbstractAsyncOperationsTest)

Example 35 with JobQuery

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

the class ManagementServiceAsyncOperationsTest method testSetJobsRetryAsyncWithJobQuery.

@Test
public void testSetJobsRetryAsyncWithJobQuery() throws Exception {
    // given
    JobQuery query = managementService.createJobQuery();
    // when
    Batch batch = managementService.setJobRetriesAsync(query, RETRIES);
    executeSeedJob(batch);
    List<Exception> exceptions = executeBatchJobs(batch);
    // then
    assertThat(exceptions.size(), is(0));
    assertRetries(ids, RETRIES);
    assertHistoricBatchExists(testRule);
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) JobQuery(org.camunda.bpm.engine.runtime.JobQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) ExpectedException(org.junit.rules.ExpectedException) Test(org.junit.Test) AbstractAsyncOperationsTest(org.camunda.bpm.engine.test.api.AbstractAsyncOperationsTest)

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