Skip to content

Commit

Permalink
Merge branch 'develop' into chore/bugfix/fix-flaky-e2e-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonEntholzer authored Sep 29, 2024
2 parents 938fe77 + 92209a3 commit ad7a54a
Show file tree
Hide file tree
Showing 633 changed files with 4,351 additions and 3,743 deletions.
54 changes: 36 additions & 18 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,89 +38,107 @@ template:
assessment:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/assessment/**/*
- src/main/java/de/tum/cit/aet/artemis/assessment/**/*
- src/test/java/de/tum/cit/aet/artemis/assessment/**/*

athena:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/athena/**/*
- src/main/java/de/tum/cit/aet/artemis/athena/**/*
- src/test/java/de/tum/cit/aet/artemis/athena/**/*

atlas:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/atlas/**/*
- src/main/java/de/tum/cit/aet/artemis/atlas/**/*
- src/test/java/de/tum/cit/aet/artemis/atlas/**/*

buildagent:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/buildagent/**/*
- src/main/java/de/tum/cit/aet/artemis/buildagent/**/*
- src/test/java/de/tum/cit/aet/artemis/buildagent/**/*

communication:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/communication/**/*
- src/main/java/de/tum/cit/aet/artemis/communication/**/*
- src/test/java/de/tum/cit/aet/artemis/communication/**/*

core:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/core/**/*
- src/main/java/de/tum/cit/aet/artemis/core/**/*
- src/test/java/de/tum/cit/aet/artemis/core/**/*

exam:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/exam/**/*
- src/main/java/de/tum/cit/aet/artemis/exam/**/*
- src/test/java/de/tum/cit/aet/artemis/exam/**/*

exercise:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/exercise/**/*
- src/main/java/de/tum/cit/aet/artemis/exercise/**/*
- src/test/java/de/tum/cit/aet/artemis/exercise/**/*

fileupload:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/fileupload/**/*
- src/main/java/de/tum/cit/aet/artemis/fileupload/**/*
- src/test/java/de/tum/cit/aet/artemis/fileupload/**/*

iris:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/iris/**/*
- src/main/java/de/tum/cit/aet/artemis/iris/**/*
- src/test/java/de/tum/cit/aet/artemis/iris/**/*

lecture:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/lecture/**/*
- src/main/java/de/tum/cit/aet/artemis/lecture/**/*
- src/test/java/de/tum/cit/aet/artemis/lecture/**/*

lti:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/lti/**/*
- src/main/java/de/tum/cit/aet/artemis/lti/**/*
- src/test/java/de/tum/cit/aet/artemis/lti/**/*

modeling:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/modeling/**/*
- src/main/java/de/tum/cit/aet/artemis/modeling/**/*
- src/test/java/de/tum/cit/aet/artemis/modeling/**/*

plagiarism:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/plagiarism/**/*
- src/main/java/de/tum/cit/aet/artemis/plagiarism/**/*
- src/test/java/de/tum/cit/aet/artemis/plagiarism/**/*

programming:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/programming/**/*
- src/main/java/de/tum/cit/aet/artemis/programming/**/*
- src/test/java/de/tum/cit/aet/artemis/programming/**/*

quiz:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/quiz/**/*
- src/main/java/de/tum/cit/aet/artemis/quiz/**/*
- src/test/java/de/tum/cit/aet/artemis/quiz/**/*

text:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/text/**/*
- src/main/java/de/tum/cit/aet/artemis/text/**/*
- src/test/java/de/tum/cit/aet/artemis/text/**/*

tutorialgroup:
- changed-files:
- any-glob-to-any-file:
- src/(main|test)/java/de/tum/cit/aet/artemis/tutorialgroup/**/*
- src/main/java/de/tum/cit/aet/artemis/tutorialgroup/**/*
- src/test/java/de/tum/cit/aet/artemis/tutorialgroup/**/*
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;

import java.util.List;
import java.util.Optional;
import java.util.Set;

