From 3021d81bb572a67b588cdd5dda07126a1a5781ef Mon Sep 17 00:00:00 2001 From: Jakub Jedlicka Date: Thu, 25 Jul 2024 13:42:45 +0200 Subject: [PATCH] Update deprecated `@QuarkusTestResource` to `@WithTestResource` --- .../src/test/java/org/acme/context/prices/PriceIT.java | 4 ++-- .../src/test/java/org/acme/context/prices/PriceTest.java | 4 ++-- jms-quickstart/src/test/java/org/acme/jms/PriceTest.java | 4 ++-- .../src/test/java/org/acme/panache/PriceResourceTest.java | 1 - .../src/test/java/org/acme/panache/PriceResourceTest.java | 1 - .../acme/kafka/streams/aggregator/streams/AggregatorIT.java | 2 +- .../acme/kafka/streams/aggregator/streams/AggregatorTest.java | 4 ++-- .../java/org/acme/mongodb/panache/PersonResourceTest.java | 4 ++-- .../src/test/java/org/acme/mongodb/FruitResourceTest.java | 4 ++-- .../src/test/java/org/acme/neo4j/FruitsEndpointTest.java | 4 ++-- .../src/test/java/org/acme/optaplanner/TestResources.java | 4 ++-- .../java/org/acme/rest/client/ExtensionsResourceTest.java | 4 ++-- .../java/org/acme/rest/client/ExtensionsResourceTest.java | 4 ++-- security-ldap-quickstart/pom.xml | 4 ++-- .../org/acme/security/oauth2/TokenSecuredResourceTest.java | 4 ++-- .../src/test/java/org/acme/FrontendApiIT.java | 4 ++-- .../src/test/java/org/acme/FrontendApiTest.java | 4 ++-- stork-quickstart/src/test/java/org/acme/FrontendApiIT.java | 4 ++-- stork-quickstart/src/test/java/org/acme/FrontendApiTest.java | 4 ++-- 19 files changed, 33 insertions(+), 35 deletions(-) diff --git a/context-propagation-quickstart/src/test/java/org/acme/context/prices/PriceIT.java b/context-propagation-quickstart/src/test/java/org/acme/context/prices/PriceIT.java index 6747c24716..59982170b0 100644 --- a/context-propagation-quickstart/src/test/java/org/acme/context/prices/PriceIT.java +++ b/context-propagation-quickstart/src/test/java/org/acme/context/prices/PriceIT.java @@ -1,10 +1,10 @@ package org.acme.context.prices; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusIntegrationTest; @QuarkusIntegrationTest -@QuarkusTestResource(KafkaResource.class) +@WithTestResource(KafkaResource.class) public class PriceIT extends PriceTest { } diff --git a/context-propagation-quickstart/src/test/java/org/acme/context/prices/PriceTest.java b/context-propagation-quickstart/src/test/java/org/acme/context/prices/PriceTest.java index 564b54df88..c9acabf5fc 100644 --- a/context-propagation-quickstart/src/test/java/org/acme/context/prices/PriceTest.java +++ b/context-propagation-quickstart/src/test/java/org/acme/context/prices/PriceTest.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.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.common.mapper.TypeRef; @QuarkusTest -@QuarkusTestResource(KafkaResource.class) +@WithTestResource(KafkaResource.class) public class PriceTest { private static final String PRICES_SSE_ENDPOINT = "http://localhost:8081/prices"; diff --git a/jms-quickstart/src/test/java/org/acme/jms/PriceTest.java b/jms-quickstart/src/test/java/org/acme/jms/PriceTest.java index c9c5206ce1..fee187d196 100644 --- a/jms-quickstart/src/test/java/org/acme/jms/PriceTest.java +++ b/jms-quickstart/src/test/java/org/acme/jms/PriceTest.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; import io.restassured.RestAssured; import java.time.Duration; @QuarkusTest -@QuarkusTestResource(ArtemisTestResource.class) +@WithTestResource(ArtemisTestResource.class) public class PriceTest { @Test diff --git a/kafka-panache-quickstart/src/test/java/org/acme/panache/PriceResourceTest.java b/kafka-panache-quickstart/src/test/java/org/acme/panache/PriceResourceTest.java index ad976ee759..d09fc7b5fc 100644 --- a/kafka-panache-quickstart/src/test/java/org/acme/panache/PriceResourceTest.java +++ b/kafka-panache-quickstart/src/test/java/org/acme/panache/PriceResourceTest.java @@ -1,6 +1,5 @@ package org.acme.panache; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; import org.junit.jupiter.api.Test; diff --git a/kafka-panache-reactive-quickstart/src/test/java/org/acme/panache/PriceResourceTest.java b/kafka-panache-reactive-quickstart/src/test/java/org/acme/panache/PriceResourceTest.java index ad976ee759..d09fc7b5fc 100644 --- a/kafka-panache-reactive-quickstart/src/test/java/org/acme/panache/PriceResourceTest.java +++ b/kafka-panache-reactive-quickstart/src/test/java/org/acme/panache/PriceResourceTest.java @@ -1,6 +1,5 @@ package org.acme.panache; -import io.quarkus.test.common.QuarkusTestResource; import io.quarkus.test.junit.QuarkusTest; import org.junit.jupiter.api.Test; diff --git a/kafka-streams-quickstart/aggregator/src/test/java/org/acme/kafka/streams/aggregator/streams/AggregatorIT.java b/kafka-streams-quickstart/aggregator/src/test/java/org/acme/kafka/streams/aggregator/streams/AggregatorIT.java index eff617cb8e..6c0116a210 100644 --- a/kafka-streams-quickstart/aggregator/src/test/java/org/acme/kafka/streams/aggregator/streams/AggregatorIT.java +++ b/kafka-streams-quickstart/aggregator/src/test/java/org/acme/kafka/streams/aggregator/streams/AggregatorIT.java @@ -4,7 +4,7 @@ /** * Native tests execute with prod profile, not test. cf https://github.com/quarkusio/quarkus/issues/4371 - * Since we extend the Hotspot tests and share the QuarkusTestResource, + * Since we extend the Hotspot tests and share the WithTestResource, * this means broker test port MUST be the same as production port. */ @QuarkusIntegrationTest diff --git a/kafka-streams-quickstart/aggregator/src/test/java/org/acme/kafka/streams/aggregator/streams/AggregatorTest.java b/kafka-streams-quickstart/aggregator/src/test/java/org/acme/kafka/streams/aggregator/streams/AggregatorTest.java index 063066f9cd..25d4d34520 100644 --- a/kafka-streams-quickstart/aggregator/src/test/java/org/acme/kafka/streams/aggregator/streams/AggregatorTest.java +++ b/kafka-streams-quickstart/aggregator/src/test/java/org/acme/kafka/streams/aggregator/streams/AggregatorTest.java @@ -33,14 +33,14 @@ 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; /** * Integration testing of the application with an embedded broker. */ @QuarkusTest -@QuarkusTestResource(KafkaResource.class) +@WithTestResource(KafkaResource.class) public class AggregatorTest { KafkaProducer temperatureProducer; diff --git a/mongodb-panache-quickstart/src/test/java/org/acme/mongodb/panache/PersonResourceTest.java b/mongodb-panache-quickstart/src/test/java/org/acme/mongodb/panache/PersonResourceTest.java index c8d63f806b..032dfc8e0c 100644 --- a/mongodb-panache-quickstart/src/test/java/org/acme/mongodb/panache/PersonResourceTest.java +++ b/mongodb-panache-quickstart/src/test/java/org/acme/mongodb/panache/PersonResourceTest.java @@ -15,7 +15,7 @@ import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -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; @@ -23,7 +23,7 @@ import io.restassured.parsing.Parser; @QuarkusTest -@QuarkusTestResource(MongoDbResource.class) +@WithTestResource(MongoDbResource.class) class PersonResourceTest { @BeforeAll diff --git a/mongodb-quickstart/src/test/java/org/acme/mongodb/FruitResourceTest.java b/mongodb-quickstart/src/test/java/org/acme/mongodb/FruitResourceTest.java index c32f7b918f..2500a78bfe 100644 --- a/mongodb-quickstart/src/test/java/org/acme/mongodb/FruitResourceTest.java +++ b/mongodb-quickstart/src/test/java/org/acme/mongodb/FruitResourceTest.java @@ -1,6 +1,6 @@ package org.acme.mongodb; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import org.apache.http.HttpStatus; import org.assertj.core.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; @@ -12,7 +12,7 @@ import io.restassured.http.ContentType; @QuarkusTest -@QuarkusTestResource(MongoDbResource.class) +@WithTestResource(MongoDbResource.class) public class FruitResourceTest { @ParameterizedTest diff --git a/neo4j-quickstart/src/test/java/org/acme/neo4j/FruitsEndpointTest.java b/neo4j-quickstart/src/test/java/org/acme/neo4j/FruitsEndpointTest.java index 87456c06fc..366b26f4f0 100644 --- a/neo4j-quickstart/src/test/java/org/acme/neo4j/FruitsEndpointTest.java +++ b/neo4j-quickstart/src/test/java/org/acme/neo4j/FruitsEndpointTest.java @@ -14,11 +14,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(Neo4jResource.class) +@WithTestResource(Neo4jResource.class) class FruitsEndpointTest { private static final Map fruitIdMap = new HashMap<>(); diff --git a/optaplanner-quickstart/src/test/java/org/acme/optaplanner/TestResources.java b/optaplanner-quickstart/src/test/java/org/acme/optaplanner/TestResources.java index 7cd28aa78e..5ad726bbe2 100644 --- a/optaplanner-quickstart/src/test/java/org/acme/optaplanner/TestResources.java +++ b/optaplanner-quickstart/src/test/java/org/acme/optaplanner/TestResources.java @@ -1,9 +1,9 @@ package org.acme.optaplanner; -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/rest-client-quickstart/src/test/java/org/acme/rest/client/ExtensionsResourceTest.java b/rest-client-quickstart/src/test/java/org/acme/rest/client/ExtensionsResourceTest.java index 385b8caee0..e1be248d90 100644 --- a/rest-client-quickstart/src/test/java/org/acme/rest/client/ExtensionsResourceTest.java +++ b/rest-client-quickstart/src/test/java/org/acme/rest/client/ExtensionsResourceTest.java @@ -1,6 +1,6 @@ package org.acme.rest.client; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import org.acme.rest.client.resources.WireMockExtensions; @@ -12,7 +12,7 @@ import static org.hamcrest.Matchers.greaterThan; @QuarkusTest -@QuarkusTestResource(WireMockExtensions.class) +@WithTestResource(WireMockExtensions.class) public class ExtensionsResourceTest { @Test diff --git a/resteasy-client-quickstart/src/test/java/org/acme/rest/client/ExtensionsResourceTest.java b/resteasy-client-quickstart/src/test/java/org/acme/rest/client/ExtensionsResourceTest.java index b376c2ede6..f3951db6c5 100644 --- a/resteasy-client-quickstart/src/test/java/org/acme/rest/client/ExtensionsResourceTest.java +++ b/resteasy-client-quickstart/src/test/java/org/acme/rest/client/ExtensionsResourceTest.java @@ -8,11 +8,11 @@ import org.acme.rest.client.resources.WireMockExtensions; 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(WireMockExtensions.class) +@WithTestResource(WireMockExtensions.class) public class ExtensionsResourceTest { @Test diff --git a/security-ldap-quickstart/pom.xml b/security-ldap-quickstart/pom.xml index 0c46e01d4d..2cebf69a8b 100644 --- a/security-ldap-quickstart/pom.xml +++ b/security-ldap-quickstart/pom.xml @@ -12,7 +12,7 @@ UTF-8 quarkus-bom io.quarkus - 999-SNAPSHOT + 3.2.9.Final 3.1.2 @@ -33,7 +33,7 @@ io.quarkus - quarkus-rest + quarkus-resteasy-reactive io.quarkus diff --git a/security-oauth2-quickstart/src/test/java/org/acme/security/oauth2/TokenSecuredResourceTest.java b/security-oauth2-quickstart/src/test/java/org/acme/security/oauth2/TokenSecuredResourceTest.java index 6d2b3bfc51..b160fc8440 100644 --- a/security-oauth2-quickstart/src/test/java/org/acme/security/oauth2/TokenSecuredResourceTest.java +++ b/security-oauth2-quickstart/src/test/java/org/acme/security/oauth2/TokenSecuredResourceTest.java @@ -1,6 +1,6 @@ package org.acme.security.oauth2; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import org.junit.jupiter.api.Test; @@ -8,7 +8,7 @@ import static org.hamcrest.Matchers.containsString; @QuarkusTest -@QuarkusTestResource(MockAuthorizationServerTestResource.class) +@WithTestResource(MockAuthorizationServerTestResource.class) 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"; diff --git a/stork-dns-quickstart/src/test/java/org/acme/FrontendApiIT.java b/stork-dns-quickstart/src/test/java/org/acme/FrontendApiIT.java index 1e254fd45e..fc9422a7dc 100644 --- a/stork-dns-quickstart/src/test/java/org/acme/FrontendApiIT.java +++ b/stork-dns-quickstart/src/test/java/org/acme/FrontendApiIT.java @@ -1,10 +1,10 @@ package org.acme; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusIntegrationTest; @QuarkusIntegrationTest -@QuarkusTestResource(DnsTestResource.class) +@WithTestResource(DnsTestResource.class) public class FrontendApiIT extends FrontendApiTest { } diff --git a/stork-dns-quickstart/src/test/java/org/acme/FrontendApiTest.java b/stork-dns-quickstart/src/test/java/org/acme/FrontendApiTest.java index e2f7bd6af2..4663811cad 100644 --- a/stork-dns-quickstart/src/test/java/org/acme/FrontendApiTest.java +++ b/stork-dns-quickstart/src/test/java/org/acme/FrontendApiTest.java @@ -1,6 +1,6 @@ package org.acme; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import org.junit.jupiter.api.Assertions; @@ -10,7 +10,7 @@ import java.util.Set; @QuarkusTest -@QuarkusTestResource(DnsTestResource.class) +@WithTestResource(DnsTestResource.class) public class FrontendApiTest { @Test diff --git a/stork-quickstart/src/test/java/org/acme/FrontendApiIT.java b/stork-quickstart/src/test/java/org/acme/FrontendApiIT.java index 15cbb5740a..018894ce0c 100644 --- a/stork-quickstart/src/test/java/org/acme/FrontendApiIT.java +++ b/stork-quickstart/src/test/java/org/acme/FrontendApiIT.java @@ -1,10 +1,10 @@ package org.acme; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusIntegrationTest; @QuarkusIntegrationTest -@QuarkusTestResource(ConsulTestResource.class) +@WithTestResource(ConsulTestResource.class) public class FrontendApiIT extends FrontendApiTest { } diff --git a/stork-quickstart/src/test/java/org/acme/FrontendApiTest.java b/stork-quickstart/src/test/java/org/acme/FrontendApiTest.java index c1671d2b3a..302fb2fcfa 100644 --- a/stork-quickstart/src/test/java/org/acme/FrontendApiTest.java +++ b/stork-quickstart/src/test/java/org/acme/FrontendApiTest.java @@ -1,6 +1,6 @@ package org.acme; -import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.common.WithTestResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import org.junit.jupiter.api.Assertions; @@ -10,7 +10,7 @@ import java.util.Set; @QuarkusTest -@QuarkusTestResource(ConsulTestResource.class) +@WithTestResource(ConsulTestResource.class) public class FrontendApiTest { @Test