use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesTest method shouldSetExternalTaskRetriesWithQueryAsync.
@Test
public void shouldSetExternalTaskRetriesWithQueryAsync() {
ExternalTaskQuery externalTaskQuery = engineRule.getExternalTaskService().createExternalTaskQuery();
// when
Batch batch = externalTaskService.setRetriesAsync(null, externalTaskQuery, 5);
// then
executeSeedAndBatchJobs(batch);
for (ExternalTask task : externalTaskQuery.list()) {
Assert.assertEquals(5, (int) task.getRetries());
}
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesTest method shouldFailForNullExternalTaskIdAsync.
@Test
public void shouldFailForNullExternalTaskIdAsync() {
List<ExternalTask> externalTasks = externalTaskService.createExternalTaskQuery().list();
ArrayList<String> externalTaskIds = new ArrayList<String>();
for (ExternalTask task : externalTasks) {
externalTaskIds.add(task.getId());
}
externalTaskIds.add(null);
Batch batch = null;
try {
batch = externalTaskService.setRetriesAsync(externalTaskIds, null, 10);
executeSeedAndBatchJobs(batch);
fail("exception expected");
} catch (BadUserRequestException e) {
Assert.assertThat(e.getMessage(), containsString("External task id cannot be null"));
}
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionUserOperationTest method testNoCreationOnSyncBatchJobExecutionByIdsAndQuery.
@Test
public void testNoCreationOnSyncBatchJobExecutionByIdsAndQuery() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null);
// when
engineRule.getIdentityService().setAuthenticatedUserId(USER_ID);
executeJobs(batch);
engineRule.getIdentityService().clearAuthentication();
// then
assertEquals(0, engineRule.getHistoryService().createUserOperationLogQuery().count());
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createMonitorJobByQuery.
@Test
public void createMonitorJobByQuery() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null);
// when
helper.executeSeedJob(batch);
// then the seed job definition still exists but the seed job is removed
JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch);
assertNotNull(seedJobDefinition);
Job seedJob = helper.getSeedJob(batch);
assertNull(seedJob);
// and a monitor job definition and job exists
JobDefinition monitorJobDefinition = helper.getMonitorJobDefinition(batch);
assertNotNull(monitorJobDefinition);
Job monitorJob = helper.getMonitorJob(batch);
assertNotNull(monitorJob);
}
use of org.camunda.bpm.engine.batch.Batch in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createBatchDeletionByQuery.
@Test
public void createBatchDeletionByQuery() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
// when
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null);
// then
assertBatchCreated(batch, 10);
}
Aggregations