use of de.tum.in.www1.artemis.domain.modeling.ModelingExercise in project ArTEMiS by ls1intum.
the class TutorParticipationIntegrationTest method initTestCase.
@BeforeEach
public void initTestCase() throws Exception {
database.addUsers(0, 1, 0, 0);
Course course = database.addCourseWithModelingAndTextExercise();
for (Exercise exercise : course.getExercises()) {
if (exercise instanceof ModelingExercise) {
modelingExercise = (ModelingExercise) exercise;
}
if (exercise instanceof TextExercise) {
textExercise = (TextExercise) exercise;
}
}
for (Exercise exercise : new Exercise[] { textExercise, modelingExercise }) {
exercise.setTitle("exercise name");
exerciseRepo.save(exercise);
path = "/api/exercises/" + exercise.getId() + "/assess-example-submission";
}
textBlockIds = new ArrayList<>();
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingExercise in project ArTEMiS by ls1intum.
the class TeamWebsocketServiceTest method testSendTeamAssignmentUpdateOnTeamCreate.
@Test
@WithMockUser(username = "tutor1", roles = "TA")
void testSendTeamAssignmentUpdateOnTeamCreate() throws Exception {
Team team = new Team().name("Team").shortName("team").exercise(modelingExercise).students(students);
team = request.postWithResponseBody(teamResourceUrl(), team, Team.class, HttpStatus.CREATED);
TeamAssignmentPayload expectedPayload = new TeamAssignmentPayload(modelingExercise, team);
team.getStudents().forEach(user -> verify(messagingTemplate).convertAndSendToUser(user.getLogin(), assignmentTopic, expectedPayload));
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingExercise in project ArTEMiS by ls1intum.
the class ModelClusterFactoryTest method testBuildingClustersWithSimilarElements.
@Test
public void testBuildingClustersWithSimilarElements() throws Exception {
ModelingSubmission submission1 = ModelFactory.generateModelingSubmission(FileUtils.loadFileFromResources("test-data/model-submission/model.54727.json"), true);
submission1.setId(1L);
ModelingSubmission submission2 = ModelFactory.generateModelingSubmission(FileUtils.loadFileFromResources("test-data/model-submission/model.54727.cpy.json"), true);
submission2.setId(2L);
ModelingSubmission submission3 = ModelFactory.generateModelingSubmission(FileUtils.loadFileFromResources("test-data/model-submission/model.54727.cpy.json"), true);
submission3.setId(3L);
ModelingSubmission submission4 = ModelFactory.generateModelingSubmission(FileUtils.loadFileFromResources("test-data/model-submission/model.54727.cpy.json"), true);
submission4.setId(4L);
ModelingSubmission submission5 = ModelFactory.generateModelingSubmission(FileUtils.loadFileFromResources("test-data/model-submission/model.one-element.json"), true);
submission5.setId(5L);
ModelingExercise exercise = new ModelingExercise();
List<ModelCluster> modelClusters = modelClusterFactory.buildClusters(List.of(submission1, submission2, submission3, submission4, submission5), exercise);
assertThat(modelClusters).as("model clusters created").hasSize(10);
ModelCluster modelCluster = modelClusters.get(0);
assertThat(modelCluster.getModelElements()).as("all elements are created").hasSize(4);
for (ModelElement element : modelCluster.getModelElements()) {
assertThat(element.getCluster()).as("created elements keeps the cluster").isEqualTo(modelCluster);
}
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingExercise in project ArTEMiS by ls1intum.
the class ProgrammingSubmissionIntegrationTest method triggerBuildStudentSubmissionNotFound.
@Test
@WithMockUser(username = "student1", roles = "USER")
void triggerBuildStudentSubmissionNotFound() throws Exception {
String login = "student1";
Course course = database.addCourseWithDifferentModelingExercises();
ModelingExercise classExercise = database.findModelingExerciseWithTitle(course.getExercises(), "ClassDiagram");
ModelingSubmission modelingSubmission = ModelFactory.generateModelingSubmission(FileUtils.loadFileFromResources("test-data/model-submission/empty-class-diagram.json"), true);
modelingSubmission = database.addModelingSubmission(classExercise, modelingSubmission, login);
String url = "/api/programming-submissions/" + modelingSubmission.getParticipation().getId() + "/trigger-build";
request.postWithoutLocation(url, null, HttpStatus.NOT_FOUND, new HttpHeaders());
}
use of de.tum.in.www1.artemis.domain.modeling.ModelingExercise in project ArTEMiS by ls1intum.
the class ProgrammingSubmissionIntegrationTest method triggerFailedBuildSubmissionNotFound.
@Test
@WithMockUser(username = "student1", roles = "USER")
void triggerFailedBuildSubmissionNotFound() throws Exception {
String login = "student1";
Course course = database.addCourseWithDifferentModelingExercises();
ModelingExercise classExercise = database.findModelingExerciseWithTitle(course.getExercises(), "ClassDiagram");
ModelingSubmission modelingSubmission = ModelFactory.generateModelingSubmission(FileUtils.loadFileFromResources("test-data/model-submission/empty-class-diagram.json"), true);
modelingSubmission = database.addModelingSubmission(classExercise, modelingSubmission, login);
String url = "/api/programming-submissions/" + modelingSubmission.getParticipation().getId() + "/trigger-failed-build";
request.postWithoutLocation(url, null, HttpStatus.NOT_FOUND, new HttpHeaders());
}
Aggregations