Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump the all-dependencies group across 1 directory with 14 updates #172

Merged
merged 2 commits into from
Feb 10, 2025
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
72 changes: 28 additions & 44 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

val mockkVersion = "1.13.13"
val tokenSupportVersion = "5.0.10"
val mockkVersion = "1.13.16"
val tokenSupportVersion = "5.0.16"
val springdocVersion = "1.8.0"
val navFoedselsnummerVersion = "1.0-SNAPSHOT.6"
val kontrakterVersion = "3.0_20241102131210_d65efd1"
val kontrakterVersion = "3.0_20250113155636_bb71360"
val mainClass = "no.nav.familie.ef.infotrygd.Main"
val ktlint by configurations.creating

plugins {
val kotlinVersion = "2.0.21"
val springBootVersion = "3.3.5"
val kotlinVersion = "2.1.10"
val springBootVersion = "3.4.2"
id("org.springframework.boot") version springBootVersion
id("io.spring.dependency-management") version "1.1.6"
id("io.spring.dependency-management") version "1.1.7"
kotlin("jvm") version kotlinVersion
kotlin("plugin.spring") version kotlinVersion
kotlin("plugin.jpa") version kotlinVersion
id("org.cyclonedx.bom") version "1.8.1"
id("org.cyclonedx.bom") version "2.1.0"
id("org.jlleitschuh.gradle.ktlint") version "12.1.2"
}

group = "no.nav"
Expand All @@ -35,21 +36,14 @@ repositories {
name = "Github"
url = uri("https://maven.pkg.github.com/navikt/nav-foedselsnummer")
credentials {
username = "x-access-token" //project.findProperty("gpr.user") as String? ?: System.getenv("GPR_USER")
username = "x-access-token" // project.findProperty("gpr.user") as String? ?: System.getenv("GPR_USER")
password = System.getenv("GPR_API_KEY") ?: System.getenv("GITHUB_TOKEN") ?: project.findProperty("gpr.key") as String?
}
}
}


dependencies {


ktlint("com.pinterest:ktlint:0.51.0-FINAL") {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
}
}
implementation("nav-foedselsnummer:core:$navFoedselsnummerVersion")
testImplementation("nav-foedselsnummer:testutils:$navFoedselsnummerVersion")
implementation("org.springframework.boot:spring-boot-starter-actuator")
Expand All @@ -60,7 +54,7 @@ dependencies {
implementation("io.micrometer:micrometer-core")
implementation("io.micrometer:micrometer-registry-prometheus")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("net.ttddyy:datasource-proxy:1.10")
implementation("net.ttddyy:datasource-proxy:1.10.1")
implementation("no.nav.security:token-validation-spring:$tokenSupportVersion")
implementation("no.nav.familie.kontrakter:enslig-forsorger:$kontrakterVersion")
implementation("no.nav.familie.kontrakter:felles:$kontrakterVersion")
Expand All @@ -73,48 +67,39 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
runtimeOnly("org.postgresql:postgresql")
implementation("com.oracle.database.jdbc:ojdbc8:23.6.0.24.10")
implementation("com.oracle.database.jdbc:ojdbc8:23.7.0.25.01")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("com.github.doyaaaaaken:kotlin-csv-jvm:1.10.0")
testImplementation("org.testcontainers:oracle-xe:1.20.3")
testImplementation("org.testcontainers:oracle-xe:1.20.4")
testImplementation("com.h2database:h2")
testImplementation("org.flywaydb:flyway-core")
testImplementation("io.mockk:mockk-jvm:$mockkVersion")


}

val inputFiles = project.fileTree(mapOf("dir" to "src", "include" to "**/*.kt"))

val ktlintCheck by tasks.creating(JavaExec::class) {
inputs.files(inputFiles)
// outputs.dir(outputDir)
allprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
}

description = "Check Kotlin code style."
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("src/**/*.kt")
ktlint {
version = "1.5.0"
}

