Search in sources :

Example 71 with ModelingSubmission

use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project Artemis by ls1intum.

the class ModelingSubmissionIntegrationTest method saveAndSubmitModelingSubmission_classDiagram.

@Test
@WithMockUser(username = "student1")
public void saveAndSubmitModelingSubmission_classDiagram() throws Exception {
    database.createAndSaveParticipationForExercise(classExercise, "student1");
    ModelingSubmission submission = ModelFactory.generateModelingSubmission(emptyModel, false);
    ModelingSubmission returnedSubmission = performInitialModelSubmission(classExercise.getId(), submission);
    database.checkModelingSubmissionCorrectlyStored(returnedSubmission.getId(), emptyModel);
    checkDetailsHidden(returnedSubmission, true);
    returnedSubmission.setModel(validModel);
    returnedSubmission.setSubmitted(true);
    returnedSubmission = performUpdateOnModelSubmission(classExercise.getId(), returnedSubmission);
    database.checkModelingSubmissionCorrectlyStored(returnedSubmission.getId(), validModel);
    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 72 with ModelingSubmission

use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project Artemis by ls1intum.

the class ModelingSubmissionIntegrationTest method saveAndSubmitModelingSubmission_useCaseDiagram.

@Test
@WithMockUser(username = "student1")
public void saveAndSubmitModelingSubmission_useCaseDiagram() throws Exception {
    database.createAndSaveParticipationForExercise(useCaseExercise, "student1");
    String emptyUseCaseModel = FileUtils.loadFileFromResources("test-data/model-submission/empty-use-case-diagram.json");
    ModelingSubmission submission = ModelFactory.generateModelingSubmission(emptyUseCaseModel, false);
    ModelingSubmission returnedSubmission = performInitialModelSubmission(useCaseExercise.getId(), submission);
    database.checkModelingSubmissionCorrectlyStored(returnedSubmission.getId(), emptyUseCaseModel);
    checkDetailsHidden(returnedSubmission, true);
    String validUseCaseModel = FileUtils.loadFileFromResources("test-data/model-submission/use-case-model.json");
    returnedSubmission.setModel(validUseCaseModel);
    returnedSubmission.setSubmitted(true);
    returnedSubmission = performUpdateOnModelSubmission(useCaseExercise.getId(), returnedSubmission);
    database.checkModelingSubmissionCorrectlyStored(returnedSubmission.getId(), validUseCaseModel);
    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 73 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 74 with ModelingSubmission

use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project Artemis by ls1intum.

the class ModelingSubmissionIntegrationTest method getModelSubmissionWithResult_notInvolved_notAllowed.

@Test
@WithMockUser(value = "student1", roles = "USER")
public void getModelSubmissionWithResult_notInvolved_notAllowed() throws Exception {
    ModelingSubmission submission = ModelFactory.generateModelingSubmission(validModel, true);
    submission = database.addModelingSubmission(classExercise, submission, "student1");
    request.get("/api/modeling-submissions/" + submission.getId(), HttpStatus.FORBIDDEN, ModelingSubmission.class);
}
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 75 with ModelingSubmission

use of de.tum.in.www1.artemis.domain.modeling.ModelingSubmission in project Artemis by ls1intum.

the class ModelingSubmissionIntegrationTest method getSubmissionForModelingEditor_emptySubmission.

@Test
@WithMockUser(username = "student1")
public void getSubmissionForModelingEditor_emptySubmission() throws Exception {
    StudentParticipation studentParticipation = database.createAndSaveParticipationForExercise(classExercise, "student1");
    assertThat(studentParticipation.getSubmissions()).isEmpty();
    ModelingSubmission returnedSubmission = request.get("/api/participations/" + studentParticipation.getId() + "/latest-modeling-submission", HttpStatus.OK, ModelingSubmission.class);
    assertThat(returnedSubmission).as("new submission is created").isNotNull();
}
Also used : ModelingSubmission(de.tum.in.www1.artemis.domain.modeling.ModelingSubmission) StudentParticipation(de.tum.in.www1.artemis.domain.participation.StudentParticipation) WithMockUser(org.springframework.security.test.context.support.WithMockUser) 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