use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class SetExternalTasksRetriesTest method shouldUpdateRetriesByProcessInstanceIds.
@Test
public void shouldUpdateRetriesByProcessInstanceIds() {
// when
Batch batch = externalTaskService.updateRetries().processInstanceIds(processInstanceIds).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 MultiTenancyExecutionPropagationTest method testPropagateTenantIdToExternalTask.
public void testPropagateTenantIdToExternalTask() {
deploymentForTenant(TENANT_ID, Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().serviceTask().camundaType("external").camundaTopic("test").endEvent().done());
startProcessInstance(PROCESS_DEFINITION_KEY);
ExternalTask externalTask = externalTaskService.createExternalTaskQuery().singleResult();
assertThat(externalTask, is(notNullValue()));
// inherit the tenant id from execution
assertThat(externalTask.getTenantId(), is(TENANT_ID));
List<LockedExternalTask> externalTasks = externalTaskService.fetchAndLock(1, "test").topic("test", 1000).execute();
assertThat(externalTasks.size(), is(1));
assertThat(externalTasks.get(0).getTenantId(), is(TENANT_ID));
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricExternalTaskLogTest method startProcessInstanceAndFailExternalTask.
@SuppressWarnings("deprecation")
protected ExternalTask startProcessInstanceAndFailExternalTask(String tenant) {
ProcessInstance pi = runtimeService.createProcessInstanceByKey(DEFAULT_PROCESS_KEY).processDefinitionTenantId(tenant).execute();
ExternalTask externalTask = externalTaskService.createExternalTaskQuery().processInstanceId(pi.getId()).singleResult();
reportExternalTaskFailure(externalTask.getId());
return externalTask;
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testSuspensionByProcessDefinitionIdCascadesToExternalTasks.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml", "org/camunda/bpm/engine/test/api/externaltask/twoExternalTaskProcess.bpmn20.xml" })
public void testSuspensionByProcessDefinitionIdCascadesToExternalTasks() {
// given
ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("oneExternalTaskProcess");
ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("twoExternalTaskProcess");
ExternalTask task1 = externalTaskService.createExternalTaskQuery().processInstanceId(processInstance1.getId()).singleResult();
assertFalse(task1.isSuspended());
// when the process instance is suspended
runtimeService.suspendProcessInstanceByProcessDefinitionId(processInstance1.getProcessDefinitionId());
// then the task is suspended
task1 = externalTaskService.createExternalTaskQuery().processInstanceId(processInstance1.getId()).singleResult();
assertTrue(task1.isSuspended());
// the other task is not
ExternalTask task2 = externalTaskService.createExternalTaskQuery().processInstanceId(processInstance2.getId()).singleResult();
assertFalse(task2.isSuspended());
// when it is activated again
runtimeService.activateProcessInstanceByProcessDefinitionId(processInstance1.getProcessDefinitionId());
// then the task is activated too
task1 = externalTaskService.createExternalTaskQuery().processInstanceId(processInstance1.getId()).singleResult();
assertFalse(task1.isSuspended());
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class ProcessInstanceSuspensionTest method testSuspensionByProcessDefinitionKeyCascadesToExternalTasks.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml", "org/camunda/bpm/engine/test/api/externaltask/twoExternalTaskProcess.bpmn20.xml" })
public void testSuspensionByProcessDefinitionKeyCascadesToExternalTasks() {
// given
ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("oneExternalTaskProcess");
ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("twoExternalTaskProcess");
ExternalTask task1 = externalTaskService.createExternalTaskQuery().processInstanceId(processInstance1.getId()).singleResult();
assertFalse(task1.isSuspended());
// when the process instance is suspended
runtimeService.suspendProcessInstanceByProcessDefinitionKey("oneExternalTaskProcess");
// then the task is suspended
task1 = externalTaskService.createExternalTaskQuery().processInstanceId(processInstance1.getId()).singleResult();
assertTrue(task1.isSuspended());
// the other task is not
ExternalTask task2 = externalTaskService.createExternalTaskQuery().processInstanceId(processInstance2.getId()).singleResult();
assertFalse(task2.isSuspended());
// when it is activated again
runtimeService.activateProcessInstanceByProcessDefinitionKey("oneExternalTaskProcess");
// then the task is activated too
task1 = externalTaskService.createExternalTaskQuery().processInstanceId(processInstance1.getId()).singleResult();
assertFalse(task1.isSuspended());
}
Aggregations