val ktlintFormat by tasks.creating(JavaExec::class) {
inputs.files(inputFiles)
// outputs.dir(outputDir)
tasks.ktlintMainSourceSetCheck {
enabled = false
}

description = "Fix Kotlin code style deviations."
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
args = listOf("-F", "src/**/*.kt")
jvmArgs = listOf("--add-opens", "java.base/java.lang=ALL-UNNAMED")
tasks.ktlintKotlinScriptCheck {
enabled = false
}

tasks.withType<KotlinCompile> {
dependsOn("ktlintFormat")
dependsOn("ktlintCheck")
tasks.findByName("ktlintCheck")?.mustRunAfter("ktlintFormat")
kotlinOptions {
tasks.withType<KotlinJvmCompile> {
dependsOn(tasks.ktlintFormat)
compilerOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "21"
jvmTarget.set(JvmTarget.JVM_21)
}
}

Expand All @@ -130,4 +115,3 @@ tasks.test {
tasks.cyclonedxBom {
setIncludeConfigs(listOf("runtimeClasspath", "compileClasspath"))
}
// tasks.findByName('publish').mustRunAfter 'build'
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ pluginManagement {
gradlePluginPortal()
}
}
rootProject.name = "familie-ef-infotrygd"
rootProject.name = "familie-ef-infotrygd"
11 changes: 5 additions & 6 deletions src/main/kotlin/no/nav/familie/ef/infotrygd/SwaggerConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@ class SwaggerConfig {
private val bearer = "Bearer"

@Bean
fun openApi(): OpenAPI {
return OpenAPI().info(Info().title("Familie ef infotrygd api"))
fun openApi(): OpenAPI =
OpenAPI()
.info(Info().title("Familie ef infotrygd api"))
.components(Components().addSecuritySchemes(bearer, bearerTokenSecurityScheme()))
.addSecurityItem(SecurityRequirement().addList(bearer, listOf("read", "write")))
}

private fun bearerTokenSecurityScheme(): SecurityScheme {
return SecurityScheme()
private fun bearerTokenSecurityScheme(): SecurityScheme =
SecurityScheme()
.type(SecurityScheme.Type.APIKEY)
.scheme(bearer)
.bearerFormat("JWT")
.`in`(SecurityScheme.In.HEADER)
.name("Authorization")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,5 @@ class JacksonJsonConfig {
}

@Bean
fun objectMapper(): ObjectMapper {
return OM
}
fun objectMapper(): ObjectMapper = OM
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ package no.nav.familie.ef.infotrygd.exception

import java.lang.RuntimeException

class UkjentDatabaseverdiException(val verdi: String, gyldigeVerdier: List<String>) :
RuntimeException("Ukjent databaseverdi '$verdi'. Tillatte verdier er: ${gyldigeVerdier.joinToString()}")
class UkjentDatabaseverdiException(
val verdi: String,
gyldigeVerdier: List<String>,
) : RuntimeException("Ukjent databaseverdi '$verdi'. Tillatte verdier er: ${gyldigeVerdier.joinToString()}")
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ class TableIntegrator : Integrator {
}

@Component
class TableIntegratorProvider(private val tableIntegrator: TableIntegrator) : IntegratorProvider {
override fun getIntegrators(): MutableList<Integrator> {
return mutableListOf(tableIntegrator)
}
class TableIntegratorProvider(
private val tableIntegrator: TableIntegrator,
) : IntegratorProvider {
override fun getIntegrators(): MutableList<Integrator> = mutableListOf(tableIntegrator)
}

@Component
class HibernateConfig(private val tableIntegratorProvider: TableIntegratorProvider) : HibernatePropertiesCustomizer {
class HibernateConfig(
private val tableIntegratorProvider: TableIntegratorProvider,
) : HibernatePropertiesCustomizer {
override fun customize(hibernateProperties: MutableMap<String, Any>) {
hibernateProperties["hibernate.integrator_provider"] = tableIntegratorProvider
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ package no.nav.familie.ef.infotrygd.model
* @param kodeRutine Verdi fra kode_rutine fra v_vedtak
* @param saS10Valg Verdi fra s10_valg fra sa_sak_10
*/
enum class StønadType(val kodeRutine: String, val saS10Valg: String) {
enum class StønadType(
val kodeRutine: String,
val saS10Valg: String,
) {
OVERGANGSSTØNAD("EO", "OG"),
BARNETILSYN("EB", "BT"),
SKOLEPENGER("EU", "UT"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package no.nav.familie.ef.infotrygd.model.converters
import jakarta.persistence.AttributeConverter
import jakarta.persistence.Converter

abstract class AbstractCharConverter(private val size: Int) : AttributeConverter<String?, String?> {
abstract class AbstractCharConverter(
private val size: Int,
) : AttributeConverter<String?, String?> {
override fun convertToDatabaseColumn(attribute: String?): String? {
val str = attribute ?: ""
return str.padEnd(size, ' ')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import org.slf4j.LoggerFactory
import java.time.LocalDate
import java.time.format.DateTimeFormatter

open class AbstractNavLocalDateConverter(datePattern: String) : AttributeConverter<LocalDate?, Int?> {
open class AbstractNavLocalDateConverter(
datePattern: String,
) : AttributeConverter<LocalDate?, Int?> {
private val logger = LoggerFactory.getLogger(javaClass)

private val formatter = DateTimeFormatter.ofPattern(datePattern)

override fun convertToDatabaseColumn(attribute: LocalDate?): Int? {
return attribute?.format(formatter)?.toInt()
}
override fun convertToDatabaseColumn(attribute: LocalDate?): Int? = attribute?.format(formatter)?.toInt()

override fun convertToEntityAttribute(dbData: Int?): LocalDate? {
if (dbData == null || dbData == NULL_VALUE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import jakarta.persistence.AttributeConverter
import no.nav.commons.foedselsnummer.FoedselsNr

class FoedselNrConverter : AttributeConverter<FoedselsNr?, String?> {
override fun convertToDatabaseColumn(attribute: FoedselsNr?): String? {
return attribute?.asString
}
override fun convertToDatabaseColumn(attribute: FoedselsNr?): String? = attribute?.asString

override fun convertToEntityAttribute(dbData: String?): FoedselsNr? {
return dbData?.let { FoedselsNr(it) }
}
override fun convertToEntityAttribute(dbData: String?): FoedselsNr? = dbData?.let { FoedselsNr(it) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import java.time.LocalDate
class NavCharDateConverter : AttributeConverter<LocalDate?, String?> {
private val converter = NavLocalDateConverter()

override fun convertToDatabaseColumn(attribute: LocalDate?): String? {
return converter.convertToDatabaseColumn(attribute)?.toString()
}
override fun convertToDatabaseColumn(attribute: LocalDate?): String? = converter.convertToDatabaseColumn(attribute)?.toString()

override fun convertToEntityAttribute(dbData: String?): LocalDate? {
return dbData?.let { converter.convertToEntityAttribute(it.toInt()) }
}
override fun convertToEntityAttribute(dbData: String?): LocalDate? = dbData?.let { converter.convertToEntityAttribute(it.toInt()) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import jakarta.persistence.AttributeConverter
import no.nav.familie.ef.infotrygd.utils.reverserFnr

class ReversedFoedselNrConverter : AttributeConverter<String?, String?> {
override fun convertToDatabaseColumn(attribute: String?): String? {
return attribute?.reverserFnr() ?: "00000000000"
}
override fun convertToDatabaseColumn(attribute: String?): String? = attribute?.reverserFnr() ?: "00000000000"

override fun convertToEntityAttribute(dbData: String?): String? {
if (dbData == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ import jakarta.persistence.AttributeConverter
class ReversedLongFoedselNrConverter : AttributeConverter<String?, Long?> {
private val converter = ReversedFoedselNrConverter()

override fun convertToDatabaseColumn(attribute: String?): Long? {
return converter.convertToDatabaseColumn(attribute)?.toLong() ?: 0
}
override fun convertToDatabaseColumn(attribute: String?): Long? = converter.convertToDatabaseColumn(attribute)?.toLong() ?: 0

override fun convertToEntityAttribute(dbData: Long?): String? {
return converter.convertToEntityAttribute(dbData?.toString()?.padStart(11, '0'))
}
override fun convertToEntityAttribute(dbData: Long?): String? =
converter.convertToEntityAttribute(dbData?.toString()?.padStart(11, '0'))
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import org.springframework.stereotype.Repository
import java.time.LocalDate

@Repository
class InfotrygdRepository(private val jdbcTemplate: NamedParameterJdbcTemplate) {
class InfotrygdRepository(
private val jdbcTemplate: NamedParameterJdbcTemplate,
) {
fun harAktivStønad(personIdenter: Set<String>) = harStønad(personIdenter, kunAktive = true)

fun harStønad(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import java.time.YearMonth
* UA: Uavklart
*/
@Repository
class PeriodeRepository(private val jdbcTemplate: NamedParameterJdbcTemplate) {
class PeriodeRepository(
private val jdbcTemplate: NamedParameterJdbcTemplate,
) {
fun hentPerioder(request: PeriodeRequest): List<Pair<StønadType, Periode>> {
val values =
MapSqlParameterSource()
Expand Down Expand Up @@ -170,13 +172,13 @@ class PeriodeRepository(private val jdbcTemplate: NamedParameterJdbcTemplate) {
.takeIf(String::isNotEmpty)
?.let(mapper)

private fun mapStønadskoder(request: PeriodeRequest): List<String> {
return request.stønadstyper.ifEmpty {
setOf(
StønadType.OVERGANGSSTØNAD,
StønadType.SKOLEPENGER,
StønadType.BARNETILSYN,
)
}.map { it.kodeRutine }
}
private fun mapStønadskoder(request: PeriodeRequest): List<String> =
request.stønadstyper
.ifEmpty {
setOf(
StønadType.OVERGANGSSTØNAD,
StønadType.SKOLEPENGER,
StønadType.BARNETILSYN,
)
}.map { it.kodeRutine }
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ import org.springframework.jdbc.core.namedparam.MapSqlParameterSource
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
import org.springframework.stereotype.Repository

data class ÅpnesakerRapport(val typeMedAntall: Map<String, Int>)
data class ÅpnesakerRapport(
val typeMedAntall: Map<String, Int>,
)

@Repository
class SakRepository(private val jdbcTemplate: NamedParameterJdbcTemplate) {
class SakRepository(
private val jdbcTemplate: NamedParameterJdbcTemplate,
) {
private val datoConverter = NavReversedLocalDateConverter()

fun hentÅpneSaker(): ÅpnesakerRapport {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ class ApiExceptionHandler : ResponseEntityExceptionHandler() {
private val logger = LoggerFactory.getLogger(ApiExceptionHandler::class.java)
private val secureLogger = LoggerFactory.getLogger("secureLogger")

private fun rootCause(throwable: Throwable): Throwable {
return NestedExceptionUtils.getMostSpecificCause(throwable)
}
private fun rootCause(throwable: Throwable): Throwable = NestedExceptionUtils.getMostSpecificCause(throwable)

override fun handleExceptionInternal(
ex: Exception,
Expand Down Expand Up @@ -90,5 +88,7 @@ class ApiExceptionHandler : ResponseEntityExceptionHandler() {
}
}

data class ErrorResponse(val errorMessage: String)
data class ErrorResponse(
val errorMessage: String,
)
}
Loading
Loading