Skip to content

Commit

Permalink
Update server dependencies
Browse files Browse the repository at this point in the history
Update Spring to 3.4.0
  • Loading branch information
krusche committed Nov 24, 2024
1 parent 4a74898 commit 404f60a
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 109 deletions.
4 changes: 2 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies {

implementation "commons-io:commons-io:2.18.0"
implementation "com.github.vladimir-bukhtoyarov:bucket4j-core:8.0.1"
implementation "org.mnode.ical4j:ical4j:4.0.5"
implementation "org.mnode.ical4j:ical4j:4.0.6"
implementation "com.itextpdf:itext-core:9.0.0"
implementation "com.itextpdf:html2pdf:6.0.0"
implementation "com.auth0:java-jwt:4.4.0"
Expand All @@ -68,8 +68,7 @@ dependencies {
testImplementation "org.testcontainers:database-commons:${test_container_version}"
testImplementation "org.testcontainers:postgresql:${test_container_version}"

// TODO: for some reason an update of org.junit.jupiter:junit-jupiter-engine to 5.11.x breaks the tests
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.5"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.11.3"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.11.3"
compileOnly "org.projectlombok:lombok:1.18.36"
annotationProcessor "org.projectlombok:lombok:1.18.36"
Expand Down
2 changes: 1 addition & 1 deletion server/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rootProject.name=Thesis Track
spring_boot_version=3.3.6
spring_boot_version=3.4.0
netty_version=4.1.115.Final
test_container_version=1.20.4
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
package thesistrack.ls1.security;

import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.http.HttpMethod;
import org.springframework.lang.NonNullApi;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.session.SessionRegistryImpl;
import org.springframework.security.web.SecurityFilterChain;
Expand All @@ -25,6 +23,7 @@
@EnableWebSecurity
@RequiredArgsConstructor
@EnableMethodSecurity
@Profile("!test") // NOTE: this is a workaround to avoid overlapping definitions during test execution
public class WebSecurityConfig {
private final JwtAuthConverter jwtAuthConverter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import thesistrack.ls1.constants.ApplicationState;
import thesistrack.ls1.controller.payload.AcceptApplicationPayload;
Expand All @@ -26,28 +23,10 @@

@Testcontainers
class ApplicationControllerTest extends BaseIntegrationTest {
@Container
static PostgreSQLContainer<?> dbContainer = new PostgreSQLContainer<>(
"postgres:16-alpine"
);

@BeforeAll
static void startDatabase() {
dbContainer.start();
}

@AfterAll
static void stopDatabase() {
dbContainer.stop();
}

@DynamicPropertySource
static void configureProperties(DynamicPropertyRegistry registry) {
dbContainer.start();

registry.add("spring.datasource.url", dbContainer::getJdbcUrl);
registry.add("spring.datasource.username", dbContainer::getUsername);
registry.add("spring.datasource.password", dbContainer::getPassword);
static void configureDynamicProperties(DynamicPropertyRegistry registry) {
configureProperties(registry);
}

@Test
Expand Down Expand Up @@ -133,4 +112,4 @@ void acceptApplication_Success() throws Exception {
.andExpect(status().isOk())
.andExpect(MockMvcResultMatchers.jsonPath("$[0].state").value(ApplicationState.ACCEPTED.getValue()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
import org.junit.jupiter.api.*;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import thesistrack.ls1.constants.*;
import thesistrack.ls1.controller.payload.*;
Expand All @@ -21,30 +18,11 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

@Testcontainers
@ActiveProfiles("test")
class ThesisControllerTest extends BaseIntegrationTest {
@Container
static PostgreSQLContainer<?> dbContainer = new PostgreSQLContainer<>(
"postgres:16-alpine"
);

@BeforeAll
static void startDatabase() {
dbContainer.start();
}

@AfterAll
static void stopDatabase() {
dbContainer.stop();
}

@DynamicPropertySource
static void configureProperties(DynamicPropertyRegistry registry) {
dbContainer.start();

registry.add("spring.datasource.url", dbContainer::getJdbcUrl);
registry.add("spring.datasource.username", dbContainer::getUsername);
registry.add("spring.datasource.password", dbContainer::getPassword);
static void configureDynamicProperties(DynamicPropertyRegistry registry) {
configureProperties(registry);
}

@Nested
Expand Down Expand Up @@ -256,4 +234,4 @@ void createPresentation_Success() throws Exception {
.andExpect(status().isOk());
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
package thesistrack.ls1.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import thesistrack.ls1.constants.ApplicationRejectReason;
import thesistrack.ls1.controller.payload.CloseTopicPayload;
Expand All @@ -27,28 +22,10 @@

@Testcontainers
class TopicControllerTest extends BaseIntegrationTest {
@Container
static PostgreSQLContainer<?> dbContainer = new PostgreSQLContainer<>(
"postgres:16-alpine"
);

@BeforeAll
static void startDatabase() {
dbContainer.start();
}

@AfterAll
static void stopDatabase() {
dbContainer.stop();
}

@DynamicPropertySource
static void configureProperties(DynamicPropertyRegistry registry) {
dbContainer.start();

registry.add("spring.datasource.url", dbContainer::getJdbcUrl);
registry.add("spring.datasource.username", dbContainer::getUsername);
registry.add("spring.datasource.password", dbContainer::getPassword);
static void configureDynamicProperties(DynamicPropertyRegistry registry) {
configureProperties(registry);
}

@Test
Expand Down Expand Up @@ -195,4 +172,4 @@ void getTopics_WithSearch_Success() throws Exception {
.andExpect(jsonPath("$.content", hasSize(equalTo(1))))
.andExpect(jsonPath("$.content[0].title", containsString("Specific")));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import thesistrack.ls1.mock.BaseIntegrationTest;

Expand All @@ -19,28 +16,10 @@

@Testcontainers
public class UserControllerTest extends BaseIntegrationTest {
@Container
static PostgreSQLContainer<?> dbContainer = new PostgreSQLContainer<>(
"postgres:16-alpine"
);

@BeforeAll
static void startDatabase() {
dbContainer.start();
}

@AfterAll
static void stopDatabase() {
dbContainer.stop();
}

@DynamicPropertySource
static void configureProperties(DynamicPropertyRegistry registry) {
dbContainer.start();

registry.add("spring.datasource.url", dbContainer::getJdbcUrl);
registry.add("spring.datasource.username", dbContainer::getUsername);
registry.add("spring.datasource.password", dbContainer::getPassword);
static void configureDynamicProperties(DynamicPropertyRegistry registry) {
configureProperties(registry);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.auth0.jwt.algorithms.Algorithm;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jayway.jsonpath.JsonPath;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInstance;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -12,9 +14,13 @@
import org.springframework.context.annotation.Import;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import thesistrack.ls1.controller.payload.CreateApplicationPayload;
import thesistrack.ls1.controller.payload.CreateThesisPayload;
import thesistrack.ls1.controller.payload.ReplaceTopicPayload;
Expand All @@ -29,38 +35,55 @@
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Import(TestSecurityConfig.class)
public abstract class BaseIntegrationTest {

@Autowired
private ApplicationRepository applicationRepository;

@Autowired
private ApplicationReviewerRepository applicationReviewerRepository;

@Autowired
private NotificationSettingRepository notificationSettingRepository;

@Autowired
private ThesisAssessmentRepository thesisAssessmentRepository;

@Autowired
private ThesisCommentRepository thesisCommentRepository;

@Autowired
private ThesisFeedbackRepository thesisFeedbackRepository;

@Autowired
private ThesisFileRepository thesisFileRepository;

@Autowired
private ThesisPresentationInviteRepository thesisPresentationInviteRepository;

@Autowired
private ThesisPresentationRepository thesisPresentationRepository;

@Autowired
private ThesisProposalRepository thesisProposalRepository;

@Autowired
private ThesisRepository thesisRepository;

@Autowired
private ThesisRoleRepository thesisRoleRepository;

@Autowired
private ThesisStateChangeRepository thesisStateChangeRepository;

@Autowired
private TopicRepository topicRepository;

@Autowired
private TopicRoleRepository topicRoleRepository;

@Autowired
private UserGroupRepository userGroupRepository;

@Autowired
private UserRepository userRepository;

Expand All @@ -70,6 +93,27 @@ public abstract class BaseIntegrationTest {
@Autowired
protected ObjectMapper objectMapper;

@Container
protected static PostgreSQLContainer<?> dbContainer = new PostgreSQLContainer<>("postgres:17.1-alpine");

protected static void configureProperties(DynamicPropertyRegistry registry) {
dbContainer.start();

registry.add("spring.datasource.url", dbContainer::getJdbcUrl);
registry.add("spring.datasource.username", dbContainer::getUsername);
registry.add("spring.datasource.password", dbContainer::getPassword);
}

@BeforeAll
protected static void startDatabase() {
dbContainer.start();
}

@AfterAll
protected static void stopDatabase() {
dbContainer.stop();
}

@BeforeEach
void deleteDatabase() {
thesisCommentRepository.deleteAll();
Expand Down Expand Up @@ -195,4 +239,4 @@ protected UUID createTestThesis(String title) throws Exception {

return objectMapper.readTree(response).get("thesisId").asText().transform(UUID::fromString);
}
}
}
Loading

0 comments on commit 404f60a

Please sign in to comment.