diff --git a/src/main/java/de/tum/cit/ase/artemisModel/ProgrammingExercise.java b/src/main/java/de/tum/cit/ase/artemisModel/ProgrammingExercise.java index 19846d0..6310773 100644 --- a/src/main/java/de/tum/cit/ase/artemisModel/ProgrammingExercise.java +++ b/src/main/java/de/tum/cit/ase/artemisModel/ProgrammingExercise.java @@ -13,6 +13,7 @@ public class ProgrammingExercise extends Exercise { private boolean staticCodeAnalysisEnabled = false; // Required for creating course ProgrammingExercise private Course course; + private ProgrammingExerciseBuildConfig buildConfig = new ProgrammingExerciseBuildConfig(); public String getShortName() { return shortName; @@ -69,4 +70,12 @@ public Course getCourse() { public void setCourse(Course course) { this.course = course; } + + public ProgrammingExerciseBuildConfig getBuildConfig() { + return buildConfig; + } + + public void setBuildConfig(ProgrammingExerciseBuildConfig buildConfig) { + this.buildConfig = buildConfig; + } } diff --git a/src/main/java/de/tum/cit/ase/artemisModel/ProgrammingExerciseBuildConfig.java b/src/main/java/de/tum/cit/ase/artemisModel/ProgrammingExerciseBuildConfig.java new file mode 100644 index 0000000..b6a7a19 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/artemisModel/ProgrammingExerciseBuildConfig.java @@ -0,0 +1,168 @@ +package de.tum.cit.ase.artemisModel; + +import jakarta.annotation.Nullable; + +public class ProgrammingExerciseBuildConfig extends DomainObject { + + private Boolean sequentialTestRuns; + + private String branch; + + private String buildPlanConfiguration; + + private String buildScript; + + private boolean checkoutSolutionRepository = false; + + private String testCheckoutPath; + + private String assignmentCheckoutPath; + + private String solutionCheckoutPath; + + private int timeoutSeconds; + + private String dockerFlags; + + private ProgrammingExercise programmingExercise; + + private boolean testwiseCoverageEnabled; + + @Nullable + private String theiaImage; + + private boolean allowBranching = false; // default value + + private String branchRegex; + + @Nullable + private String buildPlanAccessSecret; + + public String getBuildPlanAccessSecret() { + return buildPlanAccessSecret; + } + + public void setBuildPlanAccessSecret(String buildPlanAccessSecret) { + this.buildPlanAccessSecret = buildPlanAccessSecret; + } + + public String getBranchRegex() { + return branchRegex; + } + + public void setBranchRegex(String branchRegex) { + this.branchRegex = branchRegex; + } + + public boolean isAllowBranching() { + return allowBranching; + } + + public void setAllowBranching(boolean allowBranching) { + this.allowBranching = allowBranching; + } + + public String getTheiaImage() { + return theiaImage; + } + + public void setTheiaImage(String theiaImage) { + this.theiaImage = theiaImage; + } + + public boolean isTestwiseCoverageEnabled() { + return testwiseCoverageEnabled; + } + + public void setTestwiseCoverageEnabled(boolean testwiseCoverageEnabled) { + this.testwiseCoverageEnabled = testwiseCoverageEnabled; + } + + public ProgrammingExercise getProgrammingExercise() { + return programmingExercise; + } + + public void setProgrammingExercise(ProgrammingExercise programmingExercise) { + this.programmingExercise = programmingExercise; + } + + public String getDockerFlags() { + return dockerFlags; + } + + public void setDockerFlags(String dockerFlags) { + this.dockerFlags = dockerFlags; + } + + public int getTimeoutSeconds() { + return timeoutSeconds; + } + + public void setTimeoutSeconds(int timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + } + + public String getSolutionCheckoutPath() { + return solutionCheckoutPath; + } + + public void setSolutionCheckoutPath(String solutionCheckoutPath) { + this.solutionCheckoutPath = solutionCheckoutPath; + } + + public String getAssignmentCheckoutPath() { + return assignmentCheckoutPath; + } + + public void setAssignmentCheckoutPath(String assignmentCheckoutPath) { + this.assignmentCheckoutPath = assignmentCheckoutPath; + } + + public String getTestCheckoutPath() { + return testCheckoutPath; + } + + public void setTestCheckoutPath(String testCheckoutPath) { + this.testCheckoutPath = testCheckoutPath; + } + + public boolean isCheckoutSolutionRepository() { + return checkoutSolutionRepository; + } + + public void setCheckoutSolutionRepository(boolean checkoutSolutionRepository) { + this.checkoutSolutionRepository = checkoutSolutionRepository; + } + + public String getBuildScript() { + return buildScript; + } + + public void setBuildScript(String buildScript) { + this.buildScript = buildScript; + } + + public String getBuildPlanConfiguration() { + return buildPlanConfiguration; + } + + public void setBuildPlanConfiguration(String buildPlanConfiguration) { + this.buildPlanConfiguration = buildPlanConfiguration; + } + + public String getBranch() { + return branch; + } + + public void setBranch(String branch) { + this.branch = branch; + } + + public Boolean getSequentialTestRuns() { + return sequentialTestRuns; + } + + public void setSequentialTestRuns(Boolean sequentialTestRuns) { + this.sequentialTestRuns = sequentialTestRuns; + } +} diff --git a/src/main/java/de/tum/cit/ase/service/artemis/interaction/SimulatedArtemisAdmin.java b/src/main/java/de/tum/cit/ase/service/artemis/interaction/SimulatedArtemisAdmin.java index 8606668..ca7ce19 100644 --- a/src/main/java/de/tum/cit/ase/service/artemis/interaction/SimulatedArtemisAdmin.java +++ b/src/main/java/de/tum/cit/ase/service/artemis/interaction/SimulatedArtemisAdmin.java @@ -56,12 +56,11 @@ public void prepareExam(long courseId, long examId) { // Get exam Exam exam = webClient .get() - .uri( - uriBuilder -> - uriBuilder - .pathSegment("api", "courses", courseIdString, "exams", examIdString) - .query("withStudents=false&withExerciseGroups=false") - .build() + .uri(uriBuilder -> + uriBuilder + .pathSegment("api", "courses", courseIdString, "exams", examIdString) + .query("withStudents=false&withExerciseGroups=false") + .build() ) .retrieve() .bodyToMono(Exam.class) @@ -90,9 +89,8 @@ public void prepareExam(long courseId, long examId) { // Generate student exams webClient .post() - .uri( - uriBuilder -> - uriBuilder.pathSegment("api", "courses", courseIdString, "exams", examIdString, "generate-student-exams").build() + .uri(uriBuilder -> + uriBuilder.pathSegment("api", "courses", courseIdString, "exams", examIdString, "generate-student-exams").build() ) .retrieve() .toBodilessEntity() @@ -102,11 +100,8 @@ public void prepareExam(long courseId, long examId) { // Prepare exercise start webClient .post() - .uri( - uriBuilder -> - uriBuilder - .pathSegment("api", "courses", courseIdString, "exams", examIdString, "student-exams", "start-exercises") - .build() + .uri(uriBuilder -> + uriBuilder.pathSegment("api", "courses", courseIdString, "exams", examIdString, "student-exams", "start-exercises").build() ) .retrieve() .toBodilessEntity() @@ -124,20 +119,10 @@ public void prepareExam(long courseId, long examId) { status = webClient .get() - .uri( - uriBuilder -> - uriBuilder - .pathSegment( - "api", - "courses", - courseIdString, - "exams", - examIdString, - "student-exams", - "start-exercises", - "status" - ) - .build() + .uri(uriBuilder -> + uriBuilder + .pathSegment("api", "courses", courseIdString, "exams", examIdString, "student-exams", "start-exercises", "status") + .build() ) .retrieve() .bodyToMono(ExamExerciseStartPreparationStatus.class) @@ -240,11 +225,10 @@ public void createExamExercises(long courseId, Exam exam) { textExerciseGroup = webClient .post() - .uri( - uriBuilder -> - uriBuilder - .pathSegment("api", "courses", String.valueOf(courseId), "exams", exam.getId().toString(), "exerciseGroups") - .build() + .uri(uriBuilder -> + uriBuilder + .pathSegment("api", "courses", String.valueOf(courseId), "exams", exam.getId().toString(), "exercise-groups") + .build() ) .bodyValue(textExerciseGroup) .retrieve() @@ -271,11 +255,10 @@ public void createExamExercises(long courseId, Exam exam) { modelingExerciseGroup = webClient .post() - .uri( - uriBuilder -> - uriBuilder - .pathSegment("api", "courses", String.valueOf(courseId), "exams", exam.getId().toString(), "exerciseGroups") - .build() + .uri(uriBuilder -> + uriBuilder + .pathSegment("api", "courses", String.valueOf(courseId), "exams", exam.getId().toString(), "exercise-groups") + .build() ) .bodyValue(modelingExerciseGroup) .retrieve() @@ -302,11 +285,10 @@ public void createExamExercises(long courseId, Exam exam) { programmingExerciseGroup = webClient .post() - .uri( - uriBuilder -> - uriBuilder - .pathSegment("api", "courses", String.valueOf(courseId), "exams", exam.getId().toString(), "exerciseGroups") - .build() + .uri(uriBuilder -> + uriBuilder + .pathSegment("api", "courses", String.valueOf(courseId), "exams", exam.getId().toString(), "exercise-groups") + .build() ) .bodyValue(programmingExerciseGroup) .retrieve() @@ -335,11 +317,10 @@ public void createExamExercises(long courseId, Exam exam) { quizExerciseGroup = webClient .post() - .uri( - uriBuilder -> - uriBuilder - .pathSegment("api", "courses", String.valueOf(courseId), "exams", exam.getId().toString(), "exerciseGroups") - .build() + .uri(uriBuilder -> + uriBuilder + .pathSegment("api", "courses", String.valueOf(courseId), "exams", exam.getId().toString(), "exercise-groups") + .build() ) .bodyValue(quizExerciseGroup) .retrieve() @@ -417,11 +398,8 @@ public void registerStudentsForCourse(long courseId, SimulatedArtemisStudent[] s try { webClient .post() - .uri( - uriBuilder -> - uriBuilder - .pathSegment("api", "courses", String.valueOf(courseId), "students", students[i].username) - .build() + .uri(uriBuilder -> + uriBuilder.pathSegment("api", "courses", String.valueOf(courseId), "students", students[i].username).build() ) .retrieve() .toBodilessEntity() @@ -450,18 +428,10 @@ public void registerStudentsForExam(long courseId, long examId) { webClient .post() - .uri( - uriBuilder -> - uriBuilder - .pathSegment( - "api", - "courses", - String.valueOf(courseId), - "exams", - String.valueOf(examId), - "register-course-students" - ) - .build() + .uri(uriBuilder -> + uriBuilder + .pathSegment("api", "courses", String.valueOf(courseId), "exams", String.valueOf(examId), "register-course-students") + .build() ) .retrieve() .toBodilessEntity()