use of de.tum.in.www1.artemis.domain.plagiarism.text.TextSubmissionElement in project ArTEMiS by ls1intum.
the class PlagiarismIntegrationTest method updatePlagiarismComparisonFinalStatusForStudentA.
/**
* Checks the method updatePlagiarismComparisonFinalStatus as instructor
*/
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void updatePlagiarismComparisonFinalStatusForStudentA() throws Exception {
Course course = database.addCourseWithOneFinishedTextExercise();
TextExercise textExercise = textExerciseRepository.findByCourseIdWithCategories(course.getId()).get(0);
TextPlagiarismResult textPlagiarismResult = database.createTextPlagiarismResultForExercise(textExercise);
PlagiarismComparison<TextSubmissionElement> plagiarismComparison = new PlagiarismComparison<>();
PlagiarismSubmission<TextSubmissionElement> submissionA = new PlagiarismSubmission<>();
submissionA.setStudentLogin("student1");
plagiarismComparison.setInstructorStatementA(INSTRUCTOR_STATEMENT_A);
plagiarismComparison.setPlagiarismResult(textPlagiarismResult);
plagiarismComparison.setStatusA(PlagiarismStatus.NONE);
plagiarismComparison.setSubmissionA(submissionA);
plagiarismComparisonRepository.save(plagiarismComparison);
var plagiarismComparisonStatus = new PlagiarismComparisonStatusDTO();
plagiarismComparisonStatus.setStatus(PlagiarismStatus.CONFIRMED);
request.put("/api/courses/" + course.getId() + "/plagiarism-comparisons/" + plagiarismComparison.getId() + "/final-status/student1", plagiarismComparisonStatus, HttpStatus.OK);
var updatedPlagiarismComparison = plagiarismComparisonRepository.findByIdWithSubmissionsStudentsElseThrow(plagiarismComparison.getId());
assertThat(updatedPlagiarismComparison.getStatusA()).as("should update status for studentA").isEqualTo(PlagiarismStatus.CONFIRMED);
}
use of de.tum.in.www1.artemis.domain.plagiarism.text.TextSubmissionElement in project ArTEMiS by ls1intum.
the class PlagiarismIntegrationTest method saveStudentStatementForStudentA.
/**
* Checks the method updatePlagiarismComparisonStudentStatement for student A
*/
@Test
@WithMockUser(username = "student1", roles = "USER")
public void saveStudentStatementForStudentA() throws Exception {
Course course = database.addCourseWithOneFinishedTextExercise();
TextExercise textExercise = textExerciseRepository.findByCourseIdWithCategories(course.getId()).get(0);
TextPlagiarismResult textPlagiarismResult = database.createTextPlagiarismResultForExercise(textExercise);
PlagiarismComparison<TextSubmissionElement> plagiarismComparison = new PlagiarismComparison<>();
plagiarismComparison.setPlagiarismResult(textPlagiarismResult);
plagiarismComparison.setInstructorStatementA(INSTRUCTOR_STATEMENT_A);
PlagiarismSubmission<TextSubmissionElement> submissionA = new PlagiarismSubmission<>();
submissionA.setStudentLogin("student1");
plagiarismComparison.setSubmissionA(submissionA);
plagiarismComparisonRepository.save(plagiarismComparison);
var statement = new PlagiarismResource.PlagiarismStatementDTO();
statement.statement = "test statement";
request.put("/api/courses/" + course.getId() + "/plagiarism-comparisons/" + plagiarismComparison.getId() + "/student-statement", statement, HttpStatus.OK);
var comparison = plagiarismComparisonRepository.findByIdWithSubmissionsStudentsElseThrow(plagiarismComparison.getId());
assertThat(comparison.getStudentStatementA()).as("should update student statement").isEqualTo("test statement");
}
use of de.tum.in.www1.artemis.domain.plagiarism.text.TextSubmissionElement in project ArTEMiS by ls1intum.
the class PlagiarismIntegrationTest method saveInstructorStatementForStudentA.
/**
* Checks the method updatePlagiarismComparisonInstructorStatement for student A
*/
@Test
@WithMockUser(username = "instructor1", roles = "INSTRUCTOR")
public void saveInstructorStatementForStudentA() throws Exception {
Course course = database.addCourseWithOneFinishedTextExercise();
TextExercise textExercise = textExerciseRepository.findByCourseIdWithCategories(course.getId()).get(0);
TextPlagiarismResult textPlagiarismResult = database.createTextPlagiarismResultForExercise(textExercise);
PlagiarismComparison<TextSubmissionElement> plagiarismComparison = new PlagiarismComparison<>();
plagiarismComparison.setPlagiarismResult(textPlagiarismResult);
PlagiarismSubmission<TextSubmissionElement> submissionA = new PlagiarismSubmission<>();
submissionA.setStudentLogin("student1");
plagiarismComparison.setSubmissionA(submissionA);
plagiarismComparisonRepository.save(plagiarismComparison);
var statement = new PlagiarismResource.PlagiarismStatementDTO();
statement.statement = "test statement";
request.put("/api/courses/" + course.getId() + "/plagiarism-comparisons/" + plagiarismComparison.getId() + "/instructor-statement/student1", statement, HttpStatus.OK);
var comparison = plagiarismComparisonRepository.findByIdWithSubmissionsStudentsElseThrow(plagiarismComparison.getId());
assertThat(comparison.getInstructorStatementA()).as("should update instructor statement").isEqualTo("test statement");
}
use of de.tum.in.www1.artemis.domain.plagiarism.text.TextSubmissionElement in project Artemis by ls1intum.
the class TextSubmissionIntegrationTest method getTextSubmissionWithResult_involved_allowed.
@Test
@WithMockUser(username = "student1", roles = "USER")
public void getTextSubmissionWithResult_involved_allowed() throws Exception {
textSubmission = database.saveTextSubmission(finishedTextExercise, textSubmission, "student1");
PlagiarismComparison<TextSubmissionElement> plagiarismComparison = new PlagiarismComparison<>();
PlagiarismSubmission<TextSubmissionElement> submissionA = new PlagiarismSubmission<>();
submissionA.setStudentLogin("student1");
submissionA.setSubmissionId(this.textSubmission.getId());
plagiarismComparison.setSubmissionA(submissionA);
PlagiarismCase plagiarismCase = new PlagiarismCase();
plagiarismCase = plagiarismCaseRepository.save(plagiarismCase);
Post post = new Post();
post.setAuthor(userRepository.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 submission = request.get("/api/text-submissions/" + this.textSubmission.getId(), HttpStatus.OK, TextSubmission.class);
assertThat(submission.getParticipation()).as("Should anonymize participation").isNull();
assertThat(submission.getResults()).as("Should anonymize results").isEmpty();
assertThat(submission.getSubmissionDate()).as("Should anonymize submission date").isNull();
}
use of de.tum.in.www1.artemis.domain.plagiarism.text.TextSubmissionElement in project Artemis by ls1intum.
the class PlagiarismCaseIntegrationTest method initTestCase.
@BeforeEach
public void initTestCase() {
database.addUsers(3, 1, 1, 1);
course = database.addCourseWithOneFinishedTextExercise();
textExercise = textExerciseRepository.findByCourseIdWithCategories(course.getId()).get(0);
plagiarismCase1 = new PlagiarismCase();
plagiarismCase1.setExercise(textExercise);
User student1 = database.getUserByLogin("student1");
plagiarismCase1.setStudent(student1);
plagiarismCase1 = plagiarismCaseRepository.save(plagiarismCase1);
PlagiarismResult<TextSubmissionElement> textPlagiarismResult = database.createTextPlagiarismResultForExercise(textExercise);
PlagiarismComparison<TextSubmissionElement> plagiarismComparison = new PlagiarismComparison<>();
plagiarismComparison.setPlagiarismResult(textPlagiarismResult);
plagiarismComparison = plagiarismComparisonRepository.save(plagiarismComparison);
PlagiarismSubmission<TextSubmissionElement> plagiarismSubmission1 = new PlagiarismSubmission<>();
plagiarismSubmission1.setStudentLogin("student1");
plagiarismSubmission1.setPlagiarismCase(plagiarismCase1);
plagiarismSubmission1.setPlagiarismComparison(plagiarismComparison);
PlagiarismSubmission<TextSubmissionElement> plagiarismSubmission2 = new PlagiarismSubmission<>();
plagiarismSubmission2.setStudentLogin("student2");
plagiarismSubmission2.setPlagiarismCase(plagiarismCase1);
plagiarismSubmission2.setPlagiarismComparison(plagiarismComparison);
plagiarismComparison.setSubmissionA(plagiarismSubmission1);
plagiarismComparison.setSubmissionB(plagiarismSubmission2);
plagiarismComparisonRepository.save(plagiarismComparison);
plagiarismCase2 = new PlagiarismCase();
plagiarismCase2.setExercise(textExercise);
User student2 = database.getUserByLogin("student2");
plagiarismCase2.setStudent(student2);
plagiarismCase2 = plagiarismCaseRepository.save(plagiarismCase2);
plagiarismCase3 = new PlagiarismCase();
plagiarismCase3.setExercise(textExercise);
User student3 = database.getUserByLogin("student3");
plagiarismCase3.setStudent(student3);
plagiarismCase3 = plagiarismCaseRepository.save(plagiarismCase3);
}
Aggregations