use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogTest method testRetriesAndWorkerIdWhenFirstFailureAndThenComplete.
@Test
public void testRetriesAndWorkerIdWhenFirstFailureAndThenComplete() {
// given
ExternalTask task = startExternalTaskProcess();
reportExternalTaskFailure(task.getId());
completeExternalTask(task.getId());
// when
HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().successLog().singleResult();
// then
assertEquals(WORKER_ID, log.getWorkerId());
assertEquals(Integer.valueOf(1), log.getRetries());
assertLogIsInSuccessfulState(log);
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogTest method testHistoricExternalTaskLogDeletedProperties.
@Test
public void testHistoricExternalTaskLogDeletedProperties() {
// given
ExternalTask task = startExternalTaskProcess();
runtimeService.deleteProcessInstance(task.getProcessInstanceId(), "Dummy reason for deletion!");
// when
HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().deletionLog().singleResult();
// then
assertHistoricLogPropertiesAreProperlySet(task, log);
assertEquals(null, log.getWorkerId());
assertLogIsInDeletedState(log);
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogTest method testHistoricExternalTaskLogSuccessfulProperties.
@Test
public void testHistoricExternalTaskLogSuccessfulProperties() {
// given
ExternalTask task = startExternalTaskProcess();
completeExternalTask(task.getId());
// when
HistoricExternalTaskLog log = historyService.createHistoricExternalTaskLogQuery().successLog().singleResult();
// then
assertHistoricLogPropertiesAreProperlySet(task, log);
assertEquals(WORKER_ID, log.getWorkerId());
assertLogIsInSuccessfulState(log);
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceImpl method queryExternalTasks.
@Override
public List<ExternalTaskDto> queryExternalTasks(ExternalTaskQueryDto queryDto, Integer firstResult, Integer maxResults) {
ProcessEngine engine = getProcessEngine();
queryDto.setObjectMapper(getObjectMapper());
ExternalTaskQuery query = queryDto.toQuery(engine);
List<ExternalTask> matchingTasks;
if (firstResult != null || maxResults != null) {
matchingTasks = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingTasks = query.list();
}
List<ExternalTaskDto> taskResults = new ArrayList<ExternalTaskDto>();
for (ExternalTask task : matchingTasks) {
ExternalTaskDto resultInstance = ExternalTaskDto.fromExternalTask(task);
taskResults.add(resultInstance);
}
return taskResults;
}
use of org.camunda.bpm.engine.externaltask.ExternalTask in project camunda-bpm-platform by camunda.
the class MigrationExternalTaskTest method testChangeTaskConfiguration.
@Test
public void testChangeTaskConfiguration() {
// given
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(ExternalTaskModels.ONE_EXTERNAL_TASK_PROCESS).serviceTaskBuilder("externalTask").camundaTopic("new" + ExternalTaskModels.TOPIC).camundaTaskPriority(Integer.toString(ExternalTaskModels.PRIORITY * 2)).done());
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapActivities("externalTask", "externalTask").build();
ProcessInstance processInstance = rule.getRuntimeService().startProcessInstanceById(sourceProcessDefinition.getId());
// when
testHelper.migrateProcessInstance(migrationPlan, processInstance);
// then the task's topic and priority have not changed
ExternalTask externalTaskAfterMigration = rule.getExternalTaskService().createExternalTaskQuery().singleResult();
Assert.assertEquals(ExternalTaskModels.PRIORITY.longValue(), externalTaskAfterMigration.getPriority());
Assert.assertEquals(ExternalTaskModels.TOPIC, externalTaskAfterMigration.getTopicName());
}
Aggregations