From 3849fa86768c7c17357fbd5cbd33199be1311d24 Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Mon, 28 Jul 2025 22:28:24 +0200 Subject: [PATCH] update project --- build.gradle.kts | 20 +++++++++---------- gradle.properties | 2 +- .../resources/application.yml | 8 -------- src/main/resources/application.yml | 14 +++++++++++++ .../{logback.xml => logback-spring.xml} | 0 src/main/resources/logback-test.xml | 11 ---------- .../kotlin/ltd/hlaeja/ApplicationTests.kt | 0 .../ltd/hlaeja/controller/AccountEndpoint.kt | 0 .../ltd/hlaeja/controller/AccountsEndpoint.kt | 0 .../controller/AuthenticationEndpoint.kt | 0 .../resources/application.yml | 15 ++++++++++++++ .../resources/authenticate/admin-token.data | 0 .../resources/authenticate/user-token.data | 0 .../resources/cert/valid-private-key.pem | 0 .../resources/postgres/data.sql | 0 .../resources/postgres/reset.sql | 4 ++-- .../resources/postgres/schema.sql | 5 ----- 17 files changed, 42 insertions(+), 37 deletions(-) delete mode 100644 src/integration-test/resources/application.yml rename src/main/resources/{logback.xml => logback-spring.xml} (100%) delete mode 100644 src/main/resources/logback-test.xml rename src/{integration-test => test-integration}/kotlin/ltd/hlaeja/ApplicationTests.kt (100%) rename src/{integration-test => test-integration}/kotlin/ltd/hlaeja/controller/AccountEndpoint.kt (100%) rename src/{integration-test => test-integration}/kotlin/ltd/hlaeja/controller/AccountsEndpoint.kt (100%) rename src/{integration-test => test-integration}/kotlin/ltd/hlaeja/controller/AuthenticationEndpoint.kt (100%) create mode 100644 src/test-integration/resources/application.yml rename src/{integration-test => test-integration}/resources/authenticate/admin-token.data (100%) rename src/{integration-test => test-integration}/resources/authenticate/user-token.data (100%) rename src/{integration-test => test-integration}/resources/cert/valid-private-key.pem (100%) rename src/{integration-test => test-integration}/resources/postgres/data.sql (100%) rename src/{integration-test => test-integration}/resources/postgres/reset.sql (79%) rename src/{integration-test => test-integration}/resources/postgres/schema.sql (76%) diff --git a/build.gradle.kts b/build.gradle.kts index e0b5886..26cb98b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,10 @@ 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.boot) alias(hlaeja.plugins.spring.dependency.management) - alias(hlaeja.plugins.springframework.boot) + alias(hlaeja.plugins.certificate) + alias(hlaeja.plugins.service) } dependencies { @@ -32,14 +32,14 @@ dependencies { testRuntimeOnly(hlaeja.junit.platform.launcher) - integrationTestImplementation(hlaeja.assertj.core) - integrationTestImplementation(hlaeja.library.test) - integrationTestImplementation(hlaeja.projectreactor.reactor.test) - integrationTestImplementation(hlaeja.kotlin.test.junit5) - integrationTestImplementation(hlaeja.kotlinx.coroutines.test) - integrationTestImplementation(hlaeja.springboot.starter.test) + testIntegrationImplementation(hlaeja.assertj.core) + testIntegrationImplementation(hlaeja.library.test) + testIntegrationImplementation(hlaeja.projectreactor.reactor.test) + testIntegrationImplementation(hlaeja.kotlin.test.junit5) + testIntegrationImplementation(hlaeja.kotlinx.coroutines.test) + testIntegrationImplementation(hlaeja.springboot.starter.test) - integrationTestRuntimeOnly(hlaeja.junit.platform.launcher) + testIntegrationRuntimeOnly(hlaeja.junit.platform.launcher) } group = "ltd.hlaeja" diff --git a/gradle.properties b/gradle.properties index 01d29ac..ce69d49 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ kotlin.code.style=official version=0.3.0-SNAPSHOT -catalog=0.9.0 +catalog=0.11.0-SNAPSHOT container.port.host=9050 diff --git a/src/integration-test/resources/application.yml b/src/integration-test/resources/application.yml deleted file mode 100644 index 0e36cfe..0000000 --- a/src/integration-test/resources/application.yml +++ /dev/null @@ -1,8 +0,0 @@ -jwt: - private-key: cert/valid-private-key.pem - -spring: - r2dbc: - url: r2dbc:pool:postgresql://localhost:5432/test - username: test - password: test diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index b2c402b..27fb73f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -10,6 +10,20 @@ spring: name: "%APP_BUILD_OS_NAME%" version: "%APP_BUILD_OS_VERSION%" +management: + endpoints: + access: + default: none + web: + exposure: + include: "health,info" + endpoint: + health: + show-details: always + access: read_only + info: + access: read_only + jwt: private-key: cert/private_key.pem diff --git a/src/main/resources/logback.xml b/src/main/resources/logback-spring.xml similarity index 100% rename from src/main/resources/logback.xml rename to src/main/resources/logback-spring.xml diff --git a/src/main/resources/logback-test.xml b/src/main/resources/logback-test.xml deleted file mode 100644 index 3d69919..0000000 --- a/src/main/resources/logback-test.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - diff --git a/src/integration-test/kotlin/ltd/hlaeja/ApplicationTests.kt b/src/test-integration/kotlin/ltd/hlaeja/ApplicationTests.kt similarity index 100% rename from src/integration-test/kotlin/ltd/hlaeja/ApplicationTests.kt rename to src/test-integration/kotlin/ltd/hlaeja/ApplicationTests.kt diff --git a/src/integration-test/kotlin/ltd/hlaeja/controller/AccountEndpoint.kt b/src/test-integration/kotlin/ltd/hlaeja/controller/AccountEndpoint.kt similarity index 100% rename from src/integration-test/kotlin/ltd/hlaeja/controller/AccountEndpoint.kt rename to src/test-integration/kotlin/ltd/hlaeja/controller/AccountEndpoint.kt diff --git a/src/integration-test/kotlin/ltd/hlaeja/controller/AccountsEndpoint.kt b/src/test-integration/kotlin/ltd/hlaeja/controller/AccountsEndpoint.kt similarity index 100% rename from src/integration-test/kotlin/ltd/hlaeja/controller/AccountsEndpoint.kt rename to src/test-integration/kotlin/ltd/hlaeja/controller/AccountsEndpoint.kt diff --git a/src/integration-test/kotlin/ltd/hlaeja/controller/AuthenticationEndpoint.kt b/src/test-integration/kotlin/ltd/hlaeja/controller/AuthenticationEndpoint.kt similarity index 100% rename from src/integration-test/kotlin/ltd/hlaeja/controller/AuthenticationEndpoint.kt rename to src/test-integration/kotlin/ltd/hlaeja/controller/AuthenticationEndpoint.kt diff --git a/src/test-integration/resources/application.yml b/src/test-integration/resources/application.yml new file mode 100644 index 0000000..7ce3f7d --- /dev/null +++ b/src/test-integration/resources/application.yml @@ -0,0 +1,15 @@ +jwt: + private-key: cert/valid-private-key.pem + +spring: + r2dbc: + url: r2dbc:postgresql://placeholder + username: placeholder + password: placeholder + +container: + postgres: + version: postgres:17 + init: postgres/schema.sql + before: postgres/data.sql + after: postgres/reset.sql diff --git a/src/integration-test/resources/authenticate/admin-token.data b/src/test-integration/resources/authenticate/admin-token.data similarity index 100% rename from src/integration-test/resources/authenticate/admin-token.data rename to src/test-integration/resources/authenticate/admin-token.data diff --git a/src/integration-test/resources/authenticate/user-token.data b/src/test-integration/resources/authenticate/user-token.data similarity index 100% rename from src/integration-test/resources/authenticate/user-token.data rename to src/test-integration/resources/authenticate/user-token.data diff --git a/src/integration-test/resources/cert/valid-private-key.pem b/src/test-integration/resources/cert/valid-private-key.pem similarity index 100% rename from src/integration-test/resources/cert/valid-private-key.pem rename to src/test-integration/resources/cert/valid-private-key.pem diff --git a/src/integration-test/resources/postgres/data.sql b/src/test-integration/resources/postgres/data.sql similarity index 100% rename from src/integration-test/resources/postgres/data.sql rename to src/test-integration/resources/postgres/data.sql diff --git a/src/integration-test/resources/postgres/reset.sql b/src/test-integration/resources/postgres/reset.sql similarity index 79% rename from src/integration-test/resources/postgres/reset.sql rename to src/test-integration/resources/postgres/reset.sql index 99fc858..5541673 100644 --- a/src/integration-test/resources/postgres/reset.sql +++ b/src/test-integration/resources/postgres/reset.sql @@ -3,8 +3,8 @@ ALTER TABLE accounts DISABLE TRIGGER ALL; ALTER TABLE accounts_audit DISABLE TRIGGER ALL; -- Truncate tables -TRUNCATE TABLE accounts_audit; -TRUNCATE TABLE accounts; +TRUNCATE TABLE accounts_audit CASCADE; +TRUNCATE TABLE accounts CASCADE; -- Enable triggers on the account table ALTER TABLE accounts ENABLE TRIGGER ALL; diff --git a/src/integration-test/resources/postgres/schema.sql b/src/test-integration/resources/postgres/schema.sql similarity index 76% rename from src/integration-test/resources/postgres/schema.sql rename to src/test-integration/resources/postgres/schema.sql index 9ed483a..3863412 100644 --- a/src/integration-test/resources/postgres/schema.sql +++ b/src/test-integration/resources/postgres/schema.sql @@ -72,8 +72,3 @@ CREATE OR REPLACE TRIGGER accounts_audit_trigger ON public.accounts FOR EACH ROW EXECUTE FUNCTION public.accounts_audit(); --- Test data -insert into public.accounts (id, created_at, updated_at, enabled, username, password, roles) -values ('00000000-0000-7000-0000-000000000001'::uuid, '2000-01-01 00:00:00.000001 +00:00', '2000-01-01 00:00:01.000001 +00:00', true, 'admin', '$2a$12$KoXBoLOANMK11J4xeJHPA.Sy0FG.m8KWk7P4XFsMO.ZbFmFI2DckK', 'ROLE_ADMIN'), - ('00000000-0000-7000-0000-000000000002'::uuid, '2000-01-01 00:00:00.000001 +00:00', '2000-01-01 00:00:01.000001 +00:00', true, 'user', '$2a$12$KoXBoLOANMK11J4xeJHPA.Sy0FG.m8KWk7P4XFsMO.ZbFmFI2DckK', 'ROLE_USER'), - ('00000000-0000-7000-0000-000000000003'::uuid, '2000-01-01 00:00:00.000001 +00:00', '2000-01-01 00:00:01.000001 +00:00', false, 'disabled', '$2a$12$KoXBoLOANMK11J4xeJHPA.Sy0FG.m8KWk7P4XFsMO.ZbFmFI2DckK', 'ROLE_USER');