use of de.tum.in.www1.artemis.service.dto.AbstractBuildResultNotificationDTO in project Artemis by ls1intum.
the class JenkinsService method addFeedbackToResult.
@Override
protected void addFeedbackToResult(Result result, AbstractBuildResultNotificationDTO buildResult) {
final ProgrammingExercise programmingExercise = (ProgrammingExercise) result.getParticipation().getExercise();
final ProgrammingLanguage programmingLanguage = programmingExercise.getProgrammingLanguage();
final var jobs = ((TestResultsDTO) buildResult).getResults();
// Extract test case feedback
for (final var job : jobs) {
for (final var testCase : job.getTestCases()) {
var feedbackMessages = extractMessageFromTestCase(testCase).map(List::of).orElse(List.of());
var feedback = feedbackRepository.createFeedbackFromTestCase(testCase.getName(), feedbackMessages, testCase.isSuccessful(), programmingLanguage);
result.addFeedback(feedback);
}
}
// Extract static code analysis feedback if option was enabled
var staticCodeAnalysisReports = ((TestResultsDTO) buildResult).getStaticCodeAnalysisReports();
if (Boolean.TRUE.equals(programmingExercise.isStaticCodeAnalysisEnabled()) && staticCodeAnalysisReports != null && !staticCodeAnalysisReports.isEmpty()) {
var scaFeedback = feedbackRepository.createFeedbackFromStaticCodeAnalysisReports(staticCodeAnalysisReports);
result.addFeedbacks(scaFeedback);
}
// Relevant feedback is negative, or positive with a message
result.setHasFeedback(result.getFeedbacks().stream().anyMatch(fb -> !fb.isPositive() || fb.getDetailText() != null));
}
use of de.tum.in.www1.artemis.service.dto.AbstractBuildResultNotificationDTO in project ArTEMiS by ls1intum.
the class JenkinsService method addFeedbackToResult.
@Override
protected void addFeedbackToResult(Result result, AbstractBuildResultNotificationDTO buildResult) {
final ProgrammingExercise programmingExercise = (ProgrammingExercise) result.getParticipation().getExercise();
final ProgrammingLanguage programmingLanguage = programmingExercise.getProgrammingLanguage();
final var jobs = ((TestResultsDTO) buildResult).getResults();
// Extract test case feedback
for (final var job : jobs) {
for (final var testCase : job.getTestCases()) {
var feedbackMessages = extractMessageFromTestCase(testCase).map(List::of).orElse(List.of());
var feedback = feedbackRepository.createFeedbackFromTestCase(testCase.getName(), feedbackMessages, testCase.isSuccessful(), programmingLanguage);
result.addFeedback(feedback);
}
}
// Extract static code analysis feedback if option was enabled
var staticCodeAnalysisReports = ((TestResultsDTO) buildResult).getStaticCodeAnalysisReports();
if (Boolean.TRUE.equals(programmingExercise.isStaticCodeAnalysisEnabled()) && staticCodeAnalysisReports != null && !staticCodeAnalysisReports.isEmpty()) {
var scaFeedback = feedbackRepository.createFeedbackFromStaticCodeAnalysisReports(staticCodeAnalysisReports);
result.addFeedbacks(scaFeedback);
}
// Relevant feedback is negative, or positive with a message
result.setHasFeedback(result.getFeedbacks().stream().anyMatch(fb -> !fb.isPositive() || fb.getDetailText() != null));
}
Aggregations