Skip to content

Commit

Permalink
Development: Update server dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
krusche committed Dec 4, 2024
1 parent fd4882c commit 96ca4ec
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 45 deletions.
12 changes: 2 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id "com.github.ben-manes.versions" version "0.51.0"
id "com.github.andygoossens.modernizer" version "${modernizer_plugin_version}"
id "com.gorylenko.gradle-git-properties" version "2.4.2"
id "org.owasp.dependencycheck" version "11.1.0"
id "org.owasp.dependencycheck" version "11.1.1"
id "com.adarshr.test-logger" version "4.0.0"
}

Expand Down Expand Up @@ -213,10 +213,6 @@ repositories {
maven {
url "https://build.shibboleth.net/maven/releases"
}
// TODO: remove this when spring cloud is available in the official maven repository
maven {
url "https://repo.spring.io/milestone"
}
}

ext["jackson.version"] = fasterxml_version
Expand Down Expand Up @@ -295,7 +291,7 @@ dependencies {
implementation "org.apache.sshd:sshd-sftp:${sshd_version}"

// https://mvnrepository.com/artifact/net.sourceforge.plantuml/plantuml
implementation "net.sourceforge.plantuml:plantuml:1.2024.7"
implementation "net.sourceforge.plantuml:plantuml:1.2024.8"
implementation "org.jasypt:jasypt:1.9.3"
implementation "me.xdrop:fuzzywuzzy:1.4.0"
implementation("org.yaml:snakeyaml") {
Expand Down Expand Up @@ -326,10 +322,6 @@ dependencies {
implementation "org.jsoup:jsoup:1.18.3"
implementation "commons-codec:commons-codec:1.17.1" // needed for spring security saml2

// TODO: decide if we want to use OpenAPI and Swagger v3
// implementation 'io.swagger.core.v3:swagger-annotations:2.2.23'
// implementation "org.springdoc:springdoc-openapi-ui:1.8.0"

// use the latest version to avoid security vulnerabilities
implementation "org.springframework:spring-webmvc:${spring_framework_version}"

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ npm_version=10.8.0
jhipster_dependencies_version=8.7.2
spring_boot_version=3.4.0
spring_framework_version=6.2.0
spring_cloud_version=4.2.0-RC1
spring_cloud_version=4.2.0
spring_security_version=6.4.1
# TODO: upgrading to 6.6.0 currently leads to issues due to internal changes in Hibernate and potentially wrong use in Artemis server code
hibernate_version=6.4.10.Final
Expand All @@ -19,7 +19,7 @@ jwt_version=0.12.6
jaxb_runtime_version=4.0.5
hazelcast_version=5.5.0
fasterxml_version=2.18.2
jgit_version=7.0.0.202409031743-r
jgit_version=7.1.0.202411261347-r
sshd_version=2.14.0
checkstyle_version=10.20.2
jplag_version=5.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public ResponseEntity<AnswerPost> createAnswerMessage(@PathVariable Long courseI
long start = System.nanoTime();
AnswerPost createdAnswerMessage = answerMessageService.createAnswerMessage(courseId, answerMessage);
// creation of answerMessage should not trigger alert
log.info("createAnswerMessage took {}", TimeLogUtil.formatDurationFrom(start));
log.debug("createAnswerMessage took {}", TimeLogUtil.formatDurationFrom(start));
return ResponseEntity.created(new URI("/api/courses" + courseId + "/answer-messages/" + createdAnswerMessage.getId())).body(createdAnswerMessage);
}

Expand All @@ -70,7 +70,7 @@ public ResponseEntity<AnswerPost> updateAnswerMessage(@PathVariable Long courseI
log.debug("PUT updateAnswerMessage invoked for course {} with message {}", courseId, answerMessage.getContent());
long start = System.nanoTime();
AnswerPost updatedAnswerMessage = answerMessageService.updateAnswerMessage(courseId, answerMessageId, answerMessage);
log.info("updateAnswerMessage took {}", TimeLogUtil.formatDurationFrom(start));
log.debug("updateAnswerMessage took {}", TimeLogUtil.formatDurationFrom(start));
return new ResponseEntity<>(updatedAnswerMessage, null, HttpStatus.OK);
}

Expand All @@ -88,7 +88,7 @@ public ResponseEntity<Void> deleteAnswerMessage(@PathVariable Long courseId, @Pa
log.debug("PUT deleteAnswerMessage invoked for course {} on message {}", courseId, answerMessageId);
long start = System.nanoTime();
answerMessageService.deleteAnswerMessageById(courseId, answerMessageId);
log.info("deleteAnswerMessage took {}", TimeLogUtil.formatDurationFrom(start));
log.debug("deleteAnswerMessage took {}", TimeLogUtil.formatDurationFrom(start));
// deletion of answerMessages should not trigger alert
return ResponseEntity.ok().build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public ResponseEntity<Post> createMessage(@PathVariable Long courseId, @Valid @R
sendToUserPost.setConversation(sendToUserPost.getConversation().copy());
sendToUserPost.getConversation().setConversationParticipants(Collections.emptySet());

log.info("createMessage took {}", TimeLogUtil.formatDurationFrom(start));
log.debug("createMessage took {}", TimeLogUtil.formatDurationFrom(start));
return ResponseEntity.created(new URI("/api/courses/" + courseId + "/messages/" + sendToUserPost.getId())).body(sendToUserPost);
}

Expand Down Expand Up @@ -141,7 +141,7 @@ else if (postContextFilter.courseWideChannelIds() != null) {
}

private void logDuration(List<Post> posts, Principal principal, long timeNanoStart) {
if (log.isInfoEnabled()) {
if (log.isDebugEnabled()) {
long answerPosts = posts.stream().mapToLong(post -> post.getAnswers().size()).sum();
long reactions = posts.stream().mapToLong(post -> post.getReactions().size()).sum();
long answerReactions = posts.stream().flatMap(post -> post.getAnswers().stream()).mapToLong(answerPost -> answerPost.getReactions().size()).sum();
Expand All @@ -165,7 +165,7 @@ public ResponseEntity<Post> updateMessage(@PathVariable Long courseId, @PathVari
log.debug("PUT updateMessage invoked for course {} with post {}", courseId, messagePost.getContent());
long start = System.nanoTime();
Post updatedMessagePost = conversationMessagingService.updateMessage(courseId, messageId, messagePost);
log.info("updateMessage took {}", TimeLogUtil.formatDurationFrom(start));
log.debug("updateMessage took {}", TimeLogUtil.formatDurationFrom(start));
return new ResponseEntity<>(updatedMessagePost, null, HttpStatus.OK);
}

Expand All @@ -184,7 +184,7 @@ public ResponseEntity<Void> deleteMessage(@PathVariable Long courseId, @PathVari
long start = System.nanoTime();
conversationMessagingService.deleteMessageById(courseId, messageId);
// deletion of message posts should not trigger entity deletion alert
log.info("deleteMessage took {}", TimeLogUtil.formatDurationFrom(start));
log.debug("deleteMessage took {}", TimeLogUtil.formatDurationFrom(start));
return ResponseEntity.ok().build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public NotificationResource(NotificationRepository notificationRepository, UserR
public ResponseEntity<List<Notification>> getAllNotificationsForCurrentUserFilteredBySettings(Pageable pageable) {
long start = System.nanoTime();
User currentUser = userRepository.getUserWithGroupsAndAuthorities();
log.info("REST request to get notifications page {} with size {} for current user {} filtered by settings", pageable.getPageNumber(), pageable.getPageSize(),
log.debug("REST request to get notifications page {} with size {} for current user {} filtered by settings", pageable.getPageNumber(), pageable.getPageSize(),
currentUser.getLogin());
var tutorialGroupIds = tutorialGroupService.findAllForNotifications(currentUser);
var notificationSettings = notificationSettingRepository.findAllNotificationSettingsForRecipientWithId(currentUser.getId());
Expand All @@ -97,7 +97,7 @@ public ResponseEntity<List<Notification>> getAllNotificationsForCurrentUserFilte
deactivatedTitles, tutorialGroupIds, TITLES_TO_NOT_LOAD_NOTIFICATION, pageable);
}
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
log.info("Load notifications for user {} done in {}", currentUser.getLogin(), TimeLogUtil.formatDurationFrom(start));
log.debug("Load notifications for user {} done in {}", currentUser.getLogin(), TimeLogUtil.formatDurationFrom(start));
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public void processStudentExamIndividualWorkingTimeChangeDuringConduction(Long s
}

public void processScheduleParticipantScore(Long exerciseId, Long participantId, Long resultIdToBeDeleted) {
log.info("Received schedule participant score for exercise {} and participant {} (result to be deleted: {})", exerciseId, participantId, resultIdToBeDeleted);
log.debug("Received schedule participant score for exercise {} and participant {} (result to be deleted: {})", exerciseId, participantId, resultIdToBeDeleted);
participantScoreScheduleService.scheduleTask(exerciseId, participantId, resultIdToBeDeleted);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public ResponseEntity<UserDTO> getAccount() {
// we set this value on purpose here: the user can only fetch their own information, make the token available for constructing the token-based clone-URL
userDTO.setVcsAccessToken(user.getVcsAccessToken());
userDTO.setVcsAccessTokenExpiryDate(user.getVcsAccessTokenExpiryDate());
log.info("GET /account {} took {}ms", user.getLogin(), System.currentTimeMillis() - start);
log.debug("GET /account {} took {}ms", user.getLogin(), System.currentTimeMillis() - start);
return ResponseEntity.ok(userDTO);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public Repository getOrCheckoutRepository(VcsRepositoryUri sourceRepoUri, VcsRep
// Clone repository.
try {
var gitUriAsString = getGitUriAsString(sourceRepoUri);
log.info("Cloning from {} to {}", gitUriAsString, localPath);
log.debug("Cloning from {} to {}", gitUriAsString, localPath);
cloneInProgressOperations.put(localPath, localPath);
// make sure the directory to copy into is empty
FileUtils.deleteDirectory(localPath.toFile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ else if (triggeredByPushTo.equals(RepositoryType.TESTS)) {
programmingExercise.getId(), 0, priority, null, repositoryInfo, jobTimingInfo, buildConfig, null);

queue.add(buildJobQueueItem);
log.info("Added build job {} to the queue", buildJobId);
log.info("Added build job {} for exercise {} and participation {} with priority {} to the queue", buildJobId, programmingExercise.getShortName(), participation.getId(),
priority);

dockerImageCleanupInfo.put(buildConfig.dockerImage(), jobTimingInfo.submissionDate());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private boolean authenticateBuildAgent(PublicKey providedKey, ServerSession sess

if (matchingAgent.isPresent()) {
var agent = matchingAgent.get().buildAgent();
log.info("Authenticating build agent {} on address {}", agent.displayName(), agent.memberAddress());
log.debug("Authenticating build agent {} on address {}", agent.displayName(), agent.memberAddress());
session.setAttribute(SshConstants.IS_BUILD_AGENT_KEY, true);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import java.util.stream.Collectors;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
Expand Down Expand Up @@ -150,13 +149,12 @@ void testCreateAnswerInLectureChannel() throws Exception {
@WithMockUser(username = TEST_PREFIX + "student1", roles = "USER")
void testCreateAnswerInExerciseChannel() throws Exception {
Course course = courseRepository.findWithEagerExercisesById(courseId);
Exercise exercise = course.getExercises().stream().findFirst().orElseThrow();
Exercise exercise = course.getExercises().iterator().next();
Channel channel = exerciseUtilService.addChannelToExercise(exercise);
testCreateChannelAnswer(channel, NotificationType.NEW_REPLY_FOR_EXERCISE_POST, 1);
}

@Test
@Disabled // ToDo: Find out why "JsonException No _valueDeserializer assigned" is thrown when running the whole test suite
@WithMockUser(username = TEST_PREFIX + "student1", roles = "USER")
void testCreateAnswerInExamChannel() throws Exception {
Course course = courseRepository.findByIdElseThrow(courseId);
Expand Down Expand Up @@ -184,6 +182,11 @@ private void testCreateChannelAnswer(Channel channel, NotificationType notificat

var countBefore = answerPostRepository.count();

// avoid sending too much information to the server (otherwise deserialization might not work for a nested object due to a strange test error)
var conversation = savedMessage.getConversation();
if (conversation instanceof Channel theChannel) {
theChannel.setExam(null);
}
AnswerPost createdAnswerPost = request.postWithResponseBody("/api/courses/" + courseId + "/answer-messages", answerPostToSave, AnswerPost.class, HttpStatus.CREATED);
conversationUtilService.assertSensitiveInformationHidden(createdAnswerPost);
// should not be automatically post resolving
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Spy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

Expand All @@ -33,29 +30,19 @@ class WeeklyEmailSummaryScheduleServiceTest {

private static WeeklyEmailSummaryScheduleService weeklyEmailSummaryService;

@Autowired
private static TaskScheduler scheduler;

@Spy
private static TaskScheduler schedulerSpy;

@Mock
private static ProfileService profileService;

@Mock
private static EmailSummaryService emailSummaryService;

/**
* Prepares the needed values and objects for testing
*/
@BeforeAll
static void setUp() {
profileService = mock(ProfileService.class);
ProfileService profileService = mock(ProfileService.class);
when(profileService.isDevActive()).thenReturn(false);

emailSummaryService = mock(EmailSummaryService.class);
EmailSummaryService emailSummaryService = mock(EmailSummaryService.class);

scheduler = new ThreadPoolTaskScheduler();
TaskScheduler scheduler = new ThreadPoolTaskScheduler();
schedulerSpy = spy(scheduler);

weeklyEmailSummaryService = new WeeklyEmailSummaryScheduleService(profileService, schedulerSpy, emailSummaryService);
Expand Down

0 comments on commit 96ca4ec

Please sign in to comment.