import org.springframework.context.annotation.Profile;
Expand All @@ -25,8 +24,6 @@
@Repository
public interface ComplaintResponseRepository extends ArtemisJpaRepository<ComplaintResponse, Long> {

Optional<ComplaintResponse> findByComplaint_Id(Long complaintId);

/**
* This magic method counts the number of complaints responses by complaint type associated to a course id
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public interface ExampleSubmissionRepository extends ArtemisJpaRepository<Exampl
""")
Optional<ExampleSubmission> findByIdWithResultsAndFeedback(@Param("exampleSubmissionId") long exampleSubmissionId);

Optional<ExampleSubmission> findBySubmissionId(long submissionId);

@EntityGraph(type = LOAD, attributePaths = { "submission", "submission.results" })
Optional<ExampleSubmission> findWithResultsBySubmissionId(long submissionId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,6 @@ default Optional<Result> findFirstWithSubmissionAndFeedbacksAndTestCasesByPartic
@EntityGraph(type = LOAD, attributePaths = "submission")
Optional<Result> findResultWithSubmissionsById(long resultId);

/**
* Finds the first result by participation ID, including its submissions, ordered by completion date in descending order.
* This method avoids in-memory paging by retrieving the first result directly from the database.
*
* @param participationId the ID of the participation to find the result for
* @return an {@code Optional} containing the first {@code Result} with submissions, ordered by completion date in descending order,
* or an empty {@code Optional} if no result is found
*/
default Optional<Result> findFirstWithSubmissionsByParticipationIdOrderByCompletionDateDesc(long participationId) {
var resultOptional = findFirstByParticipationIdOrderByCompletionDateDesc(participationId);
if (resultOptional.isEmpty()) {
return Optional.empty();
}
var id = resultOptional.get().getId();
return findResultWithSubmissionsById(id);
}

Optional<Result> findFirstByParticipationIdAndRatedOrderByCompletionDateDesc(long participationId, boolean rated);

/**
Expand All @@ -184,11 +167,6 @@ default Optional<Result> findFirstByParticipationIdAndRatedWithSubmissionOrderBy
return findResultWithSubmissionsById(id);
}

Optional<Result> findDistinctBySubmissionId(long submissionId);

@EntityGraph(type = LOAD, attributePaths = "feedbacks")
Optional<Result> findDistinctWithFeedbackBySubmissionId(long submissionId);

@Query("""
SELECT r
FROM Result r
Expand All @@ -208,8 +186,6 @@ default Optional<Result> findFirstByParticipationIdAndRatedWithSubmissionOrderBy
""")
Optional<Result> findByIdWithEagerFeedbacksAndAssessor(@Param("resultId") long resultId);

Set<Result> findAllByParticipationExerciseId(long exerciseId);

/**
* Load a result from the database by its id together with the associated submission, the list of feedback items, its assessor and assessment note.
*
Expand Down Expand Up @@ -352,9 +328,6 @@ SELECT COUNT(r.id)
""")
List<Long> countNumberOfFinishedAssessmentsByExamIdIgnoreTestRuns(@Param("examId") long examId);

@EntityGraph(type = LOAD, attributePaths = { "feedbacks" })
Set<Result> findAllWithEagerFeedbackByAssessorIsNotNullAndParticipation_ExerciseIdAndCompletionDateIsNotNull(long exerciseId);

@Query("""
SELECT COUNT(DISTINCT p)
FROM Participation p
Expand Down Expand Up @@ -802,10 +775,6 @@ default Optional<Result> findLatestResultWithFeedbacksForParticipation(long part
}
}

default Result findFirstWithFeedbacksByParticipationIdOrderByCompletionDateDescElseThrow(long participationId) {
return getValueElseThrow(findFirstWithFeedbacksTestCasesByParticipationIdOrderByCompletionDateDesc(participationId));
}

default Result findWithBidirectionalSubmissionAndFeedbackAndAssessorAndAssessmentNoteAndTeamStudentsByIdElseThrow(long resultId) {
return getValueElseThrow(findWithBidirectionalSubmissionAndFeedbackAndAssessorAndAssessmentNoteAndTeamStudentsById(resultId), resultId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.springframework.transaction.annotation.Transactional;

import de.tum.cit.aet.artemis.assessment.domain.TutorParticipation;
import de.tum.cit.aet.artemis.core.domain.Course;
import de.tum.cit.aet.artemis.core.domain.User;
import de.tum.cit.aet.artemis.core.repository.base.ArtemisJpaRepository;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
Expand All @@ -24,8 +23,6 @@
@Repository
public interface TutorParticipationRepository extends ArtemisJpaRepository<TutorParticipation, Long> {

List<TutorParticipation> findByAssessedExercise(Exercise assessedExercise);

@EntityGraph(type = LOAD, attributePaths = { "trainedExampleSubmissions", "trainedExampleSubmissions.submission.results" })
TutorParticipation findWithEagerExampleSubmissionAndResultsByAssessedExerciseAndTutor(Exercise assessedExercise, User tutor);

Expand All @@ -34,8 +31,6 @@ public interface TutorParticipationRepository extends ArtemisJpaRepository<Tutor
@EntityGraph(type = LOAD, attributePaths = { "trainedExampleSubmissions", "trainedExampleSubmissions.submission.results" })
List<TutorParticipation> findAllByAssessedExercise_Course_IdAndTutor_Id(long courseId, long tutorId);

List<TutorParticipation> findAllByAssessedExercise_Course(Course course);

@EntityGraph(type = LOAD, attributePaths = { "trainedExampleSubmissions", "trainedExampleSubmissions.submission.results" })
List<TutorParticipation> findAllByAssessedExercise_ExerciseGroup_Exam_IdAndTutor_Id(long examId, long tutorId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ public interface CompetencyProgressRepository extends ArtemisJpaRepository<Compe
""")
Optional<CompetencyProgress> findByCompetencyIdAndUserId(@Param("competencyId") long competencyId, @Param("userId") long userId);

default CompetencyProgress findByCompetencyIdAndUserIdOrElseThrow(long competencyId, long userId) {
return getValueElseThrow(findByCompetencyIdAndUserId(competencyId, userId));
}

@Query("""
SELECT cp
FROM CompetencyProgress cp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ default LearningPath findWithEagerUserByIdElseThrow(long learningPathId) {
@EntityGraph(type = LOAD, attributePaths = { "competencies" })
Optional<LearningPath> findWithEagerCompetenciesByCourseIdAndUserId(long courseId, long userId);

default LearningPath findWithEagerCompetenciesByCourseIdAndUserIdElseThrow(long courseId, long userId) {
return getValueElseThrow(findWithEagerCompetenciesByCourseIdAndUserId(courseId, userId));
}

@EntityGraph(type = LOAD, attributePaths = { "course", "competencies" })
Optional<LearningPath> findWithEagerCourseAndCompetenciesById(long learningPathId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.springframework.transaction.annotation.Transactional;

import de.tum.cit.aet.artemis.atlas.domain.science.ScienceEvent;
import de.tum.cit.aet.artemis.atlas.domain.science.ScienceEventType;
import de.tum.cit.aet.artemis.core.repository.base.ArtemisJpaRepository;

/**
Expand All @@ -22,8 +21,6 @@
@Repository
public interface ScienceEventRepository extends ArtemisJpaRepository<ScienceEvent, Long> {

Set<ScienceEvent> findAllByType(ScienceEventType type);

@Transactional // ok because of modifying query
@Modifying
@Query("""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.atlas.web;
package de.tum.cit.aet.artemis.atlas.web.admin;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ public interface ConversationParticipantRepository extends ArtemisJpaRepository<

Optional<ConversationParticipant> findConversationParticipantByConversationIdAndUserId(Long conversationId, Long userId);

default ConversationParticipant findConversationParticipantByConversationIdAndUserIdElseThrow(Long conversationId, Long userId) {
return getValueElseThrow(findConversationParticipantByConversationIdAndUserId(conversationId, userId));
}

@Query("""
SELECT DISTINCT conversationParticipant
FROM ConversationParticipant conversationParticipant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,6 @@ public interface PostRepository extends ArtemisJpaRepository<Post, Long>, JpaSpe

List<Post> findPostsByAuthorId(long authorId);

/**
* find all posts of a user in a course
* currently only used for testing
*
* @param authorId id of the user
* @param courseId id of the course
* @return a list of posts
*/
@Query("""
SELECT p
FROM Post p
WHERE p.author.id =:authorId
AND p.conversation.course.id = :courseId
""")
List<Post> findPostsByAuthorIdAndCourseId(@Param("authorId") long authorId, @Param("courseId") long courseId);

@Transactional // ok because of delete
@Modifying
void deleteAllByConversationId(Long conversationId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,5 @@
@Repository
public interface ReactionRepository extends ArtemisJpaRepository<Reaction, Long> {

List<Reaction> findReactionsByPostId(Long postId);

List<Reaction> findReactionsByUserId(long userId);

List<Reaction> findReactionsByAnswerPostId(Long answerPostId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@ public interface ChannelRepository extends ArtemisJpaRepository<Channel, Long> {
""")
List<Channel> findChannelsOfUser(@Param("courseId") Long courseId, @Param("userId") Long userId);

@Query("""
SELECT DISTINCT channel
FROM Channel channel
WHERE channel.course.id = :courseId
AND channel.isCourseWide = TRUE
ORDER BY channel.name
""")
List<Channel> findCourseWideChannelsInCourse(@Param("courseId") long courseId);

@Query("""
SELECT DISTINCT channel
FROM Channel channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public interface ConversationRepository extends ArtemisJpaRepository<Conversatio
@Modifying
void deleteAllByCourseId(long courseId);

// This is used only for testing purposes
List<Conversation> findAllByCourseId(long courseId);

@EntityGraph(type = LOAD, attributePaths = { "conversationParticipants" })
Optional<Conversation> findWithParticipantsById(long conversationId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.springframework.stereotype.Repository;

import de.tum.cit.aet.artemis.communication.domain.conversation.OneToOneChat;
import de.tum.cit.aet.artemis.core.exception.EntityNotFoundException;
import de.tum.cit.aet.artemis.core.repository.base.ArtemisJpaRepository;

@Profile(PROFILE_CORE)
Expand Down Expand Up @@ -73,15 +72,5 @@ AND EXISTS (
// one-to-one chats userA has in that specific course.
Optional<OneToOneChat> findWithParticipantsAndUserGroupsInCourseBetweenUsers(@Param("courseId") Long courseId, @Param("userIdA") Long userIdA, @Param("userIdB") Long userIdB);

@Query("""
SELECT DISTINCT oneToOneChat
FROM OneToOneChat oneToOneChat
LEFT JOIN FETCH oneToOneChat.conversationParticipants p
LEFT JOIN FETCH p.user u
LEFT JOIN FETCH u.groups
WHERE oneToOneChat.id = :oneToOneChatId
""")
Optional<OneToOneChat> findByIdWithConversationParticipantsAndUserGroups(@Param("oneToOneChatId") Long oneToOneChatId) throws EntityNotFoundException;

Integer countByCreatorIdAndCourseId(Long creatorId, Long courseId);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.tum.cit.aet.artemis.communication.web;
package de.tum.cit.aet.artemis.communication.web.admin;

import static de.tum.cit.aet.artemis.core.config.Constants.PROFILE_CORE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties
}
config.getMapConfigs().put("default", initializeDefaultMapConfig(jHipsterProperties));
config.getMapConfigs().put("files", initializeFilesMapConfig(jHipsterProperties));
// TODO Ole: investigate if the following * in artemis.*.domain works for database entity caching or if we need to specify all module domain paths here
config.getMapConfigs().put("de.tum.cit.aet.artemis.*.domain.*", initializeDomainMapConfig(jHipsterProperties));

// Configure split brain protection if the cluster was split at some point
Expand Down
Loading

0 comments on commit ad7a54a

Please sign in to comment.