use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class BatchStatisticsQueryTest method testStatisticsRetriedFailedJobs.
@Test
public void testStatisticsRetriedFailedJobs() {
// given
Batch batch = helper.createMigrationBatchWithSize(3);
// when
helper.completeSeedJobs(batch);
helper.failExecutionJobs(batch, 3);
// then
BatchStatistics batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
assertEquals(3, batchStatistics.getTotalJobs());
assertEquals(3, batchStatistics.getJobsCreated());
assertEquals(3, batchStatistics.getRemainingJobs());
assertEquals(0, batchStatistics.getCompletedJobs());
assertEquals(3, batchStatistics.getFailedJobs());
// when
helper.setRetries(batch, 3, 1);
helper.completeJobs(batch, 3);
// then
batchStatistics = managementService.createBatchStatisticsQuery().singleResult();
assertEquals(3, batchStatistics.getTotalJobs());
assertEquals(3, batchStatistics.getJobsCreated());
assertEquals(0, batchStatistics.getRemainingJobs());
assertEquals(3, batchStatistics.getCompletedJobs());
assertEquals(0, batchStatistics.getFailedJobs());
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class ManagementServiceAsyncOperationsTest method cleanBatch.
@After
public void cleanBatch() {
Batch batch = managementService.createBatchQuery().singleResult();
if (batch != null) {
managementService.deleteBatch(batch.getId(), true);
}
HistoricBatch historicBatch = historyService.createHistoricBatchQuery().singleResult();
if (historicBatch != null) {
historyService.deleteHistoricBatch(historicBatch.getId());
}
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class ManagementServiceAsyncOperationsTest method testSetJobsRetryAsyncWithProcessQuery.
@Test
public void testSetJobsRetryAsyncWithProcessQuery() throws Exception {
// given
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();
// when
Batch batch = managementService.setJobRetriesAsync(null, query, RETRIES);
executeSeedJob(batch);
List<Exception> exceptions = executeBatchJobs(batch);
// then
assertThat(exceptions.size(), is(0));
assertRetries(ids, RETRIES);
assertHistoricBatchExists(testRule);
}
use of org.camunda.bpm.engine.batch.Batch 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);
}
use of org.camunda.bpm.engine.batch.Batch 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);
}
Aggregations