Skip to content

Commit

Permalink
Merge branch 'develop' into feature/programming-exercises/feedback-su…
Browse files Browse the repository at this point in the history
…ggestions-server

# Conflicts:
#	src/main/java/de/tum/in/www1/artemis/repository/ProgrammingExerciseRepository.java
  • Loading branch information
maximiliansoelch committed Nov 24, 2023
2 parents f0f44a2 + bd0d757 commit dd07677
Show file tree
Hide file tree
Showing 125 changed files with 4,319 additions and 1,242 deletions.
1 change: 1 addition & 0 deletions .ci/E2E-tests/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ docker volume rm $(docker volume ls -q) || true

docker compose -f ./docker/cypress-E2E-tests-mysql.yml down -v
docker compose -f ./docker/cypress-E2E-tests-postgres.yml down -v
docker compose -f ./docker/cypress-E2E-tests-local.yml down -v

# show all running docker containers and volumes after the cleanup to detect issues
echo "SHOW RUNNING Docker containers and volumes:"
Expand Down
2 changes: 2 additions & 0 deletions .ci/E2E-tests/execute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if [ "$DB" = "mysql" ]; then
COMPOSE_FILE="cypress-E2E-tests-mysql.yml"
elif [ "$DB" = "postgres" ]; then
COMPOSE_FILE="cypress-E2E-tests-postgres.yml"
elif [ "$DB" = "local" ]; then
COMPOSE_FILE="cypress-E2E-tests-local.yml"
else
echo "Invalid database type. Please choose either mysql or postgres."
exit 1
Expand Down
14 changes: 14 additions & 0 deletions docker/artemis/config/cypress-local.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ----------------------------------------------------------------------------------------------------------------------
# Artemis configuration overrides for the Cypress E2E Postgres setups
# ----------------------------------------------------------------------------------------------------------------------

SPRING_PROFILES_ACTIVE="artemis,scheduling,localvc,localci,prod,docker"

ARTEMIS_USERMANAGEMENT_USEEXTERNAL="false"
ARTEMIS_VERSIONCONTROL_URL='https://localhost'
ARTEMIS_VERSIONCONTROL_USER='demo'
ARTEMIS_VERSIONCONTROL_PASSWORD='demo'
ARTEMIS_CONTINUOUSINTEGRATION_ARTEMISAUTHENTICATIONTOKENVALUE='demo'
ARTEMIS_CONTINUOUSINTEGRATION_DOCKERCONNECTIONURI='unix:///var/run/docker.sock'
ARTEMIS_GIT_NAME='artemis'
ARTEMIS_GIT_EMAIL='[email protected]'
62 changes: 62 additions & 0 deletions docker/cypress-E2E-tests-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ----------------------------------------------------------------------------------------------------------------------
# Cypress Setup MySQL
# ----------------------------------------------------------------------------------------------------------------------

services:
mysql:
extends:
file: ./mysql.yml
service: mysql

artemis-app:
extends:
file: ./artemis.yml
service: artemis-app
user: 0:0
depends_on:
mysql:
condition: service_healthy
env_file:
- ./artemis/config/cypress.env
- ./artemis/config/cypress-local.env
volumes:
- /var/run/docker.sock:/var/run/docker.sock

nginx:
extends:
file: ./nginx.yml
service: nginx
# the artemis-app service needs to be started, otherwise there are problems with name resolution in docker
depends_on:
artemis-app:
condition: service_started
volumes:
- ./nginx/artemis-nginx-cypress.conf:/etc/nginx/conf.d/artemis-nginx-cypress.conf:ro
ports:
- "80:80"
- "443:443"
# see comments in artemis/config/cypress.env why this port is necessary
- "54321:54321"

artemis-cypress:
extends:
file: ./cypress.yml
service: artemis-cypress
depends_on:
artemis-app:
condition: service_healthy
environment:
CYPRESS_DB_TYPE: "Local"
SORRY_CYPRESS_PROJECT_ID: "artemis-local"
CYPRESS_createUsers: "true"
command: sh -c "cd /app/artemis/src/test/cypress && chmod 777 /root && npm ci && npm run cypress:setup && (npm run cypress:record:local & sleep 60 && npm run cypress:record:local & wait)"

