use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method saveAndSubmitModelingSubmission_objectDiagram.
@Test
@WithMockUser(username = "student1")
public void saveAndSubmitModelingSubmission_objectDiagram() throws Exception {
database.createAndSaveParticipationForExercise(objectExercise, "student1");
String emptyObjectModel = FileUtils.loadFileFromResources("test-data/model-submission/empty-object-diagram.json");
ModelingSubmission submission = ModelFactory.generateModelingSubmission(emptyObjectModel, false);
ModelingSubmission returnedSubmission = performInitialModelSubmission(objectExercise.getId(), submission);
database.checkModelingSubmissionCorrectlyStored(returnedSubmission.getId(), emptyObjectModel);
checkDetailsHidden(returnedSubmission, true);
String validObjectModel = FileUtils.loadFileFromResources("test-data/model-submission/object-model.json");
returnedSubmission.setModel(validObjectModel);
returnedSubmission.setSubmitted(true);
returnedSubmission = performUpdateOnModelSubmission(objectExercise.getId(), returnedSubmission);
database.checkModelingSubmissionCorrectlyStored(returnedSubmission.getId(), validObjectModel);
checkDetailsHidden(returnedSubmission, true);
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method createModelingSubmission_badRequest.
@Test
@WithMockUser(username = "student1")
public void createModelingSubmission_badRequest() throws Exception {
ModelingSubmission submission = ModelFactory.generateModelingSubmission(validModel, true);
modelingSubmissionRepo.save(submission);
request.postWithResponseBody("/api/exercises/" + classExercise.getId() + "/modeling-submissions", submission, ModelingSubmission.class, HttpStatus.BAD_REQUEST);
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method getModelSubmissionWithoutAssessment_dueDateNotOver.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void getModelSubmissionWithoutAssessment_dueDateNotOver() throws Exception {
ModelingSubmission submission = ModelFactory.generateModelingSubmission(validModel, true);
database.addModelingSubmission(classExercise, submission, "student1");
request.get("/api/exercises/" + classExercise.getId() + "/modeling-submission-without-assessment", HttpStatus.FORBIDDEN, ModelingSubmission.class);
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method getModelSubmissionWithoutAssessment.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
public void getModelSubmissionWithoutAssessment() throws Exception {
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", HttpStatus.OK, ModelingSubmission.class);
// set dates to UTC and round to milliseconds for comparison
submission.setSubmissionDate(ZonedDateTime.ofInstant(submission.getSubmissionDate().truncatedTo(ChronoUnit.MILLIS).toInstant(), ZoneId.of("UTC")));
storedSubmission.setSubmissionDate(ZonedDateTime.ofInstant(storedSubmission.getSubmissionDate().truncatedTo(ChronoUnit.MILLIS).toInstant(), ZoneId.of("UTC")));
assertThat(storedSubmission).as("submission was found").isEqualToIgnoringGivenFields(submission, "results");
assertThat(storedSubmission.getLatestResult()).as("result is not set").isNull();
checkDetailsHidden(storedSubmission, false);
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project ArTEMiS by ls1intum.
the class ModelingSubmissionIntegrationTest method getModelSubmissionWithResult_involved_allowed.
@Test
@WithMockUser(username = "student1", roles = "USER")
public void getModelSubmissionWithResult_involved_allowed() throws Exception {
ModelingSubmission submission = ModelFactory.generateModelingSubmission(validModel, true);
submission = database.addModelingSubmission(classExercise, submission, "student1");
PlagiarismComparison<ModelingSubmissionElement> plagiarismComparison = new PlagiarismComparison<>();
PlagiarismSubmission<ModelingSubmissionElement> submissionA = new PlagiarismSubmission<>();
submissionA.setStudentLogin("student1");
submissionA.setSubmissionId(submission.getId());
plagiarismComparison.setSubmissionA(submissionA);
PlagiarismCase plagiarismCase = new PlagiarismCase();
plagiarismCase = plagiarismCaseRepository.save(plagiarismCase);
Post post = new Post();
post.setAuthor(userRepo.getUserByLoginElseThrow("instructor1"));
post.setTitle("Title Plagiarism Case Post");
post.setContent("Content Plagiarism Case Post");
post.setVisibleForStudents(true);
post.setPlagiarismCase(plagiarismCase);
postRepository.save(post);
submissionA.setPlagiarismCase(plagiarismCase);
plagiarismComparisonRepository.save(plagiarismComparison);
var submissionResult = request.get("/api/modeling-submissions/" + submission.getId(), HttpStatus.OK, ModelingSubmission.class);
assertThat(submissionResult.getParticipation()).as("Should anonymize participation").isNull();
assertThat(submissionResult.getResults()).as("Should anonymize results").isEmpty();
assertThat(submissionResult.getSubmissionDate()).as("Should anonymize submission date").isNull();
}
Aggregations