Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions services/gateway/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'org.springframework.boot' version '3.1.8'
id 'org.springframework.boot' version '3.5.7'
id 'java'
id 'com.diffplug.spotless' version '6.25.0'
id "io.freefair.lombok" version "8.10.2"
Expand Down Expand Up @@ -42,10 +42,10 @@ repositories {
}

ext {
springCloudVersion = '2022.0.5'
springCloudVersion = '2025.0.0'
versions = [
restAssured : '5.5.6',
junitJupiter : '5.8.0',
junitJupiter : '5.11.4',
]
}
// override the version the spring boot dependency-management plugin would enforce
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
Expand Down Expand Up @@ -53,23 +54,18 @@ public MapReactiveUserDetailsService userDetailsService() {
}

@Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http)
throws Exception {
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
configureAuthorization(http);
return http.build();
}

private void configureAuthorization(ServerHttpSecurity http) throws Exception {
if (GatewayAuthType.OAUTH_2_LOGIN.equals(authConfig.getType())) {
commonConfig(http).oauth2Login();
http.oauth2Login(Customizer.withDefaults());
} else {
commonConfig(http).httpBasic();
http.httpBasic(Customizer.withDefaults());
}
return http.build();
}

private ServerHttpSecurity commonConfig(ServerHttpSecurity http) throws Exception {
return http.csrf()
.disable()
private void configureAuthorization(ServerHttpSecurity http) {
http.csrf(ServerHttpSecurity.CsrfSpec::disable)
.authorizeExchange(
(authorize) ->
authorize
Expand All @@ -90,8 +86,7 @@ private ServerHttpSecurity commonConfig(ServerHttpSecurity http) throws Exceptio
.pathMatchers("/ui/**")
.permitAll()
.pathMatchers("/")
.permitAll()
.and());
.permitAll());
}

@Bean
Expand Down
11 changes: 6 additions & 5 deletions services/habit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'org.springframework.boot' version '3.1.8'
id 'org.springframework.boot' version '3.5.7'
id 'org.liquibase.gradle' version '2.2.2'
id 'java'
id 'com.diffplug.spotless' version '6.25.0'
Expand Down Expand Up @@ -76,16 +76,17 @@ ext {
liquibase : '4.29.2',
pactProvider : '4.6.18',
jna : '5.8.0',
preliquibase : '1.5.1'
preliquibase : '1.6.0'
]
springCloudVersion = '2025.0.0'
}
// override the version the spring boot dependency-management plugin would enforce
ext['junit-jupiter.version'] = versions.junitJupiter

ext['jna.version'] = versions.jna // Required for Docker on ARM

