use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method createNineLockedSubmissionsForDifferentExercisesAndUsers.
private void createNineLockedSubmissionsForDifferentExercisesAndUsers(String assessor) {
ModelingSubmission submission = ModelFactory.generateModelingSubmission(validModel, true);
database.addModelingSubmissionWithResultAndAssessor(classExercise, submission, "student1", assessor);
submission = ModelFactory.generateModelingSubmission(validModel, true);
database.addModelingSubmissionWithResultAndAssessor(classExercise, submission, "student2", assessor);
submission = ModelFactory.generateModelingSubmission(validModel, true);
database.addModelingSubmissionWithResultAndAssessor(classExercise, submission, "student3", assessor);
submission = ModelFactory.generateModelingSubmission(validModel, true);
database.addModelingSubmissionWithResultAndAssessor(activityExercise, submission, "student1", assessor);
submission = ModelFactory.generateModelingSubmission(validModel, true);
database.addModelingSubmissionWithResultAndAssessor(activityExercise, submission, "student2", assessor);
submission = ModelFactory.generateModelingSubmission(validModel, true);
database.addModelingSubmissionWithResultAndAssessor(activityExercise, submission, "student3", assessor);
submission = ModelFactory.generateModelingSubmission(validModel, true);
database.addModelingSubmissionWithResultAndAssessor(objectExercise, submission, "student1", assessor);
submission = ModelFactory.generateModelingSubmission(validModel, true);
database.addModelingSubmissionWithResultAndAssessor(objectExercise, submission, "student2", assessor);
submission = ModelFactory.generateModelingSubmission(validModel, true);
database.addModelingSubmissionWithResultAndAssessor(objectExercise, submission, "student3", assessor);
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method saveAndSubmitModelingSubmission_activityDiagram.
@Test
@WithMockUser(username = "student1")
public void saveAndSubmitModelingSubmission_activityDiagram() throws Exception {
database.createAndSaveParticipationForExercise(activityExercise, "student1");
String emptyActivityModel = FileUtils.loadFileFromResources("test-data/model-submission/empty-activity-diagram.json");
ModelingSubmission submission = ModelFactory.generateModelingSubmission(emptyActivityModel, false);
ModelingSubmission returnedSubmission = performInitialModelSubmission(activityExercise.getId(), submission);
database.checkModelingSubmissionCorrectlyStored(returnedSubmission.getId(), emptyActivityModel);
checkDetailsHidden(returnedSubmission, true);
String validActivityModel = FileUtils.loadFileFromResources("test-data/model-submission/example-activity-diagram.json");
returnedSubmission.setModel(validActivityModel);
returnedSubmission.setSubmitted(true);
returnedSubmission = performUpdateOnModelSubmission(activityExercise.getId(), returnedSubmission);
database.checkModelingSubmissionCorrectlyStored(returnedSubmission.getId(), validActivityModel);
checkDetailsHidden(returnedSubmission, true);
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method getModelSubmissionWithoutAssessment_lockSubmission.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void getModelSubmissionWithoutAssessment_lockSubmission() throws Exception {
User user = database.getUserByLogin("tutor1");
ModelingSubmission submission = ModelFactory.generateModelingSubmission(validModel, true);
submission = database.addModelingSubmission(classExercise, submission, "student1");
database.updateExerciseDueDate(classExercise.getId(), ZonedDateTime.now().minusHours(1));
ModelingSubmission storedSubmission = request.get("/api/exercises/" + classExercise.getId() + "/modeling-submission-without-assessment?lock=true", HttpStatus.OK, ModelingSubmission.class);
// set dates to UTC and round to milliseconds for comparison
submission.setSubmissionDate(ZonedDateTime.ofInstant(submission.getSubmissionDate().truncatedTo(ChronoUnit.SECONDS).toInstant(), ZoneId.of("UTC")));
storedSubmission.setSubmissionDate(ZonedDateTime.ofInstant(storedSubmission.getSubmissionDate().truncatedTo(ChronoUnit.SECONDS).toInstant(), ZoneId.of("UTC")));
assertThat(storedSubmission).as("submission was found").isEqualToIgnoringGivenFields(submission, "results", "similarElementCounts");
assertThat(storedSubmission.getLatestResult()).as("result is set").isNotNull();
assertThat(storedSubmission.getLatestResult().getAssessor()).as("assessor is tutor1").isEqualTo(user);
checkDetailsHidden(storedSubmission, false);
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class SubmissionServiceTest method testModelingExerciseGetRandomSubmissionEligibleForNewAssessmentNoAssessments.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void testModelingExerciseGetRandomSubmissionEligibleForNewAssessmentNoAssessments() {
submission1 = new ModelingSubmission();
submission2 = new ModelingSubmission();
// setup
queryTestingBasics(this.examModelingExercise);
// checks
getQueryResults(examModelingExercise);
assertThat(examModelingExercise.getExerciseGroup().getExam().getNumberOfCorrectionRoundsInExam()).isEqualTo(2L);
assertThat(unassessedSubmissionCorrectionRound0Tutor1).isPresent();
assertThat(unassessedSubmissionCorrectionRound0Tutor1.get()).isIn(submission1, submission2);
assertThat(unassessedSubmissionCorrectionRound1Tutor1).isEmpty();
assertThat(submissionListTutor1CorrectionRound0).isEmpty();
assertThat(submissionListTutor2CorrectionRound0).isEmpty();
assertThat(submissionListTutor1CorrectionRound1).isEmpty();
assertThat(submissionListTutor2CorrectionRound1).isEmpty();
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class SubmissionServiceTest method testModelingExerciseGetRandomSubmissionEligibleForNewAssessmentOneAssessmentsInSecondCorrectionRoundWithLock.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void testModelingExerciseGetRandomSubmissionEligibleForNewAssessmentOneAssessmentsInSecondCorrectionRoundWithLock() {
submission1 = new ModelingSubmission();
submission2 = new ModelingSubmission();
// setup
queryTestingBasics(this.examModelingExercise);
database.addResultToSubmission(submission1, AssessmentType.MANUAL, tutor1, 10D, true);
Result resultForSecondCorrectionWithLock = submissionService.saveNewEmptyResult(submission1);
resultForSecondCorrectionWithLock.setAssessor(tutor2);
resultForSecondCorrectionWithLock.setAssessmentType(AssessmentType.MANUAL);
resultRepository.save(resultForSecondCorrectionWithLock);
// checks
getQueryResults(examModelingExercise);
assertThat(submission1.getResults()).hasSize(2);
assertThat(examModelingExercise.getExerciseGroup().getExam().getNumberOfCorrectionRoundsInExam()).isEqualTo(2);
assertThat(unassessedSubmissionCorrectionRound0Tutor1).contains(submission2);
assertThat(unassessedSubmissionCorrectionRound1Tutor1).isEmpty();
assertThat(submissionListTutor1CorrectionRound0).hasSize(1);
assertThat(submissionListTutor1CorrectionRound0.get(0)).isEqualTo(submission1);
assertThat(submissionListTutor2CorrectionRound0).isEmpty();
assertThat(submissionListTutor1CorrectionRound1).isEmpty();
assertThat(submissionListTutor2CorrectionRound1).hasSize(1);
assertThat(submissionListTutor2CorrectionRound1.get(0)).isEqualTo(submission1);
}
Aggregations