Skip to content

Commit

Permalink
Merge pull request #342 from ls1intum/chore/update-benchmarking-tool
Browse files Browse the repository at this point in the history
Add buildConfig and update endpoints
  • Loading branch information
krusche authored Oct 20, 2024
2 parents 6ee4f43 + 45dbbb8 commit 9e712a2
Show file tree
Hide file tree
Showing 3 changed files with 212 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 9e712a2

Please sign in to comment.