use of org.camunda.bpm.engine.externaltask.LockedExternalTask in project camunda-bpm-platform by camunda.
the class MultiTenancyExternalTaskCmdsTenantCheckTest method testHandleFailureWithNoAuthenticatedTenant.
@Test
public void testHandleFailureWithNoAuthenticatedTenant() {
LockedExternalTask task = externalTaskService.fetchAndLock(1, WORKER_ID).topic(TOPIC_NAME, LOCK_TIME).execute().get(0);
identityService.setAuthentication("aUserId", null);
// then
thrown.expect(ProcessEngineException.class);
thrown.expectMessage("Cannot update the process instance '" + processInstanceId + "' because it belongs to no authenticated tenant.");
externalTaskService.handleFailure(task.getId(), WORKER_ID, ERROR_MESSAGE, 1, 0);
}
use of org.camunda.bpm.engine.externaltask.LockedExternalTask in project camunda-bpm-platform by camunda.
the class MultiTenancyExternalTaskCmdsTenantCheckTest method testHandleFailureWithAuthenticatedTenant.
// handle failure test cases
@Test
public void testHandleFailureWithAuthenticatedTenant() {
LockedExternalTask task = externalTaskService.fetchAndLock(1, WORKER_ID).topic(TOPIC_NAME, LOCK_TIME).execute().get(0);
identityService.setAuthentication("aUserId", null, Arrays.asList(TENANT_ONE));
externalTaskService.handleFailure(task.getId(), WORKER_ID, ERROR_MESSAGE, 1, 0);
// then
assertEquals(ERROR_MESSAGE, externalTaskService.fetchAndLock(1, WORKER_ID).topic(TOPIC_NAME, LOCK_TIME).execute().get(0).getErrorMessage());
}
use of org.camunda.bpm.engine.externaltask.LockedExternalTask in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogQueryTest method reportExternalTaskFailure.
protected void reportExternalTaskFailure(String externalTaskId, String topic, String workerId, Integer retries, boolean usePriority, String errorMessage) {
List<LockedExternalTask> list = externalTaskService.fetchAndLock(100, workerId, usePriority).topic(topic, LOCK_DURATION).execute();
externalTaskService.handleFailure(externalTaskId, workerId, errorMessage, retries, 0L);
for (LockedExternalTask lockedExternalTask : list) {
externalTaskService.unlock(lockedExternalTask.getId());
}
}
use of org.camunda.bpm.engine.externaltask.LockedExternalTask in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogQueryTest method completeExternalTask.
protected void completeExternalTask(String externalTaskId, String topic, String workerId, boolean usePriority) {
List<LockedExternalTask> list = externalTaskService.fetchAndLock(100, workerId, usePriority).topic(topic, LOCK_DURATION).execute();
externalTaskService.complete(externalTaskId, workerId);
// unlock the remaining tasks
for (LockedExternalTask lockedExternalTask : list) {
if (!lockedExternalTask.getId().equals(externalTaskId)) {
externalTaskService.unlock(lockedExternalTask.getId());
}
}
}
use of org.camunda.bpm.engine.externaltask.LockedExternalTask in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogQuerySortingTest method reportExternalTaskFailure.
protected void reportExternalTaskFailure(String externalTaskId, String topic, String workerId, Integer retries, boolean usePriority, String errorMessage) {
List<LockedExternalTask> list = externalTaskService.fetchAndLock(100, workerId, usePriority).topic(topic, LOCK_DURATION).execute();
externalTaskService.handleFailure(externalTaskId, workerId, errorMessage, retries, 0L);
for (LockedExternalTask lockedExternalTask : list) {
externalTaskService.unlock(lockedExternalTask.getId());
}
}
Aggregations