use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class ExternalTaskServiceTest method testHandleBpmnErrorWithoutDefinedBoundary.
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testHandleBpmnErrorWithoutDefinedBoundary() {
// given
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneExternalTaskProcess");
// when
List<LockedExternalTask> externalTasks = helperHandleBpmnError(1, WORKER_ID, TOPIC_NAME, LOCK_TIME, "ERROR-OCCURED");
// then
assertEquals(0, externalTasks.size());
assertEquals(0, externalTaskService.createExternalTaskQuery().count());
Task afterBpmnError = taskService.createTaskQuery().singleResult();
assertNull(afterBpmnError);
assertProcessEnded(processInstance.getId());
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class ExternalTaskServiceTest method testUpdateRetriesByExternalTaskIds.
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testUpdateRetriesByExternalTaskIds() {
// given
startProcessInstance("oneExternalTaskProcess", 5);
List<ExternalTask> tasks = externalTaskService.createExternalTaskQuery().list();
List<String> externalTaskIds = Arrays.asList(tasks.get(0).getId(), tasks.get(1).getId(), tasks.get(2).getId(), tasks.get(3).getId(), tasks.get(4).getId());
// when
externalTaskService.updateRetries().externalTaskIds(externalTaskIds).set(5);
// then
tasks = externalTaskService.createExternalTaskQuery().list();
assertEquals(5, tasks.size());
for (ExternalTask task : tasks) {
assertEquals(5, (int) task.getRetries());
}
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesTest method shouldUpdateRetriesByProcessInstanceIdArray.
@Test
public void shouldUpdateRetriesByProcessInstanceIdArray() {
// given
// when
Batch batch = externalTaskService.updateRetries().processInstanceIds(processInstanceIds.toArray(new String[processInstanceIds.size()])).setAsync(5);
executeSeedAndBatchJobs(batch);
// then
List<ExternalTask> tasks = externalTaskService.createExternalTaskQuery().list();
assertEquals(6, tasks.size());
for (ExternalTask task : tasks) {
assertEquals(5, (int) task.getRetries());
}
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesTest method shouldUpdateRetriesByProcessInstanceQuery.
@Test
public void shouldUpdateRetriesByProcessInstanceQuery() {
// given
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
// when
Batch batch = externalTaskService.updateRetries().processInstanceQuery(processInstanceQuery).setAsync(5);
executeSeedAndBatchJobs(batch);
// then
List<ExternalTask> tasks = externalTaskService.createExternalTaskQuery().list();
assertEquals(6, tasks.size());
for (ExternalTask task : tasks) {
assertEquals(5, (int) task.getRetries());
}
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesTest method shouldFailForNonExistingExternalTaskIdSync.
@Test
public void shouldFailForNonExistingExternalTaskIdSync() {
List<ExternalTask> externalTasks = externalTaskService.createExternalTaskQuery().list();
ArrayList<String> externalTaskIds = new ArrayList<String>();
for (ExternalTask task : externalTasks) {
externalTaskIds.add(task.getId());
}
externalTaskIds.add("nonExistingExternalTaskId");
try {
externalTaskService.setRetries(externalTaskIds, 10);
fail("exception expected");
} catch (NotFoundException e) {
Assert.assertThat(e.getMessage(), containsString("Cannot find external task with id nonExistingExternalTaskId"));
}
}
Aggregations