Skip to content

Commit

Permalink
Update deprecated @QuarkusTestResource to @WithTestResource
Browse files Browse the repository at this point in the history
  • Loading branch information
jedla97 committed Jul 29, 2024
1 parent 52916b8 commit 9fc08b6
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import io.quarkus.qe.core.containers.MongoTestResource;
import io.quarkus.qe.core.containers.PostgreSqlDatabaseTestResource;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;
import io.quarkus.test.junit.QuarkusTest;

@QuarkusTest
@QuarkusTestResource(value = MongoTestResource.class)
@QuarkusTestResource(value = PostgreSqlDatabaseTestResource.class)
@WithTestResource(value = MongoTestResource.class)
@WithTestResource(value = PostgreSqlDatabaseTestResource.class)
public class AlmostAllQuarkusExtensionsTest {

@Test
Expand Down
2 changes: 1 addition & 1 deletion 004-quarkus-HHH-and-HV/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Quarkus - Hibernate and Hibernate Validator (lazy fetch strategy)
This scenario uses in-memory Java database H2.
Test class annotated with `@QuarkusTestResource(H2DatabaseTestResource.class)` starts an in-memory H2 database
Test class annotated with `@WithTestResource(H2DatabaseTestResource.class)` starts an in-memory H2 database

Module that covers integration with some Hibernate features like:
- Reproducer for [14201](https://github.com/quarkusio/quarkus/issues/14201) and [14881](https://github.com/quarkusio/quarkus/issues/14881): possible data loss bug in hibernate. This is covered under the Java package `io.quarkus.qe.hibernate.items`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.quarkus.qe.hibernate.validator;

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 {
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.quarkus.qe.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 {
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
import org.junit.jupiter.api.Test;

import io.quarkus.qe.containers.PostgreSqlDatabaseTestResource;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import io.restassured.specification.RequestSpecification;

import jakarta.ws.rs.core.MediaType;

@QuarkusTest
@QuarkusTestResource(PostgreSqlDatabaseTestResource.class)
@WithTestResource(PostgreSqlDatabaseTestResource.class)
public class PostgreSqlApplicationResourceTest {

private static final String APPLICATION_PATH = "/application";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

import io.quarkus.qe.containers.KeycloakTestResource;
import io.quarkus.qe.model.Score;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;
import io.restassured.RestAssured;
import io.restassured.config.RestAssuredConfig;
import io.restassured.http.ContentType;

@QuarkusTestResource(KeycloakTestResource.class)
@WithTestResource(KeycloakTestResource.class)
public abstract class AbstractPingPongResourceTest {

private static final String PING_ENDPOINT = "/%s-ping";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
import org.junit.jupiter.api.Test;

import io.quarkus.qe.containers.MySqlDatabaseTestResource;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import io.restassured.specification.RequestSpecification;

import jakarta.ws.rs.core.MediaType;

@QuarkusTest
@QuarkusTestResource(MySqlDatabaseTestResource.class)
@WithTestResource(MySqlDatabaseTestResource.class)
public class MySqlApplicationResourceTest {

private static final String APPLICATION_PATH = "/application";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import org.junit.jupiter.api.Test;

import io.quarkus.qe.containers.MySqlDatabaseTestResource;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;
import io.quarkus.test.junit.QuarkusTest;

@QuarkusTest
@QuarkusTestResource(MySqlDatabaseTestResource.class)
@WithTestResource(MySqlDatabaseTestResource.class)
class UserResourceTest {

private final static String NEW_USER_ID = "3";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import io.quarkus.qe.quartz.resources.QuartzNodeApplicationResource;
import io.quarkus.qe.quartz.resources.RestApplicationResource;
import io.quarkus.test.QuarkusProdModeTest;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;
import io.quarkus.test.h2.H2DatabaseTestResource;
import io.restassured.RestAssured;

@QuarkusTestResource(H2DatabaseTestResource.class)
@WithTestResource(H2DatabaseTestResource.class)
public class AnnotationScheduledJobsQuartzTest {

private static final int REST_PORT = 8081;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

import io.quarkus.qe.containers.ConsulTestResource;
import io.quarkus.test.QuarkusProdModeTest;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;

@QuarkusTestResource(ConsulTestResource.class)
@WithTestResource(ConsulTestResource.class)
public class GreetingResourceTest {

private static final String APPLICATION_PROPERTIES = "application.properties";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
import io.quarkus.qe.multiplepus.containers.PostgreSqlDatabaseTestResource;
import io.quarkus.qe.multiplepus.model.fruit.Fruit;
import io.quarkus.qe.multiplepus.model.vegetable.Vegetable;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;

@QuarkusTest
@QuarkusTestResource(MariaDbDatabaseTestResource.class)
@QuarkusTestResource(PostgreSqlDatabaseTestResource.class)
@WithTestResource(MariaDbDatabaseTestResource.class)
@WithTestResource(PostgreSqlDatabaseTestResource.class)
class MultiplePersistenceUnitTest {

private static boolean shouldCleanupFruit = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@

import io.quarkus.qe.vertx.webclient.resources.JaegerTestResource;
import io.quarkus.qe.vertx.webclient.resources.WireMockChuckNorrisResource;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;

@QuarkusTest
@QuarkusTestResource(WireMockChuckNorrisResource.class)
@QuarkusTestResource(JaegerTestResource.class)
@WithTestResource(WireMockChuckNorrisResource.class)
@WithTestResource(JaegerTestResource.class)
public class ChuckNorrisResourceTest {
private final static String jaegerEndpoint = "http://localhost:16686/api/traces";
static final String EXPECTED_ID = "aBanNLDwR-SAz7iMHuCiyw";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import io.quarkus.qe.kafka.resources.ConfluentTestProfile;
import io.quarkus.qe.kafka.resources.JaegerTestResource;
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
@TestProfile(ConfluentTestProfile.class)
@QuarkusTestResource(JaegerTestResource.class)
@WithTestResource(JaegerTestResource.class)
public class ConfluentKafkaTest extends KafkaCommonTest {
private static final String STOCK_MONITOR_SSE_ENDPOINT = "http://localhost:8081/stock/stream";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import io.quarkus.qe.kafka.resources.JaegerTestResource;
import io.quarkus.qe.kafka.resources.StrimziTestProfile;
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
@TestProfile(StrimziTestProfile.class)
@QuarkusTestResource(JaegerTestResource.class)
@WithTestResource(JaegerTestResource.class)
public class StrimziKafkaTest extends KafkaCommonTest {

private static final String STOCK_MONITOR_SSE_ENDPOINT = "http://localhost:8081/stock/stream";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import org.junit.jupiter.api.Test;

import io.quarkus.qe.vertx.resources.RedisResource;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;

@QuarkusTest
@QuarkusTestResource(RedisResource.class)
@WithTestResource(RedisResource.class)
public class BladeRunnerHandlerTest extends AbstractCommonTest {
@Test
@DisplayName("Retrieve bladeRunner by id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import org.junit.jupiter.api.Test;

import io.quarkus.qe.vertx.resources.RedisResource;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;
import io.quarkus.test.junit.QuarkusTest;

@QuarkusTest
@QuarkusTestResource(RedisResource.class)
@WithTestResource(RedisResource.class)
public class NoSecuredResourceTest {
@Test
@DisplayName("no-secured resource. ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import org.junit.jupiter.api.Test;

import io.quarkus.qe.vertx.resources.RedisResource;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;

@QuarkusTest
@QuarkusTestResource(RedisResource.class)
@WithTestResource(RedisResource.class)
public class ReplicantHandlerTest extends AbstractCommonTest {
@Test
@DisplayName("Retrieve replicant by id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import org.junit.jupiter.api.Test;

import io.quarkus.qe.vertx.resources.RedisResource;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.WithTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;

@QuarkusTest
@QuarkusTestResource(RedisResource.class)
@WithTestResource(RedisResource.class)
public class SecuredResourceTest extends AbstractCommonTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.quarkus.qe.spring.data;

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 {
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.quarkus.qe.books;

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 {
}

0 comments on commit 9fc08b6

Please sign in to comment.