use of de.tum.in.www1.artemis.service.ResultService in project ArTEMiS by ls1intum.
the class ResultServiceTest method reset.
@BeforeEach
public void reset() {
database.addUsers(2, 1, 1, 1);
Course course = database.addCourseWithOneProgrammingExercise();
this.programmingExercise = (ProgrammingExercise) course.getExercises().stream().filter(exercise -> exercise instanceof ProgrammingExercise).findAny().orElseThrow();
// This is done to avoid proxy issues in the processNewResult method of the ResultService.
this.programmingExerciseStudentParticipation = database.addStudentParticipationForProgrammingExercise(this.programmingExercise, "student1");
ProgrammingExercise examProgrammingExercise = database.addCourseExamExerciseGroupWithOneProgrammingExercise();
this.examStudentParticipation = database.addStudentParticipationForProgrammingExercise(examProgrammingExercise, "student1");
}
use of de.tum.in.www1.artemis.service.ResultService in project ArTEMiS by ls1intum.
the class ResultServiceIntegrationTest method reset.
@BeforeEach
public void reset() {
database.addUsers(10, 2, 0, 2);
course = database.addCourseWithOneProgrammingExercise();
programmingExercise = (ProgrammingExercise) course.getExercises().stream().filter(exercise -> exercise instanceof ProgrammingExercise).findAny().orElseThrow();
ProgrammingExercise programmingExerciseWithStaticCodeAnalysis = database.addProgrammingExerciseToCourse(course, true);
// This is done to avoid proxy issues in the processNewResult method of the ResultService.
solutionParticipation = solutionProgrammingExerciseRepository.findWithEagerResultsAndSubmissionsByProgrammingExerciseId(programmingExercise.getId()).get();
programmingExerciseStudentParticipation = database.addStudentParticipationForProgrammingExercise(programmingExercise, "student1");
database.addStudentParticipationForProgrammingExercise(programmingExerciseWithStaticCodeAnalysis, "student1");
database.addCourseWithOneModelingExercise();
modelingExercise = modelingExerciseRepository.findAll().get(0);
modelingExercise.setDueDate(ZonedDateTime.now().minusHours(1));
modelingExerciseRepository.save(modelingExercise);
studentParticipation = database.createAndSaveParticipationForExercise(modelingExercise, "student2");
Exam exam = database.addExamWithExerciseGroup(this.course, true);
this.examModelingExercise = new ModelingExercise();
this.examModelingExercise.setMaxPoints(100D);
this.examModelingExercise.setExerciseGroup(exam.getExerciseGroups().get(0));
this.modelingExerciseRepository.save(this.examModelingExercise);
this.examRepository.save(exam);
Result result = ModelFactory.generateResult(true, 200D).resultString("Good effort!").participation(programmingExerciseStudentParticipation);
List<Feedback> feedbacks = ModelFactory.generateFeedback().stream().peek(feedback -> feedback.setText("Good work here")).collect(Collectors.toList());
result.setFeedbacks(feedbacks);
result.setAssessmentType(AssessmentType.SEMI_AUTOMATIC);
String dummyHash = "9b3a9bd71a0d80e5bbc42204c319ed3d1d4f0d6d";
doReturn(ObjectId.fromString(dummyHash)).when(gitService).getLastCommitHash(ArgumentMatchers.any());
}
use of de.tum.in.www1.artemis.service.ResultService in project Artemis by ls1intum.
the class ResultServiceIntegrationTest method reset.
@BeforeEach
public void reset() {
database.addUsers(10, 2, 0, 2);
course = database.addCourseWithOneProgrammingExercise();
programmingExercise = (ProgrammingExercise) course.getExercises().stream().filter(exercise -> exercise instanceof ProgrammingExercise).findAny().orElseThrow();
ProgrammingExercise programmingExerciseWithStaticCodeAnalysis = database.addProgrammingExerciseToCourse(course, true);
// This is done to avoid proxy issues in the processNewResult method of the ResultService.
solutionParticipation = solutionProgrammingExerciseRepository.findWithEagerResultsAndSubmissionsByProgrammingExerciseId(programmingExercise.getId()).get();
programmingExerciseStudentParticipation = database.addStudentParticipationForProgrammingExercise(programmingExercise, "student1");
database.addStudentParticipationForProgrammingExercise(programmingExerciseWithStaticCodeAnalysis, "student1");
database.addCourseWithOneModelingExercise();
modelingExercise = modelingExerciseRepository.findAll().get(0);
modelingExercise.setDueDate(ZonedDateTime.now().minusHours(1));
modelingExerciseRepository.save(modelingExercise);
studentParticipation = database.createAndSaveParticipationForExercise(modelingExercise, "student2");
Exam exam = database.addExamWithExerciseGroup(this.course, true);
this.examModelingExercise = new ModelingExercise();
this.examModelingExercise.setMaxPoints(100D);
this.examModelingExercise.setExerciseGroup(exam.getExerciseGroups().get(0));
this.modelingExerciseRepository.save(this.examModelingExercise);
this.examRepository.save(exam);
Result result = ModelFactory.generateResult(true, 200D).resultString("Good effort!").participation(programmingExerciseStudentParticipation);
List<Feedback> feedbacks = ModelFactory.generateFeedback().stream().peek(feedback -> feedback.setText("Good work here")).collect(Collectors.toList());
result.setFeedbacks(feedbacks);
result.setAssessmentType(AssessmentType.SEMI_AUTOMATIC);
String dummyHash = "9b3a9bd71a0d80e5bbc42204c319ed3d1d4f0d6d";
doReturn(ObjectId.fromString(dummyHash)).when(gitService).getLastCommitHash(ArgumentMatchers.any());
}
use of de.tum.in.www1.artemis.service.ResultService in project Artemis by ls1intum.
the class ResultServiceTest method reset.
@BeforeEach
public void reset() {
database.addUsers(2, 1, 1, 1);
Course course = database.addCourseWithOneProgrammingExercise();
this.programmingExercise = (ProgrammingExercise) course.getExercises().stream().filter(exercise -> exercise instanceof ProgrammingExercise).findAny().orElseThrow();
// This is done to avoid proxy issues in the processNewResult method of the ResultService.
this.programmingExerciseStudentParticipation = database.addStudentParticipationForProgrammingExercise(this.programmingExercise, "student1");
ProgrammingExercise examProgrammingExercise = database.addCourseExamExerciseGroupWithOneProgrammingExercise();
this.examStudentParticipation = database.addStudentParticipationForProgrammingExercise(examProgrammingExercise, "student1");
}
Aggregations