From 5d36099738321c67efc5fc7a88f515affdb9d34c Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Tue, 10 Dec 2024 19:20:14 +0100 Subject: [PATCH] update for common plugin v0.2.0 - rename keys folder to cert - update build.gradle.kts to use certificate plugin - update catalog version --- .gitignore | 2 +- build.gradle.kts | 35 ++++++++----------- gradle.properties | 2 +- src/main/resources/application.yml | 2 +- .../ltd/hlaeja/service/JwtServiceTest.kt | 2 +- .../ltd/hlaeja/util/PrivateKeyProviderTest.kt | 6 ++-- src/test/resources/application.yml | 2 +- .../{keys => cert}/invalid-private-key.pem | 0 .../{keys => cert}/valid-private-key.pem | 0 9 files changed, 22 insertions(+), 29 deletions(-) rename src/test/resources/{keys => cert}/invalid-private-key.pem (100%) rename src/test/resources/{keys => cert}/valid-private-key.pem (100%) diff --git a/.gitignore b/.gitignore index 07528d8..847b8b0 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,4 @@ out/ .kotlin ### Cert ### -/keys/ +/cert/ diff --git a/build.gradle.kts b/build.gradle.kts index ea56b20..0329620 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,47 +1,40 @@ plugins { alias(hlaeja.plugins.kotlin.jvm) alias(hlaeja.plugins.kotlin.spring) + alias(hlaeja.plugins.ltd.hlaeja.plugin.certificate) alias(hlaeja.plugins.ltd.hlaeja.plugin.service) alias(hlaeja.plugins.spring.dependency.management) alias(hlaeja.plugins.springframework.boot) } dependencies { - implementation(hlaeja.com.fasterxml.jackson.module.kotlin) + implementation(hlaeja.fasterxml.jackson.module.kotlin) implementation(hlaeja.jjwt.api) implementation(hlaeja.kotlin.logging) implementation(hlaeja.kotlin.reflect) implementation(hlaeja.kotlinx.coroutines) - implementation(hlaeja.ltd.hlaeja.library.common.messages) - implementation(hlaeja.org.springframework.springboot.actuator.starter) - implementation(hlaeja.org.springframework.springboot.r2dbc.starter) - implementation(hlaeja.org.springframework.springboot.webflux.starter) + implementation(hlaeja.library.hlaeja.common.messages) + implementation(hlaeja.springboot.starter.actuator) + implementation(hlaeja.springboot.starter.r2dbc) + implementation(hlaeja.springboot.starter.webflux) runtimeOnly(hlaeja.jjwt.impl) runtimeOnly(hlaeja.jjwt.jackson) - runtimeOnly(hlaeja.org.postgresql) - runtimeOnly(hlaeja.org.postgresql.r2dbc) + runtimeOnly(hlaeja.postgresql) + runtimeOnly(hlaeja.postgresql.r2dbc) testImplementation(hlaeja.assertj.core) - testImplementation(hlaeja.io.mockk) - testImplementation(hlaeja.io.projectreactor.reactor.test) + testImplementation(hlaeja.mockk) + testImplementation(hlaeja.projectreactor.reactor.test) testImplementation(hlaeja.kotlin.test.junit5) testImplementation(hlaeja.kotlinx.coroutines.test) - testImplementation(hlaeja.org.springframework.springboot.test.starter) + testImplementation(hlaeja.springboot.starter.test) - testRuntimeOnly(hlaeja.org.junit.platform.launcher) + testRuntimeOnly(hlaeja.junit.platform.launcher) } group = "ltd.hlaeja" -tasks { - named("processResources") { - dependsOn("copyPrivateKey") - } - register("copyPrivateKey") { - group = "hlaeja" - from("keys/private_key.pem") - into("${layout.buildDirectory.get()}/resources/main/keys") - onlyIf { file("keys/private_key.pem").exists() } - } +tasks.named("processResources") { + dependsOn("copyCertificates") } diff --git a/gradle.properties b/gradle.properties index 21a9b38..f208913 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ kotlin.code.style=official version=0.2.0-SNAPSHOT -catalog=0.4.0 +catalog=0.6.0-SNAPSHOT container.port.host=9010 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d420659..85d11ed 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -11,7 +11,7 @@ spring: version: "%APP_BUILD_OS_VERSION%" jwt: - private-key: keys/private_key.pem + private-key: cert/private_key.pem --- ############################### diff --git a/src/test/kotlin/ltd/hlaeja/service/JwtServiceTest.kt b/src/test/kotlin/ltd/hlaeja/service/JwtServiceTest.kt index 0ac96ad..e3eb4b6 100644 --- a/src/test/kotlin/ltd/hlaeja/service/JwtServiceTest.kt +++ b/src/test/kotlin/ltd/hlaeja/service/JwtServiceTest.kt @@ -9,7 +9,7 @@ import org.junit.jupiter.api.Test class JwtServiceTest { - val property: JwtProperty = JwtProperty("keys/valid-private-key.pem") + val property: JwtProperty = JwtProperty("cert/valid-private-key.pem") lateinit var service: JwtService @BeforeEach diff --git a/src/test/kotlin/ltd/hlaeja/util/PrivateKeyProviderTest.kt b/src/test/kotlin/ltd/hlaeja/util/PrivateKeyProviderTest.kt index 63239da..e090ffd 100644 --- a/src/test/kotlin/ltd/hlaeja/util/PrivateKeyProviderTest.kt +++ b/src/test/kotlin/ltd/hlaeja/util/PrivateKeyProviderTest.kt @@ -11,7 +11,7 @@ class PrivateKeyProviderTest { @Test fun `load private key - success`() { // given - val pemFilePath = "keys/valid-private-key.pem" + val pemFilePath = "cert/valid-private-key.pem" // when val privateKey: RSAPrivateKey = PrivateKeyProvider.load(pemFilePath) @@ -24,7 +24,7 @@ class PrivateKeyProviderTest { @Test fun `load private key - file does not exist`() { // given - val nonExistentPemFilePath = "keys/non-existent.pem" + val nonExistentPemFilePath = "cert/non-existent.pem" // when exception val exception = assertThrows { @@ -38,7 +38,7 @@ class PrivateKeyProviderTest { @Test fun `load private key - file is invalid`() { // given - val invalidPemFilePath = "keys/invalid-private-key.pem" + val invalidPemFilePath = "cert/invalid-private-key.pem" // when exception val exception = assertThrows { diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 6fc0193..32c88c7 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -1,5 +1,5 @@ jwt: - private-key: keys/valid-private-key.pem + private-key: cert/valid-private-key.pem spring: r2dbc: diff --git a/src/test/resources/keys/invalid-private-key.pem b/src/test/resources/cert/invalid-private-key.pem similarity index 100% rename from src/test/resources/keys/invalid-private-key.pem rename to src/test/resources/cert/invalid-private-key.pem diff --git a/src/test/resources/keys/valid-private-key.pem b/src/test/resources/cert/valid-private-key.pem similarity index 100% rename from src/test/resources/keys/valid-private-key.pem rename to src/test/resources/cert/valid-private-key.pem