From e7694ae242b84c515112586ae97d80457619eaf3 Mon Sep 17 00:00:00 2001 From: Vincent Potucek Date: Fri, 30 May 2025 12:21:24 +0200 Subject: [PATCH 1/6] PoC: integrate Eclipse Formatter Profile into Maven Spotless Plugin - config --- .github/dependabot.yml | 3 +- CONTRIBUTING.md | 4 - build-parent/pom.xml | 132 +++++++----------- .../mssql/deployment/MsSQLReflections.java | 4 - extensions/websockets-next/deployment/pom.xml | 3 +- independent-projects/arc/pom.xml | 43 +----- independent-projects/bootstrap/pom.xml | 43 +----- independent-projects/enforcer-rules/pom.xml | 43 +----- .../extension-maven-plugin/pom.xml | 43 +----- .../capabilities/CapabilitiesConfig.java | 40 +++--- .../junit5-virtual-threads/pom.xml | 43 +----- independent-projects/parent/pom.xml | 13 -- independent-projects/qute/pom.xml | 43 +----- .../resteasy-reactive/pom.xml | 48 +------ independent-projects/tools/pom.xml | 43 +----- integration-tests/virtual-threads/pom.xml | 15 -- pom.xml | 2 +- 17 files changed, 129 insertions(+), 436 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 289ea8ced7c37..c7dbed8cd9118 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -85,8 +85,7 @@ updates: - dependency-name: org.apache.maven.plugins:* - dependency-name: org.codehaus.mojo:* - dependency-name: io.fabric8:docker-maven-plugin - - dependency-name: net.revelc.code.formatter:formatter-maven-plugin - - dependency-name: net.revelc.code:impsort-maven-plugin + - dependency-name: com.diffplug.spotless:spotless-maven-plugin # Narayana - dependency-name: org.jboss.narayana.jta:* - dependency-name: org.jboss.narayana.jts:* diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6f1d967ec7aec..033d384adb058 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -406,10 +406,6 @@ in `quarkus-parent` (root `pom.xml`). When contributing to Quarkus, it is recommended to respect the following rules. -> **Note:** The `impsort-maven-plugin` uses the `.cache` directory on each module to speed up the build. -> Because we have configured the plugin to store in a versioned directory, you may notice over time that the `.cache` directory grows in size. You can safely delete the `.cache` directory in each module to reclaim the space. -> Running `./mvnw clean -Dclean-cache` automatically deletes that directory for you. - **Contributing to an extension** When you contribute to an extension, after having applied your changes, run: diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 7154b15edbbc7..3f630a23604fc 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -681,6 +681,48 @@ com.diffplug.spotless spotless-maven-plugin 2.44.4 + + + + + + + true + 2 + + + .gitignore + + + **gradlew** + **mvnw** + extensions/panache/**/pom.xml + test-framework/junit5/pom.xml + test-framework/security/pom.xml + + + + + + ${maven.multiModuleProjectDirectory}/independent-projects/ide-config/src/main/resources/eclipse-format.xml + + + ${maven.multiModuleProjectDirectory}/independent-projects/ide-config/src/main/resources/eclipse.importorder + + + + + **/src/main/java/io/quarkus/rest/client/reactive/deployment/ClientContextResolverHandler.java + **/src/main/java/io/quarkus/rest/client/reactive/deployment/ClientExceptionMapperHandler.java + **/src/main/java/io/quarkus/rest/client/reactive/deployment/ClientRedirectHandler.java + + + + + + + + @@ -698,28 +740,14 @@ - net.revelc.code.formatter - formatter-maven-plugin - - - process-sources - - format - - - - - - net.revelc.code - impsort-maven-plugin - - true - + com.diffplug.spotless + spotless-maven-plugin - sort-imports + spotless-apply + verify - sort + apply @@ -735,50 +763,6 @@ no-format - - - - net.revelc.code.formatter - formatter-maven-plugin - - - process-sources - - validate - - - - - - net.revelc.code - impsort-maven-plugin - - true - - - - check-imports - - check - - - - - - - - - - format-kotlin - - true - - !no-format - - - src/main/kotlin - - @@ -786,29 +770,13 @@ spotless-maven-plugin - format-kotlin - process-sources + spotless-check + verify - apply + check - - - - - - - - - - - - diff --git a/extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLReflections.java b/extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLReflections.java index 6278533b17123..8811d9faf8791 100644 --- a/extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLReflections.java +++ b/extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLReflections.java @@ -19,10 +19,6 @@ void build(BuildProducer reflectiveClass) { //We register it for the sake of people not using Agroal. final String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; reflectiveClass.produce(ReflectiveClassBuildItem.builder(driverName).build()); - - // https://github.com/quarkusio/quarkus/pull/48082#issuecomment-2912550391 - String className = "com.microsoft.sqlserver.jdbc.ConfigurableRetryLogic"; - reflectiveClass.produce(ReflectiveClassBuildItem.builder(className).build()); } } diff --git a/extensions/websockets-next/deployment/pom.xml b/extensions/websockets-next/deployment/pom.xml index d8e04df3c1ca5..3b93c2d5b737f 100644 --- a/extensions/websockets-next/deployment/pom.xml +++ b/extensions/websockets-next/deployment/pom.xml @@ -196,8 +196,7 @@ 21 21 - - + 21 diff --git a/independent-projects/arc/pom.xml b/independent-projects/arc/pom.xml index 247c010ffd77d..42f59682b37cf 100644 --- a/independent-projects/arc/pom.xml +++ b/independent-projects/arc/pom.xml @@ -327,31 +327,17 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin - process-sources - - format - - - - - - net.revelc.code - impsort-maven-plugin - - - sort-imports + spotless-apply + verify - sort + apply - - true - @@ -367,8 +353,8 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin process-sources @@ -378,21 +364,6 @@ - - net.revelc.code - impsort-maven-plugin - - true - - - - check-imports - - check - - - - diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml index 90230e504dde6..3a3d5d2cced99 100644 --- a/independent-projects/bootstrap/pom.xml +++ b/independent-projects/bootstrap/pom.xml @@ -239,31 +239,17 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin - process-sources - - format - - - - - - net.revelc.code - impsort-maven-plugin - - - sort-imports + spotless-apply + verify - sort + apply - - true - @@ -279,8 +265,8 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin process-sources @@ -290,21 +276,6 @@ - - net.revelc.code - impsort-maven-plugin - - true - - - - check-imports - - check - - - - diff --git a/independent-projects/enforcer-rules/pom.xml b/independent-projects/enforcer-rules/pom.xml index 3d1a381bbd198..a09534987bfde 100644 --- a/independent-projects/enforcer-rules/pom.xml +++ b/independent-projects/enforcer-rules/pom.xml @@ -173,31 +173,17 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin - process-sources - - format - - - - - - net.revelc.code - impsort-maven-plugin - - - sort-imports + spotless-apply + verify - sort + apply - - true - @@ -213,8 +199,8 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin process-sources @@ -224,21 +210,6 @@ - - net.revelc.code - impsort-maven-plugin - - true - - - - check-imports - - check - - - - diff --git a/independent-projects/extension-maven-plugin/pom.xml b/independent-projects/extension-maven-plugin/pom.xml index 5b415927fa244..ae003d2553f81 100644 --- a/independent-projects/extension-maven-plugin/pom.xml +++ b/independent-projects/extension-maven-plugin/pom.xml @@ -455,31 +455,17 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin - process-sources - - format - - - - - - net.revelc.code - impsort-maven-plugin - - - sort-imports + spotless-apply + verify - sort + apply - - true - @@ -495,8 +481,8 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin process-sources @@ -506,21 +492,6 @@ - - net.revelc.code - impsort-maven-plugin - - true - - - - check-imports - - check - - - - diff --git a/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/capabilities/CapabilitiesConfig.java b/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/capabilities/CapabilitiesConfig.java index 6e16cc9f1dabe..be6f439fb7b01 100644 --- a/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/capabilities/CapabilitiesConfig.java +++ b/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/capabilities/CapabilitiesConfig.java @@ -6,30 +6,30 @@ public class CapabilitiesConfig { - private List provides = new ArrayList<>(0); - private List requires = new ArrayList<>(0); +private List provides = new ArrayList<>(0); +private List requires = new ArrayList<>(0); - public void addProvides(CapabilityConfig capability) { - provides.add(capability); - } +public void addProvides(CapabilityConfig capability) { +provides.add(capability); +} - public void addProvidesIf(CapabilityConfig capability) { - provides.add(capability); - } +public void addProvidesIf(CapabilityConfig capability) { +provides.add(capability); +} - public Collection getProvides() { - return provides; - } +public Collection getProvides() { +return provides; +} - public void addRequires(CapabilityConfig capability) { - requires.add(capability); - } +public void addRequires(CapabilityConfig capability) { +requires.add(capability); +} - public void addRequiresIf(CapabilityConfig capability) { - requires.add(capability); - } +public void addRequiresIf(CapabilityConfig capability) { +requires.add(capability); +} - public Collection getRequires() { - return requires; - } +public Collection getRequires() { +return requires; +} } diff --git a/independent-projects/junit5-virtual-threads/pom.xml b/independent-projects/junit5-virtual-threads/pom.xml index 22d0db159b16a..c8f16b49fa985 100644 --- a/independent-projects/junit5-virtual-threads/pom.xml +++ b/independent-projects/junit5-virtual-threads/pom.xml @@ -218,31 +218,17 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin - process-sources - - format - - - - - - net.revelc.code - impsort-maven-plugin - - - sort-imports + spotless-apply + verify - sort + apply - - true - @@ -258,8 +244,8 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin process-sources @@ -269,21 +255,6 @@ - - net.revelc.code - impsort-maven-plugin - - true - - - - check-imports - - check - - - - diff --git a/independent-projects/parent/pom.xml b/independent-projects/parent/pom.xml index e4bf460c9d2ca..2a1cfeef20c3d 100644 --- a/independent-projects/parent/pom.xml +++ b/independent-projects/parent/pom.xml @@ -378,19 +378,6 @@ ${format.skip} - - net.revelc.code - impsort-maven-plugin - ${version.impsort.plugin} - - - .cache/impsort-maven-plugin-${version.impsort.plugin} - java.,javax.,jakarta.,org.,com. - * - ${format.skip} - true - - org.apache.maven.plugins maven-surefire-plugin diff --git a/independent-projects/qute/pom.xml b/independent-projects/qute/pom.xml index bc8224be009a5..f8e6e0e750dce 100644 --- a/independent-projects/qute/pom.xml +++ b/independent-projects/qute/pom.xml @@ -230,31 +230,17 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin - process-sources - - format - - - - - - net.revelc.code - impsort-maven-plugin - - - sort-imports + spotless-apply + verify - sort + apply - - true - @@ -270,8 +256,8 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin process-sources @@ -281,21 +267,6 @@ - - net.revelc.code - impsort-maven-plugin - - true - - - - check-imports - - check - - - - diff --git a/independent-projects/resteasy-reactive/pom.xml b/independent-projects/resteasy-reactive/pom.xml index d27385c16dddd..45acda93b8b8e 100644 --- a/independent-projects/resteasy-reactive/pom.xml +++ b/independent-projects/resteasy-reactive/pom.xml @@ -585,36 +585,17 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin - process-sources - - format - - - - - - net.revelc.code - impsort-maven-plugin - - - sort-imports + spotless-apply + verify - sort + apply - - - .cache/impsort-maven-plugin-${impsort-maven-plugin.version} - java.,javax.,jakarta.,org.,com. - * - ${format.skip} - true - @@ -630,8 +611,8 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin process-sources @@ -641,21 +622,6 @@ - - net.revelc.code - impsort-maven-plugin - - true - - - - check-imports - - check - - - - diff --git a/independent-projects/tools/pom.xml b/independent-projects/tools/pom.xml index 872cee0a98093..68c10063e3edb 100644 --- a/independent-projects/tools/pom.xml +++ b/independent-projects/tools/pom.xml @@ -306,32 +306,18 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin - process-sources + spotless-apply + verify - format + apply - - net.revelc.code - impsort-maven-plugin - - - sort-imports - - sort - - - - - true - - @@ -346,8 +332,8 @@ - net.revelc.code.formatter - formatter-maven-plugin + com.diffplug.spotless + spotless-maven-plugin process-sources @@ -357,21 +343,6 @@ - - net.revelc.code - impsort-maven-plugin - - true - - - - check-imports - - check - - - - diff --git a/integration-tests/virtual-threads/pom.xml b/integration-tests/virtual-threads/pom.xml index 5dd0ca4f757d3..2971fd8cfe635 100644 --- a/integration-tests/virtual-threads/pom.xml +++ b/integration-tests/virtual-threads/pom.xml @@ -78,21 +78,6 @@ - - net.revelc.code - impsort-maven-plugin - - - sort-imports - - sort - - - - - ${impsort.skip} - - diff --git a/pom.xml b/pom.xml index 6f6970793e253..e44b31eea3932 100644 --- a/pom.xml +++ b/pom.xml @@ -71,7 +71,7 @@ 0.8.13 7.3.1 5.5.5 - 6.6.17.Final + 6.6.16.Final 3.1.0 4.13.0 1.15.11 From 3369a2038fbdee9d7132812f396be18556949685 Mon Sep 17 00:00:00 2001 From: Vincent Potucek Date: Fri, 30 May 2025 12:29:27 +0200 Subject: [PATCH 2/6] PoC: integrate Eclipse Formatter Profile into Maven Spotless Plugin - apply --- .../spi/KubernetesEnvBuildItemTest.java | 2 +- .../deployment/test/DuplicateIdEntity.kt | 3 +- .../deployment/test/DuplicateIdEntityTest.kt | 12 +- .../kotlin/deployment/test/MyEntity.kt | 3 +- .../kotlin/deployment/test/NoConfigTest.kt | 3 +- .../test/config/ConfigEnabledFalseTest.kt | 18 +- .../DefaultPersistenceUnitConfigTest.kt | 24 +-- .../DefaultPersistenceUnitFileTest.kt | 36 ++-- .../ErroneousPersistenceUnitConfigTest.kt | 14 +- .../MultiplePersistenceUnitConfigTest.kt | 27 +-- .../test/multiple_pu/second/SecondEntity.kt | 3 +- .../kotlin/deployment/test/MyEntity.kt | 3 +- .../test/config/ConfigEnabledFalseTest.kt | 17 +- .../mongodb/panache/kotlin/deployment/Book.kt | 192 +++++++++--------- .../kotlin/deployment/StudentRepository.kt | 92 ++++----- .../redis/datasource/BitMapCommandsTest.java | 2 +- .../kotlin/test/EncodeDefaultValuesTest.kt | 15 +- .../reactive/kotlin/test/ExplicitNullsTest.kt | 14 +- .../reactive/kotlin/test/LenientTest.kt | 12 +- .../reactive/kotlin/test/PrettyPrintTest.kt | 19 +- .../deployment/test/sse/SseResource.java | 1 - .../kotlin/serialization/common/BasicTest.kt | 33 ++- .../serialization/common/CustomBeanTest.kt | 22 +- .../kotlin/serialization/common/Greeting.kt | 3 +- .../common/JsonBuilderCustomizerTest.kt | 60 ++++-- .../http/proxy/fakedns/DnsMessageEncoder.java | 19 -- .../websockets/next/test/kotlin/BinaryEcho.kt | 5 +- .../next/test/kotlin/BinaryEchoUni.kt | 2 - .../websockets/next/test/kotlin/Echo.kt | 4 +- .../test/kotlin/KotlinWebSocketClientTest.kt | 18 +- .../KotlinWebSocketSessionContextTest.kt | 17 +- .../KotlinWebSocketSuspendingClientTest.kt | 18 +- .../next/test/kotlin/KotlinWebSocketTest.kt | 40 ++-- 33 files changed, 373 insertions(+), 380 deletions(-) diff --git a/extensions/kubernetes/spi/src/test/java/io/quarkus/kubernetes/spi/KubernetesEnvBuildItemTest.java b/extensions/kubernetes/spi/src/test/java/io/quarkus/kubernetes/spi/KubernetesEnvBuildItemTest.java index 41612db62653e..a3d50d5bbdd93 100644 --- a/extensions/kubernetes/spi/src/test/java/io/quarkus/kubernetes/spi/KubernetesEnvBuildItemTest.java +++ b/extensions/kubernetes/spi/src/test/java/io/quarkus/kubernetes/spi/KubernetesEnvBuildItemTest.java @@ -13,10 +13,10 @@ */ package io.quarkus.kubernetes.spi; -import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.create; import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.configmap; import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.secret; import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.var; +import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.create; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntity.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntity.kt index 19672d65310b9..6a7d6ba8ebafa 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntity.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntity.kt @@ -4,6 +4,5 @@ import io.quarkus.hibernate.orm.panache.kotlin.PanacheEntity import jakarta.persistence.Id class DuplicateIdEntity : PanacheEntity() { - @Id - var customId: String? = null + @Id var customId: String? = null } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntityTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntityTest.kt index 01210bd3b4be9..bebdf4c573840 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntityTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntityTest.kt @@ -2,8 +2,8 @@ package io.quarkus.hibernate.orm.panache.kotlin.deployment.test import io.quarkus.builder.BuildException import io.quarkus.test.QuarkusUnitTest -import org.jboss.shrinkwrap.api.spec.JavaArchive import org.jboss.shrinkwrap.api.ShrinkWrap +import org.jboss.shrinkwrap.api.spec.JavaArchive import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension @@ -17,11 +17,9 @@ class DuplicateIdEntityTest { companion object { @RegisterExtension @JvmField - var runner = QuarkusUnitTest() - .setExpectedException(BuildException::class.java) - .setArchiveProducer { - ShrinkWrap.create(JavaArchive::class.java) - .addClasses(DuplicateIdEntity::class.java) - } + var runner = + QuarkusUnitTest().setExpectedException(BuildException::class.java).setArchiveProducer { + ShrinkWrap.create(JavaArchive::class.java).addClasses(DuplicateIdEntity::class.java) + } } } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/MyEntity.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/MyEntity.kt index a3f88d987aaad..8a92c699927c0 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/MyEntity.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/MyEntity.kt @@ -6,8 +6,7 @@ import jakarta.persistence.Entity @Entity class MyEntity : PanacheEntity() { - companion object: PanacheCompanion { - } + companion object : PanacheCompanion {} lateinit var name: String } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/NoConfigTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/NoConfigTest.kt index b06fcc295c8db..cdeca3829cf93 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/NoConfigTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/NoConfigTest.kt @@ -15,6 +15,7 @@ class NoConfigTest { companion object { @RegisterExtension @JvmField - val config = QuarkusUnitTest().setArchiveProducer { ShrinkWrap.create(JavaArchive::class.java) } + val config = + QuarkusUnitTest().setArchiveProducer { ShrinkWrap.create(JavaArchive::class.java) } } } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt index 38bd7a486eaea..8c0dd6ef6d8b5 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt @@ -3,21 +3,23 @@ package io.quarkus.hibernate.orm.panache.kotlin.deployment.test.config import io.quarkus.arc.Arc import io.quarkus.hibernate.orm.panache.kotlin.deployment.test.MyEntity import io.quarkus.test.QuarkusUnitTest +import jakarta.persistence.EntityManagerFactory import org.jboss.shrinkwrap.api.spec.JavaArchive import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension -import jakarta.persistence.EntityManagerFactory class ConfigEnabledFalseTest { companion object { @RegisterExtension - val config = QuarkusUnitTest() - .withApplicationRoot { jar: JavaArchive -> jar.addClass(MyEntity::class.java) } - .withConfigurationResource("application-test.properties") - // We shouldn't get any build error caused by Panache consuming build items that are not produced - // See https://github.com/quarkusio/quarkus/issues/28842 - .overrideConfigKey("quarkus.hibernate-orm.enabled", "false") + val config = + QuarkusUnitTest() + .withApplicationRoot { jar: JavaArchive -> jar.addClass(MyEntity::class.java) } + .withConfigurationResource("application-test.properties") + // We shouldn't get any build error caused by Panache consuming build items that are + // not produced + // See https://github.com/quarkusio/quarkus/issues/28842 + .overrideConfigKey("quarkus.hibernate-orm.enabled", "false") } @Test @@ -26,4 +28,4 @@ class ConfigEnabledFalseTest { // Just check that Hibernate ORM is disabled. Assertions.assertNull(Arc.container().instance(EntityManagerFactory::class.java).get()) } -} \ No newline at end of file +} diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitConfigTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitConfigTest.kt index 8995066f030f4..be914b03fafcc 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitConfigTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitConfigTest.kt @@ -13,14 +13,10 @@ import org.junit.jupiter.api.extension.RegisterExtension class DefaultPersistenceUnitConfigTest { @Test fun panacheOperations() { - /** - * First entity operations - */ + /** First entity operations */ RestAssured.`when`()["/persistence-unit/first/name-1"].then().body(Matchers.`is`("name-1")) RestAssured.`when`()["/persistence-unit/first/name-2"].then().body(Matchers.`is`("name-2")) - /** - * second entity operations - */ + /** second entity operations */ RestAssured.`when`()["/persistence-unit/second/name-1"].then().body(Matchers.`is`("name-1")) RestAssured.`when`()["/persistence-unit/second/name-2"].then().body(Matchers.`is`("name-2")) } @@ -28,11 +24,15 @@ class DefaultPersistenceUnitConfigTest { companion object { @RegisterExtension @JvmField - var runner = QuarkusUnitTest() - .setArchiveProducer { - ShrinkWrap.create(JavaArchive::class.java) - .addClasses(FirstEntity::class.java, SecondEntity::class.java, PanacheTestResource::class.java) - .addAsResource("application-test.properties", "application.properties") - } + var runner = + QuarkusUnitTest().setArchiveProducer { + ShrinkWrap.create(JavaArchive::class.java) + .addClasses( + FirstEntity::class.java, + SecondEntity::class.java, + PanacheTestResource::class.java, + ) + .addAsResource("application-test.properties", "application.properties") + } } } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitFileTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitFileTest.kt index 6cb8d033d3f41..90a39ecfa3ba8 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitFileTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitFileTest.kt @@ -14,14 +14,10 @@ import org.junit.jupiter.api.extension.RegisterExtension class DefaultPersistenceUnitFileTest { @Test fun panacheOperations() { - /** - * First entity operations - */ + /** First entity operations */ RestAssured.`when`()["/persistence-unit/first/name-1"].then().body(Matchers.`is`("name-1")) RestAssured.`when`()["/persistence-unit/first/name-2"].then().body(Matchers.`is`("name-2")) - /** - * second entity operations - */ + /** second entity operations */ RestAssured.`when`()["/persistence-unit/second/name-1"].then().body(Matchers.`is`("name-1")) RestAssured.`when`()["/persistence-unit/second/name-2"].then().body(Matchers.`is`("name-2")) } @@ -29,17 +25,25 @@ class DefaultPersistenceUnitFileTest { companion object { @RegisterExtension @JvmField - var runner = QuarkusUnitTest() - .setArchiveProducer { - ShrinkWrap.create(JavaArchive::class.java) - .addClasses(FirstEntity::class.java, SecondEntity::class.java, PanacheTestResource::class.java) - .addAsManifestResource("META-INF/some-persistence.xml", "persistence.xml") - .addAsResource(StringAsset( - """ + var runner = + QuarkusUnitTest().setArchiveProducer { + ShrinkWrap.create(JavaArchive::class.java) + .addClasses( + FirstEntity::class.java, + SecondEntity::class.java, + PanacheTestResource::class.java, + ) + .addAsManifestResource("META-INF/some-persistence.xml", "persistence.xml") + .addAsResource( + StringAsset( + """ quarkus.datasource.db-kind=h2 quarkus.datasource.jdbc.url=jdbc:h2:mem:default;DB_CLOSE_DELAY=-1 - """.trimIndent()), - "application.properties") - } + """ + .trimIndent() + ), + "application.properties", + ) + } } } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/ErroneousPersistenceUnitConfigTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/ErroneousPersistenceUnitConfigTest.kt index d227bbeb51a29..af1412af1e969 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/ErroneousPersistenceUnitConfigTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/ErroneousPersistenceUnitConfigTest.kt @@ -18,12 +18,20 @@ class ErroneousPersistenceUnitConfigTest { companion object { @RegisterExtension @JvmField - var runner = QuarkusUnitTest() + var runner = + QuarkusUnitTest() .setExpectedException(IllegalStateException::class.java) .setArchiveProducer { ShrinkWrap.create(JavaArchive::class.java) - .addClasses(FirstEntity::class.java, SecondEntity::class.java, PanacheTestResource::class.java) - .addAsResource("application-erroneous-multiple-persistence-units.properties", "application.properties") + .addClasses( + FirstEntity::class.java, + SecondEntity::class.java, + PanacheTestResource::class.java, + ) + .addAsResource( + "application-erroneous-multiple-persistence-units.properties", + "application.properties", + ) } } } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/MultiplePersistenceUnitConfigTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/MultiplePersistenceUnitConfigTest.kt index a0ab9389da80b..a3a990317c803 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/MultiplePersistenceUnitConfigTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/MultiplePersistenceUnitConfigTest.kt @@ -15,14 +15,10 @@ class MultiplePersistenceUnitConfigTest { @Test @Disabled("fix in a separate PR") fun panacheOperations() { - /** - * First entity operations - */ + /** First entity operations */ RestAssured.`when`()["/persistence-unit/first/name-1"].then().body(Matchers.`is`("name-1")) RestAssured.`when`()["/persistence-unit/first/name-2"].then().body(Matchers.`is`("name-2")) - /** - * second entity operations - */ + /** second entity operations */ RestAssured.`when`()["/persistence-unit/second/name-1"].then().body(Matchers.`is`("name-1")) RestAssured.`when`()["/persistence-unit/second/name-2"].then().body(Matchers.`is`("name-2")) } @@ -30,11 +26,18 @@ class MultiplePersistenceUnitConfigTest { companion object { @RegisterExtension @JvmField - var runner = QuarkusUnitTest() - .setArchiveProducer { - ShrinkWrap.create(JavaArchive::class.java) - .addClasses(FirstEntity::class.java, SecondEntity::class.java, PanacheTestResource::class.java) - .addAsResource("application-multiple-persistence-units.properties", "application.properties") - } + var runner = + QuarkusUnitTest().setArchiveProducer { + ShrinkWrap.create(JavaArchive::class.java) + .addClasses( + FirstEntity::class.java, + SecondEntity::class.java, + PanacheTestResource::class.java, + ) + .addAsResource( + "application-multiple-persistence-units.properties", + "application.properties", + ) + } } } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/second/SecondEntity.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/second/SecondEntity.kt index 615a70dbc1a38..62c08edcb0e1d 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/second/SecondEntity.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/second/SecondEntity.kt @@ -6,6 +6,7 @@ import jakarta.persistence.Entity @Entity class SecondEntity : PanacheEntity() { - companion object: PanacheCompanion + companion object : PanacheCompanion + var name: String? = null } diff --git a/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/MyEntity.kt b/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/MyEntity.kt index e22eb58a2b786..6de37e4b075a3 100644 --- a/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/MyEntity.kt +++ b/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/MyEntity.kt @@ -6,8 +6,7 @@ import jakarta.persistence.Entity @Entity class MyEntity : PanacheEntity() { - companion object: PanacheCompanion { - } + companion object : PanacheCompanion {} lateinit var name: String } diff --git a/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt b/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt index bf749e2304a50..370909bdf9bcf 100644 --- a/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt +++ b/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt @@ -4,7 +4,6 @@ import io.quarkus.arc.Arc import io.quarkus.hibernate.reactive.panache.kotlin.deployment.test.MyEntity import io.quarkus.test.QuarkusUnitTest import org.hibernate.reactive.mutiny.Mutiny -import org.hibernate.reactive.mutiny.impl.MutinySessionFactoryImpl import org.jboss.shrinkwrap.api.spec.JavaArchive import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test @@ -13,12 +12,14 @@ import org.junit.jupiter.api.extension.RegisterExtension class ConfigEnabledFalseTest { companion object { @RegisterExtension - val config = QuarkusUnitTest() - .withApplicationRoot { jar: JavaArchive -> jar.addClass(MyEntity::class.java) } - .withConfigurationResource("application.properties") - // We shouldn't get any build error caused by Panache consuming build items that are not produced - // See https://github.com/quarkusio/quarkus/issues/28842 - .overrideConfigKey("quarkus.hibernate-orm.enabled", "false") + val config = + QuarkusUnitTest() + .withApplicationRoot { jar: JavaArchive -> jar.addClass(MyEntity::class.java) } + .withConfigurationResource("application.properties") + // We shouldn't get any build error caused by Panache consuming build items that are + // not produced + // See https://github.com/quarkusio/quarkus/issues/28842 + .overrideConfigKey("quarkus.hibernate-orm.enabled", "false") } @Test @@ -27,4 +28,4 @@ class ConfigEnabledFalseTest { // Just check that Hibernate Reactive is disabled. Assertions.assertNull(Arc.container().instance(Mutiny.SessionFactory::class.java).get()) } -} \ No newline at end of file +} diff --git a/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/Book.kt b/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/Book.kt index 922b50930d8db..e5e1af55c8cdd 100644 --- a/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/Book.kt +++ b/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/Book.kt @@ -6,162 +6,152 @@ import io.quarkus.mongodb.panache.common.PanacheUpdate import io.quarkus.mongodb.panache.kotlin.PanacheMongoCompanion import io.quarkus.mongodb.panache.kotlin.PanacheMongoEntity import io.quarkus.mongodb.panache.kotlin.PanacheQuery - import io.quarkus.mongodb.panache.kotlin.runtime.KotlinMongoOperations.Companion.INSTANCE +import io.quarkus.mongodb.panache.kotlin.runtime.KotlinMongoOperations.Companion.INSTANCE import io.quarkus.panache.common.Parameters import io.quarkus.panache.common.Sort +import java.util.stream.Stream import org.bson.Document import org.bson.types.ObjectId -import java.util.stream.Stream /** - * This class is used by TestEnhancers to validate the bytecode generation. Each method on PanacheMongoCompanion is - * manually implemented to give us a compiler generated metric against which to validate the quarkus generated bytecode. - * TestEnhancers further validates that all @GenerateBridge annotated methods are represented by a 'target_' method - * here. + * This class is used by TestEnhancers to validate the bytecode generation. Each method on + * PanacheMongoCompanion is manually implemented to give us a compiler generated metric against + * which to validate the quarkus generated bytecode. TestEnhancers further validates that + * all @GenerateBridge annotated methods are represented by a 'target_' method here. */ @Suppress("UNCHECKED_CAST", "unused") class Book : PanacheMongoEntity() { companion object : PanacheMongoCompanion { - fun target_count(): Long - = INSTANCE.count(Book::class.java) - - fun target_count(query: Document): Long - = INSTANCE.count(Book::class.java, query) + fun target_count(): Long = INSTANCE.count(Book::class.java) - fun target_count(query: String, params: Map): Long - = INSTANCE.count(Book::class.java, query, params) + fun target_count(query: Document): Long = INSTANCE.count(Book::class.java, query) - fun target_count(query: String, params: Parameters): Long - = INSTANCE.count(Book::class.java, query, params) + fun target_count(query: String, params: Map): Long = + INSTANCE.count(Book::class.java, query, params) - fun target_count(query: String, vararg params: Any?): Long - = INSTANCE.count(Book::class.java, query, *params) + fun target_count(query: String, params: Parameters): Long = + INSTANCE.count(Book::class.java, query, params) - fun target_delete(query: Document): Long - = INSTANCE.delete(Book::class.java, query) + fun target_count(query: String, vararg params: Any?): Long = + INSTANCE.count(Book::class.java, query, *params) - fun target_delete(query: String, params: Map): Long - = INSTANCE.delete(Book::class.java, query, params) + fun target_delete(query: Document): Long = INSTANCE.delete(Book::class.java, query) - fun target_delete(query: String, params: Parameters): Long - = INSTANCE.delete(Book::class.java, query, params) + fun target_delete(query: String, params: Map): Long = + INSTANCE.delete(Book::class.java, query, params) - fun target_delete(query: String, vararg params: Any?): Long - = INSTANCE.delete(Book::class.java, query, *params) + fun target_delete(query: String, params: Parameters): Long = + INSTANCE.delete(Book::class.java, query, params) - fun target_deleteAll(): Long - = INSTANCE.deleteAll(Book::class.java) + fun target_delete(query: String, vararg params: Any?): Long = + INSTANCE.delete(Book::class.java, query, *params) - fun target_deleteById(id: ObjectId): Boolean - = INSTANCE.deleteById(Book::class.java, id) + fun target_deleteAll(): Long = INSTANCE.deleteAll(Book::class.java) - fun target_find(query: Document): PanacheQuery - = INSTANCE.find(Book::class.java, query) as PanacheQuery + fun target_deleteById(id: ObjectId): Boolean = INSTANCE.deleteById(Book::class.java, id) - fun target_find(query: Document, sort: Document): PanacheQuery - = INSTANCE.find(Book::class.java, query, sort) as PanacheQuery + fun target_find(query: Document): PanacheQuery = + INSTANCE.find(Book::class.java, query) as PanacheQuery - fun target_find(query: String, params: Map): PanacheQuery - = INSTANCE.find(Book::class.java, query, params) as PanacheQuery + fun target_find(query: Document, sort: Document): PanacheQuery = + INSTANCE.find(Book::class.java, query, sort) as PanacheQuery - fun target_find(query: String, params: Parameters): PanacheQuery - = INSTANCE.find(Book::class.java, query, params) as PanacheQuery + fun target_find(query: String, params: Map): PanacheQuery = + INSTANCE.find(Book::class.java, query, params) as PanacheQuery - fun target_find(query: String, sort: Sort, params: Map): PanacheQuery - = INSTANCE.find(Book::class.java, query, sort, params) as PanacheQuery + fun target_find(query: String, params: Parameters): PanacheQuery = + INSTANCE.find(Book::class.java, query, params) as PanacheQuery - fun target_find(query: String, sort: Sort, params: Parameters): PanacheQuery - = INSTANCE.find(Book::class.java, query, sort, params) as PanacheQuery + fun target_find(query: String, sort: Sort, params: Map): PanacheQuery = + INSTANCE.find(Book::class.java, query, sort, params) as PanacheQuery - fun target_find(query: String, sort: Sort, vararg params: Any?): PanacheQuery - = INSTANCE.find(Book::class.java, query, sort, *params) as PanacheQuery + fun target_find(query: String, sort: Sort, params: Parameters): PanacheQuery = + INSTANCE.find(Book::class.java, query, sort, params) as PanacheQuery - fun target_find(query: String, vararg params: Any?): PanacheQuery - = INSTANCE.find(Book::class.java, query, *params) as PanacheQuery + fun target_find(query: String, sort: Sort, vararg params: Any?): PanacheQuery = + INSTANCE.find(Book::class.java, query, sort, *params) as PanacheQuery - fun target_findAll(): PanacheQuery - = INSTANCE.findAll(Book::class.java) as PanacheQuery + fun target_find(query: String, vararg params: Any?): PanacheQuery = + INSTANCE.find(Book::class.java, query, *params) as PanacheQuery - fun target_findAll(sort: Sort): PanacheQuery - = INSTANCE.findAll(Book::class.java, sort) as PanacheQuery + fun target_findAll(): PanacheQuery = + INSTANCE.findAll(Book::class.java) as PanacheQuery - fun target_findById(id: ObjectId): Book? - = INSTANCE.findById(Book::class.java, id) as Book? + fun target_findAll(sort: Sort): PanacheQuery = + INSTANCE.findAll(Book::class.java, sort) as PanacheQuery - fun target_list(query: Document): List - = INSTANCE.list(Book::class.java, query) as List + fun target_findById(id: ObjectId): Book? = INSTANCE.findById(Book::class.java, id) as Book? - fun target_list(query: Document, sort: Document): List - = INSTANCE.list(Book::class.java, query, sort) as List + fun target_list(query: Document): List = + INSTANCE.list(Book::class.java, query) as List - fun target_list(query: String, params: Map): List - = INSTANCE.list(Book::class.java, query, params) as List + fun target_list(query: Document, sort: Document): List = + INSTANCE.list(Book::class.java, query, sort) as List - fun target_list(query: String, params: Parameters): List - = INSTANCE.list(Book::class.java, query, params) as List + fun target_list(query: String, params: Map): List = + INSTANCE.list(Book::class.java, query, params) as List - fun target_list(query: String, sort: Sort, params: Map): List - = INSTANCE.list(Book::class.java, query, sort, params) as List + fun target_list(query: String, params: Parameters): List = + INSTANCE.list(Book::class.java, query, params) as List - fun target_list(query: String, sort: Sort, params: Parameters): List - = INSTANCE.list(Book::class.java, query, sort, params) as List + fun target_list(query: String, sort: Sort, params: Map): List = + INSTANCE.list(Book::class.java, query, sort, params) as List - fun target_list(query: String, sort: Sort, vararg params: Any?): List - = INSTANCE.list(Book::class.java, query, sort, *params) as List + fun target_list(query: String, sort: Sort, params: Parameters): List = + INSTANCE.list(Book::class.java, query, sort, params) as List - fun target_list(query: String, vararg params: Any?): List - = INSTANCE.list(Book::class.java, query, *params) as List + fun target_list(query: String, sort: Sort, vararg params: Any?): List = + INSTANCE.list(Book::class.java, query, sort, *params) as List - fun target_listAll(): List - = INSTANCE.listAll(Book::class.java) as List + fun target_list(query: String, vararg params: Any?): List = + INSTANCE.list(Book::class.java, query, *params) as List - fun target_listAll(sort: Sort): List - = INSTANCE.listAll(Book::class.java, sort) as List + fun target_listAll(): List = INSTANCE.listAll(Book::class.java) as List - fun target_mongoCollection(): MongoCollection - = INSTANCE.mongoCollection(Book::class.java) as MongoCollection + fun target_listAll(sort: Sort): List = + INSTANCE.listAll(Book::class.java, sort) as List - fun target_mongoDatabase(): MongoDatabase - = INSTANCE.mongoDatabase(Book::class.java) + fun target_mongoCollection(): MongoCollection = + INSTANCE.mongoCollection(Book::class.java) as MongoCollection - fun target_stream(query: Document): Stream - = INSTANCE.stream(Book::class.java, query) as Stream + fun target_mongoDatabase(): MongoDatabase = INSTANCE.mongoDatabase(Book::class.java) - fun target_stream(query: Document, sort: Document): Stream - = INSTANCE.stream(Book::class.java, query, sort) as Stream + fun target_stream(query: Document): Stream = + INSTANCE.stream(Book::class.java, query) as Stream - fun target_stream(query: String, params: Map): Stream - = INSTANCE.stream(Book::class.java, query, params) as Stream + fun target_stream(query: Document, sort: Document): Stream = + INSTANCE.stream(Book::class.java, query, sort) as Stream - fun target_stream(query: String, params: Parameters): Stream - = INSTANCE.stream(Book::class.java, query, params) as Stream + fun target_stream(query: String, params: Map): Stream = + INSTANCE.stream(Book::class.java, query, params) as Stream - fun target_stream(query: String, sort: Sort, params: Map): Stream - = INSTANCE.stream(Book::class.java, query, sort, params) as Stream + fun target_stream(query: String, params: Parameters): Stream = + INSTANCE.stream(Book::class.java, query, params) as Stream - fun target_stream(query: String, sort: Sort, params: Parameters): Stream - = INSTANCE.stream(Book::class.java, query, sort, params) as Stream + fun target_stream(query: String, sort: Sort, params: Map): Stream = + INSTANCE.stream(Book::class.java, query, sort, params) as Stream - fun target_stream(query: String, sort: Sort, vararg params: Any?): Stream - = INSTANCE.stream(Book::class.java, query, sort, *params) as Stream + fun target_stream(query: String, sort: Sort, params: Parameters): Stream = + INSTANCE.stream(Book::class.java, query, sort, params) as Stream - fun target_stream(query: String, vararg params: Any?): Stream - = INSTANCE.stream(Book::class.java, query, *params) as Stream + fun target_stream(query: String, sort: Sort, vararg params: Any?): Stream = + INSTANCE.stream(Book::class.java, query, sort, *params) as Stream - fun target_streamAll(): Stream - = INSTANCE.streamAll(Book::class.java) as Stream + fun target_stream(query: String, vararg params: Any?): Stream = + INSTANCE.stream(Book::class.java, query, *params) as Stream - fun target_streamAll(sort: Sort): Stream - = INSTANCE.streamAll(Book::class.java, sort) as Stream + fun target_streamAll(): Stream = INSTANCE.streamAll(Book::class.java) as Stream - fun target_update(update: String, params: Map): PanacheUpdate - = INSTANCE.update(Book::class.java, update, params) + fun target_streamAll(sort: Sort): Stream = + INSTANCE.streamAll(Book::class.java, sort) as Stream - fun target_update(update: String, params: Parameters): PanacheUpdate - = INSTANCE.update(Book::class.java, update, params) + fun target_update(update: String, params: Map): PanacheUpdate = + INSTANCE.update(Book::class.java, update, params) - fun target_update(update: String, vararg params: Any?): PanacheUpdate - = INSTANCE.update(Book::class.java, update, *params) + fun target_update(update: String, params: Parameters): PanacheUpdate = + INSTANCE.update(Book::class.java, update, params) + fun target_update(update: String, vararg params: Any?): PanacheUpdate = + INSTANCE.update(Book::class.java, update, *params) } } diff --git a/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/StudentRepository.kt b/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/StudentRepository.kt index 868560dd488ce..02b0f21749eab 100644 --- a/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/StudentRepository.kt +++ b/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/StudentRepository.kt @@ -8,27 +8,27 @@ import io.quarkus.mongodb.panache.kotlin.PanacheQuery import io.quarkus.mongodb.panache.kotlin.runtime.KotlinMongoOperations.Companion.INSTANCE import io.quarkus.panache.common.Parameters import io.quarkus.panache.common.Sort -import org.bson.Document import java.util.stream.Stream +import org.bson.Document /** - * This class is used by TestEnhancers to validate the bytecode generation. Each method on PanacheMongoRepositoryBase - * is manually implemented to give us a compiler generated metric against which to validate the quarkus generated - * bytecode. TestEnhancers further validates that all @GenerateBridge annotated methods are represented by a 'target_' - * method here. + * This class is used by TestEnhancers to validate the bytecode generation. Each method on + * PanacheMongoRepositoryBase is manually implemented to give us a compiler generated metric against + * which to validate the quarkus generated bytecode. TestEnhancers further validates that + * all @GenerateBridge annotated methods are represented by a 'target_' method here. */ @Suppress("unused", "UNCHECKED_CAST") class StudentRepository : PanacheMongoRepositoryBase { fun target_count(): Long = INSTANCE.count(Student::class.java) fun target_count(query: String, vararg params: Any?): Long = - INSTANCE.count(Student::class.java, query, *params) + INSTANCE.count(Student::class.java, query, *params) fun target_count(query: String, params: Map): Long = - INSTANCE.count(Student::class.java, query, params) + INSTANCE.count(Student::class.java, query, params) fun target_count(query: String, params: Parameters): Long = - INSTANCE.count(Student::class.java, query, params) + INSTANCE.count(Student::class.java, query, params) fun target_count(query: Document): Long = INSTANCE.count(Student::class.java, query) @@ -37,120 +37,120 @@ class StudentRepository : PanacheMongoRepositoryBase { fun target_deleteById(id: Long): Boolean = INSTANCE.deleteById(Student::class.java, id) fun target_delete(query: String, vararg params: Any?): Long = - INSTANCE.delete(Student::class.java, query, *params) + INSTANCE.delete(Student::class.java, query, *params) fun target_delete(query: String, params: Map): Long = - INSTANCE.delete(Student::class.java, query, params) + INSTANCE.delete(Student::class.java, query, params) fun target_delete(query: String, params: Parameters): Long = - INSTANCE.delete(Student::class.java, query, params) + INSTANCE.delete(Student::class.java, query, params) fun target_delete(query: Document): Long = INSTANCE.delete(Student::class.java, query) - fun target_findById(id: Long): Student? = - INSTANCE.findById(Student::class.java, id) as Student? + fun target_findById(id: Long): Student? = INSTANCE.findById(Student::class.java, id) as Student? fun target_find(query: String, vararg params: Any?): PanacheQuery = - INSTANCE.find(Student::class.java, query, *params) as PanacheQuery + INSTANCE.find(Student::class.java, query, *params) as PanacheQuery fun target_find(query: String, sort: Sort, vararg params: Any?): PanacheQuery = - INSTANCE.find(Student::class.java, query, sort, *params) as PanacheQuery + INSTANCE.find(Student::class.java, query, sort, *params) as PanacheQuery fun target_find(query: String, params: Map): PanacheQuery = - INSTANCE.find(Student::class.java, query, params) as PanacheQuery + INSTANCE.find(Student::class.java, query, params) as PanacheQuery fun target_find(query: String, sort: Sort, params: Map): PanacheQuery = - INSTANCE.find(Student::class.java, query, sort, params) as PanacheQuery + INSTANCE.find(Student::class.java, query, sort, params) as PanacheQuery fun target_find(query: String, params: Parameters): PanacheQuery = - INSTANCE.find(Student::class.java, query, params) as PanacheQuery + INSTANCE.find(Student::class.java, query, params) as PanacheQuery fun target_find(query: String, sort: Sort, params: Parameters): PanacheQuery = - INSTANCE.find(Student::class.java, query, sort, params) as PanacheQuery + INSTANCE.find(Student::class.java, query, sort, params) as PanacheQuery fun target_find(query: Document): PanacheQuery = - INSTANCE.find(Student::class.java, query) as PanacheQuery + INSTANCE.find(Student::class.java, query) as PanacheQuery fun target_find(query: Document, sort: Document): PanacheQuery = - INSTANCE.find(Student::class.java, query, sort) as PanacheQuery + INSTANCE.find(Student::class.java, query, sort) as PanacheQuery fun target_findAll(): PanacheQuery = - INSTANCE.findAll(Student::class.java) as PanacheQuery + INSTANCE.findAll(Student::class.java) as PanacheQuery fun target_findAll(sort: Sort): PanacheQuery = - INSTANCE.findAll(Student::class.java, sort) as PanacheQuery + INSTANCE.findAll(Student::class.java, sort) as PanacheQuery fun target_list(query: String, vararg params: Any?): List = - INSTANCE.list(Student::class.java, query, *params) as List + INSTANCE.list(Student::class.java, query, *params) as List fun target_list(query: String, sort: Sort, vararg params: Any?): List = - INSTANCE.list(Student::class.java, query, sort, *params) as List + INSTANCE.list(Student::class.java, query, sort, *params) as List fun target_list(query: String, params: Map): List = - INSTANCE.list(Student::class.java, query, params) as List + INSTANCE.list(Student::class.java, query, params) as List fun target_list(query: String, sort: Sort, params: Map): List = - INSTANCE.list(Student::class.java, query, sort, params) as List + INSTANCE.list(Student::class.java, query, sort, params) as List fun target_list(query: String, params: Parameters): List = - INSTANCE.list(Student::class.java, query, params) as List + INSTANCE.list(Student::class.java, query, params) as List fun target_list(query: String, sort: Sort, params: Parameters): List = - INSTANCE.list(Student::class.java, query, sort, params) as List + INSTANCE.list(Student::class.java, query, sort, params) as List fun target_list(query: Document): List = - INSTANCE.list(Student::class.java, query) as List + INSTANCE.list(Student::class.java, query) as List fun target_list(query: Document, sort: Document): List = - INSTANCE.list(Student::class.java, query, sort) as List + INSTANCE.list(Student::class.java, query, sort) as List fun target_listAll(): List = INSTANCE.listAll(Student::class.java) as List fun target_listAll(sort: Sort): List = - INSTANCE.listAll(Student::class.java, sort) as List + INSTANCE.listAll(Student::class.java, sort) as List fun target_mongoCollection(): MongoCollection = - INSTANCE.mongoCollection(Student::class.java) as MongoCollection + INSTANCE.mongoCollection(Student::class.java) as MongoCollection fun target_mongoDatabase(): MongoDatabase = INSTANCE.mongoDatabase(Student::class.java) fun target_stream(query: String, vararg params: Any?): Stream = - INSTANCE.stream(Student::class.java, query, *params) as Stream + INSTANCE.stream(Student::class.java, query, *params) as Stream fun target_stream(query: String, sort: Sort, vararg params: Any?): Stream = - INSTANCE.stream(Student::class.java, query, sort, *params) as Stream + INSTANCE.stream(Student::class.java, query, sort, *params) as Stream fun target_stream(query: String, params: Map): Stream = - INSTANCE.stream(Student::class.java, query, params) as Stream + INSTANCE.stream(Student::class.java, query, params) as Stream fun target_stream(query: String, sort: Sort, params: Map): Stream = - INSTANCE.stream(Student::class.java, query, sort, params) as Stream + INSTANCE.stream(Student::class.java, query, sort, params) as Stream fun target_stream(query: String, params: Parameters): Stream = - INSTANCE.stream(Student::class.java, query, params) as Stream + INSTANCE.stream(Student::class.java, query, params) as Stream fun target_stream(query: String, sort: Sort, params: Parameters): Stream = - INSTANCE.stream(Student::class.java, query, sort, params) as Stream + INSTANCE.stream(Student::class.java, query, sort, params) as Stream fun target_stream(query: Document): Stream = - INSTANCE.stream(Student::class.java, query) as Stream + INSTANCE.stream(Student::class.java, query) as Stream fun target_stream(query: Document, sort: Document): Stream = - INSTANCE.stream(Student::class.java, query, sort) as Stream + INSTANCE.stream(Student::class.java, query, sort) as Stream fun target_streamAll(sort: Sort): Stream = - INSTANCE.streamAll(Student::class.java, sort) as Stream + INSTANCE.streamAll(Student::class.java, sort) as Stream fun target_streamAll(): Stream = - INSTANCE.streamAll(Student::class.java) as Stream + INSTANCE.streamAll(Student::class.java) as Stream fun target_update(update: String, vararg params: Any?): PanacheUpdate = - INSTANCE.update(Student::class.java, update, *params) + INSTANCE.update(Student::class.java, update, *params) fun target_update(update: String, params: Map): PanacheUpdate = - INSTANCE.update(Student::class.java, update, params) + INSTANCE.update(Student::class.java, update, params) fun target_update(update: String, params: Parameters): PanacheUpdate = - INSTANCE.update(Student::class.java, update, params) + INSTANCE.update(Student::class.java, update, params) } + class Student diff --git a/extensions/redis-client/runtime/src/test/java/io/quarkus/redis/datasource/BitMapCommandsTest.java b/extensions/redis-client/runtime/src/test/java/io/quarkus/redis/datasource/BitMapCommandsTest.java index f67048b51a2ca..2b09336c38ade 100644 --- a/extensions/redis-client/runtime/src/test/java/io/quarkus/redis/datasource/BitMapCommandsTest.java +++ b/extensions/redis-client/runtime/src/test/java/io/quarkus/redis/datasource/BitMapCommandsTest.java @@ -1,10 +1,10 @@ package io.quarkus.redis.datasource; +import static io.quarkus.redis.datasource.bitmap.BitFieldArgs.OverflowType.WRAP; import static io.quarkus.redis.datasource.bitmap.BitFieldArgs.offset; import static io.quarkus.redis.datasource.bitmap.BitFieldArgs.signed; import static io.quarkus.redis.datasource.bitmap.BitFieldArgs.typeWidthBasedOffset; import static io.quarkus.redis.datasource.bitmap.BitFieldArgs.unsigned; -import static io.quarkus.redis.datasource.bitmap.BitFieldArgs.OverflowType.WRAP; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; diff --git a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/EncodeDefaultValuesTest.kt b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/EncodeDefaultValuesTest.kt index bdb50b859821d..bcc6bba6040ea 100644 --- a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/EncodeDefaultValuesTest.kt +++ b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/EncodeDefaultValuesTest.kt @@ -1,33 +1,30 @@ package io.quarkus.rest.client.reactive.kotlin.test import io.quarkus.test.QuarkusUnitTest +import jakarta.inject.Inject import kotlinx.serialization.Serializable import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension -import jakarta.inject.Inject class EncodeDefaultValuesTest { companion object { @RegisterExtension - val config = QuarkusUnitTest() - .withConfigurationResource("encode-default-values.properties") + val config = QuarkusUnitTest().withConfigurationResource("encode-default-values.properties") } - @Inject - lateinit var json: Json + @Inject lateinit var json: Json @Test fun testNoDefaults() { - assertThat(json.encodeToString(TestObject())) - .isEqualTo("{}") + assertThat(json.encodeToString(TestObject())).isEqualTo("{}") } + @Test fun testExplicitNulls() { - assertThat(json.encodeToString(TestObject(blank = null))) - .isEqualTo("{\"blank\":null}") + assertThat(json.encodeToString(TestObject(blank = null))).isEqualTo("{\"blank\":null}") } @Serializable diff --git a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/ExplicitNullsTest.kt b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/ExplicitNullsTest.kt index 0c816f080622f..052e802741845 100644 --- a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/ExplicitNullsTest.kt +++ b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/ExplicitNullsTest.kt @@ -1,30 +1,26 @@ package io.quarkus.rest.client.reactive.kotlin.test import io.quarkus.test.QuarkusUnitTest +import jakarta.inject.Inject import kotlinx.serialization.Serializable import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension -import jakarta.inject.Inject class ExplicitNullsTest { companion object { @RegisterExtension - val config = QuarkusUnitTest() - .withConfigurationResource("explicit-nulls.properties") + val config = QuarkusUnitTest().withConfigurationResource("explicit-nulls.properties") } - @Inject - lateinit var json: Json + @Inject lateinit var json: Json @Test fun testExplicitNulls() { - assertThat(json.encodeToString(TestObject(blank = null))) - .isEqualTo("{}") + assertThat(json.encodeToString(TestObject(blank = null))).isEqualTo("{}") } - @Serializable - private class TestObject(var blank: String? = "") + @Serializable private class TestObject(var blank: String? = "") } diff --git a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/LenientTest.kt b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/LenientTest.kt index 91213df829fd1..4bd3c999471b8 100644 --- a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/LenientTest.kt +++ b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/LenientTest.kt @@ -1,24 +1,21 @@ package io.quarkus.rest.client.reactive.kotlin.test import io.quarkus.test.QuarkusUnitTest +import jakarta.inject.Inject import kotlinx.serialization.Serializable import kotlinx.serialization.decodeFromString -import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension -import jakarta.inject.Inject class LenientTest { companion object { @RegisterExtension - val config = QuarkusUnitTest() - .withConfigurationResource("lenient.properties") + val config = QuarkusUnitTest().withConfigurationResource("lenient.properties") } - @Inject - lateinit var json: Json + @Inject lateinit var json: Json @Test fun testLenient() { @@ -26,6 +23,5 @@ class LenientTest { .isEqualTo(TestObject("json")) } - @Serializable - private data class TestObject(var name: String) + @Serializable private data class TestObject(var name: String) } diff --git a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/PrettyPrintTest.kt b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/PrettyPrintTest.kt index 45234612beb90..5dc8eb975debf 100644 --- a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/PrettyPrintTest.kt +++ b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/PrettyPrintTest.kt @@ -1,7 +1,7 @@ - package io.quarkus.rest.client.reactive.kotlin.test import io.quarkus.test.QuarkusUnitTest +import jakarta.inject.Inject import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.Serializable import kotlinx.serialization.encodeToString @@ -10,28 +10,27 @@ import kotlinx.serialization.json.JsonNames import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension -import jakarta.inject.Inject @OptIn(ExperimentalSerializationApi::class) class PrettyPrintTest { companion object { @RegisterExtension - val config = QuarkusUnitTest() - .withConfigurationResource("pretty-print.properties") + val config = QuarkusUnitTest().withConfigurationResource("pretty-print.properties") } - @Inject - lateinit var json: Json + @Inject lateinit var json: Json @Test fun testAlternateNames() { assertThat(json.encodeToString(TestObject("John Doe"))) - .isEqualTo(""" + .isEqualTo( + """ { "name": "John Doe" - }""".trimIndent()) + }""" + .trimIndent() + ) } - @Serializable - private data class TestObject(@JsonNames("label") var name: String) + @Serializable private data class TestObject(@JsonNames("label") var name: String) } diff --git a/extensions/resteasy-reactive/rest-jsonb/deployment/src/test/java/io/quarkus/resteasy/reactive/jsonb/deployment/test/sse/SseResource.java b/extensions/resteasy-reactive/rest-jsonb/deployment/src/test/java/io/quarkus/resteasy/reactive/jsonb/deployment/test/sse/SseResource.java index cb61f52aca63d..6d9901edad1e2 100644 --- a/extensions/resteasy-reactive/rest-jsonb/deployment/src/test/java/io/quarkus/resteasy/reactive/jsonb/deployment/test/sse/SseResource.java +++ b/extensions/resteasy-reactive/rest-jsonb/deployment/src/test/java/io/quarkus/resteasy/reactive/jsonb/deployment/test/sse/SseResource.java @@ -10,7 +10,6 @@ import jakarta.ws.rs.sse.SseBroadcaster; import jakarta.ws.rs.sse.SseEventSink; -// Using `@RestStreamElementType` on purpose to ensure the backward compatibility. import org.jboss.resteasy.reactive.RestSseElementType; import org.jboss.resteasy.reactive.common.util.RestMediaType; diff --git a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/BasicTest.kt b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/BasicTest.kt index 3da9f4d62f527..33af17e3ff633 100644 --- a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/BasicTest.kt +++ b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/BasicTest.kt @@ -2,39 +2,52 @@ package io.quarkus.resteasy.reactive.kotlin.serialization.common import io.quarkus.arc.Arc import io.quarkus.test.QuarkusUnitTest +import kotlin.reflect.full.createType import kotlinx.serialization.json.Json import kotlinx.serialization.serializer import org.jboss.shrinkwrap.api.spec.JavaArchive import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension -import kotlin.reflect.full.createType class BasicTest { companion object { @RegisterExtension - val config = QuarkusUnitTest() - .withApplicationRoot { jar: JavaArchive -> jar.addClass(Greeting::class.java) } - .withConfigurationResource("basic.properties") + val config = + QuarkusUnitTest() + .withApplicationRoot { jar: JavaArchive -> jar.addClass(Greeting::class.java) } + .withConfigurationResource("basic.properties") } @Test fun testSerialization() { // Aside from the CDI integration, this tests that the configured pretty-print is used Assertions.assertEquals( -"""{ + """{ "name": "foo", "message": "hello" }""", - Arc.container().instance(Json::class.java).get().encodeToString(serializer(), Greeting("foo", "hello"))) + Arc.container() + .instance(Json::class.java) + .get() + .encodeToString(serializer(), Greeting("foo", "hello")), + ) } @Test fun testDeserialization() { - // Aside from the CDI integration, this tests that the configured ignore-unknown-keys is used - Assertions.assertEquals(Greeting("foo", "hello"), - Arc.container().instance(Json::class.java).get().decodeFromString(serializer(Greeting::class.createType()), """{"name" : "foo", "message" : "hello", "test": "dummy"}""")) + // Aside from the CDI integration, this tests that the configured ignore-unknown-keys is + // used + Assertions.assertEquals( + Greeting("foo", "hello"), + Arc.container() + .instance(Json::class.java) + .get() + .decodeFromString( + serializer(Greeting::class.createType()), + """{"name" : "foo", "message" : "hello", "test": "dummy"}""", + ), + ) } - } diff --git a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/CustomBeanTest.kt b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/CustomBeanTest.kt index 708e02079679c..ab2a1dc3dd324 100644 --- a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/CustomBeanTest.kt +++ b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/CustomBeanTest.kt @@ -1,7 +1,9 @@ package io.quarkus.resteasy.reactive.kotlin.serialization.common -import io.quarkus.arc.Arc import io.quarkus.test.QuarkusUnitTest +import jakarta.enterprise.inject.Produces +import jakarta.inject.Inject +import jakarta.inject.Singleton import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.Json import kotlinx.serialization.serializer @@ -9,30 +11,28 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension -import jakarta.enterprise.inject.Produces -import jakarta.inject.Inject -import jakarta.inject.Singleton -import kotlin.reflect.full.createType class CustomBeanTest { companion object { @RegisterExtension - val config = QuarkusUnitTest() - .withApplicationRoot { jar: JavaArchive -> jar.addClasses(Greeting::class.java, CustomJsonProducer::class.java) } + val config = + QuarkusUnitTest().withApplicationRoot { jar: JavaArchive -> + jar.addClasses(Greeting::class.java, CustomJsonProducer::class.java) + } } - @Inject - lateinit var json: Json + @Inject lateinit var json: Json @Test fun test() { Assertions.assertEquals( -"""{ + """{ "name": "foo", "message": "hello" }""", - json.encodeToString(serializer(), Greeting("foo", "hello"))) + json.encodeToString(serializer(), Greeting("foo", "hello")), + ) } @Singleton diff --git a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/Greeting.kt b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/Greeting.kt index 0f4bb1df7e3fb..3ea19ffe715c7 100644 --- a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/Greeting.kt +++ b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/Greeting.kt @@ -2,5 +2,4 @@ package io.quarkus.resteasy.reactive.kotlin.serialization.common import kotlinx.serialization.Serializable -@Serializable -data class Greeting(val name: String, val message: String) +@Serializable data class Greeting(val name: String, val message: String) diff --git a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/JsonBuilderCustomizerTest.kt b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/JsonBuilderCustomizerTest.kt index a80d9930cdc1d..a88b02570fd37 100644 --- a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/JsonBuilderCustomizerTest.kt +++ b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/JsonBuilderCustomizerTest.kt @@ -2,6 +2,10 @@ package io.quarkus.resteasy.reactive.kotlin.serialization.common import io.quarkus.arc.Arc import io.quarkus.test.QuarkusUnitTest +import jakarta.annotation.Priority +import jakarta.inject.Inject +import jakarta.inject.Singleton +import kotlin.reflect.full.createType import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonBuilder @@ -10,40 +14,56 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension -import jakarta.annotation.Priority -import jakarta.inject.Inject -import jakarta.inject.Singleton -import kotlin.reflect.full.createType class JsonBuilderCustomizerTest { companion object { @RegisterExtension - val config = QuarkusUnitTest() - .withApplicationRoot { jar: JavaArchive -> jar.addClasses(Greeting::class.java, HighPriorityCustomizer::class.java, LowPriorityCustomizer::class.java) } - .withConfigurationResource("basic.properties") + val config = + QuarkusUnitTest() + .withApplicationRoot { jar: JavaArchive -> + jar.addClasses( + Greeting::class.java, + HighPriorityCustomizer::class.java, + LowPriorityCustomizer::class.java, + ) + } + .withConfigurationResource("basic.properties") } - @Inject - lateinit var json: Json + @Inject lateinit var json: Json @Test fun testSerialization() { - // prettyPrint should be set to false, because HighPriorityCustomizer overrides the value set in config - Assertions.assertEquals("""{"name":"foo","message":"hello"}""", - Arc.container().instance(Json::class.java).get().encodeToString(serializer(), Greeting("foo", "hello"))) + // prettyPrint should be set to false, because HighPriorityCustomizer overrides the value + // set in config + Assertions.assertEquals( + """{"name":"foo","message":"hello"}""", + Arc.container() + .instance(Json::class.java) + .get() + .encodeToString(serializer(), Greeting("foo", "hello")), + ) } @Test fun testDeserialization() { - // isLenient should be set to true, because LowPriorityCustomizer overrides the value set in HighPriorityCustomizer - Assertions.assertEquals(Greeting("foo", "hello"), - json.decodeFromString(serializer(Greeting::class.createType()), """{name : "foo", "message" : "hello", "test": "dummy"}""")) + // isLenient should be set to true, because LowPriorityCustomizer overrides the value set in + // HighPriorityCustomizer + Assertions.assertEquals( + Greeting("foo", "hello"), + json.decodeFromString( + serializer(Greeting::class.createType()), + """{name : "foo", "message" : "hello", "test": "dummy"}""", + ), + ) } @Singleton - @Priority(JsonBuilderCustomizer.DEFAULT_PRIORITY + 100) // this impl will be called before HighPriorityCustomizer - class HighPriorityCustomizer : JsonBuilderCustomizer{ + @Priority( + JsonBuilderCustomizer.DEFAULT_PRIORITY + 100 + ) // this impl will be called before HighPriorityCustomizer + class HighPriorityCustomizer : JsonBuilderCustomizer { @ExperimentalSerializationApi override fun customize(jsonBuilder: JsonBuilder) { @@ -53,8 +73,10 @@ class JsonBuilderCustomizerTest { } @Singleton - @Priority(JsonBuilderCustomizer.DEFAULT_PRIORITY + 10) // this impl will be called after HighPriorityCustomizer - class LowPriorityCustomizer : JsonBuilderCustomizer{ + @Priority( + JsonBuilderCustomizer.DEFAULT_PRIORITY + 10 + ) // this impl will be called after HighPriorityCustomizer + class LowPriorityCustomizer : JsonBuilderCustomizer { @ExperimentalSerializationApi override fun customize(jsonBuilder: JsonBuilder) { diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/proxy/fakedns/DnsMessageEncoder.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/proxy/fakedns/DnsMessageEncoder.java index 371f5a7dc3bd0..238202ceb3a8d 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/proxy/fakedns/DnsMessageEncoder.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/proxy/fakedns/DnsMessageEncoder.java @@ -7,25 +7,6 @@ import java.util.List; import java.util.Map; -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ import org.apache.directory.server.dns.io.encoder.*; import org.apache.directory.server.dns.messages.DnsMessage; import org.apache.directory.server.dns.messages.MessageType; diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEcho.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEcho.kt index 587145700bcb4..2d8dbda9feefc 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEcho.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEcho.kt @@ -4,7 +4,6 @@ import io.quarkus.websockets.next.OnBinaryMessage import io.quarkus.websockets.next.OnClose import io.quarkus.websockets.next.WebSocket import io.vertx.core.buffer.Buffer -import kotlinx.coroutines.delay @WebSocket(path = "/binary-echo") class BinaryEcho { @@ -13,7 +12,5 @@ class BinaryEcho { return msg } - @OnClose - fun close() { - } + @OnClose fun close() {} } diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEchoUni.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEchoUni.kt index 8fa01ae1e8c6d..f03f912b595ca 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEchoUni.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEchoUni.kt @@ -5,7 +5,6 @@ import io.quarkus.websockets.next.OnClose import io.quarkus.websockets.next.WebSocket import io.smallrye.mutiny.Uni import io.vertx.core.buffer.Buffer -import kotlinx.coroutines.delay @WebSocket(path = "/binary-echo-uni") class BinaryEchoUni { @@ -14,7 +13,6 @@ class BinaryEchoUni { return Uni.createFrom().item(msg) } - @OnClose fun close(): Uni { return Uni.createFrom().voidItem() diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/Echo.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/Echo.kt index 330b9fe94e093..97e194fcf54c6 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/Echo.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/Echo.kt @@ -11,7 +11,5 @@ class Echo { return msg } - @OnClose - fun close() { - } + @OnClose fun close() {} } diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketClientTest.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketClientTest.kt index 9ec2cd00baf2c..113810ba1cbd4 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketClientTest.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketClientTest.kt @@ -9,29 +9,27 @@ import io.quarkus.websockets.next.WebSocket import io.quarkus.websockets.next.WebSocketClient import io.quarkus.websockets.next.WebSocketConnector import jakarta.inject.Inject -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Assertions.assertTrue -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.RegisterExtension import java.net.URI import java.util.concurrent.CopyOnWriteArrayList import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertTrue +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.RegisterExtension class KotlinWebSocketClientTest { companion object { @RegisterExtension - val test = QuarkusUnitTest() - .withApplicationRoot { jar -> + val test = + QuarkusUnitTest().withApplicationRoot { jar -> jar.addClasses(ServerEndpoint::class.java, ClientEndpoint::class.java) } } - @Inject - lateinit var connector: WebSocketConnector + @Inject lateinit var connector: WebSocketConnector - @TestHTTPResource("/") - lateinit var uri: URI + @TestHTTPResource("/") lateinit var uri: URI @Test fun test() { diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSessionContextTest.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSessionContextTest.kt index 4fd8f29d1b03a..11d458c7d2050 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSessionContextTest.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSessionContextTest.kt @@ -8,29 +8,27 @@ import io.quarkus.websockets.next.test.utils.WSClient import io.vertx.core.Vertx import jakarta.enterprise.context.SessionScoped import jakarta.inject.Inject +import java.net.URI +import java.util.UUID import kotlinx.coroutines.delay import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Assertions.assertNotNull import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension -import java.net.URI -import java.util.UUID class KotlinWebSocketSessionContextTest { companion object { @RegisterExtension - val test = QuarkusUnitTest() - .withApplicationRoot { jar -> + val test = + QuarkusUnitTest().withApplicationRoot { jar -> jar.addClasses(MyData::class.java, Endpoint::class.java, WSClient::class.java) } } - @Inject - lateinit var vertx: Vertx + @Inject lateinit var vertx: Vertx - @TestHTTPResource("endpoint") - lateinit var endpoint: URI + @TestHTTPResource("endpoint") lateinit var endpoint: URI @Test fun testEcho() { @@ -71,8 +69,7 @@ class KotlinWebSocketSessionContextTest { @WebSocket(path = "/endpoint") class Endpoint { - @Inject - lateinit var data: MyData + @Inject lateinit var data: MyData @OnTextMessage suspend fun echo(message: String): String { diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSuspendingClientTest.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSuspendingClientTest.kt index 9c4a8fdc9051a..704eb361fb20f 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSuspendingClientTest.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSuspendingClientTest.kt @@ -9,30 +9,28 @@ import io.quarkus.websockets.next.WebSocket import io.quarkus.websockets.next.WebSocketClient import io.quarkus.websockets.next.WebSocketConnector import jakarta.inject.Inject +import java.net.URI +import java.util.concurrent.CopyOnWriteArrayList +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit import kotlinx.coroutines.delay import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension -import java.net.URI -import java.util.concurrent.CopyOnWriteArrayList -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit class KotlinWebSocketSuspendingClientTest { companion object { @RegisterExtension - val test = QuarkusUnitTest() - .withApplicationRoot { jar -> + val test = + QuarkusUnitTest().withApplicationRoot { jar -> jar.addClasses(ServerEndpoint::class.java, ClientEndpoint::class.java) } } - @Inject - lateinit var connector: WebSocketConnector + @Inject lateinit var connector: WebSocketConnector - @TestHTTPResource("/") - lateinit var uri: URI + @TestHTTPResource("/") lateinit var uri: URI @Test fun test() { diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketTest.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketTest.kt index d29dbcf931073..d621f8613bfe0 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketTest.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketTest.kt @@ -7,42 +7,42 @@ import io.vertx.core.Vertx import io.vertx.core.buffer.Buffer import io.vertx.core.json.JsonObject import jakarta.inject.Inject +import java.net.URI import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension -import java.net.URI class KotlinWebSocketTest { companion object { @RegisterExtension - val test = QuarkusUnitTest() - .withApplicationRoot { jar -> - jar.addClasses(Echo::class.java, EchoSuspend::class.java, EchoUni::class.java, - BinaryEcho::class.java, BinaryEchoSuspend::class.java, BinaryEchoUni::class.java, - Message::class.java, WSClient::class.java) + val test = + QuarkusUnitTest().withApplicationRoot { jar -> + jar.addClasses( + Echo::class.java, + EchoSuspend::class.java, + EchoUni::class.java, + BinaryEcho::class.java, + BinaryEchoSuspend::class.java, + BinaryEchoUni::class.java, + Message::class.java, + WSClient::class.java, + ) } } - @Inject - lateinit var vertx: Vertx + @Inject lateinit var vertx: Vertx - @TestHTTPResource("echo") - lateinit var echo: URI + @TestHTTPResource("echo") lateinit var echo: URI - @TestHTTPResource("echo-suspend") - lateinit var echoSuspend: URI + @TestHTTPResource("echo-suspend") lateinit var echoSuspend: URI - @TestHTTPResource("echo-uni") - lateinit var echoUni: URI + @TestHTTPResource("echo-uni") lateinit var echoUni: URI - @TestHTTPResource("binary-echo") - lateinit var binaryEcho: URI + @TestHTTPResource("binary-echo") lateinit var binaryEcho: URI - @TestHTTPResource("binary-echo-suspend") - lateinit var binaryEchoSuspend: URI + @TestHTTPResource("binary-echo-suspend") lateinit var binaryEchoSuspend: URI - @TestHTTPResource("binary-echo-uni") - lateinit var binaryEchoUni: URI + @TestHTTPResource("binary-echo-uni") lateinit var binaryEchoUni: URI @Test fun testEcho() { From 97a2fc1b206e9011b57bc6a294d3a752a9fb0eb2 Mon Sep 17 00:00:00 2001 From: Vincent Potucek Date: Fri, 30 May 2025 12:29:27 +0200 Subject: [PATCH 3/6] PoC: integrate Eclipse Formatter Profile into Maven Spotless Plugin - apply --- independent-projects/arc/pom.xml | 4 ++-- independent-projects/bootstrap/pom.xml | 4 ++-- independent-projects/enforcer-rules/pom.xml | 4 ++-- independent-projects/extension-maven-plugin/pom.xml | 4 ++-- independent-projects/junit5-virtual-threads/pom.xml | 4 ++-- independent-projects/qute/pom.xml | 4 ++-- independent-projects/resteasy-reactive/pom.xml | 4 ++-- independent-projects/tools/pom.xml | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/independent-projects/arc/pom.xml b/independent-projects/arc/pom.xml index 42f59682b37cf..5f4438b01dd20 100644 --- a/independent-projects/arc/pom.xml +++ b/independent-projects/arc/pom.xml @@ -357,9 +357,9 @@ spotless-maven-plugin - process-sources + verify - validate + check diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml index 3a3d5d2cced99..66f78c5c1dada 100644 --- a/independent-projects/bootstrap/pom.xml +++ b/independent-projects/bootstrap/pom.xml @@ -269,9 +269,9 @@ spotless-maven-plugin - process-sources + verify - validate + check diff --git a/independent-projects/enforcer-rules/pom.xml b/independent-projects/enforcer-rules/pom.xml index a09534987bfde..75d63e6a5bc57 100644 --- a/independent-projects/enforcer-rules/pom.xml +++ b/independent-projects/enforcer-rules/pom.xml @@ -203,9 +203,9 @@ spotless-maven-plugin - process-sources + verify - validate + check diff --git a/independent-projects/extension-maven-plugin/pom.xml b/independent-projects/extension-maven-plugin/pom.xml index ae003d2553f81..77a1372bf1f75 100644 --- a/independent-projects/extension-maven-plugin/pom.xml +++ b/independent-projects/extension-maven-plugin/pom.xml @@ -485,9 +485,9 @@ spotless-maven-plugin - process-sources + verify - validate + check diff --git a/independent-projects/junit5-virtual-threads/pom.xml b/independent-projects/junit5-virtual-threads/pom.xml index c8f16b49fa985..10986a42a2633 100644 --- a/independent-projects/junit5-virtual-threads/pom.xml +++ b/independent-projects/junit5-virtual-threads/pom.xml @@ -248,9 +248,9 @@ spotless-maven-plugin - process-sources + verify - validate + check diff --git a/independent-projects/qute/pom.xml b/independent-projects/qute/pom.xml index f8e6e0e750dce..2fc86393f341b 100644 --- a/independent-projects/qute/pom.xml +++ b/independent-projects/qute/pom.xml @@ -260,9 +260,9 @@ spotless-maven-plugin - process-sources + verify - validate + check diff --git a/independent-projects/resteasy-reactive/pom.xml b/independent-projects/resteasy-reactive/pom.xml index 45acda93b8b8e..e5e992fbfc189 100644 --- a/independent-projects/resteasy-reactive/pom.xml +++ b/independent-projects/resteasy-reactive/pom.xml @@ -615,9 +615,9 @@ spotless-maven-plugin - process-sources + verify - validate + check diff --git a/independent-projects/tools/pom.xml b/independent-projects/tools/pom.xml index 68c10063e3edb..843794d4d043f 100644 --- a/independent-projects/tools/pom.xml +++ b/independent-projects/tools/pom.xml @@ -336,9 +336,9 @@ spotless-maven-plugin - process-sources + verify - validate + check From f561c9a230bc98165af0979f6f8488bb4f855449 Mon Sep 17 00:00:00 2001 From: Vincent Potucek Date: Sat, 31 May 2025 22:16:45 +0200 Subject: [PATCH 4/6] MissingOverrideAnnotation --- .github/dependabot.yml | 3 +- CONTRIBUTING.md | 4 + build-parent/pom.xml | 132 +++++++----- .../mssql/deployment/MsSQLReflections.java | 4 + .../spi/KubernetesEnvBuildItemTest.java | 2 +- .../deployment/test/DuplicateIdEntity.kt | 3 +- .../deployment/test/DuplicateIdEntityTest.kt | 12 +- .../kotlin/deployment/test/MyEntity.kt | 3 +- .../kotlin/deployment/test/NoConfigTest.kt | 3 +- .../test/config/ConfigEnabledFalseTest.kt | 18 +- .../DefaultPersistenceUnitConfigTest.kt | 24 +-- .../DefaultPersistenceUnitFileTest.kt | 36 ++-- .../ErroneousPersistenceUnitConfigTest.kt | 14 +- .../MultiplePersistenceUnitConfigTest.kt | 27 ++- .../test/multiple_pu/second/SecondEntity.kt | 3 +- .../kotlin/deployment/test/MyEntity.kt | 3 +- .../test/config/ConfigEnabledFalseTest.kt | 17 +- .../mongodb/panache/kotlin/deployment/Book.kt | 192 +++++++++--------- .../kotlin/deployment/StudentRepository.kt | 92 ++++----- .../redis/datasource/BitMapCommandsTest.java | 2 +- .../kotlin/test/EncodeDefaultValuesTest.kt | 15 +- .../reactive/kotlin/test/ExplicitNullsTest.kt | 14 +- .../reactive/kotlin/test/LenientTest.kt | 12 +- .../reactive/kotlin/test/PrettyPrintTest.kt | 19 +- .../deployment/test/sse/SseResource.java | 1 + .../kotlin/serialization/common/BasicTest.kt | 33 +-- .../serialization/common/CustomBeanTest.kt | 22 +- .../kotlin/serialization/common/Greeting.kt | 3 +- .../common/JsonBuilderCustomizerTest.kt | 60 ++---- .../http/proxy/fakedns/DnsMessageEncoder.java | 19 ++ extensions/websockets-next/deployment/pom.xml | 3 +- .../websockets/next/test/kotlin/BinaryEcho.kt | 5 +- .../next/test/kotlin/BinaryEchoUni.kt | 2 + .../websockets/next/test/kotlin/Echo.kt | 4 +- .../test/kotlin/KotlinWebSocketClientTest.kt | 18 +- .../KotlinWebSocketSessionContextTest.kt | 17 +- .../KotlinWebSocketSuspendingClientTest.kt | 18 +- .../next/test/kotlin/KotlinWebSocketTest.kt | 40 ++-- independent-projects/arc/pom.xml | 45 +++- independent-projects/bootstrap/pom.xml | 45 +++- independent-projects/enforcer-rules/pom.xml | 45 +++- .../extension-maven-plugin/pom.xml | 45 +++- .../capabilities/CapabilitiesConfig.java | 40 ++-- .../junit5-virtual-threads/pom.xml | 45 +++- independent-projects/parent/pom.xml | 13 ++ independent-projects/qute/pom.xml | 45 +++- .../resteasy-reactive/pom.xml | 50 ++++- independent-projects/tools/pom.xml | 45 +++- integration-tests/virtual-threads/pom.xml | 15 ++ pom.xml | 2 +- 50 files changed, 824 insertions(+), 510 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c7dbed8cd9118..289ea8ced7c37 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -85,7 +85,8 @@ updates: - dependency-name: org.apache.maven.plugins:* - dependency-name: org.codehaus.mojo:* - dependency-name: io.fabric8:docker-maven-plugin - - dependency-name: com.diffplug.spotless:spotless-maven-plugin + - dependency-name: net.revelc.code.formatter:formatter-maven-plugin + - dependency-name: net.revelc.code:impsort-maven-plugin # Narayana - dependency-name: org.jboss.narayana.jta:* - dependency-name: org.jboss.narayana.jts:* diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 033d384adb058..6f1d967ec7aec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -406,6 +406,10 @@ in `quarkus-parent` (root `pom.xml`). When contributing to Quarkus, it is recommended to respect the following rules. +> **Note:** The `impsort-maven-plugin` uses the `.cache` directory on each module to speed up the build. +> Because we have configured the plugin to store in a versioned directory, you may notice over time that the `.cache` directory grows in size. You can safely delete the `.cache` directory in each module to reclaim the space. +> Running `./mvnw clean -Dclean-cache` automatically deletes that directory for you. + **Contributing to an extension** When you contribute to an extension, after having applied your changes, run: diff --git a/build-parent/pom.xml b/build-parent/pom.xml index 3f630a23604fc..7154b15edbbc7 100644 --- a/build-parent/pom.xml +++ b/build-parent/pom.xml @@ -681,48 +681,6 @@ com.diffplug.spotless spotless-maven-plugin 2.44.4 - - - - - - - true - 2 - - - .gitignore - - - **gradlew** - **mvnw** - extensions/panache/**/pom.xml - test-framework/junit5/pom.xml - test-framework/security/pom.xml - - - - - - ${maven.multiModuleProjectDirectory}/independent-projects/ide-config/src/main/resources/eclipse-format.xml - - - ${maven.multiModuleProjectDirectory}/independent-projects/ide-config/src/main/resources/eclipse.importorder - - - - - **/src/main/java/io/quarkus/rest/client/reactive/deployment/ClientContextResolverHandler.java - **/src/main/java/io/quarkus/rest/client/reactive/deployment/ClientExceptionMapperHandler.java - **/src/main/java/io/quarkus/rest/client/reactive/deployment/ClientRedirectHandler.java - - - - - - - - @@ -740,14 +698,28 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin - spotless-apply - verify + process-sources + + format + + + + + + net.revelc.code + impsort-maven-plugin + + true + + + + sort-imports - apply + sort @@ -763,6 +735,50 @@ no-format + + + + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + validate + + + + + + net.revelc.code + impsort-maven-plugin + + true + + + + check-imports + + check + + + + + + + + + + format-kotlin + + true + + !no-format + + + src/main/kotlin + + @@ -770,13 +786,29 @@ spotless-maven-plugin - spotless-check - verify + format-kotlin + process-sources - check + apply + + + + + + + + + + + + diff --git a/extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLReflections.java b/extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLReflections.java index 8811d9faf8791..6278533b17123 100644 --- a/extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLReflections.java +++ b/extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLReflections.java @@ -19,6 +19,10 @@ void build(BuildProducer reflectiveClass) { //We register it for the sake of people not using Agroal. final String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; reflectiveClass.produce(ReflectiveClassBuildItem.builder(driverName).build()); + + // https://github.com/quarkusio/quarkus/pull/48082#issuecomment-2912550391 + String className = "com.microsoft.sqlserver.jdbc.ConfigurableRetryLogic"; + reflectiveClass.produce(ReflectiveClassBuildItem.builder(className).build()); } } diff --git a/extensions/kubernetes/spi/src/test/java/io/quarkus/kubernetes/spi/KubernetesEnvBuildItemTest.java b/extensions/kubernetes/spi/src/test/java/io/quarkus/kubernetes/spi/KubernetesEnvBuildItemTest.java index a3d50d5bbdd93..41612db62653e 100644 --- a/extensions/kubernetes/spi/src/test/java/io/quarkus/kubernetes/spi/KubernetesEnvBuildItemTest.java +++ b/extensions/kubernetes/spi/src/test/java/io/quarkus/kubernetes/spi/KubernetesEnvBuildItemTest.java @@ -13,10 +13,10 @@ */ package io.quarkus.kubernetes.spi; +import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.create; import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.configmap; import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.secret; import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.EnvType.var; -import static io.quarkus.kubernetes.spi.KubernetesEnvBuildItem.create; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntity.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntity.kt index 6a7d6ba8ebafa..19672d65310b9 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntity.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntity.kt @@ -4,5 +4,6 @@ import io.quarkus.hibernate.orm.panache.kotlin.PanacheEntity import jakarta.persistence.Id class DuplicateIdEntity : PanacheEntity() { - @Id var customId: String? = null + @Id + var customId: String? = null } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntityTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntityTest.kt index bebdf4c573840..01210bd3b4be9 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntityTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/DuplicateIdEntityTest.kt @@ -2,8 +2,8 @@ package io.quarkus.hibernate.orm.panache.kotlin.deployment.test import io.quarkus.builder.BuildException import io.quarkus.test.QuarkusUnitTest -import org.jboss.shrinkwrap.api.ShrinkWrap import org.jboss.shrinkwrap.api.spec.JavaArchive +import org.jboss.shrinkwrap.api.ShrinkWrap import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension @@ -17,9 +17,11 @@ class DuplicateIdEntityTest { companion object { @RegisterExtension @JvmField - var runner = - QuarkusUnitTest().setExpectedException(BuildException::class.java).setArchiveProducer { - ShrinkWrap.create(JavaArchive::class.java).addClasses(DuplicateIdEntity::class.java) - } + var runner = QuarkusUnitTest() + .setExpectedException(BuildException::class.java) + .setArchiveProducer { + ShrinkWrap.create(JavaArchive::class.java) + .addClasses(DuplicateIdEntity::class.java) + } } } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/MyEntity.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/MyEntity.kt index 8a92c699927c0..a3f88d987aaad 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/MyEntity.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/MyEntity.kt @@ -6,7 +6,8 @@ import jakarta.persistence.Entity @Entity class MyEntity : PanacheEntity() { - companion object : PanacheCompanion {} + companion object: PanacheCompanion { + } lateinit var name: String } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/NoConfigTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/NoConfigTest.kt index cdeca3829cf93..b06fcc295c8db 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/NoConfigTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/NoConfigTest.kt @@ -15,7 +15,6 @@ class NoConfigTest { companion object { @RegisterExtension @JvmField - val config = - QuarkusUnitTest().setArchiveProducer { ShrinkWrap.create(JavaArchive::class.java) } + val config = QuarkusUnitTest().setArchiveProducer { ShrinkWrap.create(JavaArchive::class.java) } } } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt index 8c0dd6ef6d8b5..38bd7a486eaea 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt @@ -3,23 +3,21 @@ package io.quarkus.hibernate.orm.panache.kotlin.deployment.test.config import io.quarkus.arc.Arc import io.quarkus.hibernate.orm.panache.kotlin.deployment.test.MyEntity import io.quarkus.test.QuarkusUnitTest -import jakarta.persistence.EntityManagerFactory import org.jboss.shrinkwrap.api.spec.JavaArchive import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension +import jakarta.persistence.EntityManagerFactory class ConfigEnabledFalseTest { companion object { @RegisterExtension - val config = - QuarkusUnitTest() - .withApplicationRoot { jar: JavaArchive -> jar.addClass(MyEntity::class.java) } - .withConfigurationResource("application-test.properties") - // We shouldn't get any build error caused by Panache consuming build items that are - // not produced - // See https://github.com/quarkusio/quarkus/issues/28842 - .overrideConfigKey("quarkus.hibernate-orm.enabled", "false") + val config = QuarkusUnitTest() + .withApplicationRoot { jar: JavaArchive -> jar.addClass(MyEntity::class.java) } + .withConfigurationResource("application-test.properties") + // We shouldn't get any build error caused by Panache consuming build items that are not produced + // See https://github.com/quarkusio/quarkus/issues/28842 + .overrideConfigKey("quarkus.hibernate-orm.enabled", "false") } @Test @@ -28,4 +26,4 @@ class ConfigEnabledFalseTest { // Just check that Hibernate ORM is disabled. Assertions.assertNull(Arc.container().instance(EntityManagerFactory::class.java).get()) } -} +} \ No newline at end of file diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitConfigTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitConfigTest.kt index be914b03fafcc..8995066f030f4 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitConfigTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitConfigTest.kt @@ -13,10 +13,14 @@ import org.junit.jupiter.api.extension.RegisterExtension class DefaultPersistenceUnitConfigTest { @Test fun panacheOperations() { - /** First entity operations */ + /** + * First entity operations + */ RestAssured.`when`()["/persistence-unit/first/name-1"].then().body(Matchers.`is`("name-1")) RestAssured.`when`()["/persistence-unit/first/name-2"].then().body(Matchers.`is`("name-2")) - /** second entity operations */ + /** + * second entity operations + */ RestAssured.`when`()["/persistence-unit/second/name-1"].then().body(Matchers.`is`("name-1")) RestAssured.`when`()["/persistence-unit/second/name-2"].then().body(Matchers.`is`("name-2")) } @@ -24,15 +28,11 @@ class DefaultPersistenceUnitConfigTest { companion object { @RegisterExtension @JvmField - var runner = - QuarkusUnitTest().setArchiveProducer { - ShrinkWrap.create(JavaArchive::class.java) - .addClasses( - FirstEntity::class.java, - SecondEntity::class.java, - PanacheTestResource::class.java, - ) - .addAsResource("application-test.properties", "application.properties") - } + var runner = QuarkusUnitTest() + .setArchiveProducer { + ShrinkWrap.create(JavaArchive::class.java) + .addClasses(FirstEntity::class.java, SecondEntity::class.java, PanacheTestResource::class.java) + .addAsResource("application-test.properties", "application.properties") + } } } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitFileTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitFileTest.kt index 90a39ecfa3ba8..6cb8d033d3f41 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitFileTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/DefaultPersistenceUnitFileTest.kt @@ -14,10 +14,14 @@ import org.junit.jupiter.api.extension.RegisterExtension class DefaultPersistenceUnitFileTest { @Test fun panacheOperations() { - /** First entity operations */ + /** + * First entity operations + */ RestAssured.`when`()["/persistence-unit/first/name-1"].then().body(Matchers.`is`("name-1")) RestAssured.`when`()["/persistence-unit/first/name-2"].then().body(Matchers.`is`("name-2")) - /** second entity operations */ + /** + * second entity operations + */ RestAssured.`when`()["/persistence-unit/second/name-1"].then().body(Matchers.`is`("name-1")) RestAssured.`when`()["/persistence-unit/second/name-2"].then().body(Matchers.`is`("name-2")) } @@ -25,25 +29,17 @@ class DefaultPersistenceUnitFileTest { companion object { @RegisterExtension @JvmField - var runner = - QuarkusUnitTest().setArchiveProducer { - ShrinkWrap.create(JavaArchive::class.java) - .addClasses( - FirstEntity::class.java, - SecondEntity::class.java, - PanacheTestResource::class.java, - ) - .addAsManifestResource("META-INF/some-persistence.xml", "persistence.xml") - .addAsResource( - StringAsset( - """ + var runner = QuarkusUnitTest() + .setArchiveProducer { + ShrinkWrap.create(JavaArchive::class.java) + .addClasses(FirstEntity::class.java, SecondEntity::class.java, PanacheTestResource::class.java) + .addAsManifestResource("META-INF/some-persistence.xml", "persistence.xml") + .addAsResource(StringAsset( + """ quarkus.datasource.db-kind=h2 quarkus.datasource.jdbc.url=jdbc:h2:mem:default;DB_CLOSE_DELAY=-1 - """ - .trimIndent() - ), - "application.properties", - ) - } + """.trimIndent()), + "application.properties") + } } } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/ErroneousPersistenceUnitConfigTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/ErroneousPersistenceUnitConfigTest.kt index af1412af1e969..d227bbeb51a29 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/ErroneousPersistenceUnitConfigTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/ErroneousPersistenceUnitConfigTest.kt @@ -18,20 +18,12 @@ class ErroneousPersistenceUnitConfigTest { companion object { @RegisterExtension @JvmField - var runner = - QuarkusUnitTest() + var runner = QuarkusUnitTest() .setExpectedException(IllegalStateException::class.java) .setArchiveProducer { ShrinkWrap.create(JavaArchive::class.java) - .addClasses( - FirstEntity::class.java, - SecondEntity::class.java, - PanacheTestResource::class.java, - ) - .addAsResource( - "application-erroneous-multiple-persistence-units.properties", - "application.properties", - ) + .addClasses(FirstEntity::class.java, SecondEntity::class.java, PanacheTestResource::class.java) + .addAsResource("application-erroneous-multiple-persistence-units.properties", "application.properties") } } } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/MultiplePersistenceUnitConfigTest.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/MultiplePersistenceUnitConfigTest.kt index a3a990317c803..a0ab9389da80b 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/MultiplePersistenceUnitConfigTest.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/MultiplePersistenceUnitConfigTest.kt @@ -15,10 +15,14 @@ class MultiplePersistenceUnitConfigTest { @Test @Disabled("fix in a separate PR") fun panacheOperations() { - /** First entity operations */ + /** + * First entity operations + */ RestAssured.`when`()["/persistence-unit/first/name-1"].then().body(Matchers.`is`("name-1")) RestAssured.`when`()["/persistence-unit/first/name-2"].then().body(Matchers.`is`("name-2")) - /** second entity operations */ + /** + * second entity operations + */ RestAssured.`when`()["/persistence-unit/second/name-1"].then().body(Matchers.`is`("name-1")) RestAssured.`when`()["/persistence-unit/second/name-2"].then().body(Matchers.`is`("name-2")) } @@ -26,18 +30,11 @@ class MultiplePersistenceUnitConfigTest { companion object { @RegisterExtension @JvmField - var runner = - QuarkusUnitTest().setArchiveProducer { - ShrinkWrap.create(JavaArchive::class.java) - .addClasses( - FirstEntity::class.java, - SecondEntity::class.java, - PanacheTestResource::class.java, - ) - .addAsResource( - "application-multiple-persistence-units.properties", - "application.properties", - ) - } + var runner = QuarkusUnitTest() + .setArchiveProducer { + ShrinkWrap.create(JavaArchive::class.java) + .addClasses(FirstEntity::class.java, SecondEntity::class.java, PanacheTestResource::class.java) + .addAsResource("application-multiple-persistence-units.properties", "application.properties") + } } } diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/second/SecondEntity.kt b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/second/SecondEntity.kt index 62c08edcb0e1d..615a70dbc1a38 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/second/SecondEntity.kt +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/orm/panache/kotlin/deployment/test/multiple_pu/second/SecondEntity.kt @@ -6,7 +6,6 @@ import jakarta.persistence.Entity @Entity class SecondEntity : PanacheEntity() { - companion object : PanacheCompanion - + companion object: PanacheCompanion var name: String? = null } diff --git a/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/MyEntity.kt b/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/MyEntity.kt index 6de37e4b075a3..e22eb58a2b786 100644 --- a/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/MyEntity.kt +++ b/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/MyEntity.kt @@ -6,7 +6,8 @@ import jakarta.persistence.Entity @Entity class MyEntity : PanacheEntity() { - companion object : PanacheCompanion {} + companion object: PanacheCompanion { + } lateinit var name: String } diff --git a/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt b/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt index 370909bdf9bcf..bf749e2304a50 100644 --- a/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt +++ b/extensions/panache/hibernate-reactive-panache-kotlin/deployment/src/test/kotlin/io/quarkus/hibernate/reactive/panache/kotlin/deployment/test/config/ConfigEnabledFalseTest.kt @@ -4,6 +4,7 @@ import io.quarkus.arc.Arc import io.quarkus.hibernate.reactive.panache.kotlin.deployment.test.MyEntity import io.quarkus.test.QuarkusUnitTest import org.hibernate.reactive.mutiny.Mutiny +import org.hibernate.reactive.mutiny.impl.MutinySessionFactoryImpl import org.jboss.shrinkwrap.api.spec.JavaArchive import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test @@ -12,14 +13,12 @@ import org.junit.jupiter.api.extension.RegisterExtension class ConfigEnabledFalseTest { companion object { @RegisterExtension - val config = - QuarkusUnitTest() - .withApplicationRoot { jar: JavaArchive -> jar.addClass(MyEntity::class.java) } - .withConfigurationResource("application.properties") - // We shouldn't get any build error caused by Panache consuming build items that are - // not produced - // See https://github.com/quarkusio/quarkus/issues/28842 - .overrideConfigKey("quarkus.hibernate-orm.enabled", "false") + val config = QuarkusUnitTest() + .withApplicationRoot { jar: JavaArchive -> jar.addClass(MyEntity::class.java) } + .withConfigurationResource("application.properties") + // We shouldn't get any build error caused by Panache consuming build items that are not produced + // See https://github.com/quarkusio/quarkus/issues/28842 + .overrideConfigKey("quarkus.hibernate-orm.enabled", "false") } @Test @@ -28,4 +27,4 @@ class ConfigEnabledFalseTest { // Just check that Hibernate Reactive is disabled. Assertions.assertNull(Arc.container().instance(Mutiny.SessionFactory::class.java).get()) } -} +} \ No newline at end of file diff --git a/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/Book.kt b/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/Book.kt index e5e1af55c8cdd..922b50930d8db 100644 --- a/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/Book.kt +++ b/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/Book.kt @@ -6,152 +6,162 @@ import io.quarkus.mongodb.panache.common.PanacheUpdate import io.quarkus.mongodb.panache.kotlin.PanacheMongoCompanion import io.quarkus.mongodb.panache.kotlin.PanacheMongoEntity import io.quarkus.mongodb.panache.kotlin.PanacheQuery -import io.quarkus.mongodb.panache.kotlin.runtime.KotlinMongoOperations.Companion.INSTANCE + import io.quarkus.mongodb.panache.kotlin.runtime.KotlinMongoOperations.Companion.INSTANCE import io.quarkus.panache.common.Parameters import io.quarkus.panache.common.Sort -import java.util.stream.Stream import org.bson.Document import org.bson.types.ObjectId +import java.util.stream.Stream /** - * This class is used by TestEnhancers to validate the bytecode generation. Each method on - * PanacheMongoCompanion is manually implemented to give us a compiler generated metric against - * which to validate the quarkus generated bytecode. TestEnhancers further validates that - * all @GenerateBridge annotated methods are represented by a 'target_' method here. + * This class is used by TestEnhancers to validate the bytecode generation. Each method on PanacheMongoCompanion is + * manually implemented to give us a compiler generated metric against which to validate the quarkus generated bytecode. + * TestEnhancers further validates that all @GenerateBridge annotated methods are represented by a 'target_' method + * here. */ @Suppress("UNCHECKED_CAST", "unused") class Book : PanacheMongoEntity() { companion object : PanacheMongoCompanion { - fun target_count(): Long = INSTANCE.count(Book::class.java) + fun target_count(): Long + = INSTANCE.count(Book::class.java) + + fun target_count(query: Document): Long + = INSTANCE.count(Book::class.java, query) - fun target_count(query: Document): Long = INSTANCE.count(Book::class.java, query) + fun target_count(query: String, params: Map): Long + = INSTANCE.count(Book::class.java, query, params) - fun target_count(query: String, params: Map): Long = - INSTANCE.count(Book::class.java, query, params) + fun target_count(query: String, params: Parameters): Long + = INSTANCE.count(Book::class.java, query, params) - fun target_count(query: String, params: Parameters): Long = - INSTANCE.count(Book::class.java, query, params) + fun target_count(query: String, vararg params: Any?): Long + = INSTANCE.count(Book::class.java, query, *params) - fun target_count(query: String, vararg params: Any?): Long = - INSTANCE.count(Book::class.java, query, *params) + fun target_delete(query: Document): Long + = INSTANCE.delete(Book::class.java, query) - fun target_delete(query: Document): Long = INSTANCE.delete(Book::class.java, query) + fun target_delete(query: String, params: Map): Long + = INSTANCE.delete(Book::class.java, query, params) - fun target_delete(query: String, params: Map): Long = - INSTANCE.delete(Book::class.java, query, params) + fun target_delete(query: String, params: Parameters): Long + = INSTANCE.delete(Book::class.java, query, params) - fun target_delete(query: String, params: Parameters): Long = - INSTANCE.delete(Book::class.java, query, params) + fun target_delete(query: String, vararg params: Any?): Long + = INSTANCE.delete(Book::class.java, query, *params) - fun target_delete(query: String, vararg params: Any?): Long = - INSTANCE.delete(Book::class.java, query, *params) + fun target_deleteAll(): Long + = INSTANCE.deleteAll(Book::class.java) - fun target_deleteAll(): Long = INSTANCE.deleteAll(Book::class.java) + fun target_deleteById(id: ObjectId): Boolean + = INSTANCE.deleteById(Book::class.java, id) - fun target_deleteById(id: ObjectId): Boolean = INSTANCE.deleteById(Book::class.java, id) + fun target_find(query: Document): PanacheQuery + = INSTANCE.find(Book::class.java, query) as PanacheQuery - fun target_find(query: Document): PanacheQuery = - INSTANCE.find(Book::class.java, query) as PanacheQuery + fun target_find(query: Document, sort: Document): PanacheQuery + = INSTANCE.find(Book::class.java, query, sort) as PanacheQuery - fun target_find(query: Document, sort: Document): PanacheQuery = - INSTANCE.find(Book::class.java, query, sort) as PanacheQuery + fun target_find(query: String, params: Map): PanacheQuery + = INSTANCE.find(Book::class.java, query, params) as PanacheQuery - fun target_find(query: String, params: Map): PanacheQuery = - INSTANCE.find(Book::class.java, query, params) as PanacheQuery + fun target_find(query: String, params: Parameters): PanacheQuery + = INSTANCE.find(Book::class.java, query, params) as PanacheQuery - fun target_find(query: String, params: Parameters): PanacheQuery = - INSTANCE.find(Book::class.java, query, params) as PanacheQuery + fun target_find(query: String, sort: Sort, params: Map): PanacheQuery + = INSTANCE.find(Book::class.java, query, sort, params) as PanacheQuery - fun target_find(query: String, sort: Sort, params: Map): PanacheQuery = - INSTANCE.find(Book::class.java, query, sort, params) as PanacheQuery + fun target_find(query: String, sort: Sort, params: Parameters): PanacheQuery + = INSTANCE.find(Book::class.java, query, sort, params) as PanacheQuery - fun target_find(query: String, sort: Sort, params: Parameters): PanacheQuery = - INSTANCE.find(Book::class.java, query, sort, params) as PanacheQuery + fun target_find(query: String, sort: Sort, vararg params: Any?): PanacheQuery + = INSTANCE.find(Book::class.java, query, sort, *params) as PanacheQuery - fun target_find(query: String, sort: Sort, vararg params: Any?): PanacheQuery = - INSTANCE.find(Book::class.java, query, sort, *params) as PanacheQuery + fun target_find(query: String, vararg params: Any?): PanacheQuery + = INSTANCE.find(Book::class.java, query, *params) as PanacheQuery - fun target_find(query: String, vararg params: Any?): PanacheQuery = - INSTANCE.find(Book::class.java, query, *params) as PanacheQuery + fun target_findAll(): PanacheQuery + = INSTANCE.findAll(Book::class.java) as PanacheQuery - fun target_findAll(): PanacheQuery = - INSTANCE.findAll(Book::class.java) as PanacheQuery + fun target_findAll(sort: Sort): PanacheQuery + = INSTANCE.findAll(Book::class.java, sort) as PanacheQuery - fun target_findAll(sort: Sort): PanacheQuery = - INSTANCE.findAll(Book::class.java, sort) as PanacheQuery + fun target_findById(id: ObjectId): Book? + = INSTANCE.findById(Book::class.java, id) as Book? - fun target_findById(id: ObjectId): Book? = INSTANCE.findById(Book::class.java, id) as Book? + fun target_list(query: Document): List + = INSTANCE.list(Book::class.java, query) as List - fun target_list(query: Document): List = - INSTANCE.list(Book::class.java, query) as List + fun target_list(query: Document, sort: Document): List + = INSTANCE.list(Book::class.java, query, sort) as List - fun target_list(query: Document, sort: Document): List = - INSTANCE.list(Book::class.java, query, sort) as List + fun target_list(query: String, params: Map): List + = INSTANCE.list(Book::class.java, query, params) as List - fun target_list(query: String, params: Map): List = - INSTANCE.list(Book::class.java, query, params) as List + fun target_list(query: String, params: Parameters): List + = INSTANCE.list(Book::class.java, query, params) as List - fun target_list(query: String, params: Parameters): List = - INSTANCE.list(Book::class.java, query, params) as List + fun target_list(query: String, sort: Sort, params: Map): List + = INSTANCE.list(Book::class.java, query, sort, params) as List - fun target_list(query: String, sort: Sort, params: Map): List = - INSTANCE.list(Book::class.java, query, sort, params) as List + fun target_list(query: String, sort: Sort, params: Parameters): List + = INSTANCE.list(Book::class.java, query, sort, params) as List - fun target_list(query: String, sort: Sort, params: Parameters): List = - INSTANCE.list(Book::class.java, query, sort, params) as List + fun target_list(query: String, sort: Sort, vararg params: Any?): List + = INSTANCE.list(Book::class.java, query, sort, *params) as List - fun target_list(query: String, sort: Sort, vararg params: Any?): List = - INSTANCE.list(Book::class.java, query, sort, *params) as List + fun target_list(query: String, vararg params: Any?): List + = INSTANCE.list(Book::class.java, query, *params) as List - fun target_list(query: String, vararg params: Any?): List = - INSTANCE.list(Book::class.java, query, *params) as List + fun target_listAll(): List + = INSTANCE.listAll(Book::class.java) as List - fun target_listAll(): List = INSTANCE.listAll(Book::class.java) as List + fun target_listAll(sort: Sort): List + = INSTANCE.listAll(Book::class.java, sort) as List - fun target_listAll(sort: Sort): List = - INSTANCE.listAll(Book::class.java, sort) as List + fun target_mongoCollection(): MongoCollection + = INSTANCE.mongoCollection(Book::class.java) as MongoCollection - fun target_mongoCollection(): MongoCollection = - INSTANCE.mongoCollection(Book::class.java) as MongoCollection + fun target_mongoDatabase(): MongoDatabase + = INSTANCE.mongoDatabase(Book::class.java) - fun target_mongoDatabase(): MongoDatabase = INSTANCE.mongoDatabase(Book::class.java) + fun target_stream(query: Document): Stream + = INSTANCE.stream(Book::class.java, query) as Stream - fun target_stream(query: Document): Stream = - INSTANCE.stream(Book::class.java, query) as Stream + fun target_stream(query: Document, sort: Document): Stream + = INSTANCE.stream(Book::class.java, query, sort) as Stream - fun target_stream(query: Document, sort: Document): Stream = - INSTANCE.stream(Book::class.java, query, sort) as Stream + fun target_stream(query: String, params: Map): Stream + = INSTANCE.stream(Book::class.java, query, params) as Stream - fun target_stream(query: String, params: Map): Stream = - INSTANCE.stream(Book::class.java, query, params) as Stream + fun target_stream(query: String, params: Parameters): Stream + = INSTANCE.stream(Book::class.java, query, params) as Stream - fun target_stream(query: String, params: Parameters): Stream = - INSTANCE.stream(Book::class.java, query, params) as Stream + fun target_stream(query: String, sort: Sort, params: Map): Stream + = INSTANCE.stream(Book::class.java, query, sort, params) as Stream - fun target_stream(query: String, sort: Sort, params: Map): Stream = - INSTANCE.stream(Book::class.java, query, sort, params) as Stream + fun target_stream(query: String, sort: Sort, params: Parameters): Stream + = INSTANCE.stream(Book::class.java, query, sort, params) as Stream - fun target_stream(query: String, sort: Sort, params: Parameters): Stream = - INSTANCE.stream(Book::class.java, query, sort, params) as Stream + fun target_stream(query: String, sort: Sort, vararg params: Any?): Stream + = INSTANCE.stream(Book::class.java, query, sort, *params) as Stream - fun target_stream(query: String, sort: Sort, vararg params: Any?): Stream = - INSTANCE.stream(Book::class.java, query, sort, *params) as Stream + fun target_stream(query: String, vararg params: Any?): Stream + = INSTANCE.stream(Book::class.java, query, *params) as Stream - fun target_stream(query: String, vararg params: Any?): Stream = - INSTANCE.stream(Book::class.java, query, *params) as Stream + fun target_streamAll(): Stream + = INSTANCE.streamAll(Book::class.java) as Stream - fun target_streamAll(): Stream = INSTANCE.streamAll(Book::class.java) as Stream + fun target_streamAll(sort: Sort): Stream + = INSTANCE.streamAll(Book::class.java, sort) as Stream - fun target_streamAll(sort: Sort): Stream = - INSTANCE.streamAll(Book::class.java, sort) as Stream + fun target_update(update: String, params: Map): PanacheUpdate + = INSTANCE.update(Book::class.java, update, params) - fun target_update(update: String, params: Map): PanacheUpdate = - INSTANCE.update(Book::class.java, update, params) + fun target_update(update: String, params: Parameters): PanacheUpdate + = INSTANCE.update(Book::class.java, update, params) - fun target_update(update: String, params: Parameters): PanacheUpdate = - INSTANCE.update(Book::class.java, update, params) + fun target_update(update: String, vararg params: Any?): PanacheUpdate + = INSTANCE.update(Book::class.java, update, *params) - fun target_update(update: String, vararg params: Any?): PanacheUpdate = - INSTANCE.update(Book::class.java, update, *params) } } diff --git a/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/StudentRepository.kt b/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/StudentRepository.kt index 02b0f21749eab..868560dd488ce 100644 --- a/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/StudentRepository.kt +++ b/extensions/panache/mongodb-panache-kotlin/deployment/src/test/kotlin/io/quarkus/mongodb/panache/kotlin/deployment/StudentRepository.kt @@ -8,27 +8,27 @@ import io.quarkus.mongodb.panache.kotlin.PanacheQuery import io.quarkus.mongodb.panache.kotlin.runtime.KotlinMongoOperations.Companion.INSTANCE import io.quarkus.panache.common.Parameters import io.quarkus.panache.common.Sort -import java.util.stream.Stream import org.bson.Document +import java.util.stream.Stream /** - * This class is used by TestEnhancers to validate the bytecode generation. Each method on - * PanacheMongoRepositoryBase is manually implemented to give us a compiler generated metric against - * which to validate the quarkus generated bytecode. TestEnhancers further validates that - * all @GenerateBridge annotated methods are represented by a 'target_' method here. + * This class is used by TestEnhancers to validate the bytecode generation. Each method on PanacheMongoRepositoryBase + * is manually implemented to give us a compiler generated metric against which to validate the quarkus generated + * bytecode. TestEnhancers further validates that all @GenerateBridge annotated methods are represented by a 'target_' + * method here. */ @Suppress("unused", "UNCHECKED_CAST") class StudentRepository : PanacheMongoRepositoryBase { fun target_count(): Long = INSTANCE.count(Student::class.java) fun target_count(query: String, vararg params: Any?): Long = - INSTANCE.count(Student::class.java, query, *params) + INSTANCE.count(Student::class.java, query, *params) fun target_count(query: String, params: Map): Long = - INSTANCE.count(Student::class.java, query, params) + INSTANCE.count(Student::class.java, query, params) fun target_count(query: String, params: Parameters): Long = - INSTANCE.count(Student::class.java, query, params) + INSTANCE.count(Student::class.java, query, params) fun target_count(query: Document): Long = INSTANCE.count(Student::class.java, query) @@ -37,120 +37,120 @@ class StudentRepository : PanacheMongoRepositoryBase { fun target_deleteById(id: Long): Boolean = INSTANCE.deleteById(Student::class.java, id) fun target_delete(query: String, vararg params: Any?): Long = - INSTANCE.delete(Student::class.java, query, *params) + INSTANCE.delete(Student::class.java, query, *params) fun target_delete(query: String, params: Map): Long = - INSTANCE.delete(Student::class.java, query, params) + INSTANCE.delete(Student::class.java, query, params) fun target_delete(query: String, params: Parameters): Long = - INSTANCE.delete(Student::class.java, query, params) + INSTANCE.delete(Student::class.java, query, params) fun target_delete(query: Document): Long = INSTANCE.delete(Student::class.java, query) - fun target_findById(id: Long): Student? = INSTANCE.findById(Student::class.java, id) as Student? + fun target_findById(id: Long): Student? = + INSTANCE.findById(Student::class.java, id) as Student? fun target_find(query: String, vararg params: Any?): PanacheQuery = - INSTANCE.find(Student::class.java, query, *params) as PanacheQuery + INSTANCE.find(Student::class.java, query, *params) as PanacheQuery fun target_find(query: String, sort: Sort, vararg params: Any?): PanacheQuery = - INSTANCE.find(Student::class.java, query, sort, *params) as PanacheQuery + INSTANCE.find(Student::class.java, query, sort, *params) as PanacheQuery fun target_find(query: String, params: Map): PanacheQuery = - INSTANCE.find(Student::class.java, query, params) as PanacheQuery + INSTANCE.find(Student::class.java, query, params) as PanacheQuery fun target_find(query: String, sort: Sort, params: Map): PanacheQuery = - INSTANCE.find(Student::class.java, query, sort, params) as PanacheQuery + INSTANCE.find(Student::class.java, query, sort, params) as PanacheQuery fun target_find(query: String, params: Parameters): PanacheQuery = - INSTANCE.find(Student::class.java, query, params) as PanacheQuery + INSTANCE.find(Student::class.java, query, params) as PanacheQuery fun target_find(query: String, sort: Sort, params: Parameters): PanacheQuery = - INSTANCE.find(Student::class.java, query, sort, params) as PanacheQuery + INSTANCE.find(Student::class.java, query, sort, params) as PanacheQuery fun target_find(query: Document): PanacheQuery = - INSTANCE.find(Student::class.java, query) as PanacheQuery + INSTANCE.find(Student::class.java, query) as PanacheQuery fun target_find(query: Document, sort: Document): PanacheQuery = - INSTANCE.find(Student::class.java, query, sort) as PanacheQuery + INSTANCE.find(Student::class.java, query, sort) as PanacheQuery fun target_findAll(): PanacheQuery = - INSTANCE.findAll(Student::class.java) as PanacheQuery + INSTANCE.findAll(Student::class.java) as PanacheQuery fun target_findAll(sort: Sort): PanacheQuery = - INSTANCE.findAll(Student::class.java, sort) as PanacheQuery + INSTANCE.findAll(Student::class.java, sort) as PanacheQuery fun target_list(query: String, vararg params: Any?): List = - INSTANCE.list(Student::class.java, query, *params) as List + INSTANCE.list(Student::class.java, query, *params) as List fun target_list(query: String, sort: Sort, vararg params: Any?): List = - INSTANCE.list(Student::class.java, query, sort, *params) as List + INSTANCE.list(Student::class.java, query, sort, *params) as List fun target_list(query: String, params: Map): List = - INSTANCE.list(Student::class.java, query, params) as List + INSTANCE.list(Student::class.java, query, params) as List fun target_list(query: String, sort: Sort, params: Map): List = - INSTANCE.list(Student::class.java, query, sort, params) as List + INSTANCE.list(Student::class.java, query, sort, params) as List fun target_list(query: String, params: Parameters): List = - INSTANCE.list(Student::class.java, query, params) as List + INSTANCE.list(Student::class.java, query, params) as List fun target_list(query: String, sort: Sort, params: Parameters): List = - INSTANCE.list(Student::class.java, query, sort, params) as List + INSTANCE.list(Student::class.java, query, sort, params) as List fun target_list(query: Document): List = - INSTANCE.list(Student::class.java, query) as List + INSTANCE.list(Student::class.java, query) as List fun target_list(query: Document, sort: Document): List = - INSTANCE.list(Student::class.java, query, sort) as List + INSTANCE.list(Student::class.java, query, sort) as List fun target_listAll(): List = INSTANCE.listAll(Student::class.java) as List fun target_listAll(sort: Sort): List = - INSTANCE.listAll(Student::class.java, sort) as List + INSTANCE.listAll(Student::class.java, sort) as List fun target_mongoCollection(): MongoCollection = - INSTANCE.mongoCollection(Student::class.java) as MongoCollection + INSTANCE.mongoCollection(Student::class.java) as MongoCollection fun target_mongoDatabase(): MongoDatabase = INSTANCE.mongoDatabase(Student::class.java) fun target_stream(query: String, vararg params: Any?): Stream = - INSTANCE.stream(Student::class.java, query, *params) as Stream + INSTANCE.stream(Student::class.java, query, *params) as Stream fun target_stream(query: String, sort: Sort, vararg params: Any?): Stream = - INSTANCE.stream(Student::class.java, query, sort, *params) as Stream + INSTANCE.stream(Student::class.java, query, sort, *params) as Stream fun target_stream(query: String, params: Map): Stream = - INSTANCE.stream(Student::class.java, query, params) as Stream + INSTANCE.stream(Student::class.java, query, params) as Stream fun target_stream(query: String, sort: Sort, params: Map): Stream = - INSTANCE.stream(Student::class.java, query, sort, params) as Stream + INSTANCE.stream(Student::class.java, query, sort, params) as Stream fun target_stream(query: String, params: Parameters): Stream = - INSTANCE.stream(Student::class.java, query, params) as Stream + INSTANCE.stream(Student::class.java, query, params) as Stream fun target_stream(query: String, sort: Sort, params: Parameters): Stream = - INSTANCE.stream(Student::class.java, query, sort, params) as Stream + INSTANCE.stream(Student::class.java, query, sort, params) as Stream fun target_stream(query: Document): Stream = - INSTANCE.stream(Student::class.java, query) as Stream + INSTANCE.stream(Student::class.java, query) as Stream fun target_stream(query: Document, sort: Document): Stream = - INSTANCE.stream(Student::class.java, query, sort) as Stream + INSTANCE.stream(Student::class.java, query, sort) as Stream fun target_streamAll(sort: Sort): Stream = - INSTANCE.streamAll(Student::class.java, sort) as Stream + INSTANCE.streamAll(Student::class.java, sort) as Stream fun target_streamAll(): Stream = - INSTANCE.streamAll(Student::class.java) as Stream + INSTANCE.streamAll(Student::class.java) as Stream fun target_update(update: String, vararg params: Any?): PanacheUpdate = - INSTANCE.update(Student::class.java, update, *params) + INSTANCE.update(Student::class.java, update, *params) fun target_update(update: String, params: Map): PanacheUpdate = - INSTANCE.update(Student::class.java, update, params) + INSTANCE.update(Student::class.java, update, params) fun target_update(update: String, params: Parameters): PanacheUpdate = - INSTANCE.update(Student::class.java, update, params) + INSTANCE.update(Student::class.java, update, params) } - class Student diff --git a/extensions/redis-client/runtime/src/test/java/io/quarkus/redis/datasource/BitMapCommandsTest.java b/extensions/redis-client/runtime/src/test/java/io/quarkus/redis/datasource/BitMapCommandsTest.java index 2b09336c38ade..f67048b51a2ca 100644 --- a/extensions/redis-client/runtime/src/test/java/io/quarkus/redis/datasource/BitMapCommandsTest.java +++ b/extensions/redis-client/runtime/src/test/java/io/quarkus/redis/datasource/BitMapCommandsTest.java @@ -1,10 +1,10 @@ package io.quarkus.redis.datasource; -import static io.quarkus.redis.datasource.bitmap.BitFieldArgs.OverflowType.WRAP; import static io.quarkus.redis.datasource.bitmap.BitFieldArgs.offset; import static io.quarkus.redis.datasource.bitmap.BitFieldArgs.signed; import static io.quarkus.redis.datasource.bitmap.BitFieldArgs.typeWidthBasedOffset; import static io.quarkus.redis.datasource.bitmap.BitFieldArgs.unsigned; +import static io.quarkus.redis.datasource.bitmap.BitFieldArgs.OverflowType.WRAP; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; diff --git a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/EncodeDefaultValuesTest.kt b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/EncodeDefaultValuesTest.kt index bcc6bba6040ea..bdb50b859821d 100644 --- a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/EncodeDefaultValuesTest.kt +++ b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/EncodeDefaultValuesTest.kt @@ -1,30 +1,33 @@ package io.quarkus.rest.client.reactive.kotlin.test import io.quarkus.test.QuarkusUnitTest -import jakarta.inject.Inject import kotlinx.serialization.Serializable import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension +import jakarta.inject.Inject class EncodeDefaultValuesTest { companion object { @RegisterExtension - val config = QuarkusUnitTest().withConfigurationResource("encode-default-values.properties") + val config = QuarkusUnitTest() + .withConfigurationResource("encode-default-values.properties") } - @Inject lateinit var json: Json + @Inject + lateinit var json: Json @Test fun testNoDefaults() { - assertThat(json.encodeToString(TestObject())).isEqualTo("{}") + assertThat(json.encodeToString(TestObject())) + .isEqualTo("{}") } - @Test fun testExplicitNulls() { - assertThat(json.encodeToString(TestObject(blank = null))).isEqualTo("{\"blank\":null}") + assertThat(json.encodeToString(TestObject(blank = null))) + .isEqualTo("{\"blank\":null}") } @Serializable diff --git a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/ExplicitNullsTest.kt b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/ExplicitNullsTest.kt index 052e802741845..0c816f080622f 100644 --- a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/ExplicitNullsTest.kt +++ b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/ExplicitNullsTest.kt @@ -1,26 +1,30 @@ package io.quarkus.rest.client.reactive.kotlin.test import io.quarkus.test.QuarkusUnitTest -import jakarta.inject.Inject import kotlinx.serialization.Serializable import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension +import jakarta.inject.Inject class ExplicitNullsTest { companion object { @RegisterExtension - val config = QuarkusUnitTest().withConfigurationResource("explicit-nulls.properties") + val config = QuarkusUnitTest() + .withConfigurationResource("explicit-nulls.properties") } - @Inject lateinit var json: Json + @Inject + lateinit var json: Json @Test fun testExplicitNulls() { - assertThat(json.encodeToString(TestObject(blank = null))).isEqualTo("{}") + assertThat(json.encodeToString(TestObject(blank = null))) + .isEqualTo("{}") } - @Serializable private class TestObject(var blank: String? = "") + @Serializable + private class TestObject(var blank: String? = "") } diff --git a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/LenientTest.kt b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/LenientTest.kt index 4bd3c999471b8..91213df829fd1 100644 --- a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/LenientTest.kt +++ b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/LenientTest.kt @@ -1,21 +1,24 @@ package io.quarkus.rest.client.reactive.kotlin.test import io.quarkus.test.QuarkusUnitTest -import jakarta.inject.Inject import kotlinx.serialization.Serializable import kotlinx.serialization.decodeFromString +import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension +import jakarta.inject.Inject class LenientTest { companion object { @RegisterExtension - val config = QuarkusUnitTest().withConfigurationResource("lenient.properties") + val config = QuarkusUnitTest() + .withConfigurationResource("lenient.properties") } - @Inject lateinit var json: Json + @Inject + lateinit var json: Json @Test fun testLenient() { @@ -23,5 +26,6 @@ class LenientTest { .isEqualTo(TestObject("json")) } - @Serializable private data class TestObject(var name: String) + @Serializable + private data class TestObject(var name: String) } diff --git a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/PrettyPrintTest.kt b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/PrettyPrintTest.kt index 5dc8eb975debf..45234612beb90 100644 --- a/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/PrettyPrintTest.kt +++ b/extensions/resteasy-reactive/rest-client-kotlin-serialization/tests/src/test/kotlin/io/quarkus/rest/client/reactive/kotlin/test/PrettyPrintTest.kt @@ -1,7 +1,7 @@ + package io.quarkus.rest.client.reactive.kotlin.test import io.quarkus.test.QuarkusUnitTest -import jakarta.inject.Inject import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.Serializable import kotlinx.serialization.encodeToString @@ -10,27 +10,28 @@ import kotlinx.serialization.json.JsonNames import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension +import jakarta.inject.Inject @OptIn(ExperimentalSerializationApi::class) class PrettyPrintTest { companion object { @RegisterExtension - val config = QuarkusUnitTest().withConfigurationResource("pretty-print.properties") + val config = QuarkusUnitTest() + .withConfigurationResource("pretty-print.properties") } - @Inject lateinit var json: Json + @Inject + lateinit var json: Json @Test fun testAlternateNames() { assertThat(json.encodeToString(TestObject("John Doe"))) - .isEqualTo( - """ + .isEqualTo(""" { "name": "John Doe" - }""" - .trimIndent() - ) + }""".trimIndent()) } - @Serializable private data class TestObject(@JsonNames("label") var name: String) + @Serializable + private data class TestObject(@JsonNames("label") var name: String) } diff --git a/extensions/resteasy-reactive/rest-jsonb/deployment/src/test/java/io/quarkus/resteasy/reactive/jsonb/deployment/test/sse/SseResource.java b/extensions/resteasy-reactive/rest-jsonb/deployment/src/test/java/io/quarkus/resteasy/reactive/jsonb/deployment/test/sse/SseResource.java index 6d9901edad1e2..cb61f52aca63d 100644 --- a/extensions/resteasy-reactive/rest-jsonb/deployment/src/test/java/io/quarkus/resteasy/reactive/jsonb/deployment/test/sse/SseResource.java +++ b/extensions/resteasy-reactive/rest-jsonb/deployment/src/test/java/io/quarkus/resteasy/reactive/jsonb/deployment/test/sse/SseResource.java @@ -10,6 +10,7 @@ import jakarta.ws.rs.sse.SseBroadcaster; import jakarta.ws.rs.sse.SseEventSink; +// Using `@RestStreamElementType` on purpose to ensure the backward compatibility. import org.jboss.resteasy.reactive.RestSseElementType; import org.jboss.resteasy.reactive.common.util.RestMediaType; diff --git a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/BasicTest.kt b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/BasicTest.kt index 33af17e3ff633..3da9f4d62f527 100644 --- a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/BasicTest.kt +++ b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/BasicTest.kt @@ -2,52 +2,39 @@ package io.quarkus.resteasy.reactive.kotlin.serialization.common import io.quarkus.arc.Arc import io.quarkus.test.QuarkusUnitTest -import kotlin.reflect.full.createType import kotlinx.serialization.json.Json import kotlinx.serialization.serializer import org.jboss.shrinkwrap.api.spec.JavaArchive import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension +import kotlin.reflect.full.createType class BasicTest { companion object { @RegisterExtension - val config = - QuarkusUnitTest() - .withApplicationRoot { jar: JavaArchive -> jar.addClass(Greeting::class.java) } - .withConfigurationResource("basic.properties") + val config = QuarkusUnitTest() + .withApplicationRoot { jar: JavaArchive -> jar.addClass(Greeting::class.java) } + .withConfigurationResource("basic.properties") } @Test fun testSerialization() { // Aside from the CDI integration, this tests that the configured pretty-print is used Assertions.assertEquals( - """{ +"""{ "name": "foo", "message": "hello" }""", - Arc.container() - .instance(Json::class.java) - .get() - .encodeToString(serializer(), Greeting("foo", "hello")), - ) + Arc.container().instance(Json::class.java).get().encodeToString(serializer(), Greeting("foo", "hello"))) } @Test fun testDeserialization() { - // Aside from the CDI integration, this tests that the configured ignore-unknown-keys is - // used - Assertions.assertEquals( - Greeting("foo", "hello"), - Arc.container() - .instance(Json::class.java) - .get() - .decodeFromString( - serializer(Greeting::class.createType()), - """{"name" : "foo", "message" : "hello", "test": "dummy"}""", - ), - ) + // Aside from the CDI integration, this tests that the configured ignore-unknown-keys is used + Assertions.assertEquals(Greeting("foo", "hello"), + Arc.container().instance(Json::class.java).get().decodeFromString(serializer(Greeting::class.createType()), """{"name" : "foo", "message" : "hello", "test": "dummy"}""")) } + } diff --git a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/CustomBeanTest.kt b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/CustomBeanTest.kt index ab2a1dc3dd324..708e02079679c 100644 --- a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/CustomBeanTest.kt +++ b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/CustomBeanTest.kt @@ -1,9 +1,7 @@ package io.quarkus.resteasy.reactive.kotlin.serialization.common +import io.quarkus.arc.Arc import io.quarkus.test.QuarkusUnitTest -import jakarta.enterprise.inject.Produces -import jakarta.inject.Inject -import jakarta.inject.Singleton import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.Json import kotlinx.serialization.serializer @@ -11,28 +9,30 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension +import jakarta.enterprise.inject.Produces +import jakarta.inject.Inject +import jakarta.inject.Singleton +import kotlin.reflect.full.createType class CustomBeanTest { companion object { @RegisterExtension - val config = - QuarkusUnitTest().withApplicationRoot { jar: JavaArchive -> - jar.addClasses(Greeting::class.java, CustomJsonProducer::class.java) - } + val config = QuarkusUnitTest() + .withApplicationRoot { jar: JavaArchive -> jar.addClasses(Greeting::class.java, CustomJsonProducer::class.java) } } - @Inject lateinit var json: Json + @Inject + lateinit var json: Json @Test fun test() { Assertions.assertEquals( - """{ +"""{ "name": "foo", "message": "hello" }""", - json.encodeToString(serializer(), Greeting("foo", "hello")), - ) + json.encodeToString(serializer(), Greeting("foo", "hello"))) } @Singleton diff --git a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/Greeting.kt b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/Greeting.kt index 3ea19ffe715c7..0f4bb1df7e3fb 100644 --- a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/Greeting.kt +++ b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/Greeting.kt @@ -2,4 +2,5 @@ package io.quarkus.resteasy.reactive.kotlin.serialization.common import kotlinx.serialization.Serializable -@Serializable data class Greeting(val name: String, val message: String) +@Serializable +data class Greeting(val name: String, val message: String) diff --git a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/JsonBuilderCustomizerTest.kt b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/JsonBuilderCustomizerTest.kt index a88b02570fd37..a80d9930cdc1d 100644 --- a/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/JsonBuilderCustomizerTest.kt +++ b/extensions/resteasy-reactive/rest-kotlin-serialization-common/deployment/src/test/kotlin/io/quarkus/resteasy/reactive/kotlin/serialization/common/JsonBuilderCustomizerTest.kt @@ -2,10 +2,6 @@ package io.quarkus.resteasy.reactive.kotlin.serialization.common import io.quarkus.arc.Arc import io.quarkus.test.QuarkusUnitTest -import jakarta.annotation.Priority -import jakarta.inject.Inject -import jakarta.inject.Singleton -import kotlin.reflect.full.createType import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonBuilder @@ -14,56 +10,40 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension +import jakarta.annotation.Priority +import jakarta.inject.Inject +import jakarta.inject.Singleton +import kotlin.reflect.full.createType class JsonBuilderCustomizerTest { companion object { @RegisterExtension - val config = - QuarkusUnitTest() - .withApplicationRoot { jar: JavaArchive -> - jar.addClasses( - Greeting::class.java, - HighPriorityCustomizer::class.java, - LowPriorityCustomizer::class.java, - ) - } - .withConfigurationResource("basic.properties") + val config = QuarkusUnitTest() + .withApplicationRoot { jar: JavaArchive -> jar.addClasses(Greeting::class.java, HighPriorityCustomizer::class.java, LowPriorityCustomizer::class.java) } + .withConfigurationResource("basic.properties") } - @Inject lateinit var json: Json + @Inject + lateinit var json: Json @Test fun testSerialization() { - // prettyPrint should be set to false, because HighPriorityCustomizer overrides the value - // set in config - Assertions.assertEquals( - """{"name":"foo","message":"hello"}""", - Arc.container() - .instance(Json::class.java) - .get() - .encodeToString(serializer(), Greeting("foo", "hello")), - ) + // prettyPrint should be set to false, because HighPriorityCustomizer overrides the value set in config + Assertions.assertEquals("""{"name":"foo","message":"hello"}""", + Arc.container().instance(Json::class.java).get().encodeToString(serializer(), Greeting("foo", "hello"))) } @Test fun testDeserialization() { - // isLenient should be set to true, because LowPriorityCustomizer overrides the value set in - // HighPriorityCustomizer - Assertions.assertEquals( - Greeting("foo", "hello"), - json.decodeFromString( - serializer(Greeting::class.createType()), - """{name : "foo", "message" : "hello", "test": "dummy"}""", - ), - ) + // isLenient should be set to true, because LowPriorityCustomizer overrides the value set in HighPriorityCustomizer + Assertions.assertEquals(Greeting("foo", "hello"), + json.decodeFromString(serializer(Greeting::class.createType()), """{name : "foo", "message" : "hello", "test": "dummy"}""")) } @Singleton - @Priority( - JsonBuilderCustomizer.DEFAULT_PRIORITY + 100 - ) // this impl will be called before HighPriorityCustomizer - class HighPriorityCustomizer : JsonBuilderCustomizer { + @Priority(JsonBuilderCustomizer.DEFAULT_PRIORITY + 100) // this impl will be called before HighPriorityCustomizer + class HighPriorityCustomizer : JsonBuilderCustomizer{ @ExperimentalSerializationApi override fun customize(jsonBuilder: JsonBuilder) { @@ -73,10 +53,8 @@ class JsonBuilderCustomizerTest { } @Singleton - @Priority( - JsonBuilderCustomizer.DEFAULT_PRIORITY + 10 - ) // this impl will be called after HighPriorityCustomizer - class LowPriorityCustomizer : JsonBuilderCustomizer { + @Priority(JsonBuilderCustomizer.DEFAULT_PRIORITY + 10) // this impl will be called after HighPriorityCustomizer + class LowPriorityCustomizer : JsonBuilderCustomizer{ @ExperimentalSerializationApi override fun customize(jsonBuilder: JsonBuilder) { diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/proxy/fakedns/DnsMessageEncoder.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/proxy/fakedns/DnsMessageEncoder.java index 238202ceb3a8d..371f5a7dc3bd0 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/proxy/fakedns/DnsMessageEncoder.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/proxy/fakedns/DnsMessageEncoder.java @@ -7,6 +7,25 @@ import java.util.List; import java.util.Map; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ import org.apache.directory.server.dns.io.encoder.*; import org.apache.directory.server.dns.messages.DnsMessage; import org.apache.directory.server.dns.messages.MessageType; diff --git a/extensions/websockets-next/deployment/pom.xml b/extensions/websockets-next/deployment/pom.xml index 3b93c2d5b737f..d8e04df3c1ca5 100644 --- a/extensions/websockets-next/deployment/pom.xml +++ b/extensions/websockets-next/deployment/pom.xml @@ -196,7 +196,8 @@ 21 21 - 21 + + diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEcho.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEcho.kt index 2d8dbda9feefc..587145700bcb4 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEcho.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEcho.kt @@ -4,6 +4,7 @@ import io.quarkus.websockets.next.OnBinaryMessage import io.quarkus.websockets.next.OnClose import io.quarkus.websockets.next.WebSocket import io.vertx.core.buffer.Buffer +import kotlinx.coroutines.delay @WebSocket(path = "/binary-echo") class BinaryEcho { @@ -12,5 +13,7 @@ class BinaryEcho { return msg } - @OnClose fun close() {} + @OnClose + fun close() { + } } diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEchoUni.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEchoUni.kt index f03f912b595ca..8fa01ae1e8c6d 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEchoUni.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/BinaryEchoUni.kt @@ -5,6 +5,7 @@ import io.quarkus.websockets.next.OnClose import io.quarkus.websockets.next.WebSocket import io.smallrye.mutiny.Uni import io.vertx.core.buffer.Buffer +import kotlinx.coroutines.delay @WebSocket(path = "/binary-echo-uni") class BinaryEchoUni { @@ -13,6 +14,7 @@ class BinaryEchoUni { return Uni.createFrom().item(msg) } + @OnClose fun close(): Uni { return Uni.createFrom().voidItem() diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/Echo.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/Echo.kt index 97e194fcf54c6..330b9fe94e093 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/Echo.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/Echo.kt @@ -11,5 +11,7 @@ class Echo { return msg } - @OnClose fun close() {} + @OnClose + fun close() { + } } diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketClientTest.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketClientTest.kt index 113810ba1cbd4..9ec2cd00baf2c 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketClientTest.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketClientTest.kt @@ -9,27 +9,29 @@ import io.quarkus.websockets.next.WebSocket import io.quarkus.websockets.next.WebSocketClient import io.quarkus.websockets.next.WebSocketConnector import jakarta.inject.Inject -import java.net.URI -import java.util.concurrent.CopyOnWriteArrayList -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension +import java.net.URI +import java.util.concurrent.CopyOnWriteArrayList +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit class KotlinWebSocketClientTest { companion object { @RegisterExtension - val test = - QuarkusUnitTest().withApplicationRoot { jar -> + val test = QuarkusUnitTest() + .withApplicationRoot { jar -> jar.addClasses(ServerEndpoint::class.java, ClientEndpoint::class.java) } } - @Inject lateinit var connector: WebSocketConnector + @Inject + lateinit var connector: WebSocketConnector - @TestHTTPResource("/") lateinit var uri: URI + @TestHTTPResource("/") + lateinit var uri: URI @Test fun test() { diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSessionContextTest.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSessionContextTest.kt index 11d458c7d2050..4fd8f29d1b03a 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSessionContextTest.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSessionContextTest.kt @@ -8,27 +8,29 @@ import io.quarkus.websockets.next.test.utils.WSClient import io.vertx.core.Vertx import jakarta.enterprise.context.SessionScoped import jakarta.inject.Inject -import java.net.URI -import java.util.UUID import kotlinx.coroutines.delay import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Assertions.assertNotNull import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension +import java.net.URI +import java.util.UUID class KotlinWebSocketSessionContextTest { companion object { @RegisterExtension - val test = - QuarkusUnitTest().withApplicationRoot { jar -> + val test = QuarkusUnitTest() + .withApplicationRoot { jar -> jar.addClasses(MyData::class.java, Endpoint::class.java, WSClient::class.java) } } - @Inject lateinit var vertx: Vertx + @Inject + lateinit var vertx: Vertx - @TestHTTPResource("endpoint") lateinit var endpoint: URI + @TestHTTPResource("endpoint") + lateinit var endpoint: URI @Test fun testEcho() { @@ -69,7 +71,8 @@ class KotlinWebSocketSessionContextTest { @WebSocket(path = "/endpoint") class Endpoint { - @Inject lateinit var data: MyData + @Inject + lateinit var data: MyData @OnTextMessage suspend fun echo(message: String): String { diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSuspendingClientTest.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSuspendingClientTest.kt index 704eb361fb20f..9c4a8fdc9051a 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSuspendingClientTest.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketSuspendingClientTest.kt @@ -9,28 +9,30 @@ import io.quarkus.websockets.next.WebSocket import io.quarkus.websockets.next.WebSocketClient import io.quarkus.websockets.next.WebSocketConnector import jakarta.inject.Inject -import java.net.URI -import java.util.concurrent.CopyOnWriteArrayList -import java.util.concurrent.CountDownLatch -import java.util.concurrent.TimeUnit import kotlinx.coroutines.delay import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension +import java.net.URI +import java.util.concurrent.CopyOnWriteArrayList +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit class KotlinWebSocketSuspendingClientTest { companion object { @RegisterExtension - val test = - QuarkusUnitTest().withApplicationRoot { jar -> + val test = QuarkusUnitTest() + .withApplicationRoot { jar -> jar.addClasses(ServerEndpoint::class.java, ClientEndpoint::class.java) } } - @Inject lateinit var connector: WebSocketConnector + @Inject + lateinit var connector: WebSocketConnector - @TestHTTPResource("/") lateinit var uri: URI + @TestHTTPResource("/") + lateinit var uri: URI @Test fun test() { diff --git a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketTest.kt b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketTest.kt index d621f8613bfe0..d29dbcf931073 100644 --- a/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketTest.kt +++ b/extensions/websockets-next/deployment/src/test/kotlin/io/quarkus/websockets/next/test/kotlin/KotlinWebSocketTest.kt @@ -7,42 +7,42 @@ import io.vertx.core.Vertx import io.vertx.core.buffer.Buffer import io.vertx.core.json.JsonObject import jakarta.inject.Inject -import java.net.URI import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.RegisterExtension +import java.net.URI class KotlinWebSocketTest { companion object { @RegisterExtension - val test = - QuarkusUnitTest().withApplicationRoot { jar -> - jar.addClasses( - Echo::class.java, - EchoSuspend::class.java, - EchoUni::class.java, - BinaryEcho::class.java, - BinaryEchoSuspend::class.java, - BinaryEchoUni::class.java, - Message::class.java, - WSClient::class.java, - ) + val test = QuarkusUnitTest() + .withApplicationRoot { jar -> + jar.addClasses(Echo::class.java, EchoSuspend::class.java, EchoUni::class.java, + BinaryEcho::class.java, BinaryEchoSuspend::class.java, BinaryEchoUni::class.java, + Message::class.java, WSClient::class.java) } } - @Inject lateinit var vertx: Vertx + @Inject + lateinit var vertx: Vertx - @TestHTTPResource("echo") lateinit var echo: URI + @TestHTTPResource("echo") + lateinit var echo: URI - @TestHTTPResource("echo-suspend") lateinit var echoSuspend: URI + @TestHTTPResource("echo-suspend") + lateinit var echoSuspend: URI - @TestHTTPResource("echo-uni") lateinit var echoUni: URI + @TestHTTPResource("echo-uni") + lateinit var echoUni: URI - @TestHTTPResource("binary-echo") lateinit var binaryEcho: URI + @TestHTTPResource("binary-echo") + lateinit var binaryEcho: URI - @TestHTTPResource("binary-echo-suspend") lateinit var binaryEchoSuspend: URI + @TestHTTPResource("binary-echo-suspend") + lateinit var binaryEchoSuspend: URI - @TestHTTPResource("binary-echo-uni") lateinit var binaryEchoUni: URI + @TestHTTPResource("binary-echo-uni") + lateinit var binaryEchoUni: URI @Test fun testEcho() { diff --git a/independent-projects/arc/pom.xml b/independent-projects/arc/pom.xml index 5f4438b01dd20..247c010ffd77d 100644 --- a/independent-projects/arc/pom.xml +++ b/independent-projects/arc/pom.xml @@ -327,18 +327,32 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin - spotless-apply - verify + process-sources - apply + format + + net.revelc.code + impsort-maven-plugin + + + sort-imports + + sort + + + + + true + + @@ -353,11 +367,26 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + validate + + + + + + net.revelc.code + impsort-maven-plugin + + true + - verify + check-imports check diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml index 66f78c5c1dada..90230e504dde6 100644 --- a/independent-projects/bootstrap/pom.xml +++ b/independent-projects/bootstrap/pom.xml @@ -239,18 +239,32 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin - spotless-apply - verify + process-sources - apply + format + + net.revelc.code + impsort-maven-plugin + + + sort-imports + + sort + + + + + true + + @@ -265,11 +279,26 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + validate + + + + + + net.revelc.code + impsort-maven-plugin + + true + - verify + check-imports check diff --git a/independent-projects/enforcer-rules/pom.xml b/independent-projects/enforcer-rules/pom.xml index 75d63e6a5bc57..3d1a381bbd198 100644 --- a/independent-projects/enforcer-rules/pom.xml +++ b/independent-projects/enforcer-rules/pom.xml @@ -173,18 +173,32 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin - spotless-apply - verify + process-sources - apply + format + + net.revelc.code + impsort-maven-plugin + + + sort-imports + + sort + + + + + true + + @@ -199,11 +213,26 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + validate + + + + + + net.revelc.code + impsort-maven-plugin + + true + - verify + check-imports check diff --git a/independent-projects/extension-maven-plugin/pom.xml b/independent-projects/extension-maven-plugin/pom.xml index 77a1372bf1f75..5b415927fa244 100644 --- a/independent-projects/extension-maven-plugin/pom.xml +++ b/independent-projects/extension-maven-plugin/pom.xml @@ -455,18 +455,32 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin - spotless-apply - verify + process-sources - apply + format + + net.revelc.code + impsort-maven-plugin + + + sort-imports + + sort + + + + + true + + @@ -481,11 +495,26 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + validate + + + + + + net.revelc.code + impsort-maven-plugin + + true + - verify + check-imports check diff --git a/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/capabilities/CapabilitiesConfig.java b/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/capabilities/CapabilitiesConfig.java index be6f439fb7b01..6e16cc9f1dabe 100644 --- a/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/capabilities/CapabilitiesConfig.java +++ b/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/capabilities/CapabilitiesConfig.java @@ -6,30 +6,30 @@ public class CapabilitiesConfig { -private List provides = new ArrayList<>(0); -private List requires = new ArrayList<>(0); + private List provides = new ArrayList<>(0); + private List requires = new ArrayList<>(0); -public void addProvides(CapabilityConfig capability) { -provides.add(capability); -} + public void addProvides(CapabilityConfig capability) { + provides.add(capability); + } -public void addProvidesIf(CapabilityConfig capability) { -provides.add(capability); -} + public void addProvidesIf(CapabilityConfig capability) { + provides.add(capability); + } -public Collection getProvides() { -return provides; -} + public Collection getProvides() { + return provides; + } -public void addRequires(CapabilityConfig capability) { -requires.add(capability); -} + public void addRequires(CapabilityConfig capability) { + requires.add(capability); + } -public void addRequiresIf(CapabilityConfig capability) { -requires.add(capability); -} + public void addRequiresIf(CapabilityConfig capability) { + requires.add(capability); + } -public Collection getRequires() { -return requires; -} + public Collection getRequires() { + return requires; + } } diff --git a/independent-projects/junit5-virtual-threads/pom.xml b/independent-projects/junit5-virtual-threads/pom.xml index 10986a42a2633..22d0db159b16a 100644 --- a/independent-projects/junit5-virtual-threads/pom.xml +++ b/independent-projects/junit5-virtual-threads/pom.xml @@ -218,18 +218,32 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin - spotless-apply - verify + process-sources - apply + format + + net.revelc.code + impsort-maven-plugin + + + sort-imports + + sort + + + + + true + + @@ -244,11 +258,26 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + validate + + + + + + net.revelc.code + impsort-maven-plugin + + true + - verify + check-imports check diff --git a/independent-projects/parent/pom.xml b/independent-projects/parent/pom.xml index 2a1cfeef20c3d..e4bf460c9d2ca 100644 --- a/independent-projects/parent/pom.xml +++ b/independent-projects/parent/pom.xml @@ -378,6 +378,19 @@ ${format.skip} + + net.revelc.code + impsort-maven-plugin + ${version.impsort.plugin} + + + .cache/impsort-maven-plugin-${version.impsort.plugin} + java.,javax.,jakarta.,org.,com. + * + ${format.skip} + true + + org.apache.maven.plugins maven-surefire-plugin diff --git a/independent-projects/qute/pom.xml b/independent-projects/qute/pom.xml index 2fc86393f341b..bc8224be009a5 100644 --- a/independent-projects/qute/pom.xml +++ b/independent-projects/qute/pom.xml @@ -230,18 +230,32 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin - spotless-apply - verify + process-sources - apply + format + + net.revelc.code + impsort-maven-plugin + + + sort-imports + + sort + + + + + true + + @@ -256,11 +270,26 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + validate + + + + + + net.revelc.code + impsort-maven-plugin + + true + - verify + check-imports check diff --git a/independent-projects/resteasy-reactive/pom.xml b/independent-projects/resteasy-reactive/pom.xml index e5e992fbfc189..d27385c16dddd 100644 --- a/independent-projects/resteasy-reactive/pom.xml +++ b/independent-projects/resteasy-reactive/pom.xml @@ -585,18 +585,37 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin - spotless-apply - verify + process-sources - apply + format + + net.revelc.code + impsort-maven-plugin + + + sort-imports + + sort + + + + + + .cache/impsort-maven-plugin-${impsort-maven-plugin.version} + java.,javax.,jakarta.,org.,com. + * + ${format.skip} + true + + @@ -611,11 +630,26 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + validate + + + + + + net.revelc.code + impsort-maven-plugin + + true + - verify + check-imports check diff --git a/independent-projects/tools/pom.xml b/independent-projects/tools/pom.xml index 843794d4d043f..872cee0a98093 100644 --- a/independent-projects/tools/pom.xml +++ b/independent-projects/tools/pom.xml @@ -306,18 +306,32 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin - spotless-apply - verify + process-sources - apply + format + + net.revelc.code + impsort-maven-plugin + + + sort-imports + + sort + + + + + true + + @@ -332,11 +346,26 @@ - com.diffplug.spotless - spotless-maven-plugin + net.revelc.code.formatter + formatter-maven-plugin + + + process-sources + + validate + + + + + + net.revelc.code + impsort-maven-plugin + + true + - verify + check-imports check diff --git a/integration-tests/virtual-threads/pom.xml b/integration-tests/virtual-threads/pom.xml index 2971fd8cfe635..5dd0ca4f757d3 100644 --- a/integration-tests/virtual-threads/pom.xml +++ b/integration-tests/virtual-threads/pom.xml @@ -78,6 +78,21 @@ + + net.revelc.code + impsort-maven-plugin + + + sort-imports + + sort + + + + + ${impsort.skip} + + diff --git a/pom.xml b/pom.xml index e44b31eea3932..6f6970793e253 100644 --- a/pom.xml +++ b/pom.xml @@ -71,7 +71,7 @@ 0.8.13 7.3.1 5.5.5 - 6.6.16.Final + 6.6.17.Final 3.1.0 4.13.0 1.15.11 From 781a9563987deec21dc36e481fa39edfca224414 Mon Sep 17 00:00:00 2001 From: Vincent Potucek Date: Sat, 31 May 2025 22:26:22 +0200 Subject: [PATCH 5/6] Add missing @Override to overriding and implementing methods --- .../io/quarkus/launcher/RuntimeLaunchClassLoader.java | 2 ++ .../src/main/java/io/quarkus/runtime/Application.java | 1 + .../quarkus/runtime/configuration/ArrayListFactory.java | 1 + .../runtime/configuration/ConfigurationException.java | 1 + .../io/quarkus/runtime/configuration/HashSetFactory.java | 1 + .../runtime/configuration/MemorySizeConverter.java | 1 + .../io/quarkus/runtime/configuration/RegexConverter.java | 1 + .../java/io/quarkus/runtime/logging/InheritableLevel.java | 6 ++++++ .../java/io/quarkus/runtime/logging/LevelConverter.java | 1 + .../java/io/quarkus/runtime/util/EnumerationUtil.java | 3 +++ .../runtime/util/ForwardingScheduledExecutorService.java | 2 ++ .../src/main/java/io/quarkus/runtime/util/StringUtil.java | 8 ++++++++ .../runtime/configuration/ConfigInstantiatorTestCase.java | 4 ++++ .../io/quarkus/amazon/lambda/http/LambdaHttpHandler.java | 1 + .../io/quarkus/amazon/lambda/http/LambdaHttpHandler.java | 1 + .../validator/HibernateValidatorFactoryCustomizer.java | 1 + .../oidc/client/filter/OidcClientRequestFilter.java | 1 + .../src/main/java/io/quarkus/oidc/OidcTenantConfig.java | 1 + .../java/io/quarkus/oidc/runtime/BlockingTaskRunner.java | 2 ++ .../main/java/io/quarkus/oidc/runtime/OidcProvider.java | 1 + .../io/quarkus/oidc/runtime/OidcProviderClientImpl.java | 8 ++++++++ .../DefaultMicroprofileRestClientExceptionMapper.java | 2 ++ .../client/reactive/runtime/ExtendedHeaderFiller.java | 2 ++ .../runtime/ReactiveRestClientBuilderFactory.java | 1 + .../common/runtime/VertxBufferMessageBodyWriter.java | 4 +++- .../reactive/spi/ContainerRequestFilterBuildItem.java | 1 + .../reactive/spi/ContainerResponseFilterBuildItem.java | 1 + .../resteasy/reactive/spi/ReaderInterceptorBuildItem.java | 2 ++ .../resteasy/reactive/spi/WriterInterceptorBuildItem.java | 2 ++ .../deployment/processor/JacksonDeserializerFactory.java | 2 ++ .../deployment/processor/JacksonOptimizationConfig.java | 1 + .../reactive/jackson/deployment/test/AbstractPet.java | 2 ++ .../serialization/common/JsonBuilderCustomizer.java | 1 + .../server/servlet/runtime/ServletRequestContext.java | 4 ++++ .../customexceptions/ImplClassExceptionMapperTest.java | 4 ++++ .../deployment/QuarkusSecurityWebAuthnProcessor.java | 1 + .../smallrye/metrics/runtime/SmallRyeMetricsFactory.java | 2 ++ .../virtual/threads/DelegatingExecutorService.java | 4 ++++ 38 files changed, 83 insertions(+), 1 deletion(-) diff --git a/core/launcher/src/main/java/io/quarkus/launcher/RuntimeLaunchClassLoader.java b/core/launcher/src/main/java/io/quarkus/launcher/RuntimeLaunchClassLoader.java index ac77fdd15e9d3..f7e84c1e727a7 100644 --- a/core/launcher/src/main/java/io/quarkus/launcher/RuntimeLaunchClassLoader.java +++ b/core/launcher/src/main/java/io/quarkus/launcher/RuntimeLaunchClassLoader.java @@ -65,6 +65,7 @@ private String getPackageNameFromClassName(String className) { return className.substring(0, index); } + @Override protected Class findClass(String moduleName, String name) { try { return findClass(name); @@ -73,6 +74,7 @@ protected Class findClass(String moduleName, String name) { } } + @Override protected URL findResource(String moduleName, String name) throws IOException { return findResource(name); } diff --git a/core/runtime/src/main/java/io/quarkus/runtime/Application.java b/core/runtime/src/main/java/io/quarkus/runtime/Application.java index 6edb476a7718c..f1d68201c42d7 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/Application.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/Application.java @@ -132,6 +132,7 @@ public final void start(String[] args) { protected abstract void doStart(String[] args); + @Override public final void close() { try { stop(); diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ArrayListFactory.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ArrayListFactory.java index 67aa5fafafd70..b880a36581acd 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ArrayListFactory.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ArrayListFactory.java @@ -12,6 +12,7 @@ public final class ArrayListFactory implements IntFunction> { private ArrayListFactory() { } + @Override public ArrayList apply(final int value) { return new ArrayList<>(value); } diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigurationException.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigurationException.java index d9042f9ee9173..ef4e1c0af8a8c 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigurationException.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigurationException.java @@ -86,6 +86,7 @@ public ConfigurationException(Throwable cause) { configKeys = Collections.emptySet(); } + @Override public Set getConfigKeys() { return configKeys; } diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/HashSetFactory.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/HashSetFactory.java index ddc7556ef240d..1a96ea455b4c0 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/HashSetFactory.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/HashSetFactory.java @@ -12,6 +12,7 @@ public final class HashSetFactory implements IntFunction> { private HashSetFactory() { } + @Override public HashSet apply(final int value) { return new HashSet<>(getInitialCapacityFromExpectedSize(value)); } diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/MemorySizeConverter.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/MemorySizeConverter.java index 8c304ea0bbd1c..bdb37e113577b 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/MemorySizeConverter.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/MemorySizeConverter.java @@ -43,6 +43,7 @@ public class MemorySizeConverter implements Converter, Serializable * @param value - value to convert. * @return {@link MemorySize} - a memory size represented by the given value */ + @Override public MemorySize convert(String value) { value = value.trim(); if (value.isEmpty()) { diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/RegexConverter.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/RegexConverter.java index 518f8d03d0167..788d57f391a33 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/RegexConverter.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/RegexConverter.java @@ -23,6 +23,7 @@ public class RegexConverter implements Converter, Serializable { public RegexConverter() { } + @Override public Pattern convert(final String value) { return value.isEmpty() ? null : Pattern.compile(value); } diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/InheritableLevel.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/InheritableLevel.java index 57dfc2bcc8082..e6fea9eefb5ed 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/logging/InheritableLevel.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/InheritableLevel.java @@ -48,10 +48,12 @@ public static final class ActualLevel extends InheritableLevel { this.level = level; } + @Override public boolean isInherited() { return false; } + @Override public Level getLevel() { return level; } @@ -60,6 +62,7 @@ public String toString() { return level.toString(); } + @Override public boolean equals(final InheritableLevel other) { return other instanceof ActualLevel && level.equals(((ActualLevel) other).level); } @@ -75,10 +78,12 @@ public static final class Inherited extends InheritableLevel { private Inherited() { } + @Override public boolean isInherited() { return true; } + @Override public Level getLevel() { throw new NoSuchElementException(); } @@ -87,6 +92,7 @@ public String toString() { return "inherited"; } + @Override public boolean equals(final InheritableLevel other) { return other instanceof Inherited; } diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/LevelConverter.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/LevelConverter.java index 73cbb3548d656..5899bc1bbb019 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/logging/LevelConverter.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/LevelConverter.java @@ -19,6 +19,7 @@ public final class LevelConverter implements Converter, Serializable { private static final long serialVersionUID = 704275577610445233L; + @Override public Level convert(final String value) { if (value == null || value.isEmpty()) { return null; diff --git a/core/runtime/src/main/java/io/quarkus/runtime/util/EnumerationUtil.java b/core/runtime/src/main/java/io/quarkus/runtime/util/EnumerationUtil.java index 6dbab086bb060..93b395965e52a 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/util/EnumerationUtil.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/util/EnumerationUtil.java @@ -35,11 +35,13 @@ class Adapter implements Enumeration, Consumer { boolean valueReady; T nextElement; + @Override public void accept(T t) { this.valueReady = true; this.nextElement = t; } + @Override public boolean hasMoreElements() { if (!this.valueReady) { spliterator.tryAdvance(this); @@ -48,6 +50,7 @@ public boolean hasMoreElements() { return this.valueReady; } + @Override public T nextElement() { if (!this.valueReady && !this.hasMoreElements()) { throw new NoSuchElementException(); diff --git a/core/runtime/src/main/java/io/quarkus/runtime/util/ForwardingScheduledExecutorService.java b/core/runtime/src/main/java/io/quarkus/runtime/util/ForwardingScheduledExecutorService.java index eae3e5cf98a32..41ec2522e3d38 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/util/ForwardingScheduledExecutorService.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/util/ForwardingScheduledExecutorService.java @@ -12,6 +12,8 @@ */ public abstract class ForwardingScheduledExecutorService extends ForwardingExecutorService implements ScheduledExecutorService { + @Override + @Override protected abstract ScheduledExecutorService delegate(); @Override diff --git a/core/runtime/src/main/java/io/quarkus/runtime/util/StringUtil.java b/core/runtime/src/main/java/io/quarkus/runtime/util/StringUtil.java index 52e33c76b2d50..44a18fee3170e 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/util/StringUtil.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/util/StringUtil.java @@ -29,10 +29,12 @@ public static Iterator camelHumpsIterator(String str) { return new Iterator() { int idx; + @Override public boolean hasNext() { return idx < str.length(); } + @Override public String next() { if (idx == str.length()) throw new NoSuchElementException(); @@ -101,10 +103,12 @@ public String next() { public static Iterator lowerCase(Iterator orig) { return new Iterator() { + @Override public boolean hasNext() { return orig.hasNext(); } + @Override public String next() { return orig.next().toLowerCase(Locale.ROOT); } @@ -145,10 +149,12 @@ public static Iterator lowerCaseFirst(Iterator orig) { return new Iterator() { boolean first = true; + @Override public boolean hasNext() { return orig.hasNext(); } + @Override public String next() { final String next = orig.next(); if (first) { @@ -165,6 +171,7 @@ public static Iterator withoutSuffix(Iterator orig, String... su return new Iterator() { String next = null; + @Override public boolean hasNext() { if (next == null) { if (!orig.hasNext()) @@ -178,6 +185,7 @@ public boolean hasNext() { return true; } + @Override public String next() { if (!hasNext()) throw new NoSuchElementException(); diff --git a/core/runtime/src/test/java/io/quarkus/runtime/configuration/ConfigInstantiatorTestCase.java b/core/runtime/src/test/java/io/quarkus/runtime/configuration/ConfigInstantiatorTestCase.java index 657dbc226c7b0..f274df37bef9b 100644 --- a/core/runtime/src/test/java/io/quarkus/runtime/configuration/ConfigInstantiatorTestCase.java +++ b/core/runtime/src/test/java/io/quarkus/runtime/configuration/ConfigInstantiatorTestCase.java @@ -157,18 +157,22 @@ private static class WithNameConfig { private static class TestConfigSource implements ConfigSource { + @Override public Map getProperties() { return TEST_CONFIG_MAP; } + @Override public Set getPropertyNames() { return TEST_CONFIG_MAP.keySet(); } + @Override public String getValue(final String propertyName) { return TEST_CONFIG_MAP.get(propertyName); } + @Override public String getName() { return "ConfigInstantiatorTestCase config source"; } diff --git a/extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java b/extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java index d683dd62802e3..68207fc2a4d2f 100644 --- a/extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java +++ b/extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java @@ -56,6 +56,7 @@ public class LambdaHttpHandler implements RequestHandler COMMA_HEADERS = Set.of("access-control-request-headers"); + @Override public APIGatewayV2HTTPResponse handleRequest(APIGatewayV2HTTPEvent request, Context context) { InetSocketAddress clientAddress = null; if (request.getRequestContext() != null && request.getRequestContext().getHttp() != null) { diff --git a/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java b/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java index ebe2123e8be57..87cca7dbfe5bf 100644 --- a/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java +++ b/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java @@ -51,6 +51,7 @@ public class LambdaHttpHandler implements RequestHandler configuration); } diff --git a/extensions/oidc-client-filter/runtime/src/main/java/io/quarkus/oidc/client/filter/OidcClientRequestFilter.java b/extensions/oidc-client-filter/runtime/src/main/java/io/quarkus/oidc/client/filter/OidcClientRequestFilter.java index 8c07d54f62560..31fcfb42c7b59 100644 --- a/extensions/oidc-client-filter/runtime/src/main/java/io/quarkus/oidc/client/filter/OidcClientRequestFilter.java +++ b/extensions/oidc-client-filter/runtime/src/main/java/io/quarkus/oidc/client/filter/OidcClientRequestFilter.java @@ -19,6 +19,7 @@ public class OidcClientRequestFilter extends AbstractOidcClientRequestFilter { @Inject OidcClientFilterConfig oidcClientFilterConfig; + @Override protected Optional clientId() { return oidcClientFilterConfig.clientName(); } diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java index ff0eef86499a8..b825eb1a77492 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java @@ -2489,6 +2489,7 @@ public Binding getBinding() { return binding; } + @Override public io.quarkus.oidc.runtime.OidcTenantConfig.Binding binding() { return binding; } diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BlockingTaskRunner.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BlockingTaskRunner.java index 70d9e6baaf359..1152fc50b1b69 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BlockingTaskRunner.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BlockingTaskRunner.java @@ -30,6 +30,8 @@ public BlockingTaskRunner(BlockingSecurityExecutor blockingExecutor) { this.blockingExecutor = blockingExecutor; } + @Override + @Override public Uni runBlocking(Supplier function) { return blockingExecutor.executeBlocking(function); } diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProvider.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProvider.java index f03d2c09e2a6d..1344eccf6b27d 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProvider.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProvider.java @@ -616,6 +616,7 @@ private Key getKeyWithS256Thumbprint(String thumbprint) { } } + @Override public Uni refresh() { final long now = now(); if (now > lastForcedRefreshTime + forcedJwksRefreshIntervalMilliSecs) { diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProviderClientImpl.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProviderClientImpl.java index e4c01c2112f73..d1e8cec6f3b06 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProviderClientImpl.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcProviderClientImpl.java @@ -142,6 +142,8 @@ private Uni doGetJsonWebKeySet(OidcRequestContextProperties reque .transform(resp -> getJsonWebKeySet(requestProps, resp)); } + @Override + @Override public Uni getUserInfo(final String accessToken) { final OidcRequestContextProperties requestProps = getRequestProps(null, null); @@ -209,6 +211,8 @@ private Uni doGetUserInfo(OidcRequestContextProperties request .onItem().transform(resp -> getUserInfo(requestProps, resp)); } + @Override + @Override public Uni introspectAccessToken(final String token) { final MultiMap introspectionParams = new MultiMap(io.vertx.core.MultiMap.caseInsensitiveMultiMap()); introspectionParams.add(OidcConstants.INTROSPECTION_TOKEN, token); @@ -247,10 +251,14 @@ Uni refreshAuthorizationCodeTokens(String refreshToken) .transform(resp -> getAuthorizationCodeTokens(requestProps, resp)); } + @Override + @Override public Uni revokeAccessToken(String accessToken) { return revokeToken(accessToken, OidcConstants.ACCESS_TOKEN_VALUE); } + @Override + @Override public Uni revokeRefreshToken(String refreshToken) { return revokeToken(refreshToken, OidcConstants.REFRESH_TOKEN_VALUE); } diff --git a/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/DefaultMicroprofileRestClientExceptionMapper.java b/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/DefaultMicroprofileRestClientExceptionMapper.java index 613da542c1ac3..319c6a2a1da2b 100644 --- a/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/DefaultMicroprofileRestClientExceptionMapper.java +++ b/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/DefaultMicroprofileRestClientExceptionMapper.java @@ -9,6 +9,7 @@ @SuppressWarnings("rawtypes") public class DefaultMicroprofileRestClientExceptionMapper implements ResponseExceptionMapper { + @Override public Throwable toThrowable(Response response) { try { response.bufferEntity(); @@ -29,6 +30,7 @@ public Throwable toThrowable(Response response) { return exception; } + @Override public int getPriority() { return Integer.MAX_VALUE; } diff --git a/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/ExtendedHeaderFiller.java b/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/ExtendedHeaderFiller.java index 03c07fdef4e57..291f961e2669f 100644 --- a/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/ExtendedHeaderFiller.java +++ b/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/ExtendedHeaderFiller.java @@ -10,6 +10,8 @@ public interface ExtendedHeaderFiller extends HeaderFiller { void addHeaders(MultivaluedMap headers, ResteasyReactiveClientRequestContext requestContext); + @Override + @Override default void addHeaders(MultivaluedMap headers) { throw new IllegalStateException("should not be used"); } diff --git a/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/ReactiveRestClientBuilderFactory.java b/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/ReactiveRestClientBuilderFactory.java index 5a0a1c1481dc5..3284c8f041c42 100644 --- a/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/ReactiveRestClientBuilderFactory.java +++ b/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/ReactiveRestClientBuilderFactory.java @@ -8,6 +8,7 @@ public class ReactiveRestClientBuilderFactory implements RestClientBuilderFactory { + @Override public RestClientBuilder newBuilder(Class proxyType, RestClientsConfig restClientsConfigRoot) { RegisterRestClient annotation = proxyType.getAnnotation(RegisterRestClient.class); String configKey = null; diff --git a/extensions/resteasy-reactive/rest-common/runtime/src/main/java/io/quarkus/resteasy/reactive/common/runtime/VertxBufferMessageBodyWriter.java b/extensions/resteasy-reactive/rest-common/runtime/src/main/java/io/quarkus/resteasy/reactive/common/runtime/VertxBufferMessageBodyWriter.java index e8fb72fe0c9c1..29c1b2d6c16e0 100644 --- a/extensions/resteasy-reactive/rest-common/runtime/src/main/java/io/quarkus/resteasy/reactive/common/runtime/VertxBufferMessageBodyWriter.java +++ b/extensions/resteasy-reactive/rest-common/runtime/src/main/java/io/quarkus/resteasy/reactive/common/runtime/VertxBufferMessageBodyWriter.java @@ -13,12 +13,14 @@ import io.vertx.core.buffer.Buffer; public class VertxBufferMessageBodyWriter implements MessageBodyWriter { + @Override public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { return true; } + @Override public void writeTo(Buffer buffer, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, - MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { + MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { entityStream.write(buffer.getBytes()); } } diff --git a/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/ContainerRequestFilterBuildItem.java b/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/ContainerRequestFilterBuildItem.java index 7f7a1faed4c92..18b1f0b322c16 100644 --- a/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/ContainerRequestFilterBuildItem.java +++ b/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/ContainerRequestFilterBuildItem.java @@ -73,6 +73,7 @@ public Builder setFilterSourceMethod(MethodInfo filterSourceMethod) { return this; } + @Override public ContainerRequestFilterBuildItem build() { return new ContainerRequestFilterBuildItem(this); } diff --git a/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/ContainerResponseFilterBuildItem.java b/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/ContainerResponseFilterBuildItem.java index f4c0c51937d41..517e56214813e 100644 --- a/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/ContainerResponseFilterBuildItem.java +++ b/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/ContainerResponseFilterBuildItem.java @@ -28,6 +28,7 @@ public Builder setFilterSourceMethod(MethodInfo filterSourceMethod) { return this; } + @Override public ContainerResponseFilterBuildItem build() { return new ContainerResponseFilterBuildItem(this); } diff --git a/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/ReaderInterceptorBuildItem.java b/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/ReaderInterceptorBuildItem.java index 9b9edd15f3eef..5c8635d277592 100644 --- a/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/ReaderInterceptorBuildItem.java +++ b/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/ReaderInterceptorBuildItem.java @@ -12,6 +12,8 @@ public Builder(String className) { super(className); } + @Override + @Override public ReaderInterceptorBuildItem build() { return new ReaderInterceptorBuildItem(this); } diff --git a/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/WriterInterceptorBuildItem.java b/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/WriterInterceptorBuildItem.java index 835d900421430..913c51b20f43f 100644 --- a/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/WriterInterceptorBuildItem.java +++ b/extensions/resteasy-reactive/rest-common/spi-deployment/src/main/java/io/quarkus/resteasy/reactive/spi/WriterInterceptorBuildItem.java @@ -12,6 +12,8 @@ public Builder(String className) { super(className); } + @Override + @Override public WriterInterceptorBuildItem build() { return new WriterInterceptorBuildItem(this); } diff --git a/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/JacksonDeserializerFactory.java b/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/JacksonDeserializerFactory.java index 8b94c0c4b8e7b..d1da8444740f2 100644 --- a/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/JacksonDeserializerFactory.java +++ b/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/JacksonDeserializerFactory.java @@ -206,6 +206,8 @@ protected String getClassSuffix() { return "$quarkusjacksondeserializer"; } + @Override + @Override protected String[] getInterfacesNames(ClassInfo classInfo) { return classInfo.typeParameters().isEmpty() ? new String[0] : new String[] { ContextualDeserializer.class.getName() }; } diff --git a/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/JacksonOptimizationConfig.java b/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/JacksonOptimizationConfig.java index cf697bafb73c9..861973760590e 100644 --- a/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/JacksonOptimizationConfig.java +++ b/extensions/resteasy-reactive/rest-jackson/deployment/src/main/java/io/quarkus/resteasy/reactive/jackson/deployment/processor/JacksonOptimizationConfig.java @@ -23,6 +23,7 @@ public interface JacksonOptimizationConfig { class IsReflectionFreeSerializersEnabled implements BooleanSupplier { JacksonOptimizationConfig config; + @Override public boolean getAsBoolean() { return config.enableReflectionFreeSerializers(); } diff --git a/extensions/resteasy-reactive/rest-jackson/deployment/src/test/java/io/quarkus/resteasy/reactive/jackson/deployment/test/AbstractPet.java b/extensions/resteasy-reactive/rest-jackson/deployment/src/test/java/io/quarkus/resteasy/reactive/jackson/deployment/test/AbstractPet.java index 559a5fbfd1f27..080bdc3b2d315 100644 --- a/extensions/resteasy-reactive/rest-jackson/deployment/src/test/java/io/quarkus/resteasy/reactive/jackson/deployment/test/AbstractPet.java +++ b/extensions/resteasy-reactive/rest-jackson/deployment/src/test/java/io/quarkus/resteasy/reactive/jackson/deployment/test/AbstractPet.java @@ -5,6 +5,8 @@ public abstract class AbstractPet implements SecuredPersonInterface { private String publicName; private Veterinarian veterinarian; + @Override + @Override public String getPublicName() { return publicName; } diff --git a/extensions/resteasy-reactive/rest-kotlin-serialization-common/runtime/src/main/java/io/quarkus/resteasy/reactive/kotlin/serialization/common/JsonBuilderCustomizer.java b/extensions/resteasy-reactive/rest-kotlin-serialization-common/runtime/src/main/java/io/quarkus/resteasy/reactive/kotlin/serialization/common/JsonBuilderCustomizer.java index 4948a28be2a12..d764b27a08b7a 100644 --- a/extensions/resteasy-reactive/rest-kotlin-serialization-common/runtime/src/main/java/io/quarkus/resteasy/reactive/kotlin/serialization/common/JsonBuilderCustomizer.java +++ b/extensions/resteasy-reactive/rest-kotlin-serialization-common/runtime/src/main/java/io/quarkus/resteasy/reactive/kotlin/serialization/common/JsonBuilderCustomizer.java @@ -23,6 +23,7 @@ default int priority() { return DEFAULT_PRIORITY; } + @Override default int compareTo(JsonBuilderCustomizer o) { return Integer.compare(o.priority(), priority()); } diff --git a/extensions/resteasy-reactive/rest-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContext.java b/extensions/resteasy-reactive/rest-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContext.java index 1ef1975f9f368..5c1e6f2a9fabb 100644 --- a/extensions/resteasy-reactive/rest-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContext.java +++ b/extensions/resteasy-reactive/rest-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContext.java @@ -83,10 +83,12 @@ public ServletRequestContext(Deployment deployment, exchange.addResponseCommitListener(this); } + @Override protected boolean isRequestScopeManagementRequired() { return asyncContext != null; } + @Override protected void beginAsyncProcessing() { asyncContext = request.startAsync(); } @@ -129,6 +131,7 @@ protected void setQueryParamsFrom(String uri) { } } + @Override protected void handleRequestScopeActivation() { super.handleRequestScopeActivation(); QuarkusHttpUser user = (QuarkusHttpUser) context.user(); @@ -149,6 +152,7 @@ private static Event createEvent() { return Arc.container().beanManager().getEvent().select(SecurityIdentity.class); } + @Override protected SecurityContext createSecurityContext() { return new ResteasyReactiveSecurityContext(context); } diff --git a/extensions/resteasy-reactive/rest/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/customexceptions/ImplClassExceptionMapperTest.java b/extensions/resteasy-reactive/rest/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/customexceptions/ImplClassExceptionMapperTest.java index 147394df42fa5..34a71ffa58dc7 100644 --- a/extensions/resteasy-reactive/rest/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/customexceptions/ImplClassExceptionMapperTest.java +++ b/extensions/resteasy-reactive/rest/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/customexceptions/ImplClassExceptionMapperTest.java @@ -69,6 +69,8 @@ public Response handleThrowable(RuntimeException t) { return Response.status(416).build(); } + @Override + @Override public String throwsException() { throw removeStackTrace(new RuntimeException()); } @@ -84,6 +86,8 @@ public interface CustomResource { public static class GlobalCustomResourceImpl implements GlobalCustomResource { + @Override + @Override public String throwsException() { throw removeStackTrace(new RuntimeException()); } diff --git a/extensions/security-webauthn/deployment/src/main/java/io/quarkus/security/webauthn/deployment/QuarkusSecurityWebAuthnProcessor.java b/extensions/security-webauthn/deployment/src/main/java/io/quarkus/security/webauthn/deployment/QuarkusSecurityWebAuthnProcessor.java index a624fdf872752..14c1d1547d708 100644 --- a/extensions/security-webauthn/deployment/src/main/java/io/quarkus/security/webauthn/deployment/QuarkusSecurityWebAuthnProcessor.java +++ b/extensions/security-webauthn/deployment/src/main/java/io/quarkus/security/webauthn/deployment/QuarkusSecurityWebAuthnProcessor.java @@ -121,6 +121,7 @@ List registerHttpAuthMechanismAnnotation() public static class IsEnabled implements BooleanSupplier { WebAuthnBuildTimeConfig config; + @Override public boolean getAsBoolean() { return config.enabled(); } diff --git a/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsFactory.java b/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsFactory.java index 9540909ef2566..094e2c1485301 100644 --- a/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsFactory.java +++ b/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsFactory.java @@ -19,6 +19,7 @@ import io.smallrye.metrics.MetricRegistries; public class SmallRyeMetricsFactory implements MetricsFactory { + @Override public boolean metricsSystemSupported(String name) { return MetricsFactory.MP_METRICS.equals(name); } @@ -50,6 +51,7 @@ static class SmallRyeMetricBuilder implements MetricsFactory.MetricBuilder { .withName(name); } + @Override public MetricBuilder unit(String unit) { builder.withUnit(unit); return this; diff --git a/extensions/virtual-threads/runtime/src/main/java/io/quarkus/virtual/threads/DelegatingExecutorService.java b/extensions/virtual-threads/runtime/src/main/java/io/quarkus/virtual/threads/DelegatingExecutorService.java index d4b31e6f0ae8a..e5f1dd09f1c78 100644 --- a/extensions/virtual-threads/runtime/src/main/java/io/quarkus/virtual/threads/DelegatingExecutorService.java +++ b/extensions/virtual-threads/runtime/src/main/java/io/quarkus/virtual/threads/DelegatingExecutorService.java @@ -21,16 +21,19 @@ protected ExecutorService delegate() { return delegate; } + @Override public boolean isShutdown() { // container managed executors are never shut down from the application's perspective return false; } + @Override public boolean isTerminated() { // container managed executors are never shut down from the application's perspective return false; } + @Override public boolean awaitTermination(final long timeout, final TimeUnit unit) { return false; } @@ -39,6 +42,7 @@ public void shutdown() { throw new UnsupportedOperationException("shutdown not allowed on managed executor service"); } + @Override public List shutdownNow() { throw new UnsupportedOperationException("shutdownNow not allowed on managed executor service"); } From d7e04ad8da3f72afbc0f2feaa940c4c4f8597456 Mon Sep 17 00:00:00 2001 From: Vincent Potucek Date: Sun, 1 Jun 2025 14:51:44 +0200 Subject: [PATCH 6/6] pmd MissingOverride --- independent-projects/qute/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/independent-projects/qute/pom.xml b/independent-projects/qute/pom.xml index bc8224be009a5..3a3b6ffc01f4d 100644 --- a/independent-projects/qute/pom.xml +++ b/independent-projects/qute/pom.xml @@ -248,7 +248,7 @@ sort-imports - sort + sort