Search in sources :

Example 71 with ModelingExercise

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<>();
}
Also used : ModelingExercise(de.tum.in.www1.artemis.domain.modeling.ModelingExercise) ModelingExercise(de.tum.in.www1.artemis.domain.modeling.ModelingExercise) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 72 with ModelingExercise

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

Example 73 with ModelingExercise

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);
    }
}
Also used : ModelElement(de.tum.in.www1.artemis.domain.modeling.ModelElement) ModelingSubmission(de.tum.in.www1.artemis.domain.modeling.ModelingSubmission) ModelingExercise(de.tum.in.www1.artemis.domain.modeling.ModelingExercise) ModelCluster(de.tum.in.www1.artemis.domain.modeling.ModelCluster) Test(org.junit.jupiter.api.Test)

Example 74 with ModelingExercise

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

Example 75 with ModelingExercise

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

Aggregations

ModelingExercise (de.tum.in.www1.artemis.domain.modeling.ModelingExercise)196 WithMockUser (org.springframework.security.test.context.support.WithMockUser)132 Test (org.junit.jupiter.api.Test)126 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)96 ModelingSubmission (de.tum.in.www1.artemis.domain.modeling.ModelingSubmission)72 ModelingPlagiarismResult (de.tum.in.www1.artemis.domain.plagiarism.modeling.ModelingPlagiarismResult)28 ExerciseGroup (de.tum.in.www1.artemis.domain.exam.ExerciseGroup)26 StudentParticipation (de.tum.in.www1.artemis.domain.participation.StudentParticipation)20 AbstractSpringIntegrationBambooBitbucketJiraTest (de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest)16 TextPlagiarismResult (de.tum.in.www1.artemis.domain.plagiarism.text.TextPlagiarismResult)16 BeforeEach (org.junit.jupiter.api.BeforeEach)16 Course (de.tum.in.www1.artemis.domain.Course)14 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)14 ZonedDateTime (java.time.ZonedDateTime)12 Exam (de.tum.in.www1.artemis.domain.exam.Exam)10 QuizExercise (de.tum.in.www1.artemis.domain.quiz.QuizExercise)10 TeamAssignmentPayload (de.tum.in.www1.artemis.web.websocket.dto.TeamAssignmentPayload)9 JsonParser.parseString (com.google.gson.JsonParser.parseString)8 StudentExam (de.tum.in.www1.artemis.domain.exam.StudentExam)8 ModelCluster (de.tum.in.www1.artemis.domain.modeling.ModelCluster)8