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);
}
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);
}
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 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);
}
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();
}
Aggregations