Search in sources :

Example 41 with ModelingSubmission

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);
}
Also used : ModelingSubmission(de.tum.in.www1.artemis.domain.modeling.ModelingSubmission)

Example 42 with ModelingSubmission

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);
}
Also used : ModelingSubmission(de.tum.in.www1.artemis.domain.modeling.ModelingSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.jupiter.api.Test)

Example 43 with ModelingSubmission

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);
}
Also used : WithMockUser(org.springframework.security.test.context.support.WithMockUser) ModelingSubmission(de.tum.in.www1.artemis.domain.modeling.ModelingSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.jupiter.api.Test)

Example 44 with ModelingSubmission

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();
}
Also used : ModelingSubmission(de.tum.in.www1.artemis.domain.modeling.ModelingSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) AbstractSpringIntegrationBambooBitbucketJiraTest(de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest) Test(org.junit.jupiter.api.Test)

Example 45 with ModelingSubmission

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);
}
Also used : ModelingSubmission(de.tum.in.www1.artemis.domain.modeling.ModelingSubmission) WithMockUser(org.springframework.security.test.context.support.WithMockUser) AbstractSpringIntegrationBambooBitbucketJiraTest(de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest) Test(org.junit.jupiter.api.Test)

Aggregations

ModelingSubmission (de.tum.in.www1.artemis.domain.modeling.ModelingSubmission)160 Test (org.junit.jupiter.api.Test)108 WithMockUser (org.springframework.security.test.context.support.WithMockUser)106 ModelingExercise (de.tum.in.www1.artemis.domain.modeling.ModelingExercise)36 StudentParticipation (de.tum.in.www1.artemis.domain.participation.StudentParticipation)22 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)20 AbstractSpringIntegrationBambooBitbucketJiraTest (de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest)16 ModelingPlagiarismResult (de.tum.in.www1.artemis.domain.plagiarism.modeling.ModelingPlagiarismResult)16 TextPlagiarismResult (de.tum.in.www1.artemis.domain.plagiarism.text.TextPlagiarismResult)12 JsonParser.parseString (com.google.gson.JsonParser.parseString)8 ModelCluster (de.tum.in.www1.artemis.domain.modeling.ModelCluster)8 ModelingSubmission (de.tum.in.www1.artemis.domain.ModelingSubmission)6 Result (de.tum.in.www1.artemis.domain.Result)6 ModelElement (de.tum.in.www1.artemis.domain.modeling.ModelElement)6 ModelClusterFactory (de.tum.in.www1.artemis.service.compass.controller.ModelClusterFactory)6 StudentExam (de.tum.in.www1.artemis.domain.exam.StudentExam)4 ExerciseHint (de.tum.in.www1.artemis.domain.hestia.ExerciseHint)4 Participation (de.tum.in.www1.artemis.domain.participation.Participation)4 PlagiarismComparison (de.tum.in.www1.artemis.domain.plagiarism.PlagiarismComparison)4 PlagiarismSubmission (de.tum.in.www1.artemis.domain.plagiarism.PlagiarismSubmission)4