Skip to content
Merged
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
21 changes: 3 additions & 18 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,9 @@
// Note: if the rule feels generic enough, should consider adding it to the jore4 default preset
packageRules: [
{
// restrict spring boot updates to <4 versions for now.
// Maven depName is "groupId:artifactId", so match with a glob to also catch
// spring-boot-starter-parent (a plain "org.springframework.boot" does not match it).
groupName: "spring boot",
groupSlug: "spring-boot",
matchPackageNames: ["org.springframework.boot:**"],
allowedVersions: "<4",
},
{
// java-jdk 25 needs Kotlin 2.x, which only comes with Spring Boot 4. Stay on 21 for now
// (jOOQ needs 21, Kotlin 1.9.x supports 21 but not 25).
matchDepNames: ["java-jdk"],
allowedVersions: "<25",
},
{
// springmockk 5 is compiled against Kotlin 2.x; blocked until Spring Boot 4 raises Kotlin.
matchPackageNames: ["com.ninja-squad:springmockk"],
allowedVersions: "<5",
// jOOQ 3.20+ Open Source editions require PostgreSQL 17/18; stay on 3.19 until the database is upgraded.
matchPackageNames: ["org.jooq:**"],
allowedVersions: "<3.20",
},
{
// give each major update its own PR instead of the big "all dependencies" bundle.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
with:
languages: '["actions", "java-kotlin"]'
java_build_command: "cp profiles/dev/config.properties profiles/dev/config.runner.properties && mvn clean install -DskipTests"
java_version: "17"
java_version: "25"
4 changes: 2 additions & 2 deletions .github/workflows/run-kotlin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
- name: Start dependencies (blocking until up)
run: ./development.sh start:deps

- name: Set up JDK 17
- name: Set up JDK 25
uses: actions/setup-java@v6
with:
java-version: "17"
java-version: "25"
java-package: jdk
architecture: x64
distribution: temurin
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM maven:3-eclipse-temurin-17 AS builder
FROM maven:3-eclipse-temurin-25 AS builder

# set up workdir
WORKDIR /build
Expand Down
22 changes: 10 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.16</version>
<version>4.1.1</version>
<relativePath/>
</parent>

Expand All @@ -19,7 +19,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>17</java.version>
<java.version>25</java.version>

<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
<kotlin.compiler.jvmTarget>${java.version}</kotlin.compiler.jvmTarget>
Expand All @@ -36,10 +36,12 @@
<ktlint-plugin.version>3.7.1</ktlint-plugin.version>

<!-- Library versions -->
<!-- jOOQ 3.20+ Open Source editions require PostgreSQL 17/18; pin to 3.19 for PostgreSQL 15 support. -->
<jooq.version>3.19.39</jooq.version>
<kotlin-logging-jvm.version>8.0.4</kotlin-logging-jvm.version>
<quicktheories.version>0.26</quicktheories.version>
<mockk.version>1.14.11</mockk.version>
<springmockk.version>4.0.2</springmockk.version>
<springmockk.version>5.0.1</springmockk.version>

<!-- Other properties -->
<start.class>fi.hsl.jore4.timetables.TimetablesApiApplicationKt</start.class>
Expand Down Expand Up @@ -285,6 +287,8 @@
<args>
<!-- Enable strict mode for JSR-305 annotations. -->
<arg>-Xjsr305=strict</arg>
<!-- Retain constructor parameter names so jOOQ maps records to POJOs by name. -->
<arg>-java-parameters</arg>
</args>
</configuration>
<executions>
Expand Down Expand Up @@ -501,7 +505,7 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -544,20 +548,14 @@
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<groupId>tools.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
<!-- version inherited from the Spring Boot parent POM -->
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<!-- version inherited from the Spring Boot parent POM -->
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package fi.hsl.jore4.timetables

import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.module.kotlin.KotlinFeature
import com.fasterxml.jackson.module.kotlin.KotlinModule
import fi.hsl.jore4.timetables.config.DatabaseProperties
import fi.hsl.jore4.timetables.config.JOOQProperties
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.runApplication
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Primary
import tools.jackson.databind.json.JsonMapper
import tools.jackson.module.kotlin.KotlinFeature
import tools.jackson.module.kotlin.KotlinModule

fun main(args: Array<String>) {
runApplication<TimetablesApiApplication>(*args)
Expand All @@ -25,11 +24,11 @@ fun main(args: Array<String>) {
class TimetablesApiApplication {
@Bean
@Primary
fun objectMapper(): ObjectMapper =
ObjectMapper()
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
.registerModule(JavaTimeModule())
.registerModule(
fun jsonMapper(): JsonMapper =
JsonMapper
.builder()
.changeDefaultPropertyInclusion { it.withValueInclusion(JsonInclude.Include.NON_NULL) }
.addModule(
KotlinModule
.Builder()
.withReflectionCacheSize(512)
Expand All @@ -39,5 +38,5 @@ class TimetablesApiApplication {
.configure(KotlinFeature.SingletonSupport, false)
.configure(KotlinFeature.StrictNullChecks, true)
.build()
)
).build()
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class VehicleScheduleFrameRepository(
.and(replacedFrame.VALIDITY_START.lessThan(stagingFrame.VALIDITY_START))

return dsl
.select()
.select(*VEHICLE_SCHEDULE_FRAME.fields())
// Returns a row for each day type id.
// We are not interested in those here, just the replaced frame ids.
.distinctOn(replacedVehicleScheduleFrameIdField)
Expand Down Expand Up @@ -142,7 +142,7 @@ class VehicleScheduleFrameRepository(
.and(targetFrame.PRIORITY.eq(targetPriority.value))

return dsl
.select()
.select(*VEHICLE_SCHEDULE_FRAME.fields())
// Returns a row for each day type id.
// We are not interested in those here, just the overlapping frame ids.
.distinctOn(targetVehicleScheduleFrameIdField)
Expand Down
6 changes: 3 additions & 3 deletions src/test/kotlin/fi/hsl/jore4/timetables/TimetablesDataset.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package fi.hsl.jore4.timetables

import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import io.github.oshai.kotlinlogging.KotlinLogging
import tools.jackson.core.type.TypeReference
import tools.jackson.databind.json.JsonMapper

private val LOGGER = KotlinLogging.logger {}

class TimetablesDataset : MutableMap<String, Any?> by mutableMapOf() {
fun toJSONString(): String = OBJECT_MAPPER.writeValueAsString(this)

companion object {
private val OBJECT_MAPPER = ObjectMapper()
private val OBJECT_MAPPER = JsonMapper()

fun createFromResource(resourcePath: String): TimetablesDataset {
val jsonStream = this::class.java.classLoader.getResourceAsStream(resourcePath)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package fi.hsl.jore4.timetables.api

import com.fasterxml.jackson.databind.ObjectMapper
import com.ninjasquad.springmockk.MockkBean
import fi.hsl.jore4.timetables.enumerated.TimetablesPriority
import fi.hsl.jore4.timetables.service.CombineTimetablesService
Expand All @@ -14,8 +13,8 @@ import io.mockk.verify
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc
import org.springframework.http.MediaType
import org.springframework.test.context.ActiveProfiles
import org.springframework.test.web.servlet.MockMvc
Expand All @@ -24,6 +23,7 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.content
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
import org.springframework.transaction.TransactionSystemException
import tools.jackson.databind.json.JsonMapper
import java.util.UUID

@ExtendWith(MockKExtension::class)
Expand Down Expand Up @@ -325,6 +325,6 @@ class TimetablesCombineApiTest(
}

companion object {
private val MAPPER = ObjectMapper()
private val MAPPER = JsonMapper()
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package fi.hsl.jore4.timetables.api

import com.fasterxml.jackson.databind.ObjectMapper
import com.ninjasquad.springmockk.MockkBean
import fi.hsl.jore4.timetables.enumerated.TimetablesPriority
import fi.hsl.jore4.timetables.service.InvalidTargetPriorityException
Expand All @@ -13,8 +12,8 @@ import io.mockk.verify
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc
import org.springframework.http.MediaType
import org.springframework.test.context.ActiveProfiles
import org.springframework.test.web.servlet.MockMvc
Expand All @@ -23,6 +22,7 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.content
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
import org.springframework.transaction.TransactionSystemException
import tools.jackson.databind.json.JsonMapper
import java.util.UUID

private val LOGGER = KotlinLogging.logger {}
Expand Down Expand Up @@ -270,6 +270,6 @@ class TimetablesReplaceApiTest(
}

companion object {
private val OBJECT_MAPPER = ObjectMapper()
private val OBJECT_MAPPER = JsonMapper()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import io.mockk.verify
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc
import org.springframework.http.MediaType
import org.springframework.test.context.ActiveProfiles
import org.springframework.test.web.servlet.MockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import io.mockk.verify
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc
import org.springframework.http.MediaType
import org.springframework.test.context.ActiveProfiles
import org.springframework.test.web.servlet.MockMvc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package fi.hsl.jore4.timetables.extensions

import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import io.github.oshai.kotlinlogging.KotlinLogging
import tools.jackson.core.type.TypeReference
import tools.jackson.databind.json.JsonMapper

private val LOGGER = KotlinLogging.logger {}

Expand All @@ -23,7 +23,7 @@ fun MutableMap<String, Any?>.getNested(propertyPath: String): MutableMap<String,
return child
}

private val OBJECT_MAPPER = ObjectMapper()
private val OBJECT_MAPPER = JsonMapper()

fun MutableMap<String, Any?>.deepClone(): MutableMap<String, Any?> {
val asString = OBJECT_MAPPER.writeValueAsString(this)
Expand Down
Loading