dependencyManagement {
imports {
mavenBom 'org.springframework.modulith:spring-modulith-bom:1.2.5'
mavenBom 'org.springframework.modulith:spring-modulith-bom:1.4.4'
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.modulith.test.ApplicationModuleTest;
import org.springframework.modulith.test.Scenario;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;

@ActiveProfiles("intTest")
@ApplicationModuleTest
@MockBean(UserIdArgumentResolver.class)
public class HabitModuleIntegrationTest {

@MockitoBean private UserIdArgumentResolver userIdArgumentResolver;

@Autowired private HabitController habitController;
@Autowired private HabitRepository habitRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.servlet.MockMvc;

Expand Down Expand Up @@ -58,7 +58,7 @@ public class AuthTest {
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkZWZhdWx0In0.2E88ZlFE4Tor8d5gRU2451WrLtDavGfgbFf8ZuKBRxM");
}

@MockBean private HabitRepository repository;
@MockitoBean private HabitRepository repository;

@Autowired private MockMvc mvc;

Expand Down
8 changes: 4 additions & 4 deletions services/report/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.openapi.generator") version "7.9.0"
id("com.github.jk1.dependency-license-report") version "2.9"
id("org.springframework.boot") version "3.1.8"
id("org.springframework.boot") version "3.5.7"
id("com.diffplug.spotless") version "6.25.0"
kotlin("jvm") version "1.9.25"
kotlin("plugin.spring") version "1.9.25"
Expand Down Expand Up @@ -44,9 +44,9 @@ repositories {
}

extra["chaosMonkeyVersion"] = "3.1.2"
extra["mockkVersion"] = "1.13.16"
extra["mockkVersion"] = "1.13.3"
extra["springMockkVersion"] = "4.0.2"
extra["wiremockVersion"] = "3.0.1"
extra["wiremockVersion"] = "3.13.1"
extra["moschiVersion"] = "1.15.2"

dependencies {
Expand Down Expand Up @@ -74,7 +74,7 @@ dependencies {

testImplementation("io.mockk:mockk:${property("mockkVersion")}")
testImplementation("com.ninja-squad:springmockk:${property("springMockkVersion")}")
testImplementation("com.github.tomakehurst:wiremock:${property("wiremockVersion")}")
testImplementation("org.wiremock:wiremock-standalone:${property("wiremockVersion")}")
}

tasks.withType<Test> {
Expand Down
10 changes: 6 additions & 4 deletions services/track/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'org.springframework.boot' version '3.1.8'
id 'org.springframework.boot' version '3.5.7'
id 'org.flywaydb.flyway' version '10.21.0'
id 'java'
id 'com.diffplug.spotless' version '6.25.0'
Expand Down Expand Up @@ -53,7 +53,7 @@ spotless {
repositories {
mavenCentral()
maven {
url "https://repo.spring.io/milestone"
url = "https://repo.spring.io/milestone"
}
}

Expand All @@ -77,14 +77,15 @@ ext {
postgresql : '42.7.8',
jna : '5.8.0'
]
springCloudVersion = '2025.0.0'
}
// override the version the spring boot dependency-management plugin would enforce
ext['junit-jupiter.version'] = versions.junitJupiter
ext['jna.version'] = versions.jna // Required for Docker on ARM

dependencyManagement {
imports {
mavenBom 'org.springframework.modulith:spring-modulith-bom:1.2.5'
mavenBom 'org.springframework.modulith:spring-modulith-bom:1.4.4'
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}

Expand All @@ -105,6 +106,7 @@ dependencies {
implementation 'io.opentelemetry:opentelemetry-exporter-zipkin'
runtimeOnly "org.postgresql:postgresql:$versions.postgresql"
runtimeOnly 'org.flywaydb:flyway-core'
runtimeOnly 'org.flywaydb:flyway-database-postgresql'
runtimeOnly "de.codecentric:chaos-monkey-spring-boot:$versions.chaosMonkey"
runtimeOnly "org.aspectj:aspectjweaver"
testImplementation "org.junit.jupiter:junit-jupiter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.modulith.test.ApplicationModuleTest;
import org.springframework.modulith.test.Scenario;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;

@ActiveProfiles("intTest")
@ApplicationModuleTest
@MockBean(UserIdArgumentResolver.class)
public class HabitModuleIntegrationTest {

@MockitoBean UserIdArgumentResolver userIdArgumentResolver;

@Autowired private HabitTrackingController habitTrackingController;
@Autowired private HabitTrackingRepository habitTrackingRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void handleShouldMapApiExceptions() {
DummyError.builder().code("123").title("ABC").statusCode(I_AM_A_TEAPOT.value()).build();
ApiErrorException exception = new DummyErrorException(error);
ResponseEntity<ApiErrorResponse> response = handler.handle(exception);
assertThat(response.getStatusCodeValue()).isEqualTo(error.getStatusCode());
assertThat(response.getStatusCode().value()).isEqualTo(error.getStatusCode());
assertThat(response.getBody().getErrors()).hasSize(1);
assertEquals(error, response.getBody().getErrors().get(0));
}
Expand All @@ -77,7 +77,7 @@ public void handleShouldMapApiExceptionsWithCauseAndTemplateProperties() {
Exception cause = new IllegalArgumentException("CAUSE");
ApiErrorException exception = new DummyErrorException(error, cause, templateProperties);
ResponseEntity<ApiErrorResponse> response = handler.handle(exception);
assertThat(response.getStatusCodeValue()).isEqualTo(error.getStatusCode());
assertThat(response.getStatusCode().value()).isEqualTo(error.getStatusCode());
assertThat(response.getBody().getErrors()).hasSize(1);
assertEquals(error, response.getBody().getErrors().get(0), templateProperties);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.servlet.MockMvc;

Expand All @@ -44,9 +44,9 @@ public class HabitTrackingControllerWebMvcTest {

@Autowired private MockMvc mockMvc;

@MockBean private HabitTrackingRepository repository;
@MockitoBean private HabitTrackingRepository repository;

@MockBean private JwtDecoder jwtDecoder;
@MockitoBean private JwtDecoder jwtDecoder;

@Test
public void shouldReturnTrackRecords() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.HttpHeaders;
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.servlet.MockMvc;

Expand All @@ -48,9 +48,9 @@ public class HabitTrackingControllerJwtWebMvcTest {

@Autowired private MockMvc mockMvc;

@MockBean private HabitTrackingRepository repository;
@MockitoBean private HabitTrackingRepository repository;

@MockBean private JwtDecoder jwtDecoder;
@MockitoBean private JwtDecoder jwtDecoder;

@BeforeEach
public void beforeEach() {
Expand Down
Loading