diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
new file mode 100644
index 00000000..bd2df809
--- /dev/null
+++ b/buildSrc/build.gradle
@@ -0,0 +1,3 @@
+plugins {
+ id "groovy-gradle-plugin"
+}
diff --git a/buildSrc/src/main/groovy/io.micronaut.build.internal.liquibase.test-suite-module.gradle b/buildSrc/src/main/groovy/io.micronaut.build.internal.liquibase.test-suite-module.gradle
new file mode 100644
index 00000000..e117c61e
--- /dev/null
+++ b/buildSrc/src/main/groovy/io.micronaut.build.internal.liquibase.test-suite-module.gradle
@@ -0,0 +1,28 @@
+plugins {
+ id("groovy")
+}
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ testImplementation(platform("io.micronaut:micronaut-bom:$micronautVersion"))
+ testImplementation("io.micronaut.groovy:micronaut-runtime-groovy")
+ testImplementation("io.micronaut.sql:micronaut-jdbc-hikari")
+ testImplementation("io.micronaut.test:micronaut-test-spock")
+ testImplementation("io.micronaut:micronaut-http-client")
+ testImplementation("io.micronaut:micronaut-http-server-netty")
+ testImplementation("io.micronaut:micronaut-http-validation")
+ testImplementation("io.micronaut:micronaut-inject-groovy")
+ testImplementation("io.micronaut:micronaut-validation")
+
+ testImplementation(project(":liquibase"))
+
+ testRuntimeOnly("ch.qos.logback:logback-classic")
+ testRuntimeOnly("com.h2database:h2")
+}
+
+tasks.withType(Test) {
+ useJUnitPlatform()
+}
diff --git a/liquibase/build.gradle b/liquibase/build.gradle
index 41247420..3399d0fd 100644
--- a/liquibase/build.gradle
+++ b/liquibase/build.gradle
@@ -6,6 +6,8 @@ dependencies {
annotationProcessor(libs.micronaut.serde.processor)
compileOnly libs.micronaut.inject.java
compileOnly libs.grails.datastore.gorm.hibernate5
+ compileOnly(libs.micronaut.serde.api)
+ compileOnly(libs.micronaut.serde.jackson)
api (libs.managed.liquibase) {
exclude group: 'org.springframework'
@@ -13,9 +15,6 @@ dependencies {
api libs.micronaut.management
api libs.micronaut.jdbc
- implementation libs.micronaut.serde.api
- implementation libs.micronaut.serde.jackson
-
implementation libs.projectreactor
testAnnotationProcessor libs.groovy.sql
@@ -29,4 +28,5 @@ dependencies {
testImplementation libs.groovy.sql
testImplementation libs.grails.datastore.gorm.hibernate5
testImplementation libs.h2
+ testImplementation(libs.micronaut.serde.jackson)
}
diff --git a/settings.gradle b/settings.gradle
index bb0682c3..e245f55e 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -14,4 +14,5 @@ rootProject.name = 'liquibase-parent'
include 'liquibase'
include 'liquibase-bom'
+include 'test-suite-jackson'
include 'test-suite-serde'
diff --git a/test-suite-jackson/build.gradle.kts b/test-suite-jackson/build.gradle.kts
new file mode 100644
index 00000000..c0f7b250
--- /dev/null
+++ b/test-suite-jackson/build.gradle.kts
@@ -0,0 +1,9 @@
+plugins {
+ id("io.micronaut.build.internal.liquibase.test-suite-module")
+}
+
+description = "Test suite for Liquibase + Jackson"
+
+dependencies {
+ testImplementation("io.micronaut:micronaut-jackson-databind")
+}
diff --git a/test-suite-jackson/src/test/groovy/io/micronaut/liquibase/Dto.groovy b/test-suite-jackson/src/test/groovy/io/micronaut/liquibase/Dto.groovy
new file mode 100644
index 00000000..933f19ca
--- /dev/null
+++ b/test-suite-jackson/src/test/groovy/io/micronaut/liquibase/Dto.groovy
@@ -0,0 +1,6 @@
+package io.micronaut.liquibase
+
+class Dto {
+
+ String name
+}
diff --git a/test-suite-jackson/src/test/groovy/io/micronaut/liquibase/JacksonEndpointSpec.groovy b/test-suite-jackson/src/test/groovy/io/micronaut/liquibase/JacksonEndpointSpec.groovy
new file mode 100644
index 00000000..2c9fa912
--- /dev/null
+++ b/test-suite-jackson/src/test/groovy/io/micronaut/liquibase/JacksonEndpointSpec.groovy
@@ -0,0 +1,37 @@
+package io.micronaut.liquibase
+
+import io.micronaut.context.annotation.Property
+import io.micronaut.core.type.Argument
+import io.micronaut.core.util.StringUtils
+import io.micronaut.http.HttpRequest
+import io.micronaut.http.client.HttpClient
+import io.micronaut.http.client.annotation.Client
+import io.micronaut.test.extensions.spock.annotation.MicronautTest
+import jakarta.inject.Inject
+import spock.lang.Specification
+
+@MicronautTest
+class JacksonEndpointSpec extends Specification {
+
+ @Inject
+ @Client("/")
+ HttpClient client
+
+ void "can read endpoint using Jackson"() {
+ when:
+ def response = client.toBlocking().retrieve(HttpRequest.GET("/liquibase"), Argument.listOf(Map))
+
+ then:
+ response.name == ["default"]
+ response.changeSets.author == [['sdelamo', 'sdelamo']]
+ response.changeSets.description == [['createTable tableName=books', 'insert tableName=books; insert tableName=books']]
+ }
+
+ def "serialization still works as expected"() {
+ when:
+ def helloResponse = client.toBlocking().retrieve(HttpRequest.POST("/", new Dto(name: 'Tim')))
+
+ then:
+ helloResponse == "Hello Tim"
+ }
+}
diff --git a/test-suite-jackson/src/test/groovy/io/micronaut/liquibase/MyController.groovy b/test-suite-jackson/src/test/groovy/io/micronaut/liquibase/MyController.groovy
new file mode 100644
index 00000000..9f47d914
--- /dev/null
+++ b/test-suite-jackson/src/test/groovy/io/micronaut/liquibase/MyController.groovy
@@ -0,0 +1,13 @@
+package io.micronaut.liquibase
+
+import io.micronaut.http.annotation.Controller
+import io.micronaut.http.annotation.Post
+
+@Controller
+class MyController {
+
+ @Post
+ String index(Dto dto) {
+ "Hello $dto.name"
+ }
+}
diff --git a/test-suite-jackson/src/test/resources/application.yml b/test-suite-jackson/src/test/resources/application.yml
new file mode 100644
index 00000000..7933ea93
--- /dev/null
+++ b/test-suite-jackson/src/test/resources/application.yml
@@ -0,0 +1,13 @@
+endpoints:
+ liquibase:
+ sensitive: false
+datasources:
+ default:
+ url: jdbc:h2:mem:liquibaseEndpointDb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=TRUE
+ username: 'sa'
+ password: ''
+ driver-class-name: 'org.h2.Driver'
+liquibase:
+ datasources:
+ default:
+ change-log: classpath:db/liquibase-changelog.xml
diff --git a/test-suite-jackson/src/test/resources/db/changelog/01-create-books-schema.xml b/test-suite-jackson/src/test/resources/db/changelog/01-create-books-schema.xml
new file mode 100644
index 00000000..19764599
--- /dev/null
+++ b/test-suite-jackson/src/test/resources/db/changelog/01-create-books-schema.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test-suite-jackson/src/test/resources/db/changelog/01b-create-books-schema.xml b/test-suite-jackson/src/test/resources/db/changelog/01b-create-books-schema.xml
new file mode 100644
index 00000000..19764599
--- /dev/null
+++ b/test-suite-jackson/src/test/resources/db/changelog/01b-create-books-schema.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test-suite-jackson/src/test/resources/db/changelog/02-insert-data-books.xml b/test-suite-jackson/src/test/resources/db/changelog/02-insert-data-books.xml
new file mode 100644
index 00000000..4eab416c
--- /dev/null
+++ b/test-suite-jackson/src/test/resources/db/changelog/02-insert-data-books.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ Inserting Books
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test-suite-jackson/src/test/resources/db/changelog/03-create-books-schema.xml b/test-suite-jackson/src/test/resources/db/changelog/03-create-books-schema.xml
new file mode 100644
index 00000000..19764599
--- /dev/null
+++ b/test-suite-jackson/src/test/resources/db/changelog/03-create-books-schema.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test-suite-jackson/src/test/resources/db/liquibase-changelog.xml b/test-suite-jackson/src/test/resources/db/liquibase-changelog.xml
new file mode 100644
index 00000000..86f9cbdd
--- /dev/null
+++ b/test-suite-jackson/src/test/resources/db/liquibase-changelog.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/test-suite-jackson/src/test/resources/logback.xml b/test-suite-jackson/src/test/resources/logback.xml
new file mode 100644
index 00000000..655f0123
--- /dev/null
+++ b/test-suite-jackson/src/test/resources/logback.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
diff --git a/test-suite-serde/build.gradle.kts b/test-suite-serde/build.gradle.kts
index 5a4e6991..82590530 100644
--- a/test-suite-serde/build.gradle.kts
+++ b/test-suite-serde/build.gradle.kts
@@ -1,31 +1,10 @@
plugins {
- id("groovy")
- id("java-library")
+ id("io.micronaut.build.internal.liquibase.test-suite-module")
}
-repositories {
- mavenCentral()
-}
-
-val micronautVersion: String by project
-val groovyVersion: String by project
+description = "Test suite for Liquibase + Jackson"
dependencies {
- testImplementation("org.codehaus.groovy:groovy-all:$groovyVersion")
- testImplementation(platform("io.micronaut:micronaut-bom:$micronautVersion"))
- testImplementation("io.micronaut:micronaut-http-server-netty")
- testImplementation("io.micronaut:micronaut-inject-groovy")
- testImplementation(project(":liquibase"))
- testImplementation("org.spockframework:spock-core")
- testImplementation("io.micronaut.sql:micronaut-jdbc-hikari")
- testImplementation("io.micronaut.test:micronaut-test-spock")
- testImplementation("io.micronaut:micronaut-http-client")
+ testImplementation("io.micronaut.serde:micronaut-serde-api")
testImplementation("io.micronaut.serde:micronaut-serde-jackson")
-
- testRuntimeOnly("ch.qos.logback:logback-classic")
- testRuntimeOnly(libs.h2)
-}
-
-tasks.named("test") {
- useJUnitPlatform()
}
diff --git a/test-suite-serde/src/test/groovy/io/micronaut/liquibase/Dto.groovy b/test-suite-serde/src/test/groovy/io/micronaut/liquibase/Dto.groovy
new file mode 100644
index 00000000..46249fae
--- /dev/null
+++ b/test-suite-serde/src/test/groovy/io/micronaut/liquibase/Dto.groovy
@@ -0,0 +1,9 @@
+package io.micronaut.liquibase
+
+import io.micronaut.serde.annotation.Serdeable
+
+@Serdeable
+class Dto {
+
+ String name
+}
diff --git a/test-suite-serde/src/test/groovy/io/micronaut/liquibase/MyController.groovy b/test-suite-serde/src/test/groovy/io/micronaut/liquibase/MyController.groovy
new file mode 100644
index 00000000..9f47d914
--- /dev/null
+++ b/test-suite-serde/src/test/groovy/io/micronaut/liquibase/MyController.groovy
@@ -0,0 +1,13 @@
+package io.micronaut.liquibase
+
+import io.micronaut.http.annotation.Controller
+import io.micronaut.http.annotation.Post
+
+@Controller
+class MyController {
+
+ @Post
+ String index(Dto dto) {
+ "Hello $dto.name"
+ }
+}
diff --git a/test-suite-serde/src/test/groovy/io/micronaut/liquibase/SerdeEndpointSpec.groovy b/test-suite-serde/src/test/groovy/io/micronaut/liquibase/SerdeEndpointSpec.groovy
index ef9ca260..d5f5d35c 100644
--- a/test-suite-serde/src/test/groovy/io/micronaut/liquibase/SerdeEndpointSpec.groovy
+++ b/test-suite-serde/src/test/groovy/io/micronaut/liquibase/SerdeEndpointSpec.groovy
@@ -1,33 +1,23 @@
package io.micronaut.liquibase
-import io.micronaut.context.ApplicationContext
-import io.micronaut.context.env.Environment
+import io.micronaut.context.annotation.Property
import io.micronaut.core.type.Argument
+import io.micronaut.core.util.StringUtils
import io.micronaut.http.HttpRequest
import io.micronaut.http.client.HttpClient
-import io.micronaut.runtime.server.EmbeddedServer
+import io.micronaut.http.client.annotation.Client
+import io.micronaut.test.extensions.spock.annotation.MicronautTest
+import jakarta.inject.Inject
import spock.lang.Specification
+@MicronautTest
class SerdeEndpointSpec extends Specification {
- void "can read endpoint using Serde"() {
- given:
- EmbeddedServer embeddedServer = ApplicationContext.run(
- EmbeddedServer,
- ['jpa.default.packages-to-scan' : 'example.micronaut',
- 'jpa.default.properties.hibernate.hbm2ddl.auto': 'none',
- 'jpa.default.properties.hibernate.show_sql' : true,
- 'liquibase.datasources.default.change-log' : 'classpath:db/liquibase-changelog.xml',
- 'endpoints.liquibase.sensitive' : false,
- 'datasources.default.url' : 'jdbc:h2:mem:liquibaseEndpointDb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=TRUE',
- 'datasources.default.username' : 'sa',
- 'datasources.default.password' : '',
- 'datasources.default.driver-class-name' : 'org.h2.Driver'] as Map,
- Environment.TEST
- )
- URL server = embeddedServer.getURL()
- HttpClient client = embeddedServer.applicationContext.createBean(HttpClient, server)
+ @Inject
+ @Client("/")
+ HttpClient client
+ void "can read endpoint using Jackson"() {
when:
def response = client.toBlocking().retrieve(HttpRequest.GET("/liquibase"), Argument.listOf(Map))
@@ -36,4 +26,12 @@ class SerdeEndpointSpec extends Specification {
response.changeSets.author == [['sdelamo', 'sdelamo']]
response.changeSets.description == [['createTable tableName=books', 'insert tableName=books; insert tableName=books']]
}
+
+ def "serialization still works as expected"() {
+ when:
+ def helloResponse = client.toBlocking().retrieve(HttpRequest.POST("/", new Dto(name: 'Tim')))
+
+ then:
+ helloResponse == "Hello Tim"
+ }
}
diff --git a/test-suite-serde/src/test/resources/application.yml b/test-suite-serde/src/test/resources/application.yml
new file mode 100644
index 00000000..7933ea93
--- /dev/null
+++ b/test-suite-serde/src/test/resources/application.yml
@@ -0,0 +1,13 @@
+endpoints:
+ liquibase:
+ sensitive: false
+datasources:
+ default:
+ url: jdbc:h2:mem:liquibaseEndpointDb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=TRUE
+ username: 'sa'
+ password: ''
+ driver-class-name: 'org.h2.Driver'
+liquibase:
+ datasources:
+ default:
+ change-log: classpath:db/liquibase-changelog.xml