From 571740884320489d6d68286758c15cffea54613f Mon Sep 17 00:00:00 2001 From: Eric Deandrea Date: Fri, 21 Jun 2024 16:40:46 -0400 Subject: [PATCH] Adding new WithTesResource annotation Closes #37853 --- .../org/acme/MyMessagingApplicationTest.java | 2 +- docs/src/main/asciidoc/datasource.adoc | 8 +- .../asciidoc/getting-started-testing.adoc | 25 ++--- .../asciidoc/kafka-schema-registry-avro.adoc | 4 +- .../kafka-schema-registry-json-schema.adoc | 4 +- docs/src/main/asciidoc/kafka.adoc | 12 +- docs/src/main/asciidoc/kubernetes-client.adoc | 6 +- docs/src/main/asciidoc/messaging.adoc | 4 +- .../observability-devservices-lgtm.adoc | 4 +- .../asciidoc/observability-devservices.adoc | 2 +- docs/src/main/asciidoc/rest-client.adoc | 11 +- docs/src/main/asciidoc/resteasy-client.adoc | 4 +- docs/src/main/asciidoc/security-oauth2.adoc | 15 +-- ...rity-oidc-bearer-token-authentication.adoc | 8 +- ...ecurity-oidc-code-flow-authentication.adoc | 10 +- .../io/quarkus/agroal/test/TestResources.java | 4 +- .../elytron/security/ldap/CacheTest.java | 4 +- .../security/ldap/LdapSecurityRealmTest.java | 4 +- .../security/ldap/SearchRecursiveTest.java | 4 +- .../flyway/test/FlywayTestResources.java | 4 +- .../test/LiquibaseTestResources.java | 4 +- .../NamedOidcClientFilterDevModeTest.java | 4 +- .../filter/OidcClientFilterDevModeTest.java | 4 +- .../GraphQLClientUsingOidcClientTest.java | 4 +- .../NamedOidcClientFilterDevModeTest.java | 4 +- .../NamedOidcClientInjectionTestCase.java | 4 +- ...CredentialsJwtPrivateKeyStoreTestCase.java | 4 +- ...lientCredentialsJwtPrivateKeyTestCase.java | 4 +- ...idcClientCredentialsJwtSecretTestCase.java | 4 +- .../client/OidcClientCredentialsTestCase.java | 4 +- ...lientUserPasswordCustomFilterTestCase.java | 4 +- .../OidcClientUserPasswordTestCase.java | 4 +- .../reactive/AccessTokenAnnotationTest.java | 4 +- .../reactive/OidcTokenPropagationTest.java | 4 +- ...SecurityIdentityAugmentorLazyAuthTest.java | 4 +- ...tionWithSecurityIdentityAugmentorTest.java | 4 +- .../AccessTokenAnnotationTest.java | 4 +- .../propagation/OidcTokenPropagationTest.java | 4 +- ...SecurityIdentityAugmentorLazyAuthTest.java | 4 +- ...tionWithSecurityIdentityAugmentorTest.java | 4 +- .../CodeFlowDevModeDefaultTenantTestCase.java | 4 +- .../oidc/test/CodeFlowDevModeTestCase.java | 4 +- ...CodeFlowVerifyAccessTokenDisabledTest.java | 4 +- ...VerifyInjectedAccessTokenDisabledTest.java | 4 +- .../CodeTenantReauthenticateTestCase.java | 4 +- .../test/CustomIdentityProviderTestCase.java | 4 +- ...BasicAuthAndBearerAuthCombinationTest.java | 4 +- ...sicAuthAndCodeFlowAuthCombinationTest.java | 4 +- .../test/UserInfoRequiredDetectionTest.java | 4 +- .../common/MongoDatabaseResolverTest.java | 4 +- .../redis/deployment/NamedRedisCacheTest.java | 4 +- .../client/ClientInjectionTest.java | 4 +- .../deployment/client/CustomizerTest.java | 4 +- .../client/datasource/CustomCodecTest.java | 4 +- .../datasource/DataSourceInjectionTest.java | 4 +- .../client/datasource/DataSourceTest.java | 4 +- .../devmode/RedisClientDevModeTestCase.java | 4 +- .../RedisClientPreloadDevModeTestCase.java | 4 +- .../client/patterns/BinaryTest.java | 4 +- .../deployment/client/patterns/CacheTest.java | 4 +- .../client/patterns/CounterTest.java | 4 +- .../client/patterns/PubSubOnStartupTest.java | 4 +- .../client/patterns/PubSubTest.java | 4 +- ...ultFileForDefaultClientPreloadingTest.java | 4 +- .../preloading/MissingFilePreloadTest.java | 4 +- .../MultiClientImportPreloadingTest.java | 4 +- ...lientImportPreloadingWithFlushAllTest.java | 4 +- ...ntImportPreloadingWithOnlyIfEmptyTest.java | 4 +- ...sForDefaultClientImportPreloadingTest.java | 4 +- ...eForDefaultClientImportPreloadingTest.java | 4 +- .../io/quarkus/it/cache/TreeTestCase.java | 4 +- ...e_quark_us_MyMessagingApplicationTest.java | 2 +- ...e_quark_us_MyMessagingApplicationTest.java | 2 +- .../it/ElytronJdbcExtensionTestResources.java | 4 +- .../it/ElytronLdapExtensionTestResources.java | 4 +- .../java/org/acme/ExampleResourceTest.java | 18 +-- .../java/org/acme/ExampleResourceTest.java | 18 +-- .../example/grpc/hibernate/TestResources.java | 4 +- .../io/quarkus/it/envers/TestResources.java | 4 +- .../orm/graphql/panache/TestResources.java | 4 +- .../io/quarkus/it/panache/TestResources.kt | 4 +- .../io/quarkus/it/panache/TestResources.java | 4 +- .../orm/rest/data/panache/TestResources.java | 4 +- .../outboxpolling/TestResources.java | 4 +- .../orm/elasticsearch/TestResources.java | 4 +- .../search/orm/opensearch/TestResources.java | 4 +- .../HibernateValidatorFunctionalityTest.java | 4 +- .../HibernateValidatorFunctionalityTest.java | 6 +- .../infinispan/cache/jpa/TestResources.java | 4 +- .../jpa/db2/HibernateOrmNoWarningsTest.java | 4 +- .../jpa/derby/HibernateOrmNoWarningsTest.java | 4 +- .../quarkus/it/jpa/derby/TestResources.java | 4 +- .../it/jpa/h2/HibernateOrmNoWarningsTest.java | 4 +- .../it/jpa/h2/HibernateOrmNoWarningsTest.java | 4 +- .../mariadb/HibernateOrmNoWarningsTest.java | 4 +- .../jpa/mssql/HibernateOrmNoWarningsTest.java | 4 +- .../jpa/mysql/HibernateOrmNoWarningsTest.java | 4 +- .../oracle/HibernateOrmNoWarningsTest.java | 4 +- .../HibernateOrmNoWarningsTest.java | 4 +- .../jpa/configurationless/TestResources.java | 4 +- .../java/io/quarkus/it/kafka/KafkaAvroIT.java | 4 +- .../quarkus/it/kafka/KafkaJsonSchemaIT.java | 4 +- .../io/quarkus/it/kafka/KafkaOauthIT.java | 4 +- .../io/quarkus/it/kafka/KafkaOauthTest.java | 4 +- .../java/io/quarkus/it/kafka/KafkaSaslIT.java | 4 +- .../io/quarkus/it/kafka/KafkaSaslTest.java | 4 +- .../quarkus/it/kafka/SaslKafkaConsumerIT.java | 4 +- .../it/kafka/SaslKafkaConsumerTest.java | 4 +- .../it/kafka/KafkaSnappyCodecTest.java | 4 +- .../it/kafka/KafkaSnappyConsumerTest.java | 4 +- .../it/kafka/SslKafkaConsumerITCase.java | 4 +- .../it/kafka/SslKafkaConsumerTest.java | 4 +- .../streams/KafkaStreamsCdiEventTest.java | 4 +- .../streams/KafkaStreamsPropertiesTest.java | 4 +- .../KafkaStreamsStartupFailureTest.java | 4 +- .../it/kafka/streams/KafkaStreamsTest.java | 4 +- .../io/quarkus/it/kafka/KafkaCodecTest.java | 4 +- .../quarkus/it/kafka/KafkaConsumerTest.java | 4 +- .../quarkus/it/kafka/KafkaProducerTest.java | 4 +- .../it/keycloak/PolicyEnforcerTest.java | 4 +- .../client/AbsentConfigMapPropertiesPMT.java | 4 +- .../client/ConfigMapPropertiesTest.java | 4 +- .../client/KubernetesClientTest.java | 4 +- .../client/KubernetesNewClientTest.java | 4 +- .../NamespacedConfigMapPropertiesTest.java | 4 +- .../client/SecretPropertiesTest.java | 4 +- .../liquibase/mongodb/FruitResourceTest.java | 4 +- .../mongodb/NativeFruitResourceTestIT.java | 4 +- .../it/liquibase/LiquibaseTestResources.java | 4 +- .../minlevel/set/LoggingFilterTest.java | 4 +- .../set/LoggingMinLevelAboveTest.java | 4 +- .../set/LoggingMinLevelBelowChildTest.java | 4 +- .../set/LoggingMinLevelBelowTest.java | 4 +- .../set/LoggingMinLevelByDefaultTest.java | 4 +- .../set/LoggingMinLevelPromoteSubTest.java | 4 +- .../set/LoggingMinLevelPromoteTest.java | 4 +- .../unset/LoggingMinLevelAboveTest.java | 4 +- .../unset/LoggingMinLevelByDefaultTest.java | 4 +- .../unset/LoggingMinLevelGlobalTest.java | 4 +- .../unset/LoggingMinLevelPromoteTest.java | 4 +- .../java/io/quarkus/it/mailer/MailerIT.java | 4 +- .../java/io/quarkus/it/mailer/MailerTest.java | 6 +- .../GetExceptionsInTestResourceTestCase.java | 4 +- ...uarkusTestNestedWithResourcesTestCase.java | 4 +- .../io/quarkus/it/main/TestResources.java | 4 +- .../micrometer/prometheus/TestResources.java | 4 +- .../quarkus/it/mongodb/BookResourceTest.java | 4 +- .../panache/MongodbPanacheResourceTest.kt | 12 +- .../ReactiveMongodbPanacheResourceTest.kt | 22 ++-- .../mongodb/panache/MongoTestResources.java | 4 +- .../panache/MongoDbRestDataPanacheTest.java | 4 +- .../observability/test/LgtmLifecycleTest.java | 4 +- .../quarkus/it/keycloak/OidcClientTest.java | 4 +- .../quarkus/it/keycloak/OidcClientTest.java | 4 +- .../io/quarkus/it/keycloak/CodeFlowTest.java | 4 +- .../BearerTokenAuthorizationTest.java | 4 +- .../TestSecurityCombiningAuthMechTest.java | 4 +- .../it/keycloak/OidcTokenPropagationTest.java | 6 +- .../keycloak/AnnotationBasedTenantTest.java | 4 +- .../BearerOpaqueTokenAuthorizationTest.java | 4 +- .../BearerTokenAuthorizationTest.java | 4 +- .../keycloak/CodeFlowAuthorizationTest.java | 4 +- .../BearerTokenAuthorizationTest.java | 4 +- .../it/keycloak/WebsocketOidcTestCase.java | 4 +- .../openshift/client/OpenShiftClientTest.java | 4 +- ...2OpenTelemetryJdbcInstrumentationTest.java | 4 +- ...bOpenTelemetryJdbcInstrumentationTest.java | 4 +- ...eOpenTelemetryJdbcInstrumentationTest.java | 4 +- ...sOpenTelemetryJdbcInstrumentationTest.java | 4 +- .../it/opentelemetry/BookResourceTest.java | 4 +- .../opentelemetry/OpenTelemetryTestCase.java | 4 +- .../OpenTelemetryWithSpanAtStartupTest.java | 4 +- .../grpc/GrpcNoTLSNoCompressionTest.java | 4 +- .../grpc/GrpcNoTLSWithCompressionTest.java | 4 +- .../grpc/GrpcWithTLSNoCompressionTest.java | 4 +- .../grpc/GrpcWithTLSWithCompressionTest.java | 6 +- .../http/HttpNoTLSNoCompressionTest.java | 4 +- .../http/HttpNoTLSWithCompressionTest.java | 6 +- .../http/HttpWithTLSNoCompressionTest.java | 6 +- .../http/HttpWithTLSWithCompressionTest.java | 6 +- ...thTLSWithCompressionUsingRegistryTest.java | 6 +- .../io/quarkus/it/picocli/PicocliTest.java | 4 +- .../io/quarkus/it/quartz/TestResources.java | 4 +- .../io/quarkus/it/qute/TestResources.java | 4 +- .../io/quarkus/it/amqp/AmqpConnectorTest.java | 4 +- .../quarkus/it/kafka/KafkaConnectorTest.java | 4 +- .../quarkus/it/kafka/KafkaConnectorTest.java | 4 +- .../quarkus/it/kafka/KafkaConnectorTest.java | 4 +- .../RabbitMQConnectorDynCredsTest.java | 4 +- .../stork/RestClientReactiveStorkTest.java | 6 +- .../trustall/ExternalTlsTrustAllTestCase.java | 6 +- ...rongHostUsingHostnameVerifierTestCase.java | 4 +- ...ernalWrongHostUsingVerifyHostTestCase.java | 4 +- .../reactive/kotlin/ReactiveMessagingTest.kt | 6 +- .../quarkus/context/test/TestResources.java | 4 +- .../keycloak/GraphQLAuthExpiryTest.java | 4 +- .../keycloak/SmallRyeJwtOidcWebAppTest.java | 4 +- .../it/keycloak/OidcTokenPropagationTest.java | 4 +- .../SmallRyeJwtGrpcAuthorizationTest.java | 4 +- .../runtime/CommonAndTestProfilesTest.java | 4 +- .../client/runtime/OnlyTestProfileTest.java | 4 +- .../it/spring/data/jpa/TestResources.java | 4 +- .../it/spring/data/rest/TestResources.java | 4 +- .../quarkus/it/extension/CustomResource.java | 4 +- .../it/extension/CustomResourceWithList.java | 6 +- .../it/vthreads/amqp/VirtualThreadTest.java | 4 +- .../it/vthreads/jms/VirtualThreadTest.java | 4 +- .../it/vthreads/kafka/VirtualThreadTest.java | 4 +- .../virtual/mail/RunOnVirtualThreadTest.java | 4 +- .../test/common/QuarkusTestResource.java | 4 + .../QuarkusTestResourceLifecycleManager.java | 4 +- .../common/QuarkusTestResourceRepeatable.java | 5 + .../io/quarkus/test/common/ResourceArg.java | 2 +- .../test/common/TestResourceManager.java | 104 ++++++++++++------ .../quarkus/test/common/WithTestResource.java | 67 +++++++++++ .../common/WithTestResourceRepeatable.java | 25 +++++ .../TestResourceManagerInjectorTest.java | 16 ++- .../test/common/TestResourceManagerTest.java | 99 ++++++++++++++--- .../cloud/functions/test/WithFunction.java | 4 +- .../test/LogCollectingTestResource.java | 2 +- .../AbstractJvmQuarkusTestExtension.java | 14 ++- .../test/junit/QuarkusTestProfile.java | 2 +- .../QuarkusTestProfileAwareClassOrderer.java | 20 +++- ...arkusTestProfileAwareClassOrdererTest.java | 66 +++++++++-- .../client/WithKubernetesTestServer.java | 4 +- ...OidcWiremockTestResourceInjectionTest.java | 6 +- .../client/WithOpenShiftTestServer.java | 4 +- 227 files changed, 840 insertions(+), 577 deletions(-) create mode 100644 test-framework/common/src/main/java/io/quarkus/test/common/WithTestResource.java create mode 100644 test-framework/common/src/main/java/io/quarkus/test/common/WithTestResourceRepeatable.java diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/messaging-codestart/java/src/test/java/org/acme/MyMessagingApplicationTest.java b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/messaging-codestart/java/src/test/java/org/acme/MyMessagingApplicationTest.java index 26b5971a06b6a..ba316899f87f6 100644 --- a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/messaging-codestart/java/src/test/java/org/acme/MyMessagingApplicationTest.java +++ b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/messaging-codestart/java/src/test/java/org/acme/MyMessagingApplicationTest.java @@ -1,6 +1,6 @@ package org.acme; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; import io.quarkus.test.junit.QuarkusTest; diff --git a/docs/src/main/asciidoc/datasource.adoc b/docs/src/main/asciidoc/datasource.adoc index 138299754876d..eaf0e84cc44b2 100644 --- a/docs/src/main/asciidoc/datasource.adoc +++ b/docs/src/main/asciidoc/datasource.adoc @@ -700,8 +700,8 @@ This will allow you to test your application even when it is compiled into a nat . Add the following specific annotation on any class in your integration tests for running integration tests in both JVM or native executables: + -* `@QuarkusTestResource(H2DatabaseTestResource.class)` -* `@QuarkusTestResource(DerbyDatabaseTestResource.class)` +* `@WithTestResource(H2DatabaseTestResource.class)` +* `@WithTestResource(DerbyDatabaseTestResource.class)` + This ensures that the test suite starts and terminates the managed database in a separate process as required for test execution. + @@ -710,10 +710,10 @@ This ensures that the test suite starts and terminates the managed database in a ---- package my.app.integrationtests.db; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(H2DatabaseTestResource.class) public class TestResources { } ---- diff --git a/docs/src/main/asciidoc/getting-started-testing.adoc b/docs/src/main/asciidoc/getting-started-testing.adoc index 2d9852ece5596..5841b24e68c4d 100644 --- a/docs/src/main/asciidoc/getting-started-testing.adoc +++ b/docs/src/main/asciidoc/getting-started-testing.adoc @@ -550,7 +550,7 @@ public class MockGreetingProfile implements QuarkusTestProfile { <1> * Additional {@link QuarkusTestResourceLifecycleManager} classes (along with their init params) to be used from this * specific test profile. * - * If this method is not overridden, then only the {@link QuarkusTestResourceLifecycleManager} classes enabled via the {@link io.quarkus.test.common.QuarkusTestResource} class + * If this method is not overridden, then only the {@link QuarkusTestResourceLifecycleManager} classes enabled via the {@link io.quarkus.test.common.WithTestResource} class * annotation will be used for the tests using this profile (which is the same behavior as tests that don't use a profile at all). */ @Override @@ -1086,13 +1086,12 @@ If you are using Quarkus Security, check out the xref:security-testing.adoc[Test [[quarkus-test-resource]] == Starting services before the Quarkus application starts -A very common need is to start some services on which your Quarkus application depends, before the Quarkus application starts for testing. To address this need, Quarkus provides `@io.quarkus.test.common.QuarkusTestResource` and `io.quarkus.test.common.QuarkusTestResourceLifecycleManager`. +A very common need is to start some services on which your Quarkus application depends, before the Quarkus application starts for testing. To address this need, Quarkus provides `@io.quarkus.test.common.WithTestResource` and `io.quarkus.test.common.QuarkusTestResourceLifecycleManager`. -By simply annotating any test in the test suite with `@QuarkusTestResource`, Quarkus will run the corresponding `QuarkusTestResourceLifecycleManager` before any tests are run. -A test suite is also free to utilize multiple `@QuarkusTestResource` annotations, in which case all the corresponding `QuarkusTestResourceLifecycleManager` objects will be run before the tests. When using multiple test resources they can be started concurrently. For that you need to set `@QuarkusTestResource(parallel = true)`. +By simply annotating any test in the test suite with `@WithTestResource`, Quarkus will run the corresponding `QuarkusTestResourceLifecycleManager` before any tests are run. +A test suite is also free to utilize multiple `@WithTestResource` annotations, in which case all the corresponding `QuarkusTestResourceLifecycleManager` objects will be run before the tests. When using multiple test resources they can be started concurrently. For that you need to set `@WithTestResource(parallel = true)`. -NOTE: Test resources are global, even if they are defined on a test class or custom profile, which means they will all be activated for all tests, even though we do -remove duplicates. If you want to only enable a test resource on a single test class or test profile, you can use `@QuarkusTestResource(restrictToAnnotatedClass = true)`. +NOTE: Test resources are applied for a given test class or custom profile. To activate for all tests you can use `@WithTestResource(restrictToAnnotatedClass = false)`. Quarkus provides a few implementations of `QuarkusTestResourceLifecycleManager` out of the box (see `io.quarkus.test.h2.H2DatabaseTestResource` which starts an H2 database, or `io.quarkus.test.kubernetes.client.KubernetesServerTestResource` which starts a mock Kubernetes API server), but it is common to create custom implementations to address specific application needs. @@ -1109,7 +1108,7 @@ If for example you have a test like the following: [source,java] ---- @QuarkusTest -@QuarkusTestResource(MyWireMockResource.class) +@WithTestResource(MyWireMockResource.class) public class MyTest { @InjectWireMock // this a custom annotation you are defining in your own application @@ -1160,7 +1159,7 @@ any necessary injections into the test class. === Annotation-based test resources -It is possible to write test resources that are enabled and configured using annotations. This is enabled by placing the `@QuarkusTestResource` +It is possible to write test resources that are enabled and configured using annotations. This is enabled by placing the `@WithTestResource` on an annotation which will be used to enable and configure the test resource. For example, this defines the `@WithKubernetesTestServer` annotation, which you can use on your tests to activate the `KubernetesServerTestResource`, @@ -1168,7 +1167,7 @@ but only for the annotated test class. You can also place them on your `QuarkusT [source,java] ---- -@QuarkusTestResource(KubernetesServerTestResource.class) +@WithTestResource(KubernetesServerTestResource.class) @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface WithKubernetesTestServer { @@ -1212,12 +1211,12 @@ public class KubernetesServerTestResource } ---- -If you want to make the annotation repeatable, the containing annotation type must be annotated with `@QuarkusTestResourceRepeatable`. +If you want to make the annotation repeatable, the containing annotation type must be annotated with `@WithTestResourceRepeatable`. For example, this would define a repeatable `@WithRepeatableTestResource` annotation. [source,java] ---- -@QuarkusTestResource(KubernetesServerTestResource.class) +@WithTestResource(KubernetesServerTestResource.class) @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Repeatable(WithRepeatableTestResource.List.class) @@ -1227,7 +1226,7 @@ public @interface WithRepeatableTestResource { @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) - @QuarkusTestResourceRepeatable(WithRepeatableTestResource.class) + @WithTestResourceRepeatable(WithRepeatableTestResource.class) @interface List { WithRepeatableTestResource[] value(); } @@ -1412,7 +1411,7 @@ public class CustomResource implements QuarkusTestResourceLifecycleManager, DevS } ---- -`CustomResource` would be activated on a `@QuarkusIntegrationTest` using `@QuarkusTestResource` as is described in the corresponding section of this doc. +`CustomResource` would be activated on a `@QuarkusIntegrationTest` using `@WithTestResource` as is described in the corresponding section of this doc. === Executing against a running application diff --git a/docs/src/main/asciidoc/kafka-schema-registry-avro.adoc b/docs/src/main/asciidoc/kafka-schema-registry-avro.adoc index 2800ef99f00b3..cabb95f604bae 100644 --- a/docs/src/main/asciidoc/kafka-schema-registry-avro.adoc +++ b/docs/src/main/asciidoc/kafka-schema-registry-avro.adoc @@ -440,7 +440,7 @@ what we send. ---- package org.acme.kafka; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.http.ContentType; @@ -607,7 +607,7 @@ public class KafkaAndSchemaRegistryTestResource implements QuarkusTestResourceLi [source,java] ---- @QuarkusTest -@QuarkusTestResource(KafkaAndSchemaRegistryTestResource.class) +@WithTestResource(KafkaAndSchemaRegistryTestResource.class) public class MovieResourceTest { ... } diff --git a/docs/src/main/asciidoc/kafka-schema-registry-json-schema.adoc b/docs/src/main/asciidoc/kafka-schema-registry-json-schema.adoc index 5dc85d8a6b331..e65e0cf8e3baa 100644 --- a/docs/src/main/asciidoc/kafka-schema-registry-json-schema.adoc +++ b/docs/src/main/asciidoc/kafka-schema-registry-json-schema.adoc @@ -468,7 +468,7 @@ what we send. ---- package org.acme.kafka; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.http.ContentType; @@ -635,7 +635,7 @@ public class KafkaAndSchemaRegistryTestResource implements QuarkusTestResourceLi [source,java] ---- @QuarkusTest -@QuarkusTestResource(KafkaAndSchemaRegistryTestResource.class) +@WithTestResource(KafkaAndSchemaRegistryTestResource.class) public class MovieResourceTest { ... } diff --git a/docs/src/main/asciidoc/kafka.adoc b/docs/src/main/asciidoc/kafka.adoc index 0abd8ab7adf6d..5b64ae38ccb33 100644 --- a/docs/src/main/asciidoc/kafka.adoc +++ b/docs/src/main/asciidoc/kafka.adoc @@ -2236,7 +2236,7 @@ Create a Quarkus Test using the test resource created above: import static org.awaitility.Awaitility.await; @QuarkusTest -@QuarkusTestResource(KafkaTestResourceLifecycleManager.class) +@WithTestResource(KafkaTestResourceLifecycleManager.class) class BaristaTest { @Inject @@ -2295,7 +2295,7 @@ public class BeverageProcessor { import static org.awaitility.Awaitility.await; @QuarkusTest -@QuarkusTestResource(KafkaTestResourceLifecycleManager.class) +@WithTestResource(KafkaTestResourceLifecycleManager.class) class BaristaTest { @Inject @@ -2380,7 +2380,7 @@ For using `KafkaCompanion` API in tests, start by adding the following dependenc which provides `io.quarkus.test.kafka.KafkaCompanionResource` - an implementation of `io.quarkus.test.common.QuarkusTestResourceLifecycleManager`. -Then use `@QuarkusTestResource` to configure the Kafka Companion in tests, for example: +Then use `@WithTestResource` to configure the Kafka Companion in tests, for example: [source, java] ---- @@ -2391,7 +2391,7 @@ import java.util.UUID; import org.apache.kafka.clients.producer.ProducerRecord; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.kafka.InjectKafkaCompanion; import io.quarkus.test.kafka.KafkaCompanionResource; @@ -2399,7 +2399,7 @@ import io.smallrye.reactive.messaging.kafka.companion.ConsumerTask; import io.smallrye.reactive.messaging.kafka.companion.KafkaCompanion; @QuarkusTest -@QuarkusTestResource(KafkaCompanionResource.class) +@WithTestResource(KafkaCompanionResource.class) public class OrderProcessorTest { @InjectKafkaCompanion // <1> @@ -2430,7 +2430,7 @@ If the Kafka Dev Service is available during tests, `KafkaCompanionResource` use The configuration of the created Kafka broker can be customized using `@ResourceArg`, for example: [source,java] ---- -@QuarkusTestResource(value = KafkaCompanionResource.class, initArgs = { +@WithTestResource(value = KafkaCompanionResource.class, initArgs = { @ResourceArg(name = "strimzi.kafka.image", value = "quay.io/strimzi-test-container/test-container:0.106.0-kafka-3.7.0"), // Image name @ResourceArg(name = "kafka.port", value = "9092"), // Fixed port for kafka, by default it will be exposed on a random port @ResourceArg(name = "kraft", value = "true"), // Enable Kraft mode diff --git a/docs/src/main/asciidoc/kubernetes-client.adoc b/docs/src/main/asciidoc/kubernetes-client.adoc index 19f5be0fc7ca4..988ff7ffd5fe5 100644 --- a/docs/src/main/asciidoc/kubernetes-client.adoc +++ b/docs/src/main/asciidoc/kubernetes-client.adoc @@ -260,7 +260,7 @@ public class MyTest { } ---- -Alternately, you can create an extension of the `KubernetesServerTestResource` class to ensure all your `@QuarkusTest` enabled test classes share the same mock server setup via the `QuarkusTestResource` annotation: +Alternately, you can create an extension of the `KubernetesServerTestResource` class to ensure all your `@QuarkusTest` enabled test classes share the same mock server setup via the `WithTestResource` annotation: [source%nowrap,java] ---- @@ -278,7 +278,7 @@ public class CustomKubernetesMockServerTestResource extends KubernetesServerTest and use this in your other test classes as follows: [source%nowrap,java] ---- -@QuarkusTestResource(CustomKubernetesMockServerTestResource.class) +@WithTestResource(CustomKubernetesMockServerTestResource.class) @QuarkusTest public class KubernetesClientTest { @@ -478,7 +478,7 @@ Mock support is also provided in a similar fashion: [source, java] ---- -@QuarkusTestResource(OpenShiftMockServerTestResource.class) +@WithTestResource(OpenShiftMockServerTestResource.class) @QuarkusTest public class OpenShiftClientTest { diff --git a/docs/src/main/asciidoc/messaging.adoc b/docs/src/main/asciidoc/messaging.adoc index 2361154650bc1..e0705c1b8fea1 100644 --- a/docs/src/main/asciidoc/messaging.adoc +++ b/docs/src/main/asciidoc/messaging.adoc @@ -703,7 +703,7 @@ Create a `@QuarkusTest` using the test resource created above: [source, java] ---- -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.smallrye.reactive.messaging.memory.InMemoryConnector; import io.smallrye.reactive.messaging.memory.InMemorySink; @@ -718,7 +718,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.awaitility.Awaitility.await; @QuarkusTest -@QuarkusTestResource(InMemoryConnectorLifecycleManager.class) +@WithTestResource(InMemoryConnectorLifecycleManager.class) class MyMessagingApplicationTest { @Inject diff --git a/docs/src/main/asciidoc/observability-devservices-lgtm.adoc b/docs/src/main/asciidoc/observability-devservices-lgtm.adoc index df199401954e4..e906607d41062 100644 --- a/docs/src/main/asciidoc/observability-devservices-lgtm.adoc +++ b/docs/src/main/asciidoc/observability-devservices-lgtm.adoc @@ -113,11 +113,11 @@ And for the least 'auto-magical' usage in the tests, simply disable both (Dev Re quarkus.observability.enabled=false ---- -And then explicitly list LGTM Dev Resource in the test as a `@QuarkusTestResource` resource: +And then explicitly list LGTM Dev Resource in the test as a `@WithTestResource` resource: [source, java] ---- @QuarkusTest -@QuarkusTestResource(value = LgtmResource.class, restrictToAnnotatedClass = true) +@WithTestResource(LgtmResource.class) @TestProfile(QuarkusTestResourceTestProfile.class) public class LgtmLifecycleTest extends LgtmTestBase { } diff --git a/docs/src/main/asciidoc/observability-devservices.adoc b/docs/src/main/asciidoc/observability-devservices.adoc index e906b22741cd6..ebbdfde4bb37a 100644 --- a/docs/src/main/asciidoc/observability-devservices.adoc +++ b/docs/src/main/asciidoc/observability-devservices.adoc @@ -20,7 +20,7 @@ NOTE: Each Dev Resource implementation is an `@QuarkusTestResourceLifecycleManag * explicitly disable Dev Services and enable Dev Resources and use less-heavy concept of starting and stopping Dev Resources -* explicitly disable both Dev Services and Dev Resources, and use Quarkus' `@QuarkusTestResource` testing concept (see Note) +* explicitly disable both Dev Services and Dev Resources, and use Quarkus' `@WithTestResource` testing concept (see Note) You can either add Observability extension dependency along with needed Dev Resources dependencies, or you use existing `sinks` - pom.xml files which add Observability extension dependency along with other required dependencies for certain technology stacks; e.g. `victoriametrics` sink would have `quarkus-observability-devresource-victoriametrics` and `quarkus-victoriametrics-client` dependencies already included in the `pom.xml`. diff --git a/docs/src/main/asciidoc/rest-client.adoc b/docs/src/main/asciidoc/rest-client.adoc index 1e05d342978ea..cafc648611853 100644 --- a/docs/src/main/asciidoc/rest-client.adoc +++ b/docs/src/main/asciidoc/rest-client.adoc @@ -1856,13 +1856,13 @@ testImplementation("org.wiremock:wiremock:$wiremockVersion") <1> ---- <1> Use a proper Wiremock version. All available versions can be found link:https://search.maven.org/artifact/org.wiremock/wiremock[here]. -In Quarkus tests when some service needs to be started before the Quarkus tests are ran, we utilize the `@io.quarkus.test.common.QuarkusTestResource` +In Quarkus tests when some service needs to be started before the Quarkus tests are ran, we utilize the `@io.quarkus.test.common.WithTestResource` annotation to specify a `io.quarkus.test.common.QuarkusTestResourceLifecycleManager` which can start the service and supply configuration values that Quarkus will use. [NOTE] ==== -For more details about `@QuarkusTestResource` refer to xref:getting-started-testing.adoc#quarkus-test-resource[this part of the documentation]. +For more details about `@WithTestResource` refer to xref:getting-started-testing.adoc#quarkus-test-resource[this part of the documentation]. ==== Let's create an implementation of `QuarkusTestResourceLifecycleManager` called `WiremockExtensions` like so: @@ -1926,17 +1926,12 @@ The `ExtensionsResourceTest` test class needs to be annotated like so: [source,java] ---- @QuarkusTest -@QuarkusTestResource(WireMockExtensions.class) +@WithTestResource(WireMockExtensions.class) public class ExtensionsResourceTest { } ---- -[WARNING] -==== -`@QuarkusTestResource` applies to all tests, not just `ExtensionsResourceTest`. -==== - == Known limitations While the REST Client extension aims to be a drop-in replacement for the RESTEasy Client extension, there are some differences diff --git a/docs/src/main/asciidoc/resteasy-client.adoc b/docs/src/main/asciidoc/resteasy-client.adoc index a7df076880ee6..096ae5b509b8d 100644 --- a/docs/src/main/asciidoc/resteasy-client.adoc +++ b/docs/src/main/asciidoc/resteasy-client.adoc @@ -317,11 +317,11 @@ import static org.hamcrest.Matchers.greaterThan; import org.acme.rest.client.resources.WireMockExtensionsResource; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(WireMockExtensionsResource.class) +@WithTestResource(WireMockExtensionsResource.class) public class ExtensionsResourceTest { @Test diff --git a/docs/src/main/asciidoc/security-oauth2.adoc b/docs/src/main/asciidoc/security-oauth2.adoc index b4ece34f5f3fd..071f52b89ad9d 100644 --- a/docs/src/main/asciidoc/security-oauth2.adoc +++ b/docs/src/main/asciidoc/security-oauth2.adoc @@ -348,13 +348,13 @@ testImplementation("org.wiremock:wiremock:${wiremock.version}") <1> ---- <1> Use a proper Wiremock version. All available versions can be found link:https://search.maven.org/artifact/org.wiremock/wiremock[here]. -In Quarkus tests when some service needs to be started before the Quarkus tests are ran, we utilize the `@io.quarkus.test.common.QuarkusTestResource` +In Quarkus tests when some service needs to be started before the Quarkus tests are ran, we utilize the `@io.quarkus.test.common.WithTestResource` annotation to specify a `io.quarkus.test.common.QuarkusTestResourceLifecycleManager` which can start the service and supply configuration values that Quarkus will use. [NOTE] ==== -For more details about `@QuarkusTestResource` refer to xref:getting-started-testing.adoc#quarkus-test-resource[this part of the documentation]. +For more details about `@WithTestResource` refer to xref:getting-started-testing.adoc#quarkus-test-resource[this part of the documentation]. ==== Let's create an implementation of `QuarkusTestResourceLifecycleManager` called `MockAuthorizationServerTestResource` like so: @@ -402,14 +402,14 @@ public class MockAuthorizationServerTestResource implements QuarkusTestResourceL <5> When all tests have finished, shutdown Wiremock. -Your test class needs to be annotated like with `@QuarkusTestResource(MockAuthorizationServerTestResource.class)` to use this `QuarkusTestResourceLifecycleManager`. +Your test class needs to be annotated like with `@WithTestResource(MockAuthorizationServerTestResource.class)` to use this `QuarkusTestResourceLifecycleManager`. Below is an example of a test that uses the `MockAuthorizationServerTestResource`. [source,java] ---- @QuarkusTest -@QuarkusTestResource(MockAuthorizationServerTestResource.class) // <1> +@WithTestResource(MockAuthorizationServerTestResource.class) // <1> class TokenSecuredResourceTest { // use whatever token you want as the mock OAuth server will accept all tokens private static final String BEARER_TOKEN = "337aab0f-b547-489b-9dbd-a54dc7bdf20d"; // <2> @@ -442,13 +442,6 @@ class TokenSecuredResourceTest { <2> Define whatever token you want, it will not be validated by the OAuth2 mock authorization server. <3> Use this token inside the `Authorization` header to trigger OAuth2 authentication. - -[WARNING] -==== -`@QuarkusTestResource` applies to all tests, not just `TokenSecuredResourceTest`. -==== - - == References * https://tools.ietf.org/html/rfc6749[OAuth2] diff --git a/docs/src/main/asciidoc/security-oidc-bearer-token-authentication.adoc b/docs/src/main/asciidoc/security-oidc-bearer-token-authentication.adoc index 577ca17069967..0e3650ea89011 100644 --- a/docs/src/main/asciidoc/security-oidc-bearer-token-authentication.adoc +++ b/docs/src/main/asciidoc/security-oidc-bearer-token-authentication.adoc @@ -617,14 +617,14 @@ import java.util.Set; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.oidc.server.OidcWiremockTestResource; import io.restassured.RestAssured; import io.smallrye.jwt.build.Jwt; @QuarkusTest -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(OidcWiremockTestResource.class) public class BearerTokenAuthorizationTest { @Test @@ -926,13 +926,13 @@ import static org.hamcrest.Matchers.equalTo; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; import io.restassured.RestAssured; @QuarkusTest -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(KeycloakTestResourceLifecycleManager.class) public class BearerTokenAuthorizationTest { @Test diff --git a/docs/src/main/asciidoc/security-oidc-code-flow-authentication.adoc b/docs/src/main/asciidoc/security-oidc-code-flow-authentication.adoc index 761f861e5a680..7a2ebc6cd5a4e 100644 --- a/docs/src/main/asciidoc/security-oidc-code-flow-authentication.adoc +++ b/docs/src/main/asciidoc/security-oidc-code-flow-authentication.adoc @@ -1754,12 +1754,12 @@ import org.htmlunit.WebClient; import org.htmlunit.html.HtmlForm; import org.htmlunit.html.HtmlPage; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.oidc.server.OidcWiremockTestResource; @QuarkusTest -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(OidcWiremockTestResource.class) public class CodeFlowAuthorizationTest { @Test @@ -1822,7 +1822,7 @@ quarkus.keycloak.devservices.realm-path=quarkus-realm.json ---- Finally, write a test code the same way as it is described in the <> section. -The only difference is that `@QuarkusTestResource` is no longer needed: +The only difference is that `@WithTestResource` is no longer needed: [source, java] ---- @@ -1878,14 +1878,14 @@ Then, configure the Maven Surefire plugin as follows (and similarly the Maven Fa ---- Now, set the configuration and write the test code the same way as it is described in the <> section. -The only difference is the name of `QuarkusTestResource`: +The only difference is the name of `WithTestResource`: [source, java] ---- import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; @QuarkusTest -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(KeycloakTestResourceLifecycleManager.class) public class CodeFlowAuthorizationTest { } ---- diff --git a/extensions/agroal/deployment/src/test/java/io/quarkus/agroal/test/TestResources.java b/extensions/agroal/deployment/src/test/java/io/quarkus/agroal/test/TestResources.java index 54f8f8c569b5a..4f8197941fc33 100644 --- a/extensions/agroal/deployment/src/test/java/io/quarkus/agroal/test/TestResources.java +++ b/extensions/agroal/deployment/src/test/java/io/quarkus/agroal/test/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.agroal.test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/extensions/elytron-security-ldap/deployment/src/test/java/io/quarkus/elytron/security/ldap/CacheTest.java b/extensions/elytron-security-ldap/deployment/src/test/java/io/quarkus/elytron/security/ldap/CacheTest.java index 317f3b7485a5a..4888abf88ade6 100644 --- a/extensions/elytron-security-ldap/deployment/src/test/java/io/quarkus/elytron/security/ldap/CacheTest.java +++ b/extensions/elytron-security-ldap/deployment/src/test/java/io/quarkus/elytron/security/ldap/CacheTest.java @@ -5,11 +5,11 @@ import io.quarkus.elytron.security.ldap.rest.SingleRoleSecuredServlet; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.ldap.LdapServerTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(LdapServerTestResource.class) +@WithTestResource(value = LdapServerTestResource.class, restrictToAnnotatedClass = false) public class CacheTest { protected static Class[] testClasses = { SingleRoleSecuredServlet.class diff --git a/extensions/elytron-security-ldap/deployment/src/test/java/io/quarkus/elytron/security/ldap/LdapSecurityRealmTest.java b/extensions/elytron-security-ldap/deployment/src/test/java/io/quarkus/elytron/security/ldap/LdapSecurityRealmTest.java index f873ea5f1b76e..65662565f7b5b 100644 --- a/extensions/elytron-security-ldap/deployment/src/test/java/io/quarkus/elytron/security/ldap/LdapSecurityRealmTest.java +++ b/extensions/elytron-security-ldap/deployment/src/test/java/io/quarkus/elytron/security/ldap/LdapSecurityRealmTest.java @@ -9,7 +9,7 @@ import io.quarkus.elytron.security.ldap.rest.SingleRoleSecuredServlet; import io.quarkus.elytron.security.ldap.rest.SubjectExposingResource; import io.quarkus.elytron.security.ldap.rest.TestApplication; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.ldap.LdapServerTestResource; import io.restassured.RestAssured; import io.restassured.specification.RequestSpecification; @@ -18,7 +18,7 @@ * Tests of BASIC authentication mechanism with the minimal config required */ -@QuarkusTestResource(LdapServerTestResource.class) +@WithTestResource(value = LdapServerTestResource.class, restrictToAnnotatedClass = false) public abstract class LdapSecurityRealmTest { protected static Class[] testClasses = { diff --git a/extensions/elytron-security-ldap/deployment/src/test/java/io/quarkus/elytron/security/ldap/SearchRecursiveTest.java b/extensions/elytron-security-ldap/deployment/src/test/java/io/quarkus/elytron/security/ldap/SearchRecursiveTest.java index 657dc530d64fc..8557cef062e31 100644 --- a/extensions/elytron-security-ldap/deployment/src/test/java/io/quarkus/elytron/security/ldap/SearchRecursiveTest.java +++ b/extensions/elytron-security-ldap/deployment/src/test/java/io/quarkus/elytron/security/ldap/SearchRecursiveTest.java @@ -5,11 +5,11 @@ import io.quarkus.elytron.security.ldap.rest.SingleRoleSecuredServlet; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.ldap.LdapServerTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(LdapServerTestResource.class) +@WithTestResource(value = LdapServerTestResource.class, restrictToAnnotatedClass = false) public class SearchRecursiveTest { protected static Class[] testClasses = { diff --git a/extensions/flyway/deployment/src/test/java/io/quarkus/flyway/test/FlywayTestResources.java b/extensions/flyway/deployment/src/test/java/io/quarkus/flyway/test/FlywayTestResources.java index 21512e52f6ffb..6f82fc997dfd7 100644 --- a/extensions/flyway/deployment/src/test/java/io/quarkus/flyway/test/FlywayTestResources.java +++ b/extensions/flyway/deployment/src/test/java/io/quarkus/flyway/test/FlywayTestResources.java @@ -1,8 +1,8 @@ package io.quarkus.flyway.test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class FlywayTestResources { } diff --git a/extensions/liquibase/deployment/src/test/java/io/quarkus/liquibase/test/LiquibaseTestResources.java b/extensions/liquibase/deployment/src/test/java/io/quarkus/liquibase/test/LiquibaseTestResources.java index 6a1e0cbd6c29a..cd2ccc6d050de 100644 --- a/extensions/liquibase/deployment/src/test/java/io/quarkus/liquibase/test/LiquibaseTestResources.java +++ b/extensions/liquibase/deployment/src/test/java/io/quarkus/liquibase/test/LiquibaseTestResources.java @@ -1,8 +1,8 @@ package io.quarkus.liquibase.test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class LiquibaseTestResources { } diff --git a/extensions/oidc-client-filter/deployment/src/test/java/io/quarkus/oidc/client/filter/NamedOidcClientFilterDevModeTest.java b/extensions/oidc-client-filter/deployment/src/test/java/io/quarkus/oidc/client/filter/NamedOidcClientFilterDevModeTest.java index 58e38e74b8f92..3cebc42490393 100644 --- a/extensions/oidc-client-filter/deployment/src/test/java/io/quarkus/oidc/client/filter/NamedOidcClientFilterDevModeTest.java +++ b/extensions/oidc-client-filter/deployment/src/test/java/io/quarkus/oidc/client/filter/NamedOidcClientFilterDevModeTest.java @@ -6,11 +6,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusDevModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; import io.restassured.RestAssured; -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class NamedOidcClientFilterDevModeTest { private static final Class[] testClasses = { diff --git a/extensions/oidc-client-filter/deployment/src/test/java/io/quarkus/oidc/client/filter/OidcClientFilterDevModeTest.java b/extensions/oidc-client-filter/deployment/src/test/java/io/quarkus/oidc/client/filter/OidcClientFilterDevModeTest.java index 97cbbb8d7868c..7e49d71662616 100644 --- a/extensions/oidc-client-filter/deployment/src/test/java/io/quarkus/oidc/client/filter/OidcClientFilterDevModeTest.java +++ b/extensions/oidc-client-filter/deployment/src/test/java/io/quarkus/oidc/client/filter/OidcClientFilterDevModeTest.java @@ -19,11 +19,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusDevModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; import io.restassured.RestAssured; -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class OidcClientFilterDevModeTest { private static final Class[] testClasses = { diff --git a/extensions/oidc-client-graphql/deployment/src/test/java/io/quarkus/oidc/client/graphql/GraphQLClientUsingOidcClientTest.java b/extensions/oidc-client-graphql/deployment/src/test/java/io/quarkus/oidc/client/graphql/GraphQLClientUsingOidcClientTest.java index 112fb47baf5cb..7bce743d0565e 100644 --- a/extensions/oidc-client-graphql/deployment/src/test/java/io/quarkus/oidc/client/graphql/GraphQLClientUsingOidcClientTest.java +++ b/extensions/oidc-client-graphql/deployment/src/test/java/io/quarkus/oidc/client/graphql/GraphQLClientUsingOidcClientTest.java @@ -6,11 +6,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusDevModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; import io.restassured.RestAssured; -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class GraphQLClientUsingOidcClientTest { private static final Class[] testClasses = { diff --git a/extensions/oidc-client-reactive-filter/deployment/src/test/java/io/quarkus/oidc/client/reactive/filter/NamedOidcClientFilterDevModeTest.java b/extensions/oidc-client-reactive-filter/deployment/src/test/java/io/quarkus/oidc/client/reactive/filter/NamedOidcClientFilterDevModeTest.java index ef401cbe4d80d..e7cab2e3d064c 100644 --- a/extensions/oidc-client-reactive-filter/deployment/src/test/java/io/quarkus/oidc/client/reactive/filter/NamedOidcClientFilterDevModeTest.java +++ b/extensions/oidc-client-reactive-filter/deployment/src/test/java/io/quarkus/oidc/client/reactive/filter/NamedOidcClientFilterDevModeTest.java @@ -6,11 +6,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusDevModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; import io.restassured.RestAssured; -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class NamedOidcClientFilterDevModeTest { private static final Class[] testClasses = { diff --git a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/NamedOidcClientInjectionTestCase.java b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/NamedOidcClientInjectionTestCase.java index e06687718effd..63e84431a0c45 100644 --- a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/NamedOidcClientInjectionTestCase.java +++ b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/NamedOidcClientInjectionTestCase.java @@ -11,10 +11,10 @@ import io.quarkus.oidc.runtime.OidcUtils; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(KeycloakRealmUserPasswordManager.class) +@WithTestResource(value = KeycloakRealmUserPasswordManager.class, restrictToAnnotatedClass = false) public class NamedOidcClientInjectionTestCase { private static Class[] testClasses = { diff --git a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsJwtPrivateKeyStoreTestCase.java b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsJwtPrivateKeyStoreTestCase.java index fa47f73e9201a..f04bf0b4dfd3c 100644 --- a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsJwtPrivateKeyStoreTestCase.java +++ b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsJwtPrivateKeyStoreTestCase.java @@ -6,10 +6,10 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(KeycloakRealmClientCredentialsJwtPrivateKeyStoreManager.class) +@WithTestResource(value = KeycloakRealmClientCredentialsJwtPrivateKeyStoreManager.class, restrictToAnnotatedClass = false) public class OidcClientCredentialsJwtPrivateKeyStoreTestCase { private static Class[] testClasses = { diff --git a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsJwtPrivateKeyTestCase.java b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsJwtPrivateKeyTestCase.java index d8252bd1a9614..80e1554793afe 100644 --- a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsJwtPrivateKeyTestCase.java +++ b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsJwtPrivateKeyTestCase.java @@ -6,10 +6,10 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(KeycloakRealmClientCredentialsJwtPrivateKeyManager.class) +@WithTestResource(value = KeycloakRealmClientCredentialsJwtPrivateKeyManager.class, restrictToAnnotatedClass = false) public class OidcClientCredentialsJwtPrivateKeyTestCase { private static Class[] testClasses = { diff --git a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsJwtSecretTestCase.java b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsJwtSecretTestCase.java index 49ef2d1574aaf..c55c1b5856f14 100644 --- a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsJwtSecretTestCase.java +++ b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsJwtSecretTestCase.java @@ -8,10 +8,10 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(KeycloakRealmClientCredentialsJwtSecretManager.class) +@WithTestResource(value = KeycloakRealmClientCredentialsJwtSecretManager.class, restrictToAnnotatedClass = false) public class OidcClientCredentialsJwtSecretTestCase { private static Class[] testClasses = { diff --git a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsTestCase.java b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsTestCase.java index fe998f104859f..6b1e25acc65ac 100644 --- a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsTestCase.java +++ b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientCredentialsTestCase.java @@ -8,10 +8,10 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(KeycloakRealmClientCredentialsManager.class) +@WithTestResource(value = KeycloakRealmClientCredentialsManager.class, restrictToAnnotatedClass = false) public class OidcClientCredentialsTestCase { private static Class[] testClasses = { diff --git a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientUserPasswordCustomFilterTestCase.java b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientUserPasswordCustomFilterTestCase.java index 994ba493909f3..d03360b00c1ba 100644 --- a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientUserPasswordCustomFilterTestCase.java +++ b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientUserPasswordCustomFilterTestCase.java @@ -11,10 +11,10 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(KeycloakRealmUserPasswordCustomFilterManager.class) +@WithTestResource(value = KeycloakRealmUserPasswordCustomFilterManager.class, restrictToAnnotatedClass = false) public class OidcClientUserPasswordCustomFilterTestCase { private static Class[] testClasses = { diff --git a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientUserPasswordTestCase.java b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientUserPasswordTestCase.java index 388007bee0e6d..9f015e98c60cf 100644 --- a/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientUserPasswordTestCase.java +++ b/extensions/oidc-client/deployment/src/test/java/io/quarkus/oidc/client/OidcClientUserPasswordTestCase.java @@ -14,11 +14,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.restassured.RestAssured; import io.restassured.response.Response; -@QuarkusTestResource(KeycloakRealmUserPasswordManager.class) +@WithTestResource(value = KeycloakRealmUserPasswordManager.class, restrictToAnnotatedClass = false) public class OidcClientUserPasswordTestCase { private static Class[] testClasses = { diff --git a/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/AccessTokenAnnotationTest.java b/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/AccessTokenAnnotationTest.java index e16074e725252..3dde0c073e384 100644 --- a/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/AccessTokenAnnotationTest.java +++ b/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/AccessTokenAnnotationTest.java @@ -20,12 +20,12 @@ import io.quarkus.arc.Unremovable; import io.quarkus.oidc.token.propagation.AccessToken; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.oidc.client.OidcTestClient; import io.quarkus.test.oidc.server.OidcWiremockTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public class AccessTokenAnnotationTest { final static OidcTestClient client = new OidcTestClient(); diff --git a/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/OidcTokenPropagationTest.java b/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/OidcTokenPropagationTest.java index ae0489140f12a..c9ee6dafff025 100644 --- a/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/OidcTokenPropagationTest.java +++ b/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/OidcTokenPropagationTest.java @@ -8,11 +8,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.oidc.server.OidcWiremockTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public class OidcTokenPropagationTest { private static Class[] testClasses = { diff --git a/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/OidcTokenPropagationWithSecurityIdentityAugmentorLazyAuthTest.java b/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/OidcTokenPropagationWithSecurityIdentityAugmentorLazyAuthTest.java index f90592f66199f..9343971e68667 100644 --- a/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/OidcTokenPropagationWithSecurityIdentityAugmentorLazyAuthTest.java +++ b/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/OidcTokenPropagationWithSecurityIdentityAugmentorLazyAuthTest.java @@ -10,11 +10,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.oidc.server.OidcWiremockTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public class OidcTokenPropagationWithSecurityIdentityAugmentorLazyAuthTest { private static Class[] testClasses = { diff --git a/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/OidcTokenPropagationWithSecurityIdentityAugmentorTest.java b/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/OidcTokenPropagationWithSecurityIdentityAugmentorTest.java index 61743be804e2e..73233bd99b5b2 100644 --- a/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/OidcTokenPropagationWithSecurityIdentityAugmentorTest.java +++ b/extensions/oidc-token-propagation-reactive/deployment/src/test/java/io/quarkus/oidc/token/propagation/reactive/OidcTokenPropagationWithSecurityIdentityAugmentorTest.java @@ -17,11 +17,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.oidc.server.OidcWiremockTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public class OidcTokenPropagationWithSecurityIdentityAugmentorTest { private static Class[] testClasses = { diff --git a/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/AccessTokenAnnotationTest.java b/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/AccessTokenAnnotationTest.java index bce883c705766..7c3b3beb158cf 100644 --- a/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/AccessTokenAnnotationTest.java +++ b/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/AccessTokenAnnotationTest.java @@ -19,12 +19,12 @@ import io.quarkus.arc.Unremovable; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.oidc.client.OidcTestClient; import io.quarkus.test.oidc.server.OidcWiremockTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public class AccessTokenAnnotationTest { final static OidcTestClient client = new OidcTestClient(); diff --git a/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/OidcTokenPropagationTest.java b/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/OidcTokenPropagationTest.java index 2ad093b9bec6d..3c085d80054bb 100644 --- a/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/OidcTokenPropagationTest.java +++ b/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/OidcTokenPropagationTest.java @@ -7,12 +7,12 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.oidc.client.OidcTestClient; import io.quarkus.test.oidc.server.OidcWiremockTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public class OidcTokenPropagationTest { final static OidcTestClient client = new OidcTestClient(); diff --git a/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/OidcTokenPropagationWithSecurityIdentityAugmentorLazyAuthTest.java b/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/OidcTokenPropagationWithSecurityIdentityAugmentorLazyAuthTest.java index 7a892d26497ec..88af4bc5fd631 100644 --- a/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/OidcTokenPropagationWithSecurityIdentityAugmentorLazyAuthTest.java +++ b/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/OidcTokenPropagationWithSecurityIdentityAugmentorLazyAuthTest.java @@ -10,11 +10,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.oidc.server.OidcWiremockTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public class OidcTokenPropagationWithSecurityIdentityAugmentorLazyAuthTest { private static Class[] testClasses = { diff --git a/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/OidcTokenPropagationWithSecurityIdentityAugmentorTest.java b/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/OidcTokenPropagationWithSecurityIdentityAugmentorTest.java index c2165254c3935..a4a40d4710df5 100644 --- a/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/OidcTokenPropagationWithSecurityIdentityAugmentorTest.java +++ b/extensions/oidc-token-propagation/deployment/src/test/java/io/quarkus/oidc/token/propagation/OidcTokenPropagationWithSecurityIdentityAugmentorTest.java @@ -10,11 +10,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.oidc.server.OidcWiremockTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public class OidcTokenPropagationWithSecurityIdentityAugmentorTest { private static Class[] testClasses = { diff --git a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowDevModeDefaultTenantTestCase.java b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowDevModeDefaultTenantTestCase.java index 067351535035d..09ce6e3a7f115 100644 --- a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowDevModeDefaultTenantTestCase.java +++ b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowDevModeDefaultTenantTestCase.java @@ -14,10 +14,10 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusDevModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class CodeFlowDevModeDefaultTenantTestCase { private static Class[] testClasses = { diff --git a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowDevModeTestCase.java b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowDevModeTestCase.java index d0343742c27b7..c4e7bfbdc64eb 100644 --- a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowDevModeTestCase.java +++ b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowDevModeTestCase.java @@ -40,11 +40,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusDevModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; @TestMethodOrder(MethodOrderer.OrderAnnotation.class) -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class CodeFlowDevModeTestCase { private static Class[] testClasses = { diff --git a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowVerifyAccessTokenDisabledTest.java b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowVerifyAccessTokenDisabledTest.java index 3bd36d0d3ccb1..510cbe22ddbcd 100644 --- a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowVerifyAccessTokenDisabledTest.java +++ b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowVerifyAccessTokenDisabledTest.java @@ -12,10 +12,10 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class CodeFlowVerifyAccessTokenDisabledTest { @RegisterExtension diff --git a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowVerifyInjectedAccessTokenDisabledTest.java b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowVerifyInjectedAccessTokenDisabledTest.java index dd9d217415214..6d5a439c3e294 100644 --- a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowVerifyInjectedAccessTokenDisabledTest.java +++ b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeFlowVerifyInjectedAccessTokenDisabledTest.java @@ -12,10 +12,10 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class CodeFlowVerifyInjectedAccessTokenDisabledTest { @RegisterExtension diff --git a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeTenantReauthenticateTestCase.java b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeTenantReauthenticateTestCase.java index 51bc73fa55cd6..2b1954f62bf7d 100644 --- a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeTenantReauthenticateTestCase.java +++ b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CodeTenantReauthenticateTestCase.java @@ -16,11 +16,11 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; @TestMethodOrder(MethodOrderer.OrderAnnotation.class) -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class CodeTenantReauthenticateTestCase { private static Class[] testClasses = { TenantReauthentication.class, diff --git a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CustomIdentityProviderTestCase.java b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CustomIdentityProviderTestCase.java index 7f7c1cfa1e41e..8458bcfc9194f 100644 --- a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CustomIdentityProviderTestCase.java +++ b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/CustomIdentityProviderTestCase.java @@ -14,10 +14,10 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusDevModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class CustomIdentityProviderTestCase { private static Class[] testClasses = { diff --git a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/ImplicitBasicAuthAndBearerAuthCombinationTest.java b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/ImplicitBasicAuthAndBearerAuthCombinationTest.java index 857130a08ef65..67f9a704a21d3 100644 --- a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/ImplicitBasicAuthAndBearerAuthCombinationTest.java +++ b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/ImplicitBasicAuthAndBearerAuthCombinationTest.java @@ -12,12 +12,12 @@ import io.quarkus.oidc.BearerTokenAuthentication; import io.quarkus.test.QuarkusDevModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; import io.quarkus.vertx.http.runtime.security.annotation.BasicAuthentication; import io.restassured.RestAssured; -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class ImplicitBasicAuthAndBearerAuthCombinationTest { @RegisterExtension diff --git a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/ImplicitBasicAuthAndCodeFlowAuthCombinationTest.java b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/ImplicitBasicAuthAndCodeFlowAuthCombinationTest.java index 8abd7dad9ab2e..4a61685e0f4bb 100644 --- a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/ImplicitBasicAuthAndCodeFlowAuthCombinationTest.java +++ b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/ImplicitBasicAuthAndCodeFlowAuthCombinationTest.java @@ -21,11 +21,11 @@ import io.quarkus.oidc.IdToken; import io.quarkus.test.QuarkusDevModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; import io.restassured.RestAssured; -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class ImplicitBasicAuthAndCodeFlowAuthCombinationTest { @RegisterExtension diff --git a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/UserInfoRequiredDetectionTest.java b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/UserInfoRequiredDetectionTest.java index 73633f3bbb4a1..fcab480106554 100644 --- a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/UserInfoRequiredDetectionTest.java +++ b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/UserInfoRequiredDetectionTest.java @@ -16,13 +16,13 @@ import io.quarkus.oidc.runtime.OidcConfig; import io.quarkus.security.PermissionsAllowed; import io.quarkus.test.QuarkusDevModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.keycloak.client.KeycloakTestClient; import io.quarkus.test.keycloak.server.KeycloakTestResourceLifecycleManager; import io.restassured.RestAssured; import io.vertx.ext.web.Router; -@QuarkusTestResource(KeycloakTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class UserInfoRequiredDetectionTest { @RegisterExtension diff --git a/extensions/panache/mongodb-panache-common/deployment/src/test/java/io/quarkus/mongodb/panache/common/MongoDatabaseResolverTest.java b/extensions/panache/mongodb-panache-common/deployment/src/test/java/io/quarkus/mongodb/panache/common/MongoDatabaseResolverTest.java index ef3f4c2892a0a..d75b6b9342354 100644 --- a/extensions/panache/mongodb-panache-common/deployment/src/test/java/io/quarkus/mongodb/panache/common/MongoDatabaseResolverTest.java +++ b/extensions/panache/mongodb-panache-common/deployment/src/test/java/io/quarkus/mongodb/panache/common/MongoDatabaseResolverTest.java @@ -26,12 +26,12 @@ import io.quarkus.mongodb.reactive.ReactiveMongoClient; import io.quarkus.mongodb.reactive.ReactiveMongoCollection; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.mongodb.MongoReplicaSetTestResource; import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; -@QuarkusTestResource(MongoReplicaSetTestResource.class) +@WithTestResource(value = MongoReplicaSetTestResource.class, restrictToAnnotatedClass = false) @DisabledOnOs(OS.WINDOWS) public class MongoDatabaseResolverTest { diff --git a/extensions/redis-cache/deployment/src/test/java/io/quarkus/cache/redis/deployment/NamedRedisCacheTest.java b/extensions/redis-cache/deployment/src/test/java/io/quarkus/cache/redis/deployment/NamedRedisCacheTest.java index 5e03be1ef6e8d..95bb926fd0be0 100644 --- a/extensions/redis-cache/deployment/src/test/java/io/quarkus/cache/redis/deployment/NamedRedisCacheTest.java +++ b/extensions/redis-cache/deployment/src/test/java/io/quarkus/cache/redis/deployment/NamedRedisCacheTest.java @@ -14,9 +14,9 @@ import io.quarkus.redis.client.RedisClientName; import io.quarkus.redis.datasource.RedisDataSource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class NamedRedisCacheTest { private static final String KEY_1 = "1"; diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/ClientInjectionTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/ClientInjectionTest.java index 0f01a54c2472a..fb60bc99d36f5 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/ClientInjectionTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/ClientInjectionTest.java @@ -12,11 +12,11 @@ import io.quarkus.redis.client.RedisClientName; import io.quarkus.redis.client.reactive.ReactiveRedisClient; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.vertx.mutiny.redis.client.Redis; import io.vertx.mutiny.redis.client.RedisAPI; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class ClientInjectionTest { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/CustomizerTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/CustomizerTest.java index 0b3f7a4f5d27d..cdb1e2aedb48d 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/CustomizerTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/CustomizerTest.java @@ -17,11 +17,11 @@ import io.quarkus.redis.client.RedisOptionsCustomizer; import io.quarkus.redis.runtime.client.config.RedisConfig; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.vertx.mutiny.redis.client.RedisAPI; import io.vertx.redis.client.RedisOptions; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class CustomizerTest { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/datasource/CustomCodecTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/datasource/CustomCodecTest.java index 39b9bd89e77de..cbfa8d2fbcf64 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/datasource/CustomCodecTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/datasource/CustomCodecTest.java @@ -20,9 +20,9 @@ import io.quarkus.redis.datasource.hash.HashCommands; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class CustomCodecTest { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/datasource/DataSourceInjectionTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/datasource/DataSourceInjectionTest.java index 0b9783ca44356..07634b9f9dbc1 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/datasource/DataSourceInjectionTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/datasource/DataSourceInjectionTest.java @@ -16,9 +16,9 @@ import io.quarkus.redis.datasource.RedisDataSource; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class DataSourceInjectionTest { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/datasource/DataSourceTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/datasource/DataSourceTest.java index 736ec0e854098..6006dd2b71ef0 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/datasource/DataSourceTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/datasource/DataSourceTest.java @@ -13,9 +13,9 @@ import io.quarkus.redis.datasource.value.ValueCommands; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class DataSourceTest { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/devmode/RedisClientDevModeTestCase.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/devmode/RedisClientDevModeTestCase.java index 905cef0d54fbc..ea3b54a6dceef 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/devmode/RedisClientDevModeTestCase.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/devmode/RedisClientDevModeTestCase.java @@ -14,10 +14,10 @@ import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusDevModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class RedisClientDevModeTestCase { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/devmode/RedisClientPreloadDevModeTestCase.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/devmode/RedisClientPreloadDevModeTestCase.java index dce82f588c555..7ae35048d6c0e 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/devmode/RedisClientPreloadDevModeTestCase.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/devmode/RedisClientPreloadDevModeTestCase.java @@ -12,10 +12,10 @@ import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusDevModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class RedisClientPreloadDevModeTestCase { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/BinaryTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/BinaryTest.java index 01cffd95c4dde..84ba4cf2193dc 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/BinaryTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/BinaryTest.java @@ -16,9 +16,9 @@ import io.quarkus.redis.datasource.value.ValueCommands; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class BinaryTest { @RegisterExtension static final QuarkusUnitTest unitTest = new QuarkusUnitTest() diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/CacheTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/CacheTest.java index aac3e85f7e441..4acf5b40f9f9a 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/CacheTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/CacheTest.java @@ -15,9 +15,9 @@ import io.quarkus.redis.datasource.value.ValueCommands; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class CacheTest { @RegisterExtension static final QuarkusUnitTest unitTest = new QuarkusUnitTest() diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/CounterTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/CounterTest.java index 7d0dc766a6781..675086caca2d6 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/CounterTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/CounterTest.java @@ -13,9 +13,9 @@ import io.quarkus.redis.datasource.value.ValueCommands; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class CounterTest { @RegisterExtension static final QuarkusUnitTest unitTest = new QuarkusUnitTest() diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/PubSubOnStartupTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/PubSubOnStartupTest.java index 2842c9cfd6d7d..3c0ec81ce621f 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/PubSubOnStartupTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/PubSubOnStartupTest.java @@ -24,11 +24,11 @@ import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.runtime.Startup; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.subscription.Cancellable; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class PubSubOnStartupTest { @RegisterExtension static final QuarkusUnitTest unitTest = new QuarkusUnitTest() diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/PubSubTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/PubSubTest.java index a29a39d28c70e..d2e8abd500ddd 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/PubSubTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/patterns/PubSubTest.java @@ -22,9 +22,9 @@ import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.runtime.Startup; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class PubSubTest { @RegisterExtension static final QuarkusUnitTest unitTest = new QuarkusUnitTest() diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/DefaultFileForDefaultClientPreloadingTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/DefaultFileForDefaultClientPreloadingTest.java index 6419d9e4dd13e..34e5d42950709 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/DefaultFileForDefaultClientPreloadingTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/DefaultFileForDefaultClientPreloadingTest.java @@ -15,9 +15,9 @@ import io.quarkus.redis.datasource.RedisDataSource; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class DefaultFileForDefaultClientPreloadingTest { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MissingFilePreloadTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MissingFilePreloadTest.java index 64fc12756e415..7e6c09178c20e 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MissingFilePreloadTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MissingFilePreloadTest.java @@ -15,9 +15,9 @@ import io.quarkus.redis.datasource.RedisDataSource; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class MissingFilePreloadTest { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultiClientImportPreloadingTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultiClientImportPreloadingTest.java index 796d8adc174e4..39c5e6b3dd391 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultiClientImportPreloadingTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultiClientImportPreloadingTest.java @@ -17,9 +17,9 @@ import io.quarkus.redis.datasource.RedisDataSource; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class MultiClientImportPreloadingTest { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultiClientImportPreloadingWithFlushAllTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultiClientImportPreloadingWithFlushAllTest.java index ea0084b546cfb..d53f5a6169f69 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultiClientImportPreloadingWithFlushAllTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultiClientImportPreloadingWithFlushAllTest.java @@ -16,9 +16,9 @@ import io.quarkus.redis.datasource.RedisDataSource; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class MultiClientImportPreloadingWithFlushAllTest { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultiClientImportPreloadingWithOnlyIfEmptyTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultiClientImportPreloadingWithOnlyIfEmptyTest.java index 3a875a126dba8..cf5f3ec7b985d 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultiClientImportPreloadingWithOnlyIfEmptyTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultiClientImportPreloadingWithOnlyIfEmptyTest.java @@ -16,9 +16,9 @@ import io.quarkus.redis.datasource.RedisDataSource; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class MultiClientImportPreloadingWithOnlyIfEmptyTest { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultipleFilesForDefaultClientImportPreloadingTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultipleFilesForDefaultClientImportPreloadingTest.java index 900a34f0f3c68..1b13cfd6698a4 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultipleFilesForDefaultClientImportPreloadingTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/MultipleFilesForDefaultClientImportPreloadingTest.java @@ -16,9 +16,9 @@ import io.quarkus.redis.datasource.RedisDataSource; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class MultipleFilesForDefaultClientImportPreloadingTest { @RegisterExtension diff --git a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/NonDefaultFileForDefaultClientImportPreloadingTest.java b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/NonDefaultFileForDefaultClientImportPreloadingTest.java index b21aa0528e91c..6ff0a4de75eab 100644 --- a/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/NonDefaultFileForDefaultClientImportPreloadingTest.java +++ b/extensions/redis-client/deployment/src/test/java/io/quarkus/redis/deployment/client/preloading/NonDefaultFileForDefaultClientImportPreloadingTest.java @@ -16,9 +16,9 @@ import io.quarkus.redis.datasource.RedisDataSource; import io.quarkus.redis.deployment.client.RedisTestResource; import io.quarkus.test.QuarkusUnitTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(RedisTestResource.class) +@WithTestResource(value = RedisTestResource.class, restrictToAnnotatedClass = false) public class NonDefaultFileForDefaultClientImportPreloadingTest { @RegisterExtension diff --git a/integration-tests/cache/src/test/java/io/quarkus/it/cache/TreeTestCase.java b/integration-tests/cache/src/test/java/io/quarkus/it/cache/TreeTestCase.java index 71bdc7c26bbb2..28833a8addcbb 100644 --- a/integration-tests/cache/src/test/java/io/quarkus/it/cache/TreeTestCase.java +++ b/integration-tests/cache/src/test/java/io/quarkus/it/cache/TreeTestCase.java @@ -7,12 +7,12 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) @DisplayName("Tests the integration between panache and the cache extension") public class TreeTestCase { diff --git a/integration-tests/devtools/src/test/resources/__snapshots__/ReactiveMessagingCodestartIT/testAMQPContent/src_test_java_ilove_quark_us_MyMessagingApplicationTest.java b/integration-tests/devtools/src/test/resources/__snapshots__/ReactiveMessagingCodestartIT/testAMQPContent/src_test_java_ilove_quark_us_MyMessagingApplicationTest.java index 2141299f2a62d..f697b8c71dc4e 100644 --- a/integration-tests/devtools/src/test/resources/__snapshots__/ReactiveMessagingCodestartIT/testAMQPContent/src_test_java_ilove_quark_us_MyMessagingApplicationTest.java +++ b/integration-tests/devtools/src/test/resources/__snapshots__/ReactiveMessagingCodestartIT/testAMQPContent/src_test_java_ilove_quark_us_MyMessagingApplicationTest.java @@ -1,6 +1,6 @@ package ilove.quark.us; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; import io.quarkus.test.junit.QuarkusTest; diff --git a/integration-tests/devtools/src/test/resources/__snapshots__/ReactiveMessagingCodestartIT/testKafkaContent/src_test_java_ilove_quark_us_MyMessagingApplicationTest.java b/integration-tests/devtools/src/test/resources/__snapshots__/ReactiveMessagingCodestartIT/testKafkaContent/src_test_java_ilove_quark_us_MyMessagingApplicationTest.java index 2141299f2a62d..f697b8c71dc4e 100644 --- a/integration-tests/devtools/src/test/resources/__snapshots__/ReactiveMessagingCodestartIT/testKafkaContent/src_test_java_ilove_quark_us_MyMessagingApplicationTest.java +++ b/integration-tests/devtools/src/test/resources/__snapshots__/ReactiveMessagingCodestartIT/testKafkaContent/src_test_java_ilove_quark_us_MyMessagingApplicationTest.java @@ -1,6 +1,6 @@ package ilove.quark.us; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; import io.quarkus.test.junit.QuarkusTest; diff --git a/integration-tests/elytron-security-jdbc/src/test/java/io/quarkus/elytron/security/jdbc/it/ElytronJdbcExtensionTestResources.java b/integration-tests/elytron-security-jdbc/src/test/java/io/quarkus/elytron/security/jdbc/it/ElytronJdbcExtensionTestResources.java index 944a9b8fb4b30..80a28562e4a3b 100644 --- a/integration-tests/elytron-security-jdbc/src/test/java/io/quarkus/elytron/security/jdbc/it/ElytronJdbcExtensionTestResources.java +++ b/integration-tests/elytron-security-jdbc/src/test/java/io/quarkus/elytron/security/jdbc/it/ElytronJdbcExtensionTestResources.java @@ -1,8 +1,8 @@ package io.quarkus.elytron.security.jdbc.it; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class ElytronJdbcExtensionTestResources { } diff --git a/integration-tests/elytron-security-ldap/src/test/java/io/quarkus/elytron/security/ldap/it/ElytronLdapExtensionTestResources.java b/integration-tests/elytron-security-ldap/src/test/java/io/quarkus/elytron/security/ldap/it/ElytronLdapExtensionTestResources.java index c0144886d8b05..705e18eb2b888 100644 --- a/integration-tests/elytron-security-ldap/src/test/java/io/quarkus/elytron/security/ldap/it/ElytronLdapExtensionTestResources.java +++ b/integration-tests/elytron-security-ldap/src/test/java/io/quarkus/elytron/security/ldap/it/ElytronLdapExtensionTestResources.java @@ -1,8 +1,8 @@ package io.quarkus.elytron.security.ldap.it; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.ldap.LdapServerTestResource; -@QuarkusTestResource(LdapServerTestResource.class) +@WithTestResource(value = LdapServerTestResource.class, restrictToAnnotatedClass = false) public class ElytronLdapExtensionTestResources { } diff --git a/integration-tests/gradle/src/main/resources/custom-filesystem-provider/application/src/test/java/org/acme/ExampleResourceTest.java b/integration-tests/gradle/src/main/resources/custom-filesystem-provider/application/src/test/java/org/acme/ExampleResourceTest.java index 6b2e243fe8f1d..ee212ae78de39 100644 --- a/integration-tests/gradle/src/main/resources/custom-filesystem-provider/application/src/test/java/org/acme/ExampleResourceTest.java +++ b/integration-tests/gradle/src/main/resources/custom-filesystem-provider/application/src/test/java/org/acme/ExampleResourceTest.java @@ -1,23 +1,23 @@ package org.acme; +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.is; -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.junit.QuarkusTest; import org.junit.jupiter.api.Test; -import static io.restassured.RestAssured.given; -import static org.hamcrest.CoreMatchers.is; +import io.quarkus.test.common.WithTestResource; +import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(TestResource.class) +@WithTestResource(value = TestResource.class, restrictToAnnotatedClass = false) public class ExampleResourceTest { @Test public void testHelloEndpoint() { given() - .when().get("/hello") - .then() - .statusCode(200) - .body(is("hello")); + .when().get("/hello") + .then() + .statusCode(200) + .body(is("hello")); } } \ No newline at end of file diff --git a/integration-tests/gradle/src/main/resources/inject-bean-from-test-config/application/src/test/java/org/acme/ExampleResourceTest.java b/integration-tests/gradle/src/main/resources/inject-bean-from-test-config/application/src/test/java/org/acme/ExampleResourceTest.java index 9e48573de4616..a43bcda168cb5 100644 --- a/integration-tests/gradle/src/main/resources/inject-bean-from-test-config/application/src/test/java/org/acme/ExampleResourceTest.java +++ b/integration-tests/gradle/src/main/resources/inject-bean-from-test-config/application/src/test/java/org/acme/ExampleResourceTest.java @@ -1,18 +1,18 @@ package org.acme; import static org.junit.jupiter.api.Assertions.assertEquals; +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.is; import jakarta.inject.Inject; -import io.quarkus.test.junit.QuarkusTest; -import io.quarkus.test.common.QuarkusTestResource; import org.junit.jupiter.api.Test; -import static io.restassured.RestAssured.given; -import static org.hamcrest.CoreMatchers.is; +import io.quarkus.test.common.WithTestResource; +import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(LibraryTestResource.class) +@WithTestResource(value = LibraryTestResource.class, restrictToAnnotatedClass = false) public class ExampleResourceTest { @Inject @@ -21,10 +21,10 @@ public class ExampleResourceTest { @Test public void testHelloEndpoint() { given() - .when().get("/hello") - .then() - .statusCode(200) - .body(is("hello")); + .when().get("/hello") + .then() + .statusCode(200) + .body(is("hello")); assertEquals("test", libraryBean.getValue()); } diff --git a/integration-tests/grpc-hibernate/src/test/java/com/example/grpc/hibernate/TestResources.java b/integration-tests/grpc-hibernate/src/test/java/com/example/grpc/hibernate/TestResources.java index 37b0f78e27deb..d1fbe2e7b4f28 100644 --- a/integration-tests/grpc-hibernate/src/test/java/com/example/grpc/hibernate/TestResources.java +++ b/integration-tests/grpc-hibernate/src/test/java/com/example/grpc/hibernate/TestResources.java @@ -1,8 +1,8 @@ package com.example.grpc.hibernate; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/hibernate-orm-envers/src/test/java/io/quarkus/it/envers/TestResources.java b/integration-tests/hibernate-orm-envers/src/test/java/io/quarkus/it/envers/TestResources.java index dd5de7ea79f4a..a45abcc19839f 100644 --- a/integration-tests/hibernate-orm-envers/src/test/java/io/quarkus/it/envers/TestResources.java +++ b/integration-tests/hibernate-orm-envers/src/test/java/io/quarkus/it/envers/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.envers; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/hibernate-orm-graphql-panache/src/test/java/io/quarkus/it/hibertnate/orm/graphql/panache/TestResources.java b/integration-tests/hibernate-orm-graphql-panache/src/test/java/io/quarkus/it/hibertnate/orm/graphql/panache/TestResources.java index 87980f0eb266d..123c3bd1cc90a 100644 --- a/integration-tests/hibernate-orm-graphql-panache/src/test/java/io/quarkus/it/hibertnate/orm/graphql/panache/TestResources.java +++ b/integration-tests/hibernate-orm-graphql-panache/src/test/java/io/quarkus/it/hibertnate/orm/graphql/panache/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.hibertnate.orm.graphql.panache; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/hibernate-orm-panache-kotlin/src/test/kotlin/io/quarkus/it/panache/TestResources.kt b/integration-tests/hibernate-orm-panache-kotlin/src/test/kotlin/io/quarkus/it/panache/TestResources.kt index 09ed042d4a64f..47fcdc67f4ac7 100644 --- a/integration-tests/hibernate-orm-panache-kotlin/src/test/kotlin/io/quarkus/it/panache/TestResources.kt +++ b/integration-tests/hibernate-orm-panache-kotlin/src/test/kotlin/io/quarkus/it/panache/TestResources.kt @@ -1,6 +1,6 @@ package io.quarkus.it.panache -import io.quarkus.test.common.QuarkusTestResource +import io.quarkus.test.common.WithTestResource import io.quarkus.test.h2.H2DatabaseTestResource -@QuarkusTestResource(H2DatabaseTestResource::class) class TestResources +@WithTestResource(H2DatabaseTestResource::class, restrictToAnnotatedClass = false) class TestResources diff --git a/integration-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/TestResources.java b/integration-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/TestResources.java index 1998c543029a2..ba184daba024c 100644 --- a/integration-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/TestResources.java +++ b/integration-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.panache; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/hibernate-orm-rest-data-panache/src/test/java/io/quarkus/it/hibernate/orm/rest/data/panache/TestResources.java b/integration-tests/hibernate-orm-rest-data-panache/src/test/java/io/quarkus/it/hibernate/orm/rest/data/panache/TestResources.java index 47d334ac8a303..c4c0bca8459a5 100644 --- a/integration-tests/hibernate-orm-rest-data-panache/src/test/java/io/quarkus/it/hibernate/orm/rest/data/panache/TestResources.java +++ b/integration-tests/hibernate-orm-rest-data-panache/src/test/java/io/quarkus/it/hibernate/orm/rest/data/panache/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.hibernate.orm.rest.data.panache; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/hibernate-search-orm-elasticsearch-outbox-polling/src/test/java/io/quarkus/it/hibernate/search/orm/elasticsearch/coordination/outboxpolling/TestResources.java b/integration-tests/hibernate-search-orm-elasticsearch-outbox-polling/src/test/java/io/quarkus/it/hibernate/search/orm/elasticsearch/coordination/outboxpolling/TestResources.java index 8dc99c98d67b1..8f3e7bdd33c54 100644 --- a/integration-tests/hibernate-search-orm-elasticsearch-outbox-polling/src/test/java/io/quarkus/it/hibernate/search/orm/elasticsearch/coordination/outboxpolling/TestResources.java +++ b/integration-tests/hibernate-search-orm-elasticsearch-outbox-polling/src/test/java/io/quarkus/it/hibernate/search/orm/elasticsearch/coordination/outboxpolling/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.hibernate.search.orm.elasticsearch.coordination.outboxpolling; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/hibernate-search-orm-elasticsearch/src/test/java/io/quarkus/it/hibernate/search/orm/elasticsearch/TestResources.java b/integration-tests/hibernate-search-orm-elasticsearch/src/test/java/io/quarkus/it/hibernate/search/orm/elasticsearch/TestResources.java index 1cfd109ae8e1e..4757330847fce 100644 --- a/integration-tests/hibernate-search-orm-elasticsearch/src/test/java/io/quarkus/it/hibernate/search/orm/elasticsearch/TestResources.java +++ b/integration-tests/hibernate-search-orm-elasticsearch/src/test/java/io/quarkus/it/hibernate/search/orm/elasticsearch/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.hibernate.search.orm.elasticsearch; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/hibernate-search-orm-opensearch/src/test/java/io/quarkus/it/hibernate/search/orm/opensearch/TestResources.java b/integration-tests/hibernate-search-orm-opensearch/src/test/java/io/quarkus/it/hibernate/search/orm/opensearch/TestResources.java index 87dd55d63b968..59d3e38f79025 100644 --- a/integration-tests/hibernate-search-orm-opensearch/src/test/java/io/quarkus/it/hibernate/search/orm/opensearch/TestResources.java +++ b/integration-tests/hibernate-search-orm-opensearch/src/test/java/io/quarkus/it/hibernate/search/orm/opensearch/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.hibernate.search.orm.opensearch; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/hibernate-validator-resteasy-reactive/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java b/integration-tests/hibernate-validator-resteasy-reactive/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java index c5db7e407f595..28805dc218f42 100644 --- a/integration-tests/hibernate-validator-resteasy-reactive/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java +++ b/integration-tests/hibernate-validator-resteasy-reactive/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java @@ -18,7 +18,7 @@ import io.quarkus.hibernate.validator.runtime.jaxrs.ResteasyReactiveViolationException; import io.quarkus.test.InMemoryLogHandler; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; @@ -26,7 +26,7 @@ import io.restassured.response.ValidatableResponse; @QuarkusTest -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class HibernateValidatorFunctionalityTest { private static final Formatter LOG_FORMATTER = new PatternFormatter("%s"); private static final java.util.logging.Logger rootLogger = LogManager.getLogManager().getLogger("io.quarkus"); diff --git a/integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java b/integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java index 880841201ec35..353e1c1eaf405 100644 --- a/integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java +++ b/integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java @@ -14,8 +14,8 @@ import io.quarkus.hibernate.validator.runtime.jaxrs.ResteasyViolationExceptionImpl; import io.quarkus.test.LogCollectingTestResource; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; @@ -26,8 +26,8 @@ * Test various Bean Validation operations running in Quarkus */ @QuarkusTest -@QuarkusTestResource(H2DatabaseTestResource.class) -@QuarkusTestResource(value = LogCollectingTestResource.class, restrictToAnnotatedClass = true, initArgs = { +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) +@WithTestResource(value = LogCollectingTestResource.class, initArgs = { @ResourceArg(name = LogCollectingTestResource.LOGGER, value = "io.quarkus"), @ResourceArg(name = LogCollectingTestResource.LEVEL, value = "WARNING") }) diff --git a/integration-tests/infinispan-cache-jpa/src/test/java/io/quarkus/it/infinispan/cache/jpa/TestResources.java b/integration-tests/infinispan-cache-jpa/src/test/java/io/quarkus/it/infinispan/cache/jpa/TestResources.java index 4f8b31ecdc12a..62ded88ead828 100644 --- a/integration-tests/infinispan-cache-jpa/src/test/java/io/quarkus/it/infinispan/cache/jpa/TestResources.java +++ b/integration-tests/infinispan-cache-jpa/src/test/java/io/quarkus/it/infinispan/cache/jpa/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.infinispan.cache.jpa; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/jpa-db2/src/test/java/io/quarkus/it/jpa/db2/HibernateOrmNoWarningsTest.java b/integration-tests/jpa-db2/src/test/java/io/quarkus/it/jpa/db2/HibernateOrmNoWarningsTest.java index 3d95c4b0a6413..8d725a23d8ae1 100644 --- a/integration-tests/jpa-db2/src/test/java/io/quarkus/it/jpa/db2/HibernateOrmNoWarningsTest.java +++ b/integration-tests/jpa-db2/src/test/java/io/quarkus/it/jpa/db2/HibernateOrmNoWarningsTest.java @@ -5,8 +5,8 @@ import org.junit.jupiter.api.Test; import io.quarkus.test.LogCollectingTestResource; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -19,7 +19,7 @@ * hence the lack of a corresponding native mode test. */ @QuarkusTest -@QuarkusTestResource(value = LogCollectingTestResource.class, restrictToAnnotatedClass = true, initArgs = { +@WithTestResource(value = LogCollectingTestResource.class, initArgs = { @ResourceArg(name = LogCollectingTestResource.LEVEL, value = "WARNING"), @ResourceArg(name = LogCollectingTestResource.INCLUDE, value = "org\\.hibernate\\..*"), // Ignore logs about schema management: diff --git a/integration-tests/jpa-derby/src/test/java/io/quarkus/it/jpa/derby/HibernateOrmNoWarningsTest.java b/integration-tests/jpa-derby/src/test/java/io/quarkus/it/jpa/derby/HibernateOrmNoWarningsTest.java index 4d61663dd21ee..60260d9284596 100644 --- a/integration-tests/jpa-derby/src/test/java/io/quarkus/it/jpa/derby/HibernateOrmNoWarningsTest.java +++ b/integration-tests/jpa-derby/src/test/java/io/quarkus/it/jpa/derby/HibernateOrmNoWarningsTest.java @@ -5,8 +5,8 @@ import org.junit.jupiter.api.Test; import io.quarkus.test.LogCollectingTestResource; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -19,7 +19,7 @@ * hence the lack of a corresponding native mode test. */ @QuarkusTest -@QuarkusTestResource(value = LogCollectingTestResource.class, restrictToAnnotatedClass = true, initArgs = { +@WithTestResource(value = LogCollectingTestResource.class, initArgs = { @ResourceArg(name = LogCollectingTestResource.LEVEL, value = "WARNING"), @ResourceArg(name = LogCollectingTestResource.INCLUDE, value = "org\\.hibernate\\..*"), // Ignore logs about schema management: diff --git a/integration-tests/jpa-derby/src/test/java/io/quarkus/it/jpa/derby/TestResources.java b/integration-tests/jpa-derby/src/test/java/io/quarkus/it/jpa/derby/TestResources.java index dc9ff6d8de8fe..573b4b260ef2b 100644 --- a/integration-tests/jpa-derby/src/test/java/io/quarkus/it/jpa/derby/TestResources.java +++ b/integration-tests/jpa-derby/src/test/java/io/quarkus/it/jpa/derby/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.jpa.derby; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.derby.DerbyDatabaseTestResource; -@QuarkusTestResource(DerbyDatabaseTestResource.class) +@WithTestResource(value = DerbyDatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/jpa-h2-embedded/src/test/java/io/quarkus/it/jpa/h2/HibernateOrmNoWarningsTest.java b/integration-tests/jpa-h2-embedded/src/test/java/io/quarkus/it/jpa/h2/HibernateOrmNoWarningsTest.java index 0922b7ab32736..8bd9220f4402d 100644 --- a/integration-tests/jpa-h2-embedded/src/test/java/io/quarkus/it/jpa/h2/HibernateOrmNoWarningsTest.java +++ b/integration-tests/jpa-h2-embedded/src/test/java/io/quarkus/it/jpa/h2/HibernateOrmNoWarningsTest.java @@ -5,8 +5,8 @@ import org.junit.jupiter.api.Test; import io.quarkus.test.LogCollectingTestResource; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -19,7 +19,7 @@ * hence the lack of a corresponding native mode test. */ @QuarkusTest -@QuarkusTestResource(value = LogCollectingTestResource.class, restrictToAnnotatedClass = true, initArgs = { +@WithTestResource(value = LogCollectingTestResource.class, initArgs = { @ResourceArg(name = LogCollectingTestResource.LEVEL, value = "WARNING"), @ResourceArg(name = LogCollectingTestResource.INCLUDE, value = "org\\.hibernate\\..*"), // Ignore logs about schema management: diff --git a/integration-tests/jpa-h2/src/test/java/io/quarkus/it/jpa/h2/HibernateOrmNoWarningsTest.java b/integration-tests/jpa-h2/src/test/java/io/quarkus/it/jpa/h2/HibernateOrmNoWarningsTest.java index 9245c3ce6669c..207cecc01cdbf 100644 --- a/integration-tests/jpa-h2/src/test/java/io/quarkus/it/jpa/h2/HibernateOrmNoWarningsTest.java +++ b/integration-tests/jpa-h2/src/test/java/io/quarkus/it/jpa/h2/HibernateOrmNoWarningsTest.java @@ -5,8 +5,8 @@ import org.junit.jupiter.api.Test; import io.quarkus.test.LogCollectingTestResource; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -19,7 +19,7 @@ * hence the lack of a corresponding native mode test. */ @QuarkusTest -@QuarkusTestResource(value = LogCollectingTestResource.class, restrictToAnnotatedClass = true, initArgs = { +@WithTestResource(value = LogCollectingTestResource.class, initArgs = { @ResourceArg(name = LogCollectingTestResource.LEVEL, value = "WARNING"), @ResourceArg(name = LogCollectingTestResource.INCLUDE, value = "org\\.hibernate\\..*"), //We actually have a single warning, caused by the intentional peculiarities of io.quarkus.it.jpa.h2.CompanyCustomer: diff --git a/integration-tests/jpa-mariadb/src/test/java/io/quarkus/it/jpa/mariadb/HibernateOrmNoWarningsTest.java b/integration-tests/jpa-mariadb/src/test/java/io/quarkus/it/jpa/mariadb/HibernateOrmNoWarningsTest.java index 9769a98ff52a8..d4cc05b79ef1f 100644 --- a/integration-tests/jpa-mariadb/src/test/java/io/quarkus/it/jpa/mariadb/HibernateOrmNoWarningsTest.java +++ b/integration-tests/jpa-mariadb/src/test/java/io/quarkus/it/jpa/mariadb/HibernateOrmNoWarningsTest.java @@ -5,8 +5,8 @@ import org.junit.jupiter.api.Test; import io.quarkus.test.LogCollectingTestResource; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -19,7 +19,7 @@ * hence the lack of a corresponding native mode test. */ @QuarkusTest -@QuarkusTestResource(value = LogCollectingTestResource.class, restrictToAnnotatedClass = true, initArgs = { +@WithTestResource(value = LogCollectingTestResource.class, initArgs = { @ResourceArg(name = LogCollectingTestResource.LEVEL, value = "WARNING"), @ResourceArg(name = LogCollectingTestResource.INCLUDE, value = "org\\.hibernate\\..*"), // Ignore logs about schema management: diff --git a/integration-tests/jpa-mssql/src/test/java/io/quarkus/it/jpa/mssql/HibernateOrmNoWarningsTest.java b/integration-tests/jpa-mssql/src/test/java/io/quarkus/it/jpa/mssql/HibernateOrmNoWarningsTest.java index 6768f30c640b2..829deff127c72 100644 --- a/integration-tests/jpa-mssql/src/test/java/io/quarkus/it/jpa/mssql/HibernateOrmNoWarningsTest.java +++ b/integration-tests/jpa-mssql/src/test/java/io/quarkus/it/jpa/mssql/HibernateOrmNoWarningsTest.java @@ -5,8 +5,8 @@ import org.junit.jupiter.api.Test; import io.quarkus.test.LogCollectingTestResource; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -19,7 +19,7 @@ * hence the lack of a corresponding native mode test. */ @QuarkusTest -@QuarkusTestResource(value = LogCollectingTestResource.class, restrictToAnnotatedClass = true, initArgs = { +@WithTestResource(value = LogCollectingTestResource.class, initArgs = { @ResourceArg(name = LogCollectingTestResource.LEVEL, value = "WARNING"), @ResourceArg(name = LogCollectingTestResource.INCLUDE, value = "org\\.hibernate\\..*"), // Ignore logs about schema management: diff --git a/integration-tests/jpa-mysql/src/test/java/io/quarkus/it/jpa/mysql/HibernateOrmNoWarningsTest.java b/integration-tests/jpa-mysql/src/test/java/io/quarkus/it/jpa/mysql/HibernateOrmNoWarningsTest.java index 290c1c28c8f97..c54b05faa6bb3 100644 --- a/integration-tests/jpa-mysql/src/test/java/io/quarkus/it/jpa/mysql/HibernateOrmNoWarningsTest.java +++ b/integration-tests/jpa-mysql/src/test/java/io/quarkus/it/jpa/mysql/HibernateOrmNoWarningsTest.java @@ -5,8 +5,8 @@ import org.junit.jupiter.api.Test; import io.quarkus.test.LogCollectingTestResource; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -19,7 +19,7 @@ * hence the lack of a corresponding native mode test. */ @QuarkusTest -@QuarkusTestResource(value = LogCollectingTestResource.class, restrictToAnnotatedClass = true, initArgs = { +@WithTestResource(value = LogCollectingTestResource.class, initArgs = { @ResourceArg(name = LogCollectingTestResource.LEVEL, value = "WARNING"), @ResourceArg(name = LogCollectingTestResource.INCLUDE, value = "org\\.hibernate\\..*"), // Ignore logs about schema management: diff --git a/integration-tests/jpa-oracle/src/test/java/io/quarkus/it/jpa/oracle/HibernateOrmNoWarningsTest.java b/integration-tests/jpa-oracle/src/test/java/io/quarkus/it/jpa/oracle/HibernateOrmNoWarningsTest.java index 51e4626659d48..3cb2ec6b21992 100644 --- a/integration-tests/jpa-oracle/src/test/java/io/quarkus/it/jpa/oracle/HibernateOrmNoWarningsTest.java +++ b/integration-tests/jpa-oracle/src/test/java/io/quarkus/it/jpa/oracle/HibernateOrmNoWarningsTest.java @@ -5,8 +5,8 @@ import org.junit.jupiter.api.Test; import io.quarkus.test.LogCollectingTestResource; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -19,7 +19,7 @@ * hence the lack of a corresponding native mode test. */ @QuarkusTest -@QuarkusTestResource(value = LogCollectingTestResource.class, restrictToAnnotatedClass = true, initArgs = { +@WithTestResource(value = LogCollectingTestResource.class, initArgs = { @ResourceArg(name = LogCollectingTestResource.LEVEL, value = "WARNING"), @ResourceArg(name = LogCollectingTestResource.INCLUDE, value = "org\\.hibernate\\..*"), // Ignore logs about schema management: diff --git a/integration-tests/jpa-postgresql/src/test/java/io/quarkus/it/jpa/postgresql/HibernateOrmNoWarningsTest.java b/integration-tests/jpa-postgresql/src/test/java/io/quarkus/it/jpa/postgresql/HibernateOrmNoWarningsTest.java index c433e055b5c55..ee0b09694d20d 100644 --- a/integration-tests/jpa-postgresql/src/test/java/io/quarkus/it/jpa/postgresql/HibernateOrmNoWarningsTest.java +++ b/integration-tests/jpa-postgresql/src/test/java/io/quarkus/it/jpa/postgresql/HibernateOrmNoWarningsTest.java @@ -5,8 +5,8 @@ import org.junit.jupiter.api.Test; import io.quarkus.test.LogCollectingTestResource; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -19,7 +19,7 @@ * hence the lack of a corresponding native mode test. */ @QuarkusTest -@QuarkusTestResource(value = LogCollectingTestResource.class, restrictToAnnotatedClass = true, initArgs = { +@WithTestResource(value = LogCollectingTestResource.class, initArgs = { @ResourceArg(name = LogCollectingTestResource.LEVEL, value = "WARNING"), @ResourceArg(name = LogCollectingTestResource.INCLUDE, value = "org\\.hibernate\\..*"), // Ignore logs about schema management: diff --git a/integration-tests/jpa/src/test/java/io/quarkus/it/jpa/configurationless/TestResources.java b/integration-tests/jpa/src/test/java/io/quarkus/it/jpa/configurationless/TestResources.java index 2222dbc22d530..a7863f2142d06 100644 --- a/integration-tests/jpa/src/test/java/io/quarkus/it/jpa/configurationless/TestResources.java +++ b/integration-tests/jpa/src/test/java/io/quarkus/it/jpa/configurationless/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.jpa.configurationless; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/kafka-avro-apicurio2/src/test/java/io/quarkus/it/kafka/KafkaAvroIT.java b/integration-tests/kafka-avro-apicurio2/src/test/java/io/quarkus/it/kafka/KafkaAvroIT.java index cde33e53f4a2c..7fc68998034b7 100644 --- a/integration-tests/kafka-avro-apicurio2/src/test/java/io/quarkus/it/kafka/KafkaAvroIT.java +++ b/integration-tests/kafka-avro-apicurio2/src/test/java/io/quarkus/it/kafka/KafkaAvroIT.java @@ -5,12 +5,12 @@ import io.apicurio.registry.rest.client.RegistryClientFactory; import io.apicurio.rest.client.VertxHttpClientProvider; import io.quarkus.it.kafka.avro.AvroKafkaCreator; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusIntegrationTest; import io.vertx.core.Vertx; @QuarkusIntegrationTest -@QuarkusTestResource(value = KafkaResource.class, restrictToAnnotatedClass = true) +@WithTestResource(KafkaResource.class) public class KafkaAvroIT extends KafkaAvroTestBase { AvroKafkaCreator creator; diff --git a/integration-tests/kafka-json-schema-apicurio2/src/test/java/io/quarkus/it/kafka/KafkaJsonSchemaIT.java b/integration-tests/kafka-json-schema-apicurio2/src/test/java/io/quarkus/it/kafka/KafkaJsonSchemaIT.java index 31ddb23296938..91a1be867cf42 100644 --- a/integration-tests/kafka-json-schema-apicurio2/src/test/java/io/quarkus/it/kafka/KafkaJsonSchemaIT.java +++ b/integration-tests/kafka-json-schema-apicurio2/src/test/java/io/quarkus/it/kafka/KafkaJsonSchemaIT.java @@ -5,12 +5,12 @@ import io.apicurio.registry.rest.client.RegistryClientFactory; import io.apicurio.rest.client.VertxHttpClientProvider; import io.quarkus.it.kafka.jsonschema.JsonSchemaKafkaCreator; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusIntegrationTest; import io.vertx.core.Vertx; @QuarkusIntegrationTest -@QuarkusTestResource(value = KafkaResource.class, restrictToAnnotatedClass = true) +@WithTestResource(KafkaResource.class) public class KafkaJsonSchemaIT extends KafkaJsonSchemaTestBase { JsonSchemaKafkaCreator creator; diff --git a/integration-tests/kafka-oauth-keycloak/src/test/java/io/quarkus/it/kafka/KafkaOauthIT.java b/integration-tests/kafka-oauth-keycloak/src/test/java/io/quarkus/it/kafka/KafkaOauthIT.java index e6904b0b05a70..0ebbb14faf73f 100644 --- a/integration-tests/kafka-oauth-keycloak/src/test/java/io/quarkus/it/kafka/KafkaOauthIT.java +++ b/integration-tests/kafka-oauth-keycloak/src/test/java/io/quarkus/it/kafka/KafkaOauthIT.java @@ -1,10 +1,10 @@ package io.quarkus.it.kafka; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusIntegrationTest; @QuarkusIntegrationTest -@QuarkusTestResource(KafkaKeycloakTestResource.class) +@WithTestResource(value = KafkaKeycloakTestResource.class, restrictToAnnotatedClass = false) public class KafkaOauthIT extends KafkaOauthTest { } diff --git a/integration-tests/kafka-oauth-keycloak/src/test/java/io/quarkus/it/kafka/KafkaOauthTest.java b/integration-tests/kafka-oauth-keycloak/src/test/java/io/quarkus/it/kafka/KafkaOauthTest.java index c450e43a8b5f9..af921ca9a3d47 100644 --- a/integration-tests/kafka-oauth-keycloak/src/test/java/io/quarkus/it/kafka/KafkaOauthTest.java +++ b/integration-tests/kafka-oauth-keycloak/src/test/java/io/quarkus/it/kafka/KafkaOauthTest.java @@ -8,12 +8,12 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.common.mapper.TypeRef; @QuarkusTest -@QuarkusTestResource(KafkaKeycloakTestResource.class) +@WithTestResource(value = KafkaKeycloakTestResource.class, restrictToAnnotatedClass = false) public class KafkaOauthTest { protected static final TypeRef> TYPE_REF = new TypeRef>() { diff --git a/integration-tests/kafka-sasl-elytron/src/test/java/io/quarkus/it/kafka/KafkaSaslIT.java b/integration-tests/kafka-sasl-elytron/src/test/java/io/quarkus/it/kafka/KafkaSaslIT.java index 6dd49ca3c4d7f..5b508486fedb5 100644 --- a/integration-tests/kafka-sasl-elytron/src/test/java/io/quarkus/it/kafka/KafkaSaslIT.java +++ b/integration-tests/kafka-sasl-elytron/src/test/java/io/quarkus/it/kafka/KafkaSaslIT.java @@ -8,12 +8,12 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusIntegrationTest; import io.restassured.common.mapper.TypeRef; @QuarkusIntegrationTest -@QuarkusTestResource(KafkaSaslTestResource.class) +@WithTestResource(value = KafkaSaslTestResource.class, restrictToAnnotatedClass = false) public class KafkaSaslIT { protected static final TypeRef> TYPE_REF = new TypeRef>() { diff --git a/integration-tests/kafka-sasl-elytron/src/test/java/io/quarkus/it/kafka/KafkaSaslTest.java b/integration-tests/kafka-sasl-elytron/src/test/java/io/quarkus/it/kafka/KafkaSaslTest.java index 6532f0c2586f9..966e7aa976745 100644 --- a/integration-tests/kafka-sasl-elytron/src/test/java/io/quarkus/it/kafka/KafkaSaslTest.java +++ b/integration-tests/kafka-sasl-elytron/src/test/java/io/quarkus/it/kafka/KafkaSaslTest.java @@ -8,12 +8,12 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.common.mapper.TypeRef; @QuarkusTest -@QuarkusTestResource(KafkaSaslTestResource.class) +@WithTestResource(value = KafkaSaslTestResource.class, restrictToAnnotatedClass = false) public class KafkaSaslTest { protected static final TypeRef> TYPE_REF = new TypeRef>() { diff --git a/integration-tests/kafka-sasl/src/test/java/io/quarkus/it/kafka/SaslKafkaConsumerIT.java b/integration-tests/kafka-sasl/src/test/java/io/quarkus/it/kafka/SaslKafkaConsumerIT.java index 06c419fb681af..d98d5d9b443e3 100644 --- a/integration-tests/kafka-sasl/src/test/java/io/quarkus/it/kafka/SaslKafkaConsumerIT.java +++ b/integration-tests/kafka-sasl/src/test/java/io/quarkus/it/kafka/SaslKafkaConsumerIT.java @@ -1,10 +1,10 @@ package io.quarkus.it.kafka; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusIntegrationTest; @QuarkusIntegrationTest -@QuarkusTestResource(KafkaSASLTestResource.class) +@WithTestResource(value = KafkaSASLTestResource.class, restrictToAnnotatedClass = false) public class SaslKafkaConsumerIT extends SaslKafkaConsumerTest { } diff --git a/integration-tests/kafka-sasl/src/test/java/io/quarkus/it/kafka/SaslKafkaConsumerTest.java b/integration-tests/kafka-sasl/src/test/java/io/quarkus/it/kafka/SaslKafkaConsumerTest.java index f88c6c59a5090..763e3d876894d 100644 --- a/integration-tests/kafka-sasl/src/test/java/io/quarkus/it/kafka/SaslKafkaConsumerTest.java +++ b/integration-tests/kafka-sasl/src/test/java/io/quarkus/it/kafka/SaslKafkaConsumerTest.java @@ -13,12 +13,12 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; @QuarkusTest -@QuarkusTestResource(KafkaSASLTestResource.class) +@WithTestResource(value = KafkaSASLTestResource.class, restrictToAnnotatedClass = false) public class SaslKafkaConsumerTest { public Producer createProducer() { diff --git a/integration-tests/kafka-snappy/src/test/java/io/quarkus/it/kafka/KafkaSnappyCodecTest.java b/integration-tests/kafka-snappy/src/test/java/io/quarkus/it/kafka/KafkaSnappyCodecTest.java index a78831f712915..860c3de4ab629 100644 --- a/integration-tests/kafka-snappy/src/test/java/io/quarkus/it/kafka/KafkaSnappyCodecTest.java +++ b/integration-tests/kafka-snappy/src/test/java/io/quarkus/it/kafka/KafkaSnappyCodecTest.java @@ -5,13 +5,13 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.config.ObjectMapperConfig; import io.restassured.mapper.ObjectMapperType; -@QuarkusTestResource(KafkaTestResource.class) +@WithTestResource(value = KafkaTestResource.class, restrictToAnnotatedClass = false) @QuarkusTest public class KafkaSnappyCodecTest { diff --git a/integration-tests/kafka-snappy/src/test/java/io/quarkus/it/kafka/KafkaSnappyConsumerTest.java b/integration-tests/kafka-snappy/src/test/java/io/quarkus/it/kafka/KafkaSnappyConsumerTest.java index 0024eec301b8c..87587c15a43b6 100644 --- a/integration-tests/kafka-snappy/src/test/java/io/quarkus/it/kafka/KafkaSnappyConsumerTest.java +++ b/integration-tests/kafka-snappy/src/test/java/io/quarkus/it/kafka/KafkaSnappyConsumerTest.java @@ -14,13 +14,13 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.config.ObjectMapperConfig; import io.restassured.mapper.ObjectMapperType; -@QuarkusTestResource(KafkaTestResource.class) +@WithTestResource(value = KafkaTestResource.class, restrictToAnnotatedClass = false) @QuarkusTest public class KafkaSnappyConsumerTest { diff --git a/integration-tests/kafka-ssl/src/test/java/io/quarkus/it/kafka/SslKafkaConsumerITCase.java b/integration-tests/kafka-ssl/src/test/java/io/quarkus/it/kafka/SslKafkaConsumerITCase.java index f470a00957939..88c27cfdd99f2 100644 --- a/integration-tests/kafka-ssl/src/test/java/io/quarkus/it/kafka/SslKafkaConsumerITCase.java +++ b/integration-tests/kafka-ssl/src/test/java/io/quarkus/it/kafka/SslKafkaConsumerITCase.java @@ -1,10 +1,10 @@ package io.quarkus.it.kafka; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusIntegrationTest; @QuarkusIntegrationTest -@QuarkusTestResource(KafkaSSLTestResource.class) +@WithTestResource(value = KafkaSSLTestResource.class, restrictToAnnotatedClass = false) public class SslKafkaConsumerITCase extends SslKafkaConsumerTest { } diff --git a/integration-tests/kafka-ssl/src/test/java/io/quarkus/it/kafka/SslKafkaConsumerTest.java b/integration-tests/kafka-ssl/src/test/java/io/quarkus/it/kafka/SslKafkaConsumerTest.java index e74abe95c6458..f2b0144bad31b 100644 --- a/integration-tests/kafka-ssl/src/test/java/io/quarkus/it/kafka/SslKafkaConsumerTest.java +++ b/integration-tests/kafka-ssl/src/test/java/io/quarkus/it/kafka/SslKafkaConsumerTest.java @@ -16,7 +16,7 @@ import org.junit.jupiter.params.provider.CsvSource; import io.quarkus.it.kafka.ssl.CertificateFormat; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import me.escoffier.certs.Format; @@ -28,7 +28,7 @@ Format.PEM }, password = "Z_pkTh9xgZovK4t34cGB2o6afT4zZg0L") }, baseDir = "target/certs") @QuarkusTest -@QuarkusTestResource(KafkaSSLTestResource.class) +@WithTestResource(value = KafkaSSLTestResource.class, restrictToAnnotatedClass = false) public class SslKafkaConsumerTest { public static Producer createProducer(CertificateFormat format) { diff --git a/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsCdiEventTest.java b/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsCdiEventTest.java index 8c7fffe1ff5b4..8a30469bef7e1 100644 --- a/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsCdiEventTest.java +++ b/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsCdiEventTest.java @@ -5,10 +5,10 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; -@QuarkusTestResource(KafkaSSLTestResource.class) +@WithTestResource(value = KafkaSSLTestResource.class, restrictToAnnotatedClass = false) @QuarkusTest public class KafkaStreamsCdiEventTest { diff --git a/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsPropertiesTest.java b/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsPropertiesTest.java index 8a56018dbeedb..9ab7b1ef521ba 100644 --- a/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsPropertiesTest.java +++ b/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsPropertiesTest.java @@ -11,10 +11,10 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; -@QuarkusTestResource(KafkaSSLTestResource.class) +@WithTestResource(value = KafkaSSLTestResource.class, restrictToAnnotatedClass = false) @QuarkusTest public class KafkaStreamsPropertiesTest { diff --git a/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsStartupFailureTest.java b/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsStartupFailureTest.java index a68acba849e55..926326abbca6b 100644 --- a/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsStartupFailureTest.java +++ b/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsStartupFailureTest.java @@ -17,13 +17,13 @@ import io.quarkus.kafka.streams.runtime.KafkaStreamsTopologyManager; import io.quarkus.runtime.Application; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.QuarkusTestProfile; import io.quarkus.test.junit.TestProfile; import io.restassured.RestAssured; -@QuarkusTestResource(KafkaSSLTestResource.class) +@WithTestResource(value = KafkaSSLTestResource.class, restrictToAnnotatedClass = false) @TestProfile(KafkaStreamsStartupFailureTest.NonExistingTopicProfile.class) @QuarkusTest public class KafkaStreamsStartupFailureTest { diff --git a/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsTest.java b/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsTest.java index ae2f7ee91f9e5..e3559561abe05 100644 --- a/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsTest.java +++ b/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsTest.java @@ -29,11 +29,11 @@ import io.quarkus.kafka.client.serialization.ObjectMapperDeserializer; import io.quarkus.kafka.client.serialization.ObjectMapperSerializer; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; -@QuarkusTestResource(KafkaSSLTestResource.class) +@WithTestResource(value = KafkaSSLTestResource.class, restrictToAnnotatedClass = false) @QuarkusTest public class KafkaStreamsTest { diff --git a/integration-tests/kafka/src/test/java/io/quarkus/it/kafka/KafkaCodecTest.java b/integration-tests/kafka/src/test/java/io/quarkus/it/kafka/KafkaCodecTest.java index 8ac8044d84532..348227d9c26cc 100644 --- a/integration-tests/kafka/src/test/java/io/quarkus/it/kafka/KafkaCodecTest.java +++ b/integration-tests/kafka/src/test/java/io/quarkus/it/kafka/KafkaCodecTest.java @@ -5,14 +5,14 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.kafka.KafkaCompanionResource; import io.restassured.RestAssured; import io.restassured.config.ObjectMapperConfig; import io.restassured.mapper.ObjectMapperType; -@QuarkusTestResource(KafkaCompanionResource.class) +@WithTestResource(value = KafkaCompanionResource.class, restrictToAnnotatedClass = false) @QuarkusTest public class KafkaCodecTest { diff --git a/integration-tests/kafka/src/test/java/io/quarkus/it/kafka/KafkaConsumerTest.java b/integration-tests/kafka/src/test/java/io/quarkus/it/kafka/KafkaConsumerTest.java index 2c2fbac8f1e09..af950619fa9a1 100644 --- a/integration-tests/kafka/src/test/java/io/quarkus/it/kafka/KafkaConsumerTest.java +++ b/integration-tests/kafka/src/test/java/io/quarkus/it/kafka/KafkaConsumerTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.kafka.InjectKafkaCompanion; import io.quarkus.test.kafka.KafkaCompanionResource; @@ -16,7 +16,7 @@ import io.restassured.mapper.ObjectMapperType; import io.smallrye.reactive.messaging.kafka.companion.KafkaCompanion; -@QuarkusTestResource(KafkaCompanionResource.class) +@WithTestResource(value = KafkaCompanionResource.class, restrictToAnnotatedClass = false) @QuarkusTest public class KafkaConsumerTest { diff --git a/integration-tests/kafka/src/test/java/io/quarkus/it/kafka/KafkaProducerTest.java b/integration-tests/kafka/src/test/java/io/quarkus/it/kafka/KafkaProducerTest.java index 81c44331b8cc6..2d561f06b7d20 100644 --- a/integration-tests/kafka/src/test/java/io/quarkus/it/kafka/KafkaProducerTest.java +++ b/integration-tests/kafka/src/test/java/io/quarkus/it/kafka/KafkaProducerTest.java @@ -9,7 +9,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.kafka.InjectKafkaCompanion; import io.quarkus.test.kafka.KafkaCompanionResource; @@ -19,7 +19,7 @@ import io.smallrye.reactive.messaging.kafka.companion.ConsumerTask; import io.smallrye.reactive.messaging.kafka.companion.KafkaCompanion; -@QuarkusTestResource(KafkaCompanionResource.class) +@WithTestResource(value = KafkaCompanionResource.class, restrictToAnnotatedClass = false) @QuarkusTest public class KafkaProducerTest { diff --git a/integration-tests/keycloak-authorization/src/test/java/io/quarkus/it/keycloak/PolicyEnforcerTest.java b/integration-tests/keycloak-authorization/src/test/java/io/quarkus/it/keycloak/PolicyEnforcerTest.java index 3fc5fe50e69b1..1b470353dd7e4 100644 --- a/integration-tests/keycloak-authorization/src/test/java/io/quarkus/it/keycloak/PolicyEnforcerTest.java +++ b/integration-tests/keycloak-authorization/src/test/java/io/quarkus/it/keycloak/PolicyEnforcerTest.java @@ -17,7 +17,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.keycloak.client.KeycloakTestClient; @@ -29,7 +29,7 @@ * @author Pedro Igor */ @QuarkusTest -@QuarkusTestResource(KeycloakLifecycleManager.class) +@WithTestResource(value = KeycloakLifecycleManager.class, restrictToAnnotatedClass = false) public class PolicyEnforcerTest { private static final Duration REQUEST_TIMEOUT = Duration.ofSeconds(10); diff --git a/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/AbsentConfigMapPropertiesPMT.java b/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/AbsentConfigMapPropertiesPMT.java index 4f1a94cff8e4c..9db13b315d579 100644 --- a/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/AbsentConfigMapPropertiesPMT.java +++ b/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/AbsentConfigMapPropertiesPMT.java @@ -7,9 +7,9 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusProdModeTest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; -@QuarkusTestResource(value = CustomKubernetesMockServerTestResource.class, restrictToAnnotatedClass = true) +@WithTestResource(CustomKubernetesMockServerTestResource.class) public class AbsentConfigMapPropertiesPMT { @RegisterExtension diff --git a/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/ConfigMapPropertiesTest.java b/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/ConfigMapPropertiesTest.java index 03d0102941a06..7a8c86457bfda 100644 --- a/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/ConfigMapPropertiesTest.java +++ b/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/ConfigMapPropertiesTest.java @@ -5,10 +5,10 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; -@QuarkusTestResource(value = CustomKubernetesMockServerTestResource.class, restrictToAnnotatedClass = true) +@WithTestResource(CustomKubernetesMockServerTestResource.class) @QuarkusTest public class ConfigMapPropertiesTest { diff --git a/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/KubernetesClientTest.java b/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/KubernetesClientTest.java index 3961655f0f30c..1a2135835f8d2 100644 --- a/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/KubernetesClientTest.java +++ b/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/KubernetesClientTest.java @@ -18,7 +18,7 @@ import io.fabric8.kubernetes.api.model.PodListBuilder; import io.fabric8.kubernetes.client.internal.CertUtils; import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.kubernetes.client.MockServer; import io.restassured.RestAssured; @@ -27,7 +27,7 @@ * KubernetesClientTest.TestResource contains the entire process of setting up the Mock Kubernetes API Server * It has to live there otherwise the Kubernetes client in native mode won't be able to locate the mock API Server */ -@QuarkusTestResource(value = CustomKubernetesMockServerTestResource.class, restrictToAnnotatedClass = true) +@WithTestResource(CustomKubernetesMockServerTestResource.class) @QuarkusTest public class KubernetesClientTest { diff --git a/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/KubernetesNewClientTest.java b/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/KubernetesNewClientTest.java index 9eabaacc6d954..ba092eb5da1cf 100644 --- a/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/KubernetesNewClientTest.java +++ b/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/KubernetesNewClientTest.java @@ -8,7 +8,7 @@ import io.fabric8.kubernetes.api.model.Pod; import io.fabric8.kubernetes.api.model.PodBuilder; import io.fabric8.kubernetes.client.server.mock.KubernetesServer; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.kubernetes.client.KubernetesTestServer; import io.restassured.RestAssured; @@ -17,7 +17,7 @@ * KubernetesClientTest.TestResource contains the entire process of setting up the Mock Kubernetes API Server * It has to live there otherwise the Kubernetes client in native mode won't be able to locate the mock API Server */ -@QuarkusTestResource(value = CustomKubernetesTestServerTestResource.class, restrictToAnnotatedClass = true) +@WithTestResource(CustomKubernetesTestServerTestResource.class) @QuarkusTest class KubernetesNewClientTest { diff --git a/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/NamespacedConfigMapPropertiesTest.java b/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/NamespacedConfigMapPropertiesTest.java index ea203c1c90b15..f72d4e2e7ec2b 100644 --- a/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/NamespacedConfigMapPropertiesTest.java +++ b/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/NamespacedConfigMapPropertiesTest.java @@ -5,12 +5,12 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.QuarkusTestProfile; import io.quarkus.test.junit.TestProfile; -@QuarkusTestResource(value = CustomKubernetesMockServerTestResource.class, restrictToAnnotatedClass = true) +@WithTestResource(CustomKubernetesMockServerTestResource.class) @TestProfile(NamespacedConfigMapPropertiesTest.MyProfile.class) @QuarkusTest public class NamespacedConfigMapPropertiesTest { diff --git a/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/SecretPropertiesTest.java b/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/SecretPropertiesTest.java index 425fef9d150f7..02580f47dd099 100644 --- a/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/SecretPropertiesTest.java +++ b/integration-tests/kubernetes-client/src/test/java/io/quarkus/it/kubernetes/client/SecretPropertiesTest.java @@ -5,10 +5,10 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; -@QuarkusTestResource(value = CustomKubernetesMockServerTestResource.class, restrictToAnnotatedClass = true) +@WithTestResource(CustomKubernetesMockServerTestResource.class) @QuarkusTest public class SecretPropertiesTest { diff --git a/integration-tests/liquibase-mongodb/src/test/java/io/quarkus/it/liquibase/mongodb/FruitResourceTest.java b/integration-tests/liquibase-mongodb/src/test/java/io/quarkus/it/liquibase/mongodb/FruitResourceTest.java index f87033d050171..ebe2268e6dd95 100644 --- a/integration-tests/liquibase-mongodb/src/test/java/io/quarkus/it/liquibase/mongodb/FruitResourceTest.java +++ b/integration-tests/liquibase-mongodb/src/test/java/io/quarkus/it/liquibase/mongodb/FruitResourceTest.java @@ -18,13 +18,13 @@ import com.mongodb.client.ListIndexesIterable; import com.mongodb.client.MongoClient; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.mongodb.MongoTestResource; import io.restassured.common.mapper.TypeRef; @QuarkusTest -@QuarkusTestResource(MongoTestResource.class) +@WithTestResource(value = MongoTestResource.class, restrictToAnnotatedClass = false) @DisabledOnOs(OS.WINDOWS) class FruitResourceTest { diff --git a/integration-tests/liquibase-mongodb/src/test/java/io/quarkus/it/liquibase/mongodb/NativeFruitResourceTestIT.java b/integration-tests/liquibase-mongodb/src/test/java/io/quarkus/it/liquibase/mongodb/NativeFruitResourceTestIT.java index 7d3cd68437683..81362c25d2bd4 100644 --- a/integration-tests/liquibase-mongodb/src/test/java/io/quarkus/it/liquibase/mongodb/NativeFruitResourceTestIT.java +++ b/integration-tests/liquibase-mongodb/src/test/java/io/quarkus/it/liquibase/mongodb/NativeFruitResourceTestIT.java @@ -9,13 +9,13 @@ import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusIntegrationTest; import io.quarkus.test.mongodb.MongoTestResource; import io.restassured.common.mapper.TypeRef; @QuarkusIntegrationTest -@QuarkusTestResource(MongoTestResource.class) +@WithTestResource(value = MongoTestResource.class, restrictToAnnotatedClass = false) @DisabledOnOs(OS.WINDOWS) class NativeFruitResourceTestIT { @Test diff --git a/integration-tests/liquibase/src/test/java/io/quarkus/it/liquibase/LiquibaseTestResources.java b/integration-tests/liquibase/src/test/java/io/quarkus/it/liquibase/LiquibaseTestResources.java index 499a1291b287b..4ea994ff530ca 100644 --- a/integration-tests/liquibase/src/test/java/io/quarkus/it/liquibase/LiquibaseTestResources.java +++ b/integration-tests/liquibase/src/test/java/io/quarkus/it/liquibase/LiquibaseTestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.liquibase; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class LiquibaseTestResources { } diff --git a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingFilterTest.java b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingFilterTest.java index 2556243f76013..1d5fe9486798e 100644 --- a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingFilterTest.java +++ b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingFilterTest.java @@ -5,11 +5,11 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(SetRuntimeLogLevels.class) +@WithTestResource(value = SetRuntimeLogLevels.class, restrictToAnnotatedClass = false) public class LoggingFilterTest { @Test diff --git a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelAboveTest.java b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelAboveTest.java index 0494c00722ac0..996f25f6c743e 100644 --- a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelAboveTest.java +++ b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelAboveTest.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -13,7 +13,7 @@ * and this can be further tweaked at runtime to go to above to an even higher level. */ @QuarkusTest -@QuarkusTestResource(SetRuntimeLogLevels.class) +@WithTestResource(value = SetRuntimeLogLevels.class, restrictToAnnotatedClass = false) public class LoggingMinLevelAboveTest { @Test diff --git a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelBelowChildTest.java b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelBelowChildTest.java index 4ae4a80484490..760f37cd216bd 100644 --- a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelBelowChildTest.java +++ b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelBelowChildTest.java @@ -5,14 +5,14 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** * Test verifies that a min-level override that goes below the default min-level is applied correctly. */ @QuarkusTest -@QuarkusTestResource(SetRuntimeLogLevels.class) +@WithTestResource(value = SetRuntimeLogLevels.class, restrictToAnnotatedClass = false) public class LoggingMinLevelBelowChildTest { @Test diff --git a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelBelowTest.java b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelBelowTest.java index ced72852db9bf..afc6def35c1e5 100644 --- a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelBelowTest.java +++ b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelBelowTest.java @@ -5,14 +5,14 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** * Test verifies that a min-level override that goes below the default min-level is applied correctly. */ @QuarkusTest -@QuarkusTestResource(SetRuntimeLogLevels.class) +@WithTestResource(value = SetRuntimeLogLevels.class, restrictToAnnotatedClass = false) public class LoggingMinLevelBelowTest { @Test diff --git a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelByDefaultTest.java b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelByDefaultTest.java index b4a79abf90a9d..f8e5d3450a34b 100644 --- a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelByDefaultTest.java +++ b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelByDefaultTest.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -16,7 +16,7 @@ * say to DEBUG, the code works as expected. */ @QuarkusTest -@QuarkusTestResource(SetRuntimeLogLevels.class) +@WithTestResource(value = SetRuntimeLogLevels.class, restrictToAnnotatedClass = false) public class LoggingMinLevelByDefaultTest { @Test diff --git a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelPromoteSubTest.java b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelPromoteSubTest.java index 9b7e978754b3e..c17c56ed82f85 100644 --- a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelPromoteSubTest.java +++ b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelPromoteSubTest.java @@ -5,14 +5,14 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** * This test verifies that log levels are promoted to min-level when set below, even for subpackages. */ @QuarkusTest -@QuarkusTestResource(SetRuntimeLogLevels.class) +@WithTestResource(value = SetRuntimeLogLevels.class, restrictToAnnotatedClass = false) public class LoggingMinLevelPromoteSubTest { @Test diff --git a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelPromoteTest.java b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelPromoteTest.java index bd4e8208828fc..2da3e20f16bdc 100644 --- a/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelPromoteTest.java +++ b/integration-tests/logging-min-level-set/src/test/java/io/quarkus/it/logging/minlevel/set/LoggingMinLevelPromoteTest.java @@ -5,14 +5,14 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** * This test verifies that log levels are promoted to min-level when set below. */ @QuarkusTest -@QuarkusTestResource(SetRuntimeLogLevels.class) +@WithTestResource(value = SetRuntimeLogLevels.class, restrictToAnnotatedClass = false) public class LoggingMinLevelPromoteTest { @Test diff --git a/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelAboveTest.java b/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelAboveTest.java index b96233e999946..a536b6b887b6c 100644 --- a/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelAboveTest.java +++ b/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelAboveTest.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -13,7 +13,7 @@ * and only messages at same runtime log level or above are shown. */ @QuarkusTest -@QuarkusTestResource(SetCategoryRuntimeLogLevels.class) +@WithTestResource(value = SetCategoryRuntimeLogLevels.class, restrictToAnnotatedClass = false) public class LoggingMinLevelAboveTest { @Test diff --git a/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelByDefaultTest.java b/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelByDefaultTest.java index d52fce3a7b56f..ea91082127707 100644 --- a/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelByDefaultTest.java +++ b/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelByDefaultTest.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -13,7 +13,7 @@ * and there's no applicable runtime log level override. */ @QuarkusTest -@QuarkusTestResource(SetCategoryRuntimeLogLevels.class) +@WithTestResource(value = SetCategoryRuntimeLogLevels.class, restrictToAnnotatedClass = false) public class LoggingMinLevelByDefaultTest { @Test diff --git a/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelGlobalTest.java b/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelGlobalTest.java index a94ba4de4fb12..9999b1339bc80 100644 --- a/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelGlobalTest.java +++ b/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelGlobalTest.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -13,7 +13,7 @@ * and the global log level is below it. */ @QuarkusTest -@QuarkusTestResource(SetGlobalRuntimeLogLevel.class) +@WithTestResource(value = SetGlobalRuntimeLogLevel.class, restrictToAnnotatedClass = false) public class LoggingMinLevelGlobalTest { @Test diff --git a/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelPromoteTest.java b/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelPromoteTest.java index c3b27db977dbc..b6740f8f672cd 100644 --- a/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelPromoteTest.java +++ b/integration-tests/logging-min-level-unset/src/test/java/io/quarkus/it/logging/minlevel/unset/LoggingMinLevelPromoteTest.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -16,7 +16,7 @@ * it will be automatically promoted to DEBUG. */ @QuarkusTest -@QuarkusTestResource(SetCategoryRuntimeLogLevels.class) +@WithTestResource(value = SetCategoryRuntimeLogLevels.class, restrictToAnnotatedClass = false) public class LoggingMinLevelPromoteTest { @Test diff --git a/integration-tests/mailer/src/test/java/io/quarkus/it/mailer/MailerIT.java b/integration-tests/mailer/src/test/java/io/quarkus/it/mailer/MailerIT.java index 64a2986c7ab17..235a69e17ad6a 100644 --- a/integration-tests/mailer/src/test/java/io/quarkus/it/mailer/MailerIT.java +++ b/integration-tests/mailer/src/test/java/io/quarkus/it/mailer/MailerIT.java @@ -1,10 +1,10 @@ package io.quarkus.it.mailer; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusIntegrationTest; @QuarkusIntegrationTest -@QuarkusTestResource(MailpitTestResource.class) +@WithTestResource(value = MailpitTestResource.class, restrictToAnnotatedClass = false) public class MailerIT extends MailerTest { } diff --git a/integration-tests/mailer/src/test/java/io/quarkus/it/mailer/MailerTest.java b/integration-tests/mailer/src/test/java/io/quarkus/it/mailer/MailerTest.java index 846414150d16a..84b52b25a4dd2 100644 --- a/integration-tests/mailer/src/test/java/io/quarkus/it/mailer/MailerTest.java +++ b/integration-tests/mailer/src/test/java/io/quarkus/it/mailer/MailerTest.java @@ -17,7 +17,7 @@ import io.quarkus.it.mailer.mailpit.MailPitClient; import io.quarkus.it.mailer.mailpit.Message; import io.quarkus.it.mailer.mailpit.Recipient; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.vertx.core.json.JsonObject; @@ -27,8 +27,8 @@ */ @DisabledOnOs({ OS.WINDOWS }) @QuarkusTest -@QuarkusTestResource(MailpitTestResource.class) -@QuarkusTestResource(MailpitFullTlsTestResource.class) +@WithTestResource(value = MailpitTestResource.class, restrictToAnnotatedClass = false) +@WithTestResource(value = MailpitFullTlsTestResource.class, restrictToAnnotatedClass = false) public class MailerTest { private MailPitClient client; private MailPitClient clientTls; diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/GetExceptionsInTestResourceTestCase.java b/integration-tests/main/src/test/java/io/quarkus/it/main/GetExceptionsInTestResourceTestCase.java index 1e02474fe46bf..af90597a55e9e 100644 --- a/integration-tests/main/src/test/java/io/quarkus/it/main/GetExceptionsInTestResourceTestCase.java +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/GetExceptionsInTestResourceTestCase.java @@ -12,12 +12,12 @@ import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTestExtension; @ExtendWith({ GetExceptionsInTestResourceTestCase.IgnoreCustomExceptions.class, QuarkusTestExtension.class }) -@QuarkusTestResource(restrictToAnnotatedClass = true, value = GetExceptionsInTestResourceTestCase.KeepContextTestResource.class) +@WithTestResource(GetExceptionsInTestResourceTestCase.KeepContextTestResource.class) public class GetExceptionsInTestResourceTestCase { public static final AtomicReference CONTEXT = new AtomicReference<>(); diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/QuarkusTestNestedWithResourcesTestCase.java b/integration-tests/main/src/test/java/io/quarkus/it/main/QuarkusTestNestedWithResourcesTestCase.java index 19290533b1946..e0338d142e9d4 100644 --- a/integration-tests/main/src/test/java/io/quarkus/it/main/QuarkusTestNestedWithResourcesTestCase.java +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/QuarkusTestNestedWithResourcesTestCase.java @@ -15,8 +15,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; /** @@ -28,7 +28,7 @@ */ @QuarkusTest @Tag("nested") -@QuarkusTestResource(value = QuarkusTestNestedWithResourcesTestCase.DummyTestResource.class, restrictToAnnotatedClass = true) +@WithTestResource(QuarkusTestNestedWithResourcesTestCase.DummyTestResource.class) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) public class QuarkusTestNestedWithResourcesTestCase { diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/TestResources.java b/integration-tests/main/src/test/java/io/quarkus/it/main/TestResources.java index 2c8f12d2518df..46ca1e18472fe 100644 --- a/integration-tests/main/src/test/java/io/quarkus/it/main/TestResources.java +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.main; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/TestResources.java b/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/TestResources.java index 49a22905af3e5..43295a4dc5512 100644 --- a/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/TestResources.java +++ b/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.micrometer.prometheus; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/BookResourceTest.java b/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/BookResourceTest.java index 4b5f0edd38449..d994be917ed01 100644 --- a/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/BookResourceTest.java +++ b/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/BookResourceTest.java @@ -12,13 +12,13 @@ import org.junit.jupiter.api.Test; import io.quarkus.mongodb.health.MongoHealthCheck; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.mongodb.MongoTestResource; import io.restassured.RestAssured; @QuarkusTest -@QuarkusTestResource(value = MongoTestResource.class) +@WithTestResource(value = MongoTestResource.class, restrictToAnnotatedClass = false) public class BookResourceTest { private static Jsonb jsonb; diff --git a/integration-tests/mongodb-panache-kotlin/src/test/kotlin/io/quarkus/it/mongodb/panache/MongodbPanacheResourceTest.kt b/integration-tests/mongodb-panache-kotlin/src/test/kotlin/io/quarkus/it/mongodb/panache/MongodbPanacheResourceTest.kt index 41f54b3a98b6f..187b74addac6b 100644 --- a/integration-tests/mongodb-panache-kotlin/src/test/kotlin/io/quarkus/it/mongodb/panache/MongodbPanacheResourceTest.kt +++ b/integration-tests/mongodb-panache-kotlin/src/test/kotlin/io/quarkus/it/mongodb/panache/MongodbPanacheResourceTest.kt @@ -4,11 +4,6 @@ import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule -import io.quarkus.it.mongodb.panache.book.BookDetail -import io.quarkus.it.mongodb.panache.person.Person -import io.quarkus.test.common.QuarkusTestResource -import io.quarkus.test.junit.QuarkusTest -import io.quarkus.test.mongodb.MongoTestResource import io.restassured.RestAssured import io.restassured.RestAssured.get import io.restassured.common.mapper.TypeRef @@ -19,12 +14,17 @@ import java.util.Calendar import java.util.Collections import java.util.Date import java.util.GregorianCalendar +import io.quarkus.it.mongodb.panache.book.BookDetail +import io.quarkus.it.mongodb.panache.person.Person +import io.quarkus.test.common.WithTestResource +import io.quarkus.test.junit.QuarkusTest +import io.quarkus.test.mongodb.MongoTestResource import org.hamcrest.Matchers.`is` import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test @QuarkusTest -@QuarkusTestResource(MongoTestResource::class) +@WithTestResource(MongoTestResource::class, restrictToAnnotatedClass = false) open class MongodbPanacheResourceTest { @Test fun testBookEntity() { diff --git a/integration-tests/mongodb-panache-kotlin/src/test/kotlin/io/quarkus/it/mongodb/panache/reactive/ReactiveMongodbPanacheResourceTest.kt b/integration-tests/mongodb-panache-kotlin/src/test/kotlin/io/quarkus/it/mongodb/panache/reactive/ReactiveMongodbPanacheResourceTest.kt index f62245276a78c..ef717e663069d 100644 --- a/integration-tests/mongodb-panache-kotlin/src/test/kotlin/io/quarkus/it/mongodb/panache/reactive/ReactiveMongodbPanacheResourceTest.kt +++ b/integration-tests/mongodb-panache-kotlin/src/test/kotlin/io/quarkus/it/mongodb/panache/reactive/ReactiveMongodbPanacheResourceTest.kt @@ -4,22 +4,12 @@ import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule -import io.quarkus.it.mongodb.panache.BookDTO -import io.quarkus.it.mongodb.panache.book.BookDetail -import io.quarkus.it.mongodb.panache.person.Person -import io.quarkus.test.common.QuarkusTestResource -import io.quarkus.test.junit.QuarkusTest -import io.quarkus.test.mongodb.MongoTestResource import io.restassured.RestAssured import io.restassured.RestAssured.get import io.restassured.common.mapper.TypeRef import io.restassured.config.ObjectMapperConfig import io.restassured.parsing.Parser import io.restassured.response.Response -import jakarta.ws.rs.client.Client -import jakarta.ws.rs.client.ClientBuilder -import jakarta.ws.rs.client.WebTarget -import jakarta.ws.rs.sse.SseEventSource import java.io.IOException import java.time.Duration import java.util.Calendar @@ -27,6 +17,16 @@ import java.util.Collections import java.util.Date import java.util.GregorianCalendar import java.util.concurrent.atomic.LongAdder +import jakarta.ws.rs.client.Client +import jakarta.ws.rs.client.ClientBuilder +import jakarta.ws.rs.client.WebTarget +import jakarta.ws.rs.sse.SseEventSource +import io.quarkus.it.mongodb.panache.BookDTO +import io.quarkus.it.mongodb.panache.book.BookDetail +import io.quarkus.it.mongodb.panache.person.Person +import io.quarkus.test.common.WithTestResource +import io.quarkus.test.junit.QuarkusTest +import io.quarkus.test.mongodb.MongoTestResource import org.awaitility.Awaitility.await import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions.assertEquals @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Assertions.assertNotNull import org.junit.jupiter.api.Test @QuarkusTest -@QuarkusTestResource(MongoTestResource::class) +@WithTestResource(MongoTestResource::class, restrictToAnnotatedClass = false) internal open class ReactiveMongodbPanacheResourceTest { companion object { private val LIST_OF_BOOK_TYPE_REF: TypeRef> = diff --git a/integration-tests/mongodb-panache/src/test/java/io/quarkus/it/mongodb/panache/MongoTestResources.java b/integration-tests/mongodb-panache/src/test/java/io/quarkus/it/mongodb/panache/MongoTestResources.java index 9326b60a25f08..5b88c40ce5d02 100644 --- a/integration-tests/mongodb-panache/src/test/java/io/quarkus/it/mongodb/panache/MongoTestResources.java +++ b/integration-tests/mongodb-panache/src/test/java/io/quarkus/it/mongodb/panache/MongoTestResources.java @@ -1,9 +1,9 @@ package io.quarkus.it.mongodb.panache; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.mongodb.MongoReplicaSetTestResource; -@QuarkusTestResource(MongoReplicaSetTestResource.class) +@WithTestResource(value = MongoReplicaSetTestResource.class, restrictToAnnotatedClass = false) public class MongoTestResources { } diff --git a/integration-tests/mongodb-rest-data-panache/src/test/java/io/quarkus/it/mongodb/rest/data/panache/MongoDbRestDataPanacheTest.java b/integration-tests/mongodb-rest-data-panache/src/test/java/io/quarkus/it/mongodb/rest/data/panache/MongoDbRestDataPanacheTest.java index 5287ec9cce4a8..06148724c4754 100644 --- a/integration-tests/mongodb-rest-data-panache/src/test/java/io/quarkus/it/mongodb/rest/data/panache/MongoDbRestDataPanacheTest.java +++ b/integration-tests/mongodb-rest-data-panache/src/test/java/io/quarkus/it/mongodb/rest/data/panache/MongoDbRestDataPanacheTest.java @@ -17,14 +17,14 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.mongodb.MongoTestResource; import io.restassured.response.Response; @QuarkusTest -@QuarkusTestResource(value = MongoTestResource.class, initArgs = @ResourceArg(name = MongoTestResource.PORT, value = "37017")) +@WithTestResource(value = MongoTestResource.class, restrictToAnnotatedClass = false, initArgs = @ResourceArg(name = MongoTestResource.PORT, value = "37017")) class MongoDbRestDataPanacheTest { private Author dostoevsky; diff --git a/integration-tests/observability-lgtm/src/test/java/io/quarkus/observability/test/LgtmLifecycleTest.java b/integration-tests/observability-lgtm/src/test/java/io/quarkus/observability/test/LgtmLifecycleTest.java index 8660c82c95b93..17a1b4488aec5 100644 --- a/integration-tests/observability-lgtm/src/test/java/io/quarkus/observability/test/LgtmLifecycleTest.java +++ b/integration-tests/observability-lgtm/src/test/java/io/quarkus/observability/test/LgtmLifecycleTest.java @@ -5,12 +5,12 @@ import io.quarkus.observability.devresource.lgtm.LgtmResource; import io.quarkus.observability.test.support.QuarkusTestResourceTestProfile; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; @QuarkusTest -@QuarkusTestResource(value = LgtmResource.class, restrictToAnnotatedClass = true) +@WithTestResource(LgtmResource.class) @TestProfile(QuarkusTestResourceTestProfile.class) @DisabledOnOs(OS.WINDOWS) public class LgtmLifecycleTest extends LgtmTestBase { diff --git a/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java b/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java index b21fa0c95f83e..26c9aca0624db 100644 --- a/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java +++ b/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java @@ -25,12 +25,12 @@ import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.WireMock; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; @QuarkusTest -@QuarkusTestResource(KeycloakRealmResourceManager.class) +@WithTestResource(value = KeycloakRealmResourceManager.class, restrictToAnnotatedClass = false) public class OidcClientTest { @InjectWireMock diff --git a/integration-tests/oidc-client/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java b/integration-tests/oidc-client/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java index c6d8aca5b9bf9..d5a66e2c44cf5 100644 --- a/integration-tests/oidc-client/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java +++ b/integration-tests/oidc-client/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java @@ -21,12 +21,12 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; @QuarkusTest -@QuarkusTestResource(KeycloakRealmResourceManager.class) +@WithTestResource(value = KeycloakRealmResourceManager.class, restrictToAnnotatedClass = false) public class OidcClientTest { @Test diff --git a/integration-tests/oidc-code-flow/src/test/java/io/quarkus/it/keycloak/CodeFlowTest.java b/integration-tests/oidc-code-flow/src/test/java/io/quarkus/it/keycloak/CodeFlowTest.java index 9629c61ce5dab..3b1e45505da7c 100644 --- a/integration-tests/oidc-code-flow/src/test/java/io/quarkus/it/keycloak/CodeFlowTest.java +++ b/integration-tests/oidc-code-flow/src/test/java/io/quarkus/it/keycloak/CodeFlowTest.java @@ -35,7 +35,7 @@ import org.junit.jupiter.api.Test; import io.quarkus.oidc.runtime.OidcUtils; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.keycloak.client.KeycloakTestClient; import io.restassured.RestAssured; @@ -45,7 +45,7 @@ * @author Pedro Igor */ @QuarkusTest -@QuarkusTestResource(KeycloakRealmResourceManager.class) +@WithTestResource(value = KeycloakRealmResourceManager.class, restrictToAnnotatedClass = false) public class CodeFlowTest { KeycloakTestClient client = new KeycloakTestClient(); diff --git a/integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java b/integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java index a1e7e351e9e29..39871ba90f7a7 100644 --- a/integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java +++ b/integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.keycloak.client.KeycloakTestClient; import io.restassured.RestAssured; @@ -40,7 +40,7 @@ * @author Pedro Igor */ @QuarkusTest -@QuarkusTestResource(KeycloakRealmResourceManager.class) +@WithTestResource(value = KeycloakRealmResourceManager.class, restrictToAnnotatedClass = false) public class BearerTokenAuthorizationTest { private KeycloakTestClient client = new KeycloakTestClient(); diff --git a/integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/TestSecurityCombiningAuthMechTest.java b/integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/TestSecurityCombiningAuthMechTest.java index 21d5636f81f95..96ce4db1a038c 100644 --- a/integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/TestSecurityCombiningAuthMechTest.java +++ b/integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/TestSecurityCombiningAuthMechTest.java @@ -14,7 +14,7 @@ import org.htmlunit.html.HtmlPage; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.common.http.TestHTTPEndpoint; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.security.TestSecurity; @@ -22,7 +22,7 @@ import io.restassured.http.ContentType; @QuarkusTest -@QuarkusTestResource(KeycloakRealmResourceManager.class) +@WithTestResource(value = KeycloakRealmResourceManager.class, restrictToAnnotatedClass = false) public class TestSecurityCombiningAuthMechTest { @TestHTTPEndpoint(MultipleAuthMechResource.class) diff --git a/integration-tests/oidc-token-propagation/src/test/java/io/quarkus/it/keycloak/OidcTokenPropagationTest.java b/integration-tests/oidc-token-propagation/src/test/java/io/quarkus/it/keycloak/OidcTokenPropagationTest.java index bcd717025d989..207f14dad78dd 100644 --- a/integration-tests/oidc-token-propagation/src/test/java/io/quarkus/it/keycloak/OidcTokenPropagationTest.java +++ b/integration-tests/oidc-token-propagation/src/test/java/io/quarkus/it/keycloak/OidcTokenPropagationTest.java @@ -5,13 +5,13 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.keycloak.client.KeycloakTestClient; import io.restassured.RestAssured; @QuarkusTest -@QuarkusTestResource(KeycloakRealmResourceManager.class) +@WithTestResource(value = KeycloakRealmResourceManager.class, restrictToAnnotatedClass = false) public class OidcTokenPropagationTest { final KeycloakTestClient client = new KeycloakTestClient(); @@ -44,7 +44,7 @@ public void testGetUserNameWithAccessTokenPropagation() { // Note this test does pass if Keycloak is started manually, // 'quarkus' realm, 'quarkus-app' and 'quarkus-app-exchange' clients, and 'alice' user is created // and the token-exchange permission is added to the clients as per the Keycloak docs. - // It can be confirmed by commenting @QuarkusTestResource above + // It can be confirmed by commenting @WithTestResource above // and running the tests as 'mvn clean install -Dtest-containers' RestAssured.given().auth().oauth2(getAccessToken("alice")) diff --git a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/AnnotationBasedTenantTest.java b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/AnnotationBasedTenantTest.java index 3e5fb78ce14fd..d05f3138c2cff 100644 --- a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/AnnotationBasedTenantTest.java +++ b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/AnnotationBasedTenantTest.java @@ -12,7 +12,7 @@ import io.quarkus.oidc.runtime.OidcUtils; import io.quarkus.security.identity.SecurityIdentity; import io.quarkus.security.spi.runtime.AuthorizationSuccessEvent; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.QuarkusTestProfile; import io.quarkus.test.junit.TestProfile; @@ -23,7 +23,7 @@ @QuarkusTest @TestProfile(AnnotationBasedTenantTest.NoProactiveAuthTestProfile.class) -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public class AnnotationBasedTenantTest { public static class NoProactiveAuthTestProfile implements QuarkusTestProfile { public Map getConfigOverrides() { diff --git a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerOpaqueTokenAuthorizationTest.java b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerOpaqueTokenAuthorizationTest.java index 2c70886ec6fa4..52109c3e95102 100644 --- a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerOpaqueTokenAuthorizationTest.java +++ b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerOpaqueTokenAuthorizationTest.java @@ -14,14 +14,14 @@ import com.github.tomakehurst.wiremock.WireMockServer; import io.quarkus.oidc.common.runtime.OidcConstants; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.oidc.server.OidcWireMock; import io.quarkus.test.oidc.server.OidcWiremockTestResource; import io.restassured.RestAssured; @QuarkusTest -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public class BearerOpaqueTokenAuthorizationTest { @OidcWireMock diff --git a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java index 6977986b7d99f..caeb1e47adbee 100644 --- a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java +++ b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java @@ -30,7 +30,7 @@ import io.quarkus.deployment.util.FileUtil; import io.quarkus.oidc.runtime.OidcUtils; import io.quarkus.oidc.runtime.TrustStoreUtils; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.oidc.server.OidcWireMock; import io.quarkus.test.oidc.server.OidcWiremockTestResource; @@ -43,7 +43,7 @@ import io.vertx.core.json.JsonObject; @QuarkusTest -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public class BearerTokenAuthorizationTest { @OidcWireMock diff --git a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/CodeFlowAuthorizationTest.java b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/CodeFlowAuthorizationTest.java index 759c8a6b65ed6..bbdacc2329988 100644 --- a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/CodeFlowAuthorizationTest.java +++ b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/CodeFlowAuthorizationTest.java @@ -41,7 +41,7 @@ import io.quarkus.oidc.common.runtime.OidcCommonUtils; import io.quarkus.oidc.runtime.OidcUtils; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.oidc.server.OidcWireMock; import io.quarkus.test.oidc.server.OidcWiremockTestResource; @@ -51,7 +51,7 @@ import io.vertx.core.json.JsonObject; @QuarkusTest -@QuarkusTestResource(OidcWiremockTestResource.class) +@WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public class CodeFlowAuthorizationTest { @OidcWireMock diff --git a/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java b/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java index 06e635866911c..1107ab10f9e35 100644 --- a/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java +++ b/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java @@ -12,7 +12,7 @@ import org.junit.jupiter.api.RepeatedTest; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; @@ -20,7 +20,7 @@ * @author Pedro Igor */ @QuarkusTest -@QuarkusTestResource(KeycloakXTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakXTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class BearerTokenAuthorizationTest { @Test diff --git a/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/WebsocketOidcTestCase.java b/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/WebsocketOidcTestCase.java index b998d0bf7bc3b..7f2d5b882ae9d 100644 --- a/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/WebsocketOidcTestCase.java +++ b/integration-tests/oidc/src/test/java/io/quarkus/it/keycloak/WebsocketOidcTestCase.java @@ -15,13 +15,13 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.websockets.BearerTokenClientEndpointConfigurator; @QuarkusTest -@QuarkusTestResource(KeycloakXTestResourceLifecycleManager.class) +@WithTestResource(value = KeycloakXTestResourceLifecycleManager.class, restrictToAnnotatedClass = false) public class WebsocketOidcTestCase { @TestHTTPResource("secured-hello") diff --git a/integration-tests/openshift-client/src/test/java/io/quarkus/it/openshift/client/OpenShiftClientTest.java b/integration-tests/openshift-client/src/test/java/io/quarkus/it/openshift/client/OpenShiftClientTest.java index 0398a7bb4bc0b..3de0a0620e185 100644 --- a/integration-tests/openshift-client/src/test/java/io/quarkus/it/openshift/client/OpenShiftClientTest.java +++ b/integration-tests/openshift-client/src/test/java/io/quarkus/it/openshift/client/OpenShiftClientTest.java @@ -10,13 +10,13 @@ import io.fabric8.openshift.api.model.RouteBuilder; import io.fabric8.openshift.client.NamespacedOpenShiftClient; import io.fabric8.openshift.client.server.mock.OpenShiftMockServer; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.kubernetes.client.MockServer; import io.quarkus.test.kubernetes.client.OpenShiftMockServerTestResource; import io.restassured.RestAssured; -@QuarkusTestResource(OpenShiftMockServerTestResource.class) +@WithTestResource(value = OpenShiftMockServerTestResource.class, restrictToAnnotatedClass = false) @QuarkusTest public class OpenShiftClientTest { diff --git a/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/Db2OpenTelemetryJdbcInstrumentationTest.java b/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/Db2OpenTelemetryJdbcInstrumentationTest.java index 32c0e20389814..51fd8f4898483 100644 --- a/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/Db2OpenTelemetryJdbcInstrumentationTest.java +++ b/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/Db2OpenTelemetryJdbcInstrumentationTest.java @@ -3,12 +3,12 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledIfSystemProperty; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @EnabledIfSystemProperty(named = "enable-db2", matches = "true") @QuarkusTest -@QuarkusTestResource(value = Db2LifecycleManager.class, restrictToAnnotatedClass = true) +@WithTestResource(Db2LifecycleManager.class) public class Db2OpenTelemetryJdbcInstrumentationTest extends OpenTelemetryJdbcInstrumentationTest { @Test diff --git a/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/MariaDbOpenTelemetryJdbcInstrumentationTest.java b/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/MariaDbOpenTelemetryJdbcInstrumentationTest.java index 5034ac7e7c978..74ab1437778a7 100644 --- a/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/MariaDbOpenTelemetryJdbcInstrumentationTest.java +++ b/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/MariaDbOpenTelemetryJdbcInstrumentationTest.java @@ -2,11 +2,11 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = MariaDbLifecycleManager.class, restrictToAnnotatedClass = true) +@WithTestResource(MariaDbLifecycleManager.class) public class MariaDbOpenTelemetryJdbcInstrumentationTest extends OpenTelemetryJdbcInstrumentationTest { @Test diff --git a/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/OracleOpenTelemetryJdbcInstrumentationTest.java b/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/OracleOpenTelemetryJdbcInstrumentationTest.java index 67e784bc1d457..7c74adc8d22f1 100644 --- a/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/OracleOpenTelemetryJdbcInstrumentationTest.java +++ b/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/OracleOpenTelemetryJdbcInstrumentationTest.java @@ -2,11 +2,11 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = OracleLifecycleManager.class, restrictToAnnotatedClass = true) +@WithTestResource(OracleLifecycleManager.class) public class OracleOpenTelemetryJdbcInstrumentationTest extends OpenTelemetryJdbcInstrumentationTest { @Test diff --git a/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/PostgresOpenTelemetryJdbcInstrumentationTest.java b/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/PostgresOpenTelemetryJdbcInstrumentationTest.java index cde8956e413eb..c3bafd0ea2153 100644 --- a/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/PostgresOpenTelemetryJdbcInstrumentationTest.java +++ b/integration-tests/opentelemetry-jdbc-instrumentation/src/test/java/io/quarkus/it/opentelemetry/PostgresOpenTelemetryJdbcInstrumentationTest.java @@ -2,11 +2,11 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = PostgreSqlLifecycleManager.class, restrictToAnnotatedClass = true) +@WithTestResource(PostgreSqlLifecycleManager.class) public class PostgresOpenTelemetryJdbcInstrumentationTest extends OpenTelemetryJdbcInstrumentationTest { @Test diff --git a/integration-tests/opentelemetry-mongodb-client-instrumentation/src/test/java/io/quarkus/it/opentelemetry/BookResourceTest.java b/integration-tests/opentelemetry-mongodb-client-instrumentation/src/test/java/io/quarkus/it/opentelemetry/BookResourceTest.java index 59e74442f163f..ba082017a8d1c 100644 --- a/integration-tests/opentelemetry-mongodb-client-instrumentation/src/test/java/io/quarkus/it/opentelemetry/BookResourceTest.java +++ b/integration-tests/opentelemetry-mongodb-client-instrumentation/src/test/java/io/quarkus/it/opentelemetry/BookResourceTest.java @@ -14,14 +14,14 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.mongodb.MongoTestResource; import io.restassured.common.mapper.TypeRef; @QuarkusTest -@QuarkusTestResource(value = MongoTestResource.class, initArgs = @ResourceArg(name = MongoTestResource.VERSION, value = "V6_0")) +@WithTestResource(value = MongoTestResource.class, restrictToAnnotatedClass = false, initArgs = @ResourceArg(name = MongoTestResource.VERSION, value = "V6_0")) class BookResourceTest { private final TypeRef> bookListType = new TypeRef<>() { diff --git a/integration-tests/opentelemetry-reactive-messaging/src/test/java/io/quarkus/it/opentelemetry/OpenTelemetryTestCase.java b/integration-tests/opentelemetry-reactive-messaging/src/test/java/io/quarkus/it/opentelemetry/OpenTelemetryTestCase.java index b2298c59fb334..69adc297df4ba 100644 --- a/integration-tests/opentelemetry-reactive-messaging/src/test/java/io/quarkus/it/opentelemetry/OpenTelemetryTestCase.java +++ b/integration-tests/opentelemetry-reactive-messaging/src/test/java/io/quarkus/it/opentelemetry/OpenTelemetryTestCase.java @@ -24,7 +24,7 @@ import io.opentelemetry.api.trace.SpanId; import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.api.trace.TraceId; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.kafka.InjectKafkaCompanion; @@ -33,7 +33,7 @@ import io.smallrye.reactive.messaging.kafka.companion.KafkaCompanion; @QuarkusTest -@QuarkusTestResource(KafkaCompanionResource.class) +@WithTestResource(value = KafkaCompanionResource.class, restrictToAnnotatedClass = false) public class OpenTelemetryTestCase { @TestHTTPResource("direct") URL directUrl; diff --git a/integration-tests/opentelemetry-reactive/src/test/java/io/quarkus/it/opentelemetry/reactive/OpenTelemetryWithSpanAtStartupTest.java b/integration-tests/opentelemetry-reactive/src/test/java/io/quarkus/it/opentelemetry/reactive/OpenTelemetryWithSpanAtStartupTest.java index b6fa9159bc6f8..888e868d9fc91 100644 --- a/integration-tests/opentelemetry-reactive/src/test/java/io/quarkus/it/opentelemetry/reactive/OpenTelemetryWithSpanAtStartupTest.java +++ b/integration-tests/opentelemetry-reactive/src/test/java/io/quarkus/it/opentelemetry/reactive/OpenTelemetryWithSpanAtStartupTest.java @@ -25,11 +25,11 @@ import io.opentelemetry.instrumentation.annotations.WithSpan; import io.quarkus.runtime.Startup; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; -@QuarkusTestResource(restrictToAnnotatedClass = true, value = OpenTelemetryWithSpanAtStartupTest.MyWireMockResource.class) +@WithTestResource(OpenTelemetryWithSpanAtStartupTest.MyWireMockResource.class) @QuarkusTest public class OpenTelemetryWithSpanAtStartupTest { diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcNoTLSNoCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcNoTLSNoCompressionTest.java index de67a1f1bae3a..b7ee61e3e97eb 100644 --- a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcNoTLSNoCompressionTest.java +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcNoTLSNoCompressionTest.java @@ -2,11 +2,11 @@ import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, restrictToAnnotatedClass = true) +@WithTestResource(OtelCollectorLifecycleManager.class) public class GrpcNoTLSNoCompressionTest extends AbstractExporterTest { } diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcNoTLSWithCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcNoTLSWithCompressionTest.java index facf170af3fc6..fc9ccc21722b8 100644 --- a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcNoTLSWithCompressionTest.java +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcNoTLSWithCompressionTest.java @@ -2,12 +2,12 @@ import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = @ResourceArg(name = "enableCompression", value = "true"), restrictToAnnotatedClass = true) +@WithTestResource(value = OtelCollectorLifecycleManager.class, initArgs = @ResourceArg(name = "enableCompression", value = "true")) public class GrpcNoTLSWithCompressionTest extends AbstractExporterTest { } diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcWithTLSNoCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcWithTLSNoCompressionTest.java index b2420fd1b689b..2e1b715f01d0f 100644 --- a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcWithTLSNoCompressionTest.java +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcWithTLSNoCompressionTest.java @@ -2,12 +2,12 @@ import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = @ResourceArg(name = "enableTLS", value = "true"), restrictToAnnotatedClass = true) +@WithTestResource(value = OtelCollectorLifecycleManager.class, initArgs = @ResourceArg(name = "enableTLS", value = "true")) public class GrpcWithTLSNoCompressionTest extends AbstractExporterTest { } diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcWithTLSWithCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcWithTLSWithCompressionTest.java index 557c2f8f7f3a7..511d717ed5a4b 100644 --- a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcWithTLSWithCompressionTest.java +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/grpc/GrpcWithTLSWithCompressionTest.java @@ -2,15 +2,15 @@ import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { +@WithTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { @ResourceArg(name = "enableTLS", value = "true"), @ResourceArg(name = "enableCompression", value = "true") -}, restrictToAnnotatedClass = true) +}) public class GrpcWithTLSWithCompressionTest extends AbstractExporterTest { } diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpNoTLSNoCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpNoTLSNoCompressionTest.java index 60d5f0b70d2ec..89e2479c49f14 100644 --- a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpNoTLSNoCompressionTest.java +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpNoTLSNoCompressionTest.java @@ -2,12 +2,12 @@ import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = @ResourceArg(name = "protocol", value = "http/protobuf"), restrictToAnnotatedClass = true) +@WithTestResource(value = OtelCollectorLifecycleManager.class, initArgs = @ResourceArg(name = "protocol", value = "http/protobuf")) public class HttpNoTLSNoCompressionTest extends AbstractExporterTest { } diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpNoTLSWithCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpNoTLSWithCompressionTest.java index d9557d9aabe05..a58624618e448 100644 --- a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpNoTLSWithCompressionTest.java +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpNoTLSWithCompressionTest.java @@ -2,15 +2,15 @@ import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { +@WithTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { @ResourceArg(name = "enableCompression", value = "true"), @ResourceArg(name = "protocol", value = "http/protobuf") -}, restrictToAnnotatedClass = true) +}) public class HttpNoTLSWithCompressionTest extends AbstractExporterTest { } diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpWithTLSNoCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpWithTLSNoCompressionTest.java index 78603ca32c5a3..24a48d32a1129 100644 --- a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpWithTLSNoCompressionTest.java +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpWithTLSNoCompressionTest.java @@ -2,15 +2,15 @@ import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { +@WithTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { @ResourceArg(name = "enableTLS", value = "true"), @ResourceArg(name = "protocol", value = "http/protobuf") -}, restrictToAnnotatedClass = true) +}) public class HttpWithTLSNoCompressionTest extends AbstractExporterTest { } diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpWithTLSWithCompressionTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpWithTLSWithCompressionTest.java index 0f940eebae378..f9113e42f31cf 100644 --- a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpWithTLSWithCompressionTest.java +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpWithTLSWithCompressionTest.java @@ -2,16 +2,16 @@ import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { +@WithTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { @ResourceArg(name = "enableTLS", value = "true"), @ResourceArg(name = "enableCompression", value = "true"), @ResourceArg(name = "protocol", value = "http/protobuf") -}, restrictToAnnotatedClass = true) +}) public class HttpWithTLSWithCompressionTest extends AbstractExporterTest { } diff --git a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpWithTLSWithCompressionUsingRegistryTest.java b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpWithTLSWithCompressionUsingRegistryTest.java index e00d9ca008237..031930dd46b05 100644 --- a/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpWithTLSWithCompressionUsingRegistryTest.java +++ b/integration-tests/opentelemetry-vertx-exporter/src/test/java/io/quarkus/it/opentelemetry/vertx/exporter/http/HttpWithTLSWithCompressionUsingRegistryTest.java @@ -2,17 +2,17 @@ import io.quarkus.it.opentelemetry.vertx.exporter.AbstractExporterTest; import io.quarkus.it.opentelemetry.vertx.exporter.OtelCollectorLifecycleManager; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.ResourceArg; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { +@WithTestResource(value = OtelCollectorLifecycleManager.class, initArgs = { @ResourceArg(name = "enableTLS", value = "true"), @ResourceArg(name = "enableCompression", value = "true"), @ResourceArg(name = "protocol", value = "http/protobuf"), @ResourceArg(name = "tlsRegistryName", value = "otel") -}, restrictToAnnotatedClass = true) +}) public class HttpWithTLSWithCompressionUsingRegistryTest extends AbstractExporterTest { } diff --git a/integration-tests/picocli-native/src/test/java/io/quarkus/it/picocli/PicocliTest.java b/integration-tests/picocli-native/src/test/java/io/quarkus/it/picocli/PicocliTest.java index 0a4291903365b..2022710db4fa2 100644 --- a/integration-tests/picocli-native/src/test/java/io/quarkus/it/picocli/PicocliTest.java +++ b/integration-tests/picocli-native/src/test/java/io/quarkus/it/picocli/PicocliTest.java @@ -8,15 +8,15 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.main.Launch; import io.quarkus.test.junit.main.LaunchResult; import io.quarkus.test.junit.main.QuarkusMainLauncher; import io.quarkus.test.junit.main.QuarkusMainTest; @QuarkusMainTest -@QuarkusTestResource(PicocliTest.TestResource.class) +@WithTestResource(value = PicocliTest.TestResource.class, restrictToAnnotatedClass = false) public class PicocliTest { private String value; diff --git a/integration-tests/quartz/src/test/java/io/quarkus/it/quartz/TestResources.java b/integration-tests/quartz/src/test/java/io/quarkus/it/quartz/TestResources.java index ecc74f854233f..ac266eb5b96d5 100644 --- a/integration-tests/quartz/src/test/java/io/quarkus/it/quartz/TestResources.java +++ b/integration-tests/quartz/src/test/java/io/quarkus/it/quartz/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.quartz; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/qute/src/test/java/io/quarkus/it/qute/TestResources.java b/integration-tests/qute/src/test/java/io/quarkus/it/qute/TestResources.java index 5dbac2cb4c232..01ed2b66b77a5 100644 --- a/integration-tests/qute/src/test/java/io/quarkus/it/qute/TestResources.java +++ b/integration-tests/qute/src/test/java/io/quarkus/it/qute/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.qute; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/reactive-messaging-amqp/src/test/java/io/quarkus/it/amqp/AmqpConnectorTest.java b/integration-tests/reactive-messaging-amqp/src/test/java/io/quarkus/it/amqp/AmqpConnectorTest.java index ee51e7d097f10..62a18c1c35119 100644 --- a/integration-tests/reactive-messaging-amqp/src/test/java/io/quarkus/it/amqp/AmqpConnectorTest.java +++ b/integration-tests/reactive-messaging-amqp/src/test/java/io/quarkus/it/amqp/AmqpConnectorTest.java @@ -12,12 +12,12 @@ import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.common.mapper.TypeRef; @QuarkusTest -@QuarkusTestResource(AmqpBroker.class) +@WithTestResource(value = AmqpBroker.class, restrictToAnnotatedClass = false) @DisabledOnOs(OS.WINDOWS) public class AmqpConnectorTest { diff --git a/integration-tests/reactive-messaging-hibernate-orm/src/test/java/io/quarkus/it/kafka/KafkaConnectorTest.java b/integration-tests/reactive-messaging-hibernate-orm/src/test/java/io/quarkus/it/kafka/KafkaConnectorTest.java index acad13994bca7..6942cf955f9fd 100644 --- a/integration-tests/reactive-messaging-hibernate-orm/src/test/java/io/quarkus/it/kafka/KafkaConnectorTest.java +++ b/integration-tests/reactive-messaging-hibernate-orm/src/test/java/io/quarkus/it/kafka/KafkaConnectorTest.java @@ -17,7 +17,7 @@ import io.quarkus.it.kafka.fruit.Fruit; import io.quarkus.it.kafka.people.PeopleState; import io.quarkus.it.kafka.people.Person; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.kafka.InjectKafkaCompanion; import io.quarkus.test.kafka.KafkaCompanionResource; @@ -26,7 +26,7 @@ import io.smallrye.reactive.messaging.kafka.companion.KafkaCompanion; @QuarkusTest -@QuarkusTestResource(KafkaCompanionResource.class) +@WithTestResource(value = KafkaCompanionResource.class, restrictToAnnotatedClass = false) public class KafkaConnectorTest { protected static final TypeRef> TYPE_REF = new TypeRef>() { diff --git a/integration-tests/reactive-messaging-hibernate-reactive/src/test/java/io/quarkus/it/kafka/KafkaConnectorTest.java b/integration-tests/reactive-messaging-hibernate-reactive/src/test/java/io/quarkus/it/kafka/KafkaConnectorTest.java index 0bb645727b28e..8711f2b66eb3c 100644 --- a/integration-tests/reactive-messaging-hibernate-reactive/src/test/java/io/quarkus/it/kafka/KafkaConnectorTest.java +++ b/integration-tests/reactive-messaging-hibernate-reactive/src/test/java/io/quarkus/it/kafka/KafkaConnectorTest.java @@ -12,14 +12,14 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.kafka.KafkaCompanionResource; import io.restassured.common.mapper.TypeRef; import io.restassured.http.ContentType; @QuarkusTest -@QuarkusTestResource(KafkaCompanionResource.class) +@WithTestResource(value = KafkaCompanionResource.class, restrictToAnnotatedClass = false) public class KafkaConnectorTest { protected static final TypeRef> FRUIT_TYPE_REF = new TypeRef>() { diff --git a/integration-tests/reactive-messaging-kafka/src/test/java/io/quarkus/it/kafka/KafkaConnectorTest.java b/integration-tests/reactive-messaging-kafka/src/test/java/io/quarkus/it/kafka/KafkaConnectorTest.java index 98dbd1998899d..02713f36f335d 100644 --- a/integration-tests/reactive-messaging-kafka/src/test/java/io/quarkus/it/kafka/KafkaConnectorTest.java +++ b/integration-tests/reactive-messaging-kafka/src/test/java/io/quarkus/it/kafka/KafkaConnectorTest.java @@ -16,7 +16,7 @@ import org.junit.jupiter.api.TestMethodOrder; import io.quarkus.arc.Arc; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.DisabledOnIntegrationTest; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.kafka.KafkaCompanionResource; @@ -25,7 +25,7 @@ import io.smallrye.reactive.messaging.kafka.commit.ProcessingState; @QuarkusTest -@QuarkusTestResource(KafkaCompanionResource.class) +@WithTestResource(value = KafkaCompanionResource.class, restrictToAnnotatedClass = false) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) public class KafkaConnectorTest { diff --git a/integration-tests/reactive-messaging-rabbitmq-dyn/src/test/java/io/quarkus/it/rabbitmq/RabbitMQConnectorDynCredsTest.java b/integration-tests/reactive-messaging-rabbitmq-dyn/src/test/java/io/quarkus/it/rabbitmq/RabbitMQConnectorDynCredsTest.java index eab9ad69c8765..057a0d8fa629f 100644 --- a/integration-tests/reactive-messaging-rabbitmq-dyn/src/test/java/io/quarkus/it/rabbitmq/RabbitMQConnectorDynCredsTest.java +++ b/integration-tests/reactive-messaging-rabbitmq-dyn/src/test/java/io/quarkus/it/rabbitmq/RabbitMQConnectorDynCredsTest.java @@ -15,13 +15,13 @@ import org.testcontainers.utility.DockerImageName; import io.quarkus.it.rabbitmq.RabbitMQConnectorDynCredsTest.RabbitMQResource; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.common.mapper.TypeRef; @QuarkusTest -@QuarkusTestResource(RabbitMQResource.class) +@WithTestResource(value = RabbitMQResource.class, restrictToAnnotatedClass = false) public class RabbitMQConnectorDynCredsTest { public static class RabbitMQResource implements QuarkusTestResourceLifecycleManager { diff --git a/integration-tests/rest-client-reactive-stork/src/test/java/io/quarkus/it/rest/reactive/stork/RestClientReactiveStorkTest.java b/integration-tests/rest-client-reactive-stork/src/test/java/io/quarkus/it/rest/reactive/stork/RestClientReactiveStorkTest.java index 884d5ffbbfc0f..fae294fca82f0 100644 --- a/integration-tests/rest-client-reactive-stork/src/test/java/io/quarkus/it/rest/reactive/stork/RestClientReactiveStorkTest.java +++ b/integration-tests/rest-client-reactive-stork/src/test/java/io/quarkus/it/rest/reactive/stork/RestClientReactiveStorkTest.java @@ -12,15 +12,15 @@ import io.quarkus.arc.Arc; import io.quarkus.it.rest.client.reactive.stork.MyServiceDiscoveryProvider; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.DisabledOnIntegrationTest; import io.quarkus.test.junit.QuarkusTest; import io.restassured.response.Response; import io.vertx.core.Vertx; @QuarkusTest -@QuarkusTestResource(SlowWiremockServer.class) -@QuarkusTestResource(FastWiremockServer.class) +@WithTestResource(value = SlowWiremockServer.class, restrictToAnnotatedClass = false) +@WithTestResource(value = FastWiremockServer.class, restrictToAnnotatedClass = false) public class RestClientReactiveStorkTest { @Test diff --git a/integration-tests/rest-client/src/test/java/io/quarkus/it/rest/client/trustall/ExternalTlsTrustAllTestCase.java b/integration-tests/rest-client/src/test/java/io/quarkus/it/rest/client/trustall/ExternalTlsTrustAllTestCase.java index 99e93df420eaf..533a60ee460a8 100644 --- a/integration-tests/rest-client/src/test/java/io/quarkus/it/rest/client/trustall/ExternalTlsTrustAllTestCase.java +++ b/integration-tests/rest-client/src/test/java/io/quarkus/it/rest/client/trustall/ExternalTlsTrustAllTestCase.java @@ -6,12 +6,12 @@ import org.junit.jupiter.api.Test; import io.quarkus.it.rest.client.wronghost.ExternalWrongHostTestResourceUsingHostnameVerifier; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(ExternalTlsTrustAllTestResource.class) -@QuarkusTestResource(value = ExternalWrongHostTestResourceUsingHostnameVerifier.class, restrictToAnnotatedClass = true) +@WithTestResource(value = ExternalTlsTrustAllTestResource.class, restrictToAnnotatedClass = false) +@WithTestResource(ExternalWrongHostTestResourceUsingHostnameVerifier.class) public class ExternalTlsTrustAllTestCase { @Test diff --git a/integration-tests/rest-client/src/test/java/io/quarkus/it/rest/client/wronghost/ExternalWrongHostUsingHostnameVerifierTestCase.java b/integration-tests/rest-client/src/test/java/io/quarkus/it/rest/client/wronghost/ExternalWrongHostUsingHostnameVerifierTestCase.java index 382b68e36ceff..e1e9fd01482dc 100644 --- a/integration-tests/rest-client/src/test/java/io/quarkus/it/rest/client/wronghost/ExternalWrongHostUsingHostnameVerifierTestCase.java +++ b/integration-tests/rest-client/src/test/java/io/quarkus/it/rest/client/wronghost/ExternalWrongHostUsingHostnameVerifierTestCase.java @@ -1,9 +1,9 @@ package io.quarkus.it.rest.client.wronghost; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = ExternalWrongHostTestResourceUsingHostnameVerifier.class, restrictToAnnotatedClass = true) +@WithTestResource(ExternalWrongHostTestResourceUsingHostnameVerifier.class) public class ExternalWrongHostUsingHostnameVerifierTestCase extends BaseExternalWrongHostTestCase { } diff --git a/integration-tests/rest-client/src/test/java/io/quarkus/it/rest/client/wronghost/ExternalWrongHostUsingVerifyHostTestCase.java b/integration-tests/rest-client/src/test/java/io/quarkus/it/rest/client/wronghost/ExternalWrongHostUsingVerifyHostTestCase.java index 9ad9ce8d3930f..0eac789caf578 100644 --- a/integration-tests/rest-client/src/test/java/io/quarkus/it/rest/client/wronghost/ExternalWrongHostUsingVerifyHostTestCase.java +++ b/integration-tests/rest-client/src/test/java/io/quarkus/it/rest/client/wronghost/ExternalWrongHostUsingVerifyHostTestCase.java @@ -1,9 +1,9 @@ package io.quarkus.it.rest.client.wronghost; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(value = ExternalWrongHostTestResourceUsingVerifyHost.class, restrictToAnnotatedClass = true) +@WithTestResource(ExternalWrongHostTestResourceUsingVerifyHost.class) public class ExternalWrongHostUsingVerifyHostTestCase extends BaseExternalWrongHostTestCase { } diff --git a/integration-tests/resteasy-reactive-kotlin/standard/src/test/kotlin/io/quarkus/it/resteasy/reactive/kotlin/ReactiveMessagingTest.kt b/integration-tests/resteasy-reactive-kotlin/standard/src/test/kotlin/io/quarkus/it/resteasy/reactive/kotlin/ReactiveMessagingTest.kt index 07a2c65cbaa3a..334633c01eef0 100644 --- a/integration-tests/resteasy-reactive-kotlin/standard/src/test/kotlin/io/quarkus/it/resteasy/reactive/kotlin/ReactiveMessagingTest.kt +++ b/integration-tests/resteasy-reactive-kotlin/standard/src/test/kotlin/io/quarkus/it/resteasy/reactive/kotlin/ReactiveMessagingTest.kt @@ -1,18 +1,18 @@ package io.quarkus.it.resteasy.reactive.kotlin -import io.quarkus.test.common.QuarkusTestResource -import io.quarkus.test.junit.QuarkusTest import io.restassured.RestAssured.get import io.restassured.common.mapper.TypeRef import io.restassured.module.kotlin.extensions.Then import io.restassured.module.kotlin.extensions.When import java.time.Duration +import io.quarkus.test.common.WithTestResource +import io.quarkus.test.junit.QuarkusTest import org.awaitility.Awaitility.await import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test @QuarkusTest -@QuarkusTestResource(KafkaTestResource::class) +@WithTestResource(KafkaTestResource::class, restrictToAnnotatedClass = false) class ReactiveMessagingTest { private val TYPE_REF: TypeRef> = object : TypeRef>() {} diff --git a/integration-tests/smallrye-context-propagation/src/test/java/io/quarkus/context/test/TestResources.java b/integration-tests/smallrye-context-propagation/src/test/java/io/quarkus/context/test/TestResources.java index 0235b59982383..80e04828a206b 100644 --- a/integration-tests/smallrye-context-propagation/src/test/java/io/quarkus/context/test/TestResources.java +++ b/integration-tests/smallrye-context-propagation/src/test/java/io/quarkus/context/test/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.context.test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/smallrye-graphql-client-keycloak/src/test/java/io/quarkus/it/smallrye/graphql/keycloak/GraphQLAuthExpiryTest.java b/integration-tests/smallrye-graphql-client-keycloak/src/test/java/io/quarkus/it/smallrye/graphql/keycloak/GraphQLAuthExpiryTest.java index 01338e9915215..0dd2ae9fefd27 100644 --- a/integration-tests/smallrye-graphql-client-keycloak/src/test/java/io/quarkus/it/smallrye/graphql/keycloak/GraphQLAuthExpiryTest.java +++ b/integration-tests/smallrye-graphql-client-keycloak/src/test/java/io/quarkus/it/smallrye/graphql/keycloak/GraphQLAuthExpiryTest.java @@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; @@ -14,7 +14,7 @@ * See `GraphQLClientTester` for the actual testing code that uses GraphQL clients. */ @QuarkusTest -@QuarkusTestResource(KeycloakRealmResourceManager.class) +@WithTestResource(value = KeycloakRealmResourceManager.class, restrictToAnnotatedClass = false) public class GraphQLAuthExpiryTest { @TestHTTPResource diff --git a/integration-tests/smallrye-jwt-oidc-webapp/src/test/java/io/quarkus/it/keycloak/SmallRyeJwtOidcWebAppTest.java b/integration-tests/smallrye-jwt-oidc-webapp/src/test/java/io/quarkus/it/keycloak/SmallRyeJwtOidcWebAppTest.java index 45c4ab108d033..9056400eb3cf8 100644 --- a/integration-tests/smallrye-jwt-oidc-webapp/src/test/java/io/quarkus/it/keycloak/SmallRyeJwtOidcWebAppTest.java +++ b/integration-tests/smallrye-jwt-oidc-webapp/src/test/java/io/quarkus/it/keycloak/SmallRyeJwtOidcWebAppTest.java @@ -10,12 +10,12 @@ import org.htmlunit.html.HtmlPage; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; @QuarkusTest -@QuarkusTestResource(KeycloakRealmResourceManager.class) +@WithTestResource(value = KeycloakRealmResourceManager.class, restrictToAnnotatedClass = false) public class SmallRyeJwtOidcWebAppTest { @Test diff --git a/integration-tests/smallrye-jwt-token-propagation/src/test/java/io/quarkus/it/keycloak/OidcTokenPropagationTest.java b/integration-tests/smallrye-jwt-token-propagation/src/test/java/io/quarkus/it/keycloak/OidcTokenPropagationTest.java index fce76b77d1d78..90161e7d78813 100644 --- a/integration-tests/smallrye-jwt-token-propagation/src/test/java/io/quarkus/it/keycloak/OidcTokenPropagationTest.java +++ b/integration-tests/smallrye-jwt-token-propagation/src/test/java/io/quarkus/it/keycloak/OidcTokenPropagationTest.java @@ -5,13 +5,13 @@ import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.http.ContentType; @QuarkusTest -@QuarkusTestResource(KeycloakRealmResourceManager.class) +@WithTestResource(value = KeycloakRealmResourceManager.class, restrictToAnnotatedClass = false) public class OidcTokenPropagationTest { @Test diff --git a/integration-tests/smallrye-jwt-token-propagation/src/test/java/io/quarkus/it/keycloak/SmallRyeJwtGrpcAuthorizationTest.java b/integration-tests/smallrye-jwt-token-propagation/src/test/java/io/quarkus/it/keycloak/SmallRyeJwtGrpcAuthorizationTest.java index 1a22535d77209..d9a43c07e41fa 100644 --- a/integration-tests/smallrye-jwt-token-propagation/src/test/java/io/quarkus/it/keycloak/SmallRyeJwtGrpcAuthorizationTest.java +++ b/integration-tests/smallrye-jwt-token-propagation/src/test/java/io/quarkus/it/keycloak/SmallRyeJwtGrpcAuthorizationTest.java @@ -3,12 +3,12 @@ import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; @QuarkusTest -@QuarkusTestResource(KeycloakRealmResourceManager.class) +@WithTestResource(value = KeycloakRealmResourceManager.class, restrictToAnnotatedClass = false) public class SmallRyeJwtGrpcAuthorizationTest { @Test diff --git a/integration-tests/spring-cloud-config-client/src/test/java/io/quarkus/spring/cloud/config/client/runtime/CommonAndTestProfilesTest.java b/integration-tests/spring-cloud-config-client/src/test/java/io/quarkus/spring/cloud/config/client/runtime/CommonAndTestProfilesTest.java index c577f996119e1..a4148c5700910 100644 --- a/integration-tests/spring-cloud-config-client/src/test/java/io/quarkus/spring/cloud/config/client/runtime/CommonAndTestProfilesTest.java +++ b/integration-tests/spring-cloud-config-client/src/test/java/io/quarkus/spring/cloud/config/client/runtime/CommonAndTestProfilesTest.java @@ -7,11 +7,11 @@ import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(SpringCloudConfigServerResource.class) +@WithTestResource(value = SpringCloudConfigServerResource.class, restrictToAnnotatedClass = false) @Tag("common") @Tag("test") public class CommonAndTestProfilesTest { diff --git a/integration-tests/spring-cloud-config-client/src/test/java/io/quarkus/spring/cloud/config/client/runtime/OnlyTestProfileTest.java b/integration-tests/spring-cloud-config-client/src/test/java/io/quarkus/spring/cloud/config/client/runtime/OnlyTestProfileTest.java index 4956e277950bb..cd8b8f29eb11a 100644 --- a/integration-tests/spring-cloud-config-client/src/test/java/io/quarkus/spring/cloud/config/client/runtime/OnlyTestProfileTest.java +++ b/integration-tests/spring-cloud-config-client/src/test/java/io/quarkus/spring/cloud/config/client/runtime/OnlyTestProfileTest.java @@ -7,11 +7,11 @@ import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest -@QuarkusTestResource(SpringCloudConfigServerResource.class) +@WithTestResource(value = SpringCloudConfigServerResource.class, restrictToAnnotatedClass = false) @Tag("test") @Tag("test-only") public class OnlyTestProfileTest { diff --git a/integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/TestResources.java b/integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/TestResources.java index 4ef6ba0fd6d7f..cbb8c056c615d 100644 --- a/integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/TestResources.java +++ b/integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.spring.data.jpa; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/spring-data-rest/src/test/java/io/quarkus/it/spring/data/rest/TestResources.java b/integration-tests/spring-data-rest/src/test/java/io/quarkus/it/spring/data/rest/TestResources.java index b847c6bd2d916..63c81bf6a200e 100644 --- a/integration-tests/spring-data-rest/src/test/java/io/quarkus/it/spring/data/rest/TestResources.java +++ b/integration-tests/spring-data-rest/src/test/java/io/quarkus/it/spring/data/rest/TestResources.java @@ -1,8 +1,8 @@ package io.quarkus.it.spring.data.rest; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.h2.H2DatabaseTestResource; -@QuarkusTestResource(H2DatabaseTestResource.class) +@WithTestResource(value = H2DatabaseTestResource.class, restrictToAnnotatedClass = false) public class TestResources { } diff --git a/integration-tests/test-extension/tests/src/test/java/io/quarkus/it/extension/CustomResource.java b/integration-tests/test-extension/tests/src/test/java/io/quarkus/it/extension/CustomResource.java index bd4c7d77ab7d4..5bcedc155de88 100644 --- a/integration-tests/test-extension/tests/src/test/java/io/quarkus/it/extension/CustomResource.java +++ b/integration-tests/test-extension/tests/src/test/java/io/quarkus/it/extension/CustomResource.java @@ -7,11 +7,11 @@ import jakarta.enterprise.inject.Stereotype; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) -@QuarkusTestResource(LifecycleManager.class) +@WithTestResource(value = LifecycleManager.class, restrictToAnnotatedClass = false) @Stereotype public @interface CustomResource { diff --git a/integration-tests/test-extension/tests/src/test/java/io/quarkus/it/extension/CustomResourceWithList.java b/integration-tests/test-extension/tests/src/test/java/io/quarkus/it/extension/CustomResourceWithList.java index ec818cef8840a..7f25f4a671e89 100644 --- a/integration-tests/test-extension/tests/src/test/java/io/quarkus/it/extension/CustomResourceWithList.java +++ b/integration-tests/test-extension/tests/src/test/java/io/quarkus/it/extension/CustomResourceWithList.java @@ -7,12 +7,12 @@ import jakarta.enterprise.inject.Stereotype; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) -@QuarkusTestResource.List({ - @QuarkusTestResource(LifecycleManager.class) +@WithTestResource.List({ + @WithTestResource(value = LifecycleManager.class, restrictToAnnotatedClass = false) }) @Stereotype public @interface CustomResourceWithList { diff --git a/integration-tests/virtual-threads/amqp-virtual-threads/src/test/java/io/quarkus/it/vthreads/amqp/VirtualThreadTest.java b/integration-tests/virtual-threads/amqp-virtual-threads/src/test/java/io/quarkus/it/vthreads/amqp/VirtualThreadTest.java index f78312ba795d5..0ece61ecf1437 100644 --- a/integration-tests/virtual-threads/amqp-virtual-threads/src/test/java/io/quarkus/it/vthreads/amqp/VirtualThreadTest.java +++ b/integration-tests/virtual-threads/amqp-virtual-threads/src/test/java/io/quarkus/it/vthreads/amqp/VirtualThreadTest.java @@ -11,13 +11,13 @@ import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.CountMatchingStrategy; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit5.virtual.ShouldNotPin; import io.quarkus.test.junit5.virtual.VirtualThreadUnit; @QuarkusTest -@QuarkusTestResource(WireMockExtension.class) +@WithTestResource(value = WireMockExtension.class, restrictToAnnotatedClass = false) @VirtualThreadUnit @ShouldNotPin public class VirtualThreadTest { diff --git a/integration-tests/virtual-threads/jms-virtual-threads/src/test/java/io/quarkus/it/vthreads/jms/VirtualThreadTest.java b/integration-tests/virtual-threads/jms-virtual-threads/src/test/java/io/quarkus/it/vthreads/jms/VirtualThreadTest.java index 39ebce8240846..0c81d6b5747ab 100644 --- a/integration-tests/virtual-threads/jms-virtual-threads/src/test/java/io/quarkus/it/vthreads/jms/VirtualThreadTest.java +++ b/integration-tests/virtual-threads/jms-virtual-threads/src/test/java/io/quarkus/it/vthreads/jms/VirtualThreadTest.java @@ -11,13 +11,13 @@ import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.CountMatchingStrategy; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit5.virtual.ShouldNotPin; import io.quarkus.test.junit5.virtual.VirtualThreadUnit; @QuarkusTest -@QuarkusTestResource(WireMockExtension.class) +@WithTestResource(value = WireMockExtension.class, restrictToAnnotatedClass = false) @VirtualThreadUnit @ShouldNotPin public class VirtualThreadTest { diff --git a/integration-tests/virtual-threads/kafka-virtual-threads/src/test/java/io/quarkus/it/vthreads/kafka/VirtualThreadTest.java b/integration-tests/virtual-threads/kafka-virtual-threads/src/test/java/io/quarkus/it/vthreads/kafka/VirtualThreadTest.java index ca5060e18aec1..812d98962002b 100644 --- a/integration-tests/virtual-threads/kafka-virtual-threads/src/test/java/io/quarkus/it/vthreads/kafka/VirtualThreadTest.java +++ b/integration-tests/virtual-threads/kafka-virtual-threads/src/test/java/io/quarkus/it/vthreads/kafka/VirtualThreadTest.java @@ -11,13 +11,13 @@ import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.CountMatchingStrategy; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit5.virtual.ShouldNotPin; import io.quarkus.test.junit5.virtual.VirtualThreadUnit; @QuarkusTest -@QuarkusTestResource(WireMockExtension.class) +@WithTestResource(value = WireMockExtension.class, restrictToAnnotatedClass = false) @VirtualThreadUnit @ShouldNotPin public class VirtualThreadTest { diff --git a/integration-tests/virtual-threads/mailer-virtual-threads/src/test/java/io/quarkus/virtual/mail/RunOnVirtualThreadTest.java b/integration-tests/virtual-threads/mailer-virtual-threads/src/test/java/io/quarkus/virtual/mail/RunOnVirtualThreadTest.java index 659dc606b7e4a..6e81fd521c911 100644 --- a/integration-tests/virtual-threads/mailer-virtual-threads/src/test/java/io/quarkus/virtual/mail/RunOnVirtualThreadTest.java +++ b/integration-tests/virtual-threads/mailer-virtual-threads/src/test/java/io/quarkus/virtual/mail/RunOnVirtualThreadTest.java @@ -6,7 +6,7 @@ import org.eclipse.microprofile.config.ConfigProvider; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit5.virtual.ShouldNotPin; import io.quarkus.test.junit5.virtual.VirtualThreadUnit; @@ -15,7 +15,7 @@ import io.vertx.core.json.JsonObject; @QuarkusTest -@QuarkusTestResource(MailHogResource.class) +@WithTestResource(value = MailHogResource.class, restrictToAnnotatedClass = false) @VirtualThreadUnit @ShouldNotPin class RunOnVirtualThreadTest { diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResource.java b/test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResource.java index de5921d3d0625..803fb23abc179 100644 --- a/test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResource.java +++ b/test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResource.java @@ -20,11 +20,14 @@ * * Note that test resources are never restarted when running {@code @Nested} test classes. * + * @deprecated Use the new {@link WithTestResource} instead. It will be a long while before this is removed, but better to move + * to the replacement sooner than later. */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Repeatable(List.class) +@Deprecated(forRemoval = true) public @interface QuarkusTestResource { /** @@ -54,6 +57,7 @@ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented + @Deprecated(forRemoval = true) @interface List { QuarkusTestResource[] value(); } diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResourceLifecycleManager.java b/test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResourceLifecycleManager.java index 7c95b3aaa253f..a5f9ed3ce3f5e 100644 --- a/test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResourceLifecycleManager.java +++ b/test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResourceLifecycleManager.java @@ -9,7 +9,7 @@ * Manage the lifecycle of a test resource, for instance a H2 test server. *

