use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogAuthorizationTest method completeExternalTaskWithFailure.
protected void completeExternalTaskWithFailure(ProcessInstance pi) {
ExternalTask task = externalTaskService.createExternalTaskQuery().processInstanceId(pi.getId()).singleResult();
completeExternalTaskWithFailure(task.getId());
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class HandleExternalTaskFailureAuthorizationTest method assertExternalTaskResults.
@Override
public void assertExternalTaskResults() {
ExternalTask externalTask = engineRule.getExternalTaskService().createExternalTaskQuery().singleResult();
Assert.assertEquals(5, (int) externalTask.getRetries());
Assert.assertEquals("error", externalTask.getErrorMessage());
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesAuthorizationTest method testSetRetrieSync.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testSetRetrieSync() {
// given
ProcessInstance processInstance1 = engineRule.getRuntimeService().startProcessInstanceByKey("oneExternalTaskProcess");
ProcessInstance processInstance2 = engineRule.getRuntimeService().startProcessInstanceByKey("oneExternalTaskProcess");
List<ExternalTask> tasks = engineRule.getExternalTaskService().createExternalTaskQuery().list();
// when
authRule.init(scenario).withUser("userId").bindResource("processInstanceId1", processInstance1.getId()).bindResource("processInstanceId2", processInstance2.getId()).bindResource("processDefinitionKey", "oneExternalTaskProcess").start();
ArrayList<String> externalTaskIds = new ArrayList<String>();
externalTaskIds.add(tasks.get(0).getId());
externalTaskIds.add(tasks.get(1).getId());
engineRule.getExternalTaskService().setRetries(externalTaskIds, 5);
// then
if (authRule.assertScenario(scenario)) {
tasks = engineRule.getExternalTaskService().createExternalTaskQuery().list();
Assert.assertEquals(5, (int) tasks.get(0).getRetries());
Assert.assertEquals(5, (int) tasks.get(1).getRetries());
}
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesBatchAuthorizationTest method testSetRetriesWithQueryAsync.
@Test
public void testSetRetriesWithQueryAsync() {
// given
ProcessDefinition processDefinition = testRule.deployAndGetDefinition(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS);
ProcessInstance processInstance1 = engineRule.getRuntimeService().startProcessInstanceByKey("Process");
List<ExternalTask> externalTasks;
ExternalTaskQuery externalTaskQuery = engineRule.getExternalTaskService().createExternalTaskQuery();
// when
authRule.init(scenario).withUser("userId").bindResource("batchId", "*").bindResource("processInstance1", processInstance1.getId()).bindResource("processDefinition", processDefinition.getKey()).start();
Batch batch = engineRule.getExternalTaskService().setRetriesAsync(null, externalTaskQuery, 5);
if (batch != null) {
executeSeedAndBatchJobs(batch);
}
// then
if (authRule.assertScenario(scenario)) {
externalTasks = engineRule.getExternalTaskService().createExternalTaskQuery().list();
for (ExternalTask task : externalTasks) {
Assert.assertEquals(5, (int) task.getRetries());
}
}
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class UnlockExternalTaskAuthorizationTest method testSetJobPriority.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testSetJobPriority() {
// given
ProcessInstance processInstance = engineRule.getRuntimeService().startProcessInstanceByKey("oneExternalTaskProcess");
List<LockedExternalTask> tasks = engineRule.getExternalTaskService().fetchAndLock(5, "workerId").topic("externalTaskTopic", 5000L).execute();
LockedExternalTask task = tasks.get(0);
// when
authRule.init(scenario).withUser("userId").bindResource("processInstanceId", processInstance.getId()).bindResource("processDefinitionKey", "oneExternalTaskProcess").start();
engineRule.getExternalTaskService().unlock(task.getId());
// then
if (authRule.assertScenario(scenario)) {
ExternalTask externalTask = engineRule.getExternalTaskService().createExternalTaskQuery().singleResult();
Assert.assertNull(externalTask.getLockExpirationTime());
}
}
Aggregations