use of org.sonar.ce.queue.CeTaskResult in project sonarqube by SonarSource.
the class CeWorkerCallableImpl method executeTask.
private void executeTask(CeTask task) {
ceLogging.initForTask(task);
Profiler ceProfiler = startActivityProfiler(task);
CeActivityDto.Status status = CeActivityDto.Status.FAILED;
CeTaskResult taskResult = null;
Throwable error = null;
try {
// TODO delegate the message to the related task processor, according to task type
Optional<CeTaskProcessor> taskProcessor = taskProcessorRepository.getForCeTask(task);
if (taskProcessor.isPresent()) {
taskResult = taskProcessor.get().process(task);
status = CeActivityDto.Status.SUCCESS;
} else {
LOG.error("No CeTaskProcessor is defined for task of type {}. Plugin configuration may have changed", task.getType());
status = CeActivityDto.Status.FAILED;
}
} catch (Throwable e) {
LOG.error(format("Failed to execute task %s", task.getUuid()), e);
error = e;
} finally {
finalizeTask(task, ceProfiler, status, taskResult, error);
}
}
use of org.sonar.ce.queue.CeTaskResult in project sonarqube by SonarSource.
the class InternalCeQueueImplTest method newTaskResult.
private CeTaskResult newTaskResult(@Nullable String analysisUuid) {
CeTaskResult taskResult = mock(CeTaskResult.class);
when(taskResult.getAnalysisUuid()).thenReturn(java.util.Optional.ofNullable(analysisUuid));
return taskResult;
}
use of org.sonar.ce.queue.CeTaskResult in project sonarqube by SonarSource.
the class MutableTaskResultHolderImplTest method getResult_returns_object_set_with_setResult.
@Test
public void getResult_returns_object_set_with_setResult() {
CeTaskResult taskResult = mock(CeTaskResult.class);
underTest.setResult(taskResult);
assertThat(underTest.getResult()).isSameAs(taskResult);
}
Aggregations