networks:
artemis:
driver: "bridge"
name: artemis
volumes:
artemis-mysql-data:
name: artemis-mysql-data
artemis-data:
name: artemis-data
13 changes: 0 additions & 13 deletions src/main/java/de/tum/in/www1/artemis/domain/Course.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import de.tum.in.www1.artemis.domain.enumeration.Language;
import de.tum.in.www1.artemis.domain.enumeration.ProgrammingLanguage;
import de.tum.in.www1.artemis.domain.exam.Exam;
import de.tum.in.www1.artemis.domain.iris.settings.IrisSettings;
import de.tum.in.www1.artemis.domain.metis.Post;
import de.tum.in.www1.artemis.domain.tutorialgroups.TutorialGroup;
import de.tum.in.www1.artemis.domain.tutorialgroups.TutorialGroupsConfiguration;
Expand Down Expand Up @@ -255,10 +254,6 @@ public class Course extends DomainObject {
@JsonIgnoreProperties("course")
private TutorialGroupsConfiguration tutorialGroupsConfiguration;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
@JoinColumn(name = "iris_settings_id")
private IrisSettings irisSettings;

// NOTE: Helpers variable names must be different from Getter name, so that Jackson ignores the @Transient annotation, but Hibernate still respects it
@Transient
private Long numberOfInstructorsTransient;
Expand Down Expand Up @@ -1030,12 +1025,4 @@ public String getCourseInformationSharingMessagingCodeOfConduct() {
public void setCourseInformationSharingMessagingCodeOfConduct(String courseInformationSharingMessagingCodeOfConduct) {
this.courseInformationSharingMessagingCodeOfConduct = courseInformationSharingMessagingCodeOfConduct;
}

public IrisSettings getIrisSettings() {
return irisSettings;
}

public void setIrisSettings(IrisSettings irisSettings) {
this.irisSettings = irisSettings;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import de.tum.in.www1.artemis.domain.enumeration.*;
import de.tum.in.www1.artemis.domain.hestia.ExerciseHint;
import de.tum.in.www1.artemis.domain.hestia.ProgrammingExerciseTask;
import de.tum.in.www1.artemis.domain.iris.settings.IrisSettings;
import de.tum.in.www1.artemis.domain.participation.Participation;
import de.tum.in.www1.artemis.domain.participation.SolutionProgrammingExerciseParticipation;
import de.tum.in.www1.artemis.domain.participation.StudentParticipation;
Expand Down Expand Up @@ -147,10 +146,6 @@ public String getType() {
@Column(name = "release_tests_with_example_solution", table = "programming_exercise_details")
private boolean releaseTestsWithExampleSolution;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
@JoinColumn(name = "iris_settings_id", table = "programming_exercise_details")
private IrisSettings irisSettings;

@Column(name = "build_plan_configuration", table = "programming_exercise_details", columnDefinition = "longtext")
private String buildPlanConfiguration;

Expand Down Expand Up @@ -862,10 +857,6 @@ public void generateAndSetBuildPlanAccessSecret() {
buildPlanAccessSecret = UUID.randomUUID().toString();
}

public IrisSettings getIrisSettings() {
return irisSettings;
}

/**
* {@inheritDoc}
*/
Expand All @@ -876,10 +867,6 @@ public void disconnectRelatedEntities() {
super.disconnectRelatedEntities();
}

public void setIrisSettings(IrisSettings irisSettings) {
this.irisSettings = irisSettings;
}

/**
* Returns the JSON encoded custom build plan configuration
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package de.tum.in.www1.artemis.domain.iris.settings;

import javax.annotation.Nullable;
import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonInclude;

import de.tum.in.www1.artemis.domain.iris.IrisTemplate;

/**
* An {@link IrisSubSettings} implementation for chat settings.
* Chat settings notably provide settings for the rate limit.
* Chat settings provide a single {@link IrisTemplate} for the chat messages.
*/
@Entity
@DiscriminatorValue("CHAT")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class IrisChatSubSettings extends IrisSubSettings {

@Nullable
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
private IrisTemplate template;

@Nullable
@Column(name = "rate_limit")
private Integer rateLimit;

@Nullable
@Column(name = "rate_limit_timeframe_hours")
private Integer rateLimitTimeframeHours;

@Nullable
public IrisTemplate getTemplate() {
return template;
}

public void setTemplate(@Nullable IrisTemplate template) {
this.template = template;
}

@Nullable
public Integer getRateLimit() {
return rateLimit;
}

public void setRateLimit(@Nullable Integer rateLimit) {
this.rateLimit = rateLimit;
}

@Nullable
public Integer getRateLimitTimeframeHours() {
return rateLimitTimeframeHours;
}

public void setRateLimitTimeframeHours(@Nullable Integer rateLimitTimeframeHours) {
this.rateLimitTimeframeHours = rateLimitTimeframeHours;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package de.tum.in.www1.artemis.domain.iris.settings;

import javax.annotation.Nullable;
import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonInclude;

import de.tum.in.www1.artemis.domain.iris.IrisTemplate;

/**
* An {@link IrisSubSettings} implementation for code editor settings.
* Code editor settings notably provide multiple {@link IrisTemplate}s for the different steps in the code generation.
*/
@Entity
@DiscriminatorValue("CODE_EDITOR")
@SecondaryTable(name = "iris_code_editor_sub_settings")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class IrisCodeEditorSubSettings extends IrisSubSettings {

@Nullable
@JoinColumn(table = "iris_code_editor_sub_settings")
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
private IrisTemplate chatTemplate;

@Nullable
@JoinColumn(table = "iris_code_editor_sub_settings")
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
private IrisTemplate problemStatementGenerationTemplate;

@Nullable
@JoinColumn(table = "iris_code_editor_sub_settings")
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
private IrisTemplate templateRepoGenerationTemplate;

@Nullable
@JoinColumn(table = "iris_code_editor_sub_settings")
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
private IrisTemplate solutionRepoGenerationTemplate;

@Nullable
@JoinColumn(table = "iris_code_editor_sub_settings")
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
private IrisTemplate testRepoGenerationTemplate;

@Nullable
public IrisTemplate getChatTemplate() {
return chatTemplate;
}

public void setChatTemplate(@Nullable IrisTemplate chatTemplate) {
this.chatTemplate = chatTemplate;
}

@Nullable
public IrisTemplate getProblemStatementGenerationTemplate() {
return problemStatementGenerationTemplate;
}

public void setProblemStatementGenerationTemplate(@Nullable IrisTemplate problemStatementGenerationTemplate) {
this.problemStatementGenerationTemplate = problemStatementGenerationTemplate;
}

@Nullable
public IrisTemplate getTemplateRepoGenerationTemplate() {
return templateRepoGenerationTemplate;
}

public void setTemplateRepoGenerationTemplate(@Nullable IrisTemplate templateRepoGenerationTemplate) {
this.templateRepoGenerationTemplate = templateRepoGenerationTemplate;
}

@Nullable
public IrisTemplate getSolutionRepoGenerationTemplate() {
return solutionRepoGenerationTemplate;
}

public void setSolutionRepoGenerationTemplate(@Nullable IrisTemplate solutionRepoGenerationTemplate) {
this.solutionRepoGenerationTemplate = solutionRepoGenerationTemplate;
}

@Nullable
public IrisTemplate getTestRepoGenerationTemplate() {
return testRepoGenerationTemplate;
}

public void setTestRepoGenerationTemplate(@Nullable IrisTemplate testRepoGenerationTemplate) {
this.testRepoGenerationTemplate = testRepoGenerationTemplate;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package de.tum.in.www1.artemis.domain.iris.settings;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonInclude;

import de.tum.in.www1.artemis.domain.Course;

/**
* An {@link IrisSettings} implementation for course specific settings.
* Course settings are used to override global settings and allows all sub setting types.
*/
@Entity
@DiscriminatorValue("COURSE")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class IrisCourseSettings extends IrisSettings {

@OneToOne(optional = false)
@JoinColumn(name = "course_id", unique = true, nullable = false)
private Course course;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "iris_chat_settings_id")
private IrisChatSubSettings irisChatSettings;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "iris_hestia_settings_id")
private IrisHestiaSubSettings irisHestiaSettings;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "iris_code_editor_settings_id")
private IrisCodeEditorSubSettings irisCodeEditorSettings;

@Override
public boolean isValid() {
return course != null;
}

public Course getCourse() {
return course;
}

public void setCourse(Course course) {
this.course = course;
}

public IrisChatSubSettings getIrisChatSettings() {
return irisChatSettings;
}

public void setIrisChatSettings(IrisChatSubSettings irisChatSettings) {
this.irisChatSettings = irisChatSettings;
}

public IrisHestiaSubSettings getIrisHestiaSettings() {
return irisHestiaSettings;
}

public void setIrisHestiaSettings(IrisHestiaSubSettings irisHestiaSettings) {
this.irisHestiaSettings = irisHestiaSettings;
}

@Override
public IrisCodeEditorSubSettings getIrisCodeEditorSettings() {
return irisCodeEditorSettings;
}

@Override
public void setIrisCodeEditorSettings(IrisCodeEditorSubSettings irisCodeEditorSettings) {
this.irisCodeEditorSettings = irisCodeEditorSettings;
}
}
Loading

0 comments on commit dd07677

Please sign in to comment.