* These resources are started before the first test is run, and are closed - * at the end of the test suite. They are configured via the {@link QuarkusTestResource} + * at the end of the test suite. They are configured via the {@link WithTestResource} * annotation, which can be placed on any class in the test suite. * * These can also be loaded via a service loader mechanism, however if a service @@ -55,7 +55,7 @@ default void setContext(Context context) { * * The {@code args} is never null * - * @see QuarkusTestResource#initArgs() + * @see WithTestResource#initArgs() */ default void init(Map initArgs) { diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResourceRepeatable.java b/test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResourceRepeatable.java index 859a863e272e3..2398d6a0f89ba 100644 --- a/test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResourceRepeatable.java +++ b/test-framework/common/src/main/java/io/quarkus/test/common/QuarkusTestResourceRepeatable.java @@ -11,10 +11,15 @@ * Used to indicate the type of the repeatable annotation * type annotated with a {@code QuarkusTestResource} annotations. * + *

+ * + * @deprecated Use {@link WithTestResourceRepeatable} instead + *

*/ @Target(ElementType.ANNOTATION_TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented +@Deprecated(forRemoval = true) public @interface QuarkusTestResourceRepeatable { /** diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/ResourceArg.java b/test-framework/common/src/main/java/io/quarkus/test/common/ResourceArg.java index 325ae29533654..e4c49b8cd05f6 100644 --- a/test-framework/common/src/main/java/io/quarkus/test/common/ResourceArg.java +++ b/test-framework/common/src/main/java/io/quarkus/test/common/ResourceArg.java @@ -8,7 +8,7 @@ /** * Uses to define arguments of for {@code QuarkusTestResource} * - * see {@link QuarkusTestResource#initArgs()} + * see {@link WithTestResource#initArgs()} */ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/TestResourceManager.java b/test-framework/common/src/main/java/io/quarkus/test/common/TestResourceManager.java index dfe8865ee850b..bc73a6cd5883d 100644 --- a/test-framework/common/src/main/java/io/quarkus/test/common/TestResourceManager.java +++ b/test-framework/common/src/main/java/io/quarkus/test/common/TestResourceManager.java @@ -6,6 +6,7 @@ import java.lang.reflect.InvocationTargetException; import java.nio.file.Path; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -24,6 +25,7 @@ import java.util.concurrent.Executors; import java.util.function.Function; import java.util.function.Predicate; +import java.util.stream.Collectors; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.AnnotationValue; @@ -34,7 +36,8 @@ import io.smallrye.config.SmallRyeConfigProviderResolver; public class TestResourceManager implements Closeable { - + private static final DotName QUARKUS_TEST_RESOURCE = DotName.createSimple(QuarkusTestResource.class); + private static final DotName WITH_TEST_RESOURCE = DotName.createSimple(WithTestResource.class); public static final String CLOSEABLE_NAME = TestResourceManager.class.getName() + ".closeable"; private final List sequentialTestResourceEntries; @@ -69,7 +72,7 @@ public TestResourceManager(Class testClass, Class profileClass, List(); // we need to keep track of duplicate entries to make sure we don't start the same resource - // multiple times even if there are multiple same @QuarkusTestResource annotations + // multiple times even if there are multiple same @WithTestResource annotations Set uniqueEntries; if (disableGlobalTestResources) { uniqueEntries = new HashSet<>(additionalTestResources); @@ -313,8 +316,7 @@ private Set getUniqueTestResourceClassEntries(Path testC isParallel = parallelAnnotationValue.asBoolean(); } - AnnotationValue restrict = annotation.value("restrictToAnnotatedClass"); - if (restrict != null && restrict.asBoolean()) { + if (restrictToAnnotatedClass(annotation)) { hasPerTestResources = true; } @@ -333,7 +335,26 @@ private void collectMetaAnnotations(Class testClassFromTCCL, Function addTestResourceEntry(res, metaAnnotation, uniqueEntries)); + hasPerTestResources = true; + break; + } else if (ann.annotationType() == WithTestResourceRepeatable.class) { + for (Annotation repeatableMetaAnn : testClassFromTCCL + .getAnnotationsByType(((WithTestResourceRepeatable) ann).value())) { + WithTestResource quarkusTestResource = repeatableMetaAnn.annotationType() + .getAnnotation(WithTestResource.class); + if (quarkusTestResource != null) { + addTestResourceEntry(quarkusTestResource, repeatableMetaAnn, uniqueEntries); + hasPerTestResources = true; + } + } + } else if (ann.annotationType() == QuarkusTestResource.class) { addTestResourceEntry((QuarkusTestResource) ann, metaAnnotation, uniqueEntries); hasPerTestResources = true; break; @@ -352,7 +373,6 @@ private void collectMetaAnnotations(Class testClassFromTCCL, Function testClassFromTCCL, Function uniqueEntries) { + private void addTestResourceEntry(Class testResourceClass, + ResourceArg[] argsAnnotationValue, Annotation originalAnnotation, + Set uniqueEntries, boolean parallel) { // NOTE: we don't need to check restrictToAnnotatedClass because by design config-based annotations // are not discovered outside the test class, so they're restricted - Class testResourceClass = quarkusTestResource.value(); + var args = Arrays.stream(argsAnnotationValue) + .collect(Collectors.toMap(ResourceArg::name, ResourceArg::value)); - ResourceArg[] argsAnnotationValue = quarkusTestResource.initArgs(); - Map args; - if (argsAnnotationValue.length == 0) { - args = Collections.emptyMap(); - } else { - args = new HashMap<>(); - for (ResourceArg arg : argsAnnotationValue) { - args.put(arg.name(), arg.value()); - } - } uniqueEntries - .add(new TestResourceClassEntry(testResourceClass, args, originalAnnotation, quarkusTestResource.parallel())); + .add(new TestResourceClassEntry(testResourceClass, args, originalAnnotation, parallel)); + } + + private void addTestResourceEntry(WithTestResource quarkusTestResource, Annotation originalAnnotation, + Set uniqueEntries) { + + addTestResourceEntry(quarkusTestResource.value(), quarkusTestResource.initArgs(), originalAnnotation, uniqueEntries, + quarkusTestResource.parallel()); + } + + private void addTestResourceEntry(QuarkusTestResource quarkusTestResource, Annotation originalAnnotation, + Set uniqueEntries) { + + addTestResourceEntry(quarkusTestResource.value(), quarkusTestResource.initArgs(), originalAnnotation, uniqueEntries, + quarkusTestResource.parallel()); } @SuppressWarnings("unchecked") @@ -405,22 +431,29 @@ private Collection findQuarkusTestResourceInstances(Class testClasses.add(current.getName()); current = current.getEnclosingClass(); } + Set testResourceAnnotations = new LinkedHashSet<>(); - for (AnnotationInstance annotation : index.getAnnotations(DotName.createSimple(QuarkusTestResource.class.getName()))) { - if (keepTestResourceAnnotation(annotation, annotation.target().asClass(), testClasses)) { - testResourceAnnotations.add(annotation); + + for (DotName testResourceClasses : List.of(WITH_TEST_RESOURCE, QUARKUS_TEST_RESOURCE)) { + for (AnnotationInstance annotation : index.getAnnotations(testResourceClasses)) { + if (keepTestResourceAnnotation(annotation, annotation.target().asClass(), testClasses)) { + testResourceAnnotations.add(annotation); + } } } - for (AnnotationInstance annotation : index - .getAnnotations(DotName.createSimple(QuarkusTestResource.List.class.getName()))) { - for (AnnotationInstance nestedAnnotation : annotation.value().asNestedArray()) { - // keep the list target - if (keepTestResourceAnnotation(nestedAnnotation, annotation.target().asClass(), testClasses)) { - testResourceAnnotations.add(nestedAnnotation); + for (DotName testResourceListClasses : List.of(DotName.createSimple(WithTestResource.List.class.getName()), + DotName.createSimple(QuarkusTestResource.List.class.getName()))) { + for (AnnotationInstance annotation : index.getAnnotations(testResourceListClasses)) { + for (AnnotationInstance nestedAnnotation : annotation.value().asNestedArray()) { + // keep the list target + if (keepTestResourceAnnotation(nestedAnnotation, annotation.target().asClass(), testClasses)) { + testResourceAnnotations.add(nestedAnnotation); + } } } } + return testResourceAnnotations; } @@ -434,13 +467,22 @@ private boolean keepTestResourceAnnotation(AnnotationInstance annotation, ClassI // meta-annotations have already been handled in collectMetaAnnotations return false; } - AnnotationValue restrict = annotation.value("restrictToAnnotatedClass"); - if (restrict != null && restrict.asBoolean()) { + + if (restrictToAnnotatedClass(annotation)) { return testClasses.contains(targetClass.name().toString('.')); } + return true; } + private boolean restrictToAnnotatedClass(AnnotationInstance annotation) { + AnnotationValue restrict = annotation.value("restrictToAnnotatedClass"); + + return (annotation.name().equals(WITH_TEST_RESOURCE) && ((restrict == null) || restrict.asBoolean())) + || + (annotation.name().equals(QUARKUS_TEST_RESOURCE) && ((restrict != null) && restrict.asBoolean())); + } + public static class TestResourceClassEntry { private Class clazz; diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/WithTestResource.java b/test-framework/common/src/main/java/io/quarkus/test/common/WithTestResource.java new file mode 100644 index 0000000000000..c44d91cdac803 --- /dev/null +++ b/test-framework/common/src/main/java/io/quarkus/test/common/WithTestResource.java @@ -0,0 +1,67 @@ +package io.quarkus.test.common; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Repeatable; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.Map; + +import io.quarkus.test.common.WithTestResource.List; + +/** + * Used to define a test resource. + * + * All {@code WithTestResource} annotations in the test module + * are discovered (regardless of the test which contains the annotation) + * and their corresponding {@code QuarkusTestResourceLifecycleManager} + * started before any test is run. + * + * Note that test resources are never restarted when running {@code @Nested} test classes. + *

+ * This replaces {@link QuarkusTestResource}. The only difference is that the default value for + * {@link #restrictToAnnotatedClass()} {@code == true}. + *

+ *

+ * This means that any resources managed by {@link #value()} apply to an individual test class or test profile, unlike with + * {@link QuarkusTestResource} where a resource applies to all test classes. + *

+ */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Repeatable(List.class) +public @interface WithTestResource { + + /** + * @return The class managing the lifecycle of the test resource. + */ + Class value(); + + /** + * @return The arguments to be passed to the {@code QuarkusTestResourceLifecycleManager} + * + * @see QuarkusTestResourceLifecycleManager#init(Map) + */ + ResourceArg[] initArgs() default {}; + + /** + * Whether this test resource is to be started in parallel (concurrently) along with others also marked as parallel + */ + boolean parallel() default false; + + /** + * Whether this annotation should only be enabled if it is placed on the currently running test class or test profile. + * Note that this defaults to true for meta-annotations since meta-annotations are only considered + * for the current test class or test profile. + */ + boolean restrictToAnnotatedClass() default true; + + @Target(ElementType.TYPE) + @Retention(RetentionPolicy.RUNTIME) + @Documented + @interface List { + WithTestResource[] value(); + } +} diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/WithTestResourceRepeatable.java b/test-framework/common/src/main/java/io/quarkus/test/common/WithTestResourceRepeatable.java new file mode 100644 index 0000000000000..2e978f445ae21 --- /dev/null +++ b/test-framework/common/src/main/java/io/quarkus/test/common/WithTestResourceRepeatable.java @@ -0,0 +1,25 @@ +package io.quarkus.test.common; + +import java.lang.annotation.Annotation; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Used to indicate the type of the repeatable annotation + * type annotated with a {@link WithTestResource} annotations. + * + *

+ */ +@Target(ElementType.ANNOTATION_TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface WithTestResourceRepeatable { + + /** + * @return The class annotated with a {@link WithTestResource} annotations. + */ + Class value(); +} diff --git a/test-framework/common/src/test/java/io/quarkus/test/common/TestResourceManagerInjectorTest.java b/test-framework/common/src/test/java/io/quarkus/test/common/TestResourceManagerInjectorTest.java index 24d1e48edf1a5..ae65a769ce40a 100644 --- a/test-framework/common/src/test/java/io/quarkus/test/common/TestResourceManagerInjectorTest.java +++ b/test-framework/common/src/test/java/io/quarkus/test/common/TestResourceManagerInjectorTest.java @@ -9,13 +9,15 @@ import java.util.Map; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; public class TestResourceManagerInjectorTest { - @Test - void testTestInjector() { - TestResourceManager manager = new TestResourceManager(UsingInjectorTest.class); + @ParameterizedTest + @ValueSource(classes = { UsingInjectorTest.class, UsingInjectorTest2.class }) + void testTestInjector(Class clazz) { + TestResourceManager manager = new TestResourceManager(clazz); manager.start(); Foo foo = new Foo(); @@ -27,10 +29,14 @@ void testTestInjector() { Assertions.assertEquals("dummy", foo.dummy.value); } - @QuarkusTestResource(UsingTestInjectorLifecycleManager.class) + @WithTestResource(value = UsingTestInjectorLifecycleManager.class, restrictToAnnotatedClass = false) public static class UsingInjectorTest { } + @QuarkusTestResource(UsingTestInjectorLifecycleManager.class) + public static class UsingInjectorTest2 { + } + public static class UsingTestInjectorLifecycleManager implements QuarkusTestResourceLifecycleManager { @Override diff --git a/test-framework/common/src/test/java/io/quarkus/test/common/TestResourceManagerTest.java b/test-framework/common/src/test/java/io/quarkus/test/common/TestResourceManagerTest.java index 51c8946995d60..0d83478dfbb2f 100644 --- a/test-framework/common/src/test/java/io/quarkus/test/common/TestResourceManagerTest.java +++ b/test-framework/common/src/test/java/io/quarkus/test/common/TestResourceManagerTest.java @@ -13,41 +13,50 @@ import java.util.concurrent.atomic.AtomicInteger; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; public class TestResourceManagerTest { private static final String OVERRIDEN_KEY = "overridenKey"; public static boolean parallelTestResourceRunned = false; - @Test - void testRepeatableAnnotationsAreIndexed() { + @ParameterizedTest + @ValueSource(classes = { MyTest.class, MyTest2.class }) + void testRepeatableAnnotationsAreIndexed(Class clazz) { AtomicInteger counter = new AtomicInteger(); - TestResourceManager manager = new TestResourceManager(MyTest.class); + TestResourceManager manager = new TestResourceManager(clazz); manager.inject(counter); assertThat(counter.intValue()).isEqualTo(2); } - @Test - void testSequentialResourcesRunSequentially() { - TestResourceManager manager = new TestResourceManager(SequentialTestResourcesTest.class); + @ParameterizedTest + @ValueSource(classes = { SequentialTestResourcesTest.class, SequentialTestResourcesTest2.class }) + void testSequentialResourcesRunSequentially(Class clazz) { + TestResourceManager manager = new TestResourceManager(clazz); Map props = manager.start(); Assertions.assertEquals("value1", props.get("key1")); Assertions.assertEquals("value2", props.get("key2")); Assertions.assertEquals("value2", props.get(OVERRIDEN_KEY)); } - @Test - void testParallelResourcesRunInParallel() { - TestResourceManager manager = new TestResourceManager(ParallelTestResourcesTest.class); + @ParameterizedTest + @ValueSource(classes = { ParallelTestResourcesTest.class, ParallelTestResourcesTest2.class }) + void testParallelResourcesRunInParallel(Class clazz) { + TestResourceManager manager = new TestResourceManager(clazz); Map props = manager.start(); Assertions.assertEquals("value1", props.get("key1")); Assertions.assertEquals("value2", props.get("key2")); } + @WithTestResource(value = FirstLifecycleManager.class, restrictToAnnotatedClass = false) + @WithTestResource(value = SecondLifecycleManager.class, restrictToAnnotatedClass = false) + public static class MyTest { + } + @QuarkusTestResource(FirstLifecycleManager.class) @QuarkusTestResource(SecondLifecycleManager.class) - public static class MyTest { + public static class MyTest2 { } public static class FirstLifecycleManager implements QuarkusTestResourceLifecycleManager { @@ -90,9 +99,14 @@ public void stop() { } } + @WithTestResource(value = FirstSequentialQuarkusTestResource.class, restrictToAnnotatedClass = false) + @WithTestResource(value = SecondSequentialQuarkusTestResource.class, restrictToAnnotatedClass = false) + public static class SequentialTestResourcesTest { + } + @QuarkusTestResource(FirstSequentialQuarkusTestResource.class) @QuarkusTestResource(SecondSequentialQuarkusTestResource.class) - public static class SequentialTestResourcesTest { + public static class SequentialTestResourcesTest2 { } public static class FirstSequentialQuarkusTestResource implements QuarkusTestResourceLifecycleManager { @@ -136,9 +150,14 @@ public int order() { } } + @WithTestResource(value = FirstParallelQuarkusTestResource.class, parallel = true, restrictToAnnotatedClass = false) + @WithTestResource(value = SecondParallelQuarkusTestResource.class, parallel = true, restrictToAnnotatedClass = false) + public static class ParallelTestResourcesTest { + } + @QuarkusTestResource(value = FirstParallelQuarkusTestResource.class, parallel = true) @QuarkusTestResource(value = SecondParallelQuarkusTestResource.class, parallel = true) - public static class ParallelTestResourcesTest { + public static class ParallelTestResourcesTest2 { } public static class FirstParallelQuarkusTestResource implements QuarkusTestResourceLifecycleManager { @@ -183,9 +202,11 @@ public int order() { } } - @Test - void testAnnotationBased() { - TestResourceManager manager = new TestResourceManager(RepeatableAnnotationBasedTestResourcesTest.class); + @ParameterizedTest + @ValueSource(classes = { RepeatableAnnotationBasedTestResourcesTest.class, + RepeatableAnnotationBasedTestResourcesTest2.class }) + void testAnnotationBased(Class clazz) { + TestResourceManager manager = new TestResourceManager(clazz); manager.init("test"); Map props = manager.start(); Assertions.assertEquals("value", props.get("annotationkey1")); @@ -214,7 +235,29 @@ public void stop() { } } - @QuarkusTestResource(AnnotationBasedQuarkusTestResource.class) + public static class AnnotationBasedQuarkusTestResource2 + implements QuarkusTestResourceConfigurableLifecycleManager { + + private String key; + + @Override + public void init(WithAnnotationBasedTestResource2 annotation) { + this.key = annotation.key(); + } + + @Override + public Map start() { + Map props = new HashMap<>(); + props.put(key, "value"); + return props; + } + + @Override + public void stop() { + } + } + + @WithTestResource(value = AnnotationBasedQuarkusTestResource.class, restrictToAnnotatedClass = false) @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Repeatable(WithAnnotationBasedTestResource.List.class) @@ -223,14 +266,34 @@ public void stop() { @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) - @QuarkusTestResourceRepeatable(WithAnnotationBasedTestResource.class) + @WithTestResourceRepeatable(WithAnnotationBasedTestResource.class) @interface List { WithAnnotationBasedTestResource[] value(); } } + @QuarkusTestResource(AnnotationBasedQuarkusTestResource2.class) + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.TYPE) + @Repeatable(WithAnnotationBasedTestResource2.List.class) + public @interface WithAnnotationBasedTestResource2 { + String key() default ""; + + @Target(ElementType.TYPE) + @Retention(RetentionPolicy.RUNTIME) + @QuarkusTestResourceRepeatable(WithAnnotationBasedTestResource2.class) + @interface List { + WithAnnotationBasedTestResource2[] value(); + } + } + @WithAnnotationBasedTestResource(key = "annotationkey1") @WithAnnotationBasedTestResource(key = "annotationkey2") public static class RepeatableAnnotationBasedTestResourcesTest { } + + @WithAnnotationBasedTestResource2(key = "annotationkey1") + @WithAnnotationBasedTestResource2(key = "annotationkey2") + public static class RepeatableAnnotationBasedTestResourcesTest2 { + } } diff --git a/test-framework/google-cloud-functions/src/main/java/io/quarkus/google/cloud/functions/test/WithFunction.java b/test-framework/google-cloud-functions/src/main/java/io/quarkus/google/cloud/functions/test/WithFunction.java index 22296fc1d17c8..0e395b5cc5812 100644 --- a/test-framework/google-cloud-functions/src/main/java/io/quarkus/google/cloud/functions/test/WithFunction.java +++ b/test-framework/google-cloud-functions/src/main/java/io/quarkus/google/cloud/functions/test/WithFunction.java @@ -5,7 +5,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; /** * This annotation can be used to start a Google Cloud Function for a test. @@ -15,7 +15,7 @@ * * @see CloudFunctionTestResource */ -@QuarkusTestResource(value = CloudFunctionTestResource.class, restrictToAnnotatedClass = true) +@WithTestResource(CloudFunctionTestResource.class) @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface WithFunction { diff --git a/test-framework/junit5-internal/src/main/java/io/quarkus/test/LogCollectingTestResource.java b/test-framework/junit5-internal/src/main/java/io/quarkus/test/LogCollectingTestResource.java index ea756df682782..e018888b18118 100644 --- a/test-framework/junit5-internal/src/main/java/io/quarkus/test/LogCollectingTestResource.java +++ b/test-framework/junit5-internal/src/main/java/io/quarkus/test/LogCollectingTestResource.java @@ -34,7 +34,7 @@ public static String format(LogRecord record) { public static LogCollectingTestResource current() { if (current == null) { throw new IllegalStateException( - LogCollectingTestResource.class.getName() + " must be registered with @QuarkusTestResource"); + LogCollectingTestResource.class.getName() + " must be registered with @WithTestResource"); } return current; } diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/AbstractJvmQuarkusTestExtension.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/AbstractJvmQuarkusTestExtension.java index 83b9ef2bb18d9..8e4255618c77e 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/AbstractJvmQuarkusTestExtension.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/AbstractJvmQuarkusTestExtension.java @@ -42,6 +42,7 @@ import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.RestorableSystemProperties; import io.quarkus.test.common.TestClassIndexer; +import io.quarkus.test.common.WithTestResource; public class AbstractJvmQuarkusTestExtension extends AbstractQuarkusTestWithContextExtension { @@ -275,6 +276,12 @@ protected static boolean hasPerTestResources(ExtensionContext extensionContext) public static boolean hasPerTestResources(Class requiredTestClass) { while (requiredTestClass != Object.class) { + for (WithTestResource testResource : requiredTestClass.getAnnotationsByType(WithTestResource.class)) { + if (testResource.restrictToAnnotatedClass()) { + return true; + } + } + for (QuarkusTestResource testResource : requiredTestClass.getAnnotationsByType(QuarkusTestResource.class)) { if (testResource.restrictToAnnotatedClass()) { return true; @@ -283,9 +290,12 @@ public static boolean hasPerTestResources(Class requiredTestClass) { // scan for meta-annotations for (Annotation annotation : requiredTestClass.getAnnotations()) { // skip TestResource annotations - if (annotation.annotationType() != QuarkusTestResource.class) { + var annotationType = annotation.annotationType(); + + if ((annotationType != WithTestResource.class) && (annotationType != QuarkusTestResource.class)) { // look for a TestResource on the annotation itself - if (annotation.annotationType().getAnnotationsByType(QuarkusTestResource.class).length > 0) { + if ((annotationType.getAnnotationsByType(WithTestResource.class).length > 0) + || (annotationType.getAnnotationsByType(QuarkusTestResource.class).length > 0)) { // meta-annotations are per-test scoped for now return true; } diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestProfile.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestProfile.java index 6b64d87733a4b..46b11de971cf3 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestProfile.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestProfile.java @@ -51,7 +51,7 @@ default String getConfigProfile() { * specific test profile. * * If this method is not overridden, then only the {@link QuarkusTestResourceLifecycleManager} classes enabled via the - * {@link io.quarkus.test.common.QuarkusTestResource} class + * {@link io.quarkus.test.common.WithTestResource} class * annotation will be used for the tests using this profile (which is the same behavior as tests that don't use a profile at * all). */ diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/util/QuarkusTestProfileAwareClassOrderer.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/util/QuarkusTestProfileAwareClassOrderer.java index d4d97c0316df0..810150bec98ce 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/util/QuarkusTestProfileAwareClassOrderer.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/util/QuarkusTestProfileAwareClassOrderer.java @@ -12,6 +12,7 @@ import org.junit.jupiter.api.Nested; import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusIntegrationTest; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; @@ -20,11 +21,13 @@ /** * A {@link ClassOrderer} that orders {@link QuarkusTest}, {@link QuarkusIntegrationTest} and {@link QuarkusMainTest} classes * for minimum Quarkus - * restarts by grouping them by their {@link TestProfile} and {@link QuarkusTestResource} annotation(s). + * restarts by grouping them by their {@link TestProfile}, {@link WithTestResource}, and {@link QuarkusTestResource} + * annotation(s). *

* By default, Quarkus*Tests not using any profile come first, then classes using a profile (in groups) and then all other * non-Quarkus tests (e.g. plain unit tests).
- * Quarkus*Tests with {@linkplain QuarkusTestResource#restrictToAnnotatedClass() restricted} {@code QuarkusTestResource} come + * Quarkus*Tests with {@linkplain WithTestResource#restrictToAnnotatedClass()} or + * {@linkplain QuarkusTestResource#restrictToAnnotatedClass() restricted} {@code QuarkusTestResource} come * after tests with profiles and Quarkus*Tests with only unrestricted resources are handled like tests without a profile (come * first). *

@@ -136,16 +139,25 @@ private ClassOrderer buildSecondaryOrderer(ClassOrdererContext context) { } private boolean hasRestrictedResource(ClassDescriptor classDescriptor) { - return classDescriptor.findRepeatableAnnotations(QuarkusTestResource.class).stream() - .anyMatch(res -> res.restrictToAnnotatedClass() || isMetaTestResource(res, classDescriptor)); + return classDescriptor.findRepeatableAnnotations(WithTestResource.class).stream() + .anyMatch(res -> res.restrictToAnnotatedClass() || isMetaTestResource(res, classDescriptor)) || + classDescriptor.findRepeatableAnnotations(QuarkusTestResource.class).stream() + .anyMatch(res -> res.restrictToAnnotatedClass() || isMetaTestResource(res, classDescriptor)); } + @Deprecated(forRemoval = true) private boolean isMetaTestResource(QuarkusTestResource resource, ClassDescriptor classDescriptor) { return Arrays.stream(classDescriptor.getTestClass().getAnnotationsByType(QuarkusTestResource.class)) .map(QuarkusTestResource::value) .noneMatch(resource.value()::equals); } + private boolean isMetaTestResource(WithTestResource resource, ClassDescriptor classDescriptor) { + return Arrays.stream(classDescriptor.getTestClass().getAnnotationsByType(WithTestResource.class)) + .map(WithTestResource::value) + .noneMatch(resource.value()::equals); + } + /** * Template method that provides an optional custom order key for the given {@code classDescriptor}. * diff --git a/test-framework/junit5/src/test/java/io/quarkus/test/junit/util/QuarkusTestProfileAwareClassOrdererTest.java b/test-framework/junit5/src/test/java/io/quarkus/test/junit/util/QuarkusTestProfileAwareClassOrdererTest.java index 4aaf942d225a3..259a5f1347778 100644 --- a/test-framework/junit5/src/test/java/io/quarkus/test/junit/util/QuarkusTestProfileAwareClassOrdererTest.java +++ b/test-framework/junit5/src/test/java/io/quarkus/test/junit/util/QuarkusTestProfileAwareClassOrdererTest.java @@ -10,6 +10,7 @@ import static org.mockito.Mockito.when; import static org.mockito.Mockito.withSettings; +import java.lang.annotation.Annotation; import java.util.Arrays; import java.util.List; import java.util.Optional; @@ -27,6 +28,7 @@ import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.QuarkusTestProfile; import io.quarkus.test.junit.TestProfile; @@ -52,26 +54,38 @@ void singleClass() { @Test void allVariants() { ClassDescriptor quarkusTest1Desc = quarkusDescriptorMock(Test01.class, null); - ClassDescriptor quarkusTestWithUnrestrictedResourceDesc = quarkusDescriptorMock(Test02.class, Manager3.class, false); + ClassDescriptor quarkusTestWithUnrestrictedResourceDesc = quarkusDescriptorMock(Test02.class, Manager3.class, false, + WithTestResource.class); + ClassDescriptor quarkusTestWithUnrestrictedQuarkusTestResourceDesc = quarkusDescriptorMock(Test02a.class, + Manager3.class, false, QuarkusTestResource.class); ClassDescriptor quarkusTest2Desc = quarkusDescriptorMock(Test03.class, null); ClassDescriptor quarkusTestWithProfile1Desc = quarkusDescriptorMock(Test04.class, Profile1.class); ClassDescriptor quarkusTestWithProfile2Test4Desc = quarkusDescriptorMock(Test05.class, Profile2.class); ClassDescriptor quarkusTestWithProfile2Test5Desc = quarkusDescriptorMock(Test06.class, Profile2.class); - ClassDescriptor quarkusTestWithRestrictedResourceDesc = quarkusDescriptorMock(Test07.class, Manager2.class, true); - ClassDescriptor quarkusTestWithMetaResourceDesc = quarkusDescriptorMock(Test08.class, Manager1.class, false); + ClassDescriptor quarkusTestWithRestrictedResourceDesc = quarkusDescriptorMock(Test07.class, Manager2.class, true, + WithTestResource.class); + ClassDescriptor quarkusTestWithRestrictedResourceDesc2 = quarkusDescriptorMock(Test07.class, Manager2.class, true, + QuarkusTestResource.class); + ClassDescriptor quarkusTestWithMetaResourceDesc = quarkusDescriptorMock(Test08.class, Manager1.class, false, + WithTestResource.class); + ClassDescriptor quarkusTestWithMetaResourceDesc2 = quarkusDescriptorMock(Test08.class, Manager1.class, false, + QuarkusTestResource.class); ClassDescriptor nonQuarkusTest1Desc = descriptorMock(Test09.class); ClassDescriptor nonQuarkusTest2Desc = descriptorMock(Test10.class); List input = Arrays.asList( quarkusTestWithRestrictedResourceDesc, nonQuarkusTest2Desc, + quarkusTestWithRestrictedResourceDesc2, quarkusTestWithProfile2Test5Desc, quarkusTest2Desc, nonQuarkusTest1Desc, quarkusTestWithMetaResourceDesc, quarkusTest1Desc, quarkusTestWithProfile2Test4Desc, + quarkusTestWithMetaResourceDesc2, quarkusTestWithUnrestrictedResourceDesc, - quarkusTestWithProfile1Desc); + quarkusTestWithProfile1Desc, + quarkusTestWithUnrestrictedQuarkusTestResourceDesc); doReturn(input).when(contextMock).getClassDescriptors(); underTest.orderClasses(contextMock); @@ -79,12 +93,15 @@ void allVariants() { assertThat(input).containsExactly( quarkusTest1Desc, quarkusTestWithUnrestrictedResourceDesc, + quarkusTestWithUnrestrictedQuarkusTestResourceDesc, quarkusTest2Desc, quarkusTestWithProfile1Desc, quarkusTestWithProfile2Test4Desc, quarkusTestWithProfile2Test5Desc, quarkusTestWithRestrictedResourceDesc, + quarkusTestWithRestrictedResourceDesc2, quarkusTestWithMetaResourceDesc, + quarkusTestWithMetaResourceDesc2, nonQuarkusTest1Desc, nonQuarkusTest2Desc); } @@ -169,27 +186,52 @@ private ClassDescriptor quarkusDescriptorMock(Class testClass, Class testClass, - Class managerClass, boolean restrictToAnnotatedClass) { + private ClassDescriptor quarkusDescriptorMock(Class testClass, + Class managerClass, boolean restrictToAnnotatedClass, + Class testResourceClass) { ClassDescriptor mock = descriptorMock(testClass); when(mock.isAnnotated(QuarkusTest.class)).thenReturn(true); - QuarkusTestResource resourceMock = Mockito.mock(QuarkusTestResource.class, - withSettings().strictness(Strictness.LENIENT)); - doReturn(managerClass).when(resourceMock).value(); - when(resourceMock.restrictToAnnotatedClass()).thenReturn(restrictToAnnotatedClass); - when(mock.findRepeatableAnnotations(QuarkusTestResource.class)).thenReturn(List.of(resourceMock)); + + if (WithTestResource.class.isAssignableFrom(testResourceClass)) { + quarkusWithTestResourceMock(mock, managerClass, restrictToAnnotatedClass); + } else if (QuarkusTestResource.class.isAssignableFrom(testResourceClass)) { + quarkusTestResourceMock(mock, managerClass, restrictToAnnotatedClass); + } + return mock; } + private void quarkusWithTestResourceMock(ClassDescriptor mock, + Class managerClass, boolean restrictToAnnotatedClass) { + WithTestResource withResourceMock = Mockito.mock(WithTestResource.class, withSettings().strictness(Strictness.LENIENT)); + doReturn(managerClass).when(withResourceMock).value(); + when(withResourceMock.restrictToAnnotatedClass()).thenReturn(restrictToAnnotatedClass); + when(mock.findRepeatableAnnotations(WithTestResource.class)).thenReturn(List.of(withResourceMock)); + } + + private void quarkusTestResourceMock(ClassDescriptor mock, + Class managerClass, boolean restrictToAnnotatedClass) { + QuarkusTestResource testResourceMock = Mockito.mock(QuarkusTestResource.class, + withSettings().strictness(Strictness.LENIENT)); + doReturn(managerClass).when(testResourceMock).value(); + when(testResourceMock.restrictToAnnotatedClass()).thenReturn(restrictToAnnotatedClass); + when(mock.findRepeatableAnnotations(QuarkusTestResource.class)).thenReturn(List.of(testResourceMock)); + } + private static class Test01 { } // this single made-up test class needs an actual annotation since the orderer will have to do the meta-check directly // because ClassDescriptor does not offer any details whether an annotation is directly annotated or meta-annotated - @QuarkusTestResource(Manager3.class) + @WithTestResource(value = Manager3.class, restrictToAnnotatedClass = false) private static class Test02 { } + @QuarkusTestResource(Manager3.class) + private static class Test02a { + + } + private static class Test03 { } diff --git a/test-framework/kubernetes-client/src/main/java/io/quarkus/test/kubernetes/client/WithKubernetesTestServer.java b/test-framework/kubernetes-client/src/main/java/io/quarkus/test/kubernetes/client/WithKubernetesTestServer.java index a9dc203a100ef..1edcb1fd20a54 100644 --- a/test-framework/kubernetes-client/src/main/java/io/quarkus/test/kubernetes/client/WithKubernetesTestServer.java +++ b/test-framework/kubernetes-client/src/main/java/io/quarkus/test/kubernetes/client/WithKubernetesTestServer.java @@ -7,13 +7,13 @@ import java.util.function.Consumer; import io.fabric8.kubernetes.client.server.mock.KubernetesServer; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; /** * Use on your test resource to get a mock {@link KubernetesServer} spawn up, and injectable with {@link KubernetesTestServer}. * This annotation is only active when used on a test class, and only for this test class. */ -@QuarkusTestResource(value = KubernetesServerTestResource.class, restrictToAnnotatedClass = true) +@WithTestResource(KubernetesServerTestResource.class) @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface WithKubernetesTestServer { diff --git a/test-framework/oidc-server/src/test/java/io/quarkus/test/oidc/server/OidcWiremockTestResourceInjectionTest.java b/test-framework/oidc-server/src/test/java/io/quarkus/test/oidc/server/OidcWiremockTestResourceInjectionTest.java index 12bfc5a0fb35c..953de58f61c87 100644 --- a/test-framework/oidc-server/src/test/java/io/quarkus/test/oidc/server/OidcWiremockTestResourceInjectionTest.java +++ b/test-framework/oidc-server/src/test/java/io/quarkus/test/oidc/server/OidcWiremockTestResourceInjectionTest.java @@ -1,13 +1,13 @@ package io.quarkus.test.oidc.server; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertNotNull; import org.junit.jupiter.api.Test; import com.github.tomakehurst.wiremock.WireMockServer; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.common.TestResourceManager; +import io.quarkus.test.common.WithTestResource; /** * Validates the injection of {@link WireMockServer} objects into test instances by {@link OidcWiremockTestResource}. @@ -24,7 +24,7 @@ void testWireMockServerInjection() { assertNotNull(test.server); } - @QuarkusTestResource(OidcWiremockTestResource.class) + @WithTestResource(value = OidcWiremockTestResource.class, restrictToAnnotatedClass = false) public static class CustomTest { @OidcWireMock WireMockServer server; diff --git a/test-framework/openshift-client/src/main/java/io/quarkus/test/kubernetes/client/WithOpenShiftTestServer.java b/test-framework/openshift-client/src/main/java/io/quarkus/test/kubernetes/client/WithOpenShiftTestServer.java index 9d978bdd8c0a9..a140a36bca874 100644 --- a/test-framework/openshift-client/src/main/java/io/quarkus/test/kubernetes/client/WithOpenShiftTestServer.java +++ b/test-framework/openshift-client/src/main/java/io/quarkus/test/kubernetes/client/WithOpenShiftTestServer.java @@ -7,13 +7,13 @@ import java.util.function.Consumer; import io.fabric8.openshift.client.server.mock.OpenShiftServer; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; /** * Use on your test resource to get a mock {@link OpenShiftServer} spawn up, and injectable with {@link OpenShiftTestServer}. * This annotation is only active when used on a test class, and only for this test class. */ -@QuarkusTestResource(value = OpenShiftServerTestResource.class, restrictToAnnotatedClass = true) +@WithTestResource(OpenShiftServerTestResource.class) @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface WithOpenShiftTestServer {