Skip to content

Commit

Permalink
Merge pull request #1435 from jedla97/remove-quarkusTestResource
Browse files Browse the repository at this point in the history
Update deprecated `@QuarkusTestResource` to `@WithTestResource`
  • Loading branch information
geoand authored Jul 26, 2024
2 parents af6c820 + 3021d81 commit b5dacc1
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -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 {

}
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions jms-quickstart/src/test/java/org/acme/jms/PriceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Integer, String> temperatureProducer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
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;
import io.restassured.http.ContentType;
import io.restassured.parsing.Parser;

@QuarkusTest
@QuarkusTestResource(MongoDbResource.class)
@WithTestResource(MongoDbResource.class)
class PersonResourceTest {

@BeforeAll
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -12,7 +12,7 @@
import io.restassured.http.ContentType;

@QuarkusTest
@QuarkusTestResource(MongoDbResource.class)
@WithTestResource(MongoDbResource.class)
public class FruitResourceTest {

@ParameterizedTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> fruitIdMap = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -12,7 +12,7 @@
import static org.hamcrest.Matchers.greaterThan;

@QuarkusTest
@QuarkusTestResource(WireMockExtensions.class)
@WithTestResource(WireMockExtensions.class)
public class ExtensionsResourceTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions security-ldap-quickstart/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>999-SNAPSHOT</quarkus.platform.version>
<quarkus.platform.version>3.2.9.Final</quarkus.platform.version>
<surefire-plugin.version>3.1.2</surefire-plugin.version>
</properties>
<dependencyManagement>
Expand All @@ -33,7 +33,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest</artifactId>
<artifactId>quarkus-resteasy-reactive</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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;

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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -10,7 +10,7 @@
import java.util.Set;

@QuarkusTest
@QuarkusTestResource(DnsTestResource.class)
@WithTestResource(DnsTestResource.class)
public class FrontendApiTest {

@Test
Expand Down
4 changes: 2 additions & 2 deletions stork-quickstart/src/test/java/org/acme/FrontendApiIT.java
Original file line number Diff line number Diff line change
@@ -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 {

}
4 changes: 2 additions & 2 deletions stork-quickstart/src/test/java/org/acme/FrontendApiTest.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -10,7 +10,7 @@
import java.util.Set;

@QuarkusTest
@QuarkusTestResource(ConsulTestResource.class)
@WithTestResource(ConsulTestResource.class)
public class FrontendApiTest {

@Test
Expand Down

0 comments on commit b5dacc1

Please sign in to comment.