Skip to content

Commit

Permalink
Merge pull request quarkus-qe#703 from pjgg/backport_2.7_2
Browse files Browse the repository at this point in the history
[2.7] Bulk - Backport 2.7 - part 2
  • Loading branch information
michalvavrik authored Jun 10, 2022
2 parents 099c4dd + 8332e8c commit 9f34cfc
Show file tree
Hide file tree
Showing 48 changed files with 249 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import io.quarkus.test.scenarios.QuarkusScenario;

@QuarkusScenario
public class ServiceWithCacheResourceIT {
public class CaffeineCacheIT {

private static final String SERVICE_APPLICATION_SCOPE_PATH = "/services/" + APPLICATION_SCOPE_SERVICE_PATH;
private static final String SERVICE_REQUEST_SCOPE_PATH = "/services/" + REQUEST_SCOPE_SERVICE_PATH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import io.quarkus.test.scenarios.OpenShiftScenario;

@OpenShiftScenario
public class OpenShiftServiceWithCacheResourceIT extends ServiceWithCacheResourceIT {
public class OpenShiftCaffeineCacheIT extends CaffeineCacheIT {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import io.quarkus.test.scenarios.OpenShiftScenario;

@OpenShiftScenario
public class OpenShiftServiceWithCacheResourceIT extends ServiceWithCacheResourceIT {
public class OpenShiftSpringCacheIT extends SpringCacheIT {
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import io.quarkus.test.scenarios.QuarkusScenario;

@QuarkusScenario
public class ServiceWithCacheResourceIT {
public class SpringCacheIT {

private static final String SERVICE_APPLICATION_SCOPE_PATH = "/services/" + APPLICATION_SCOPE_SERVICE_PATH;
private static final String SERVICE_REQUEST_SCOPE_PATH = "/services/" + REQUEST_SCOPE_SERVICE_PATH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void verifyTelemetry() {
await().atMost(1, TimeUnit.MINUTES).pollInterval(Duration.ofSeconds(10)).untilAsserted(() -> {
String operation = "graphql";
Response traces = given().when()
.queryParam("operationName", operation)
.queryParam("operation", operation)
.queryParam("lookback", "1h")
.queryParam("limit", 10)
.queryParam("service", "graphql-telemetry")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import io.quarkus.test.scenarios.QuarkusScenario;

@QuarkusScenario
public class HttpCustomHeadersIT {
public class HttpCustomHeadersReactiveIT {

@Tag("QUARKUS-1574")
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import io.quarkus.test.scenarios.OpenShiftScenario;

@OpenShiftScenario
public class OpenShiftMultipartResourceIT extends MultipartResourceIT {
public class OpenShiftRESTEasyReactiveMultipartIT extends RESTEasyReactiveMultipartIT {
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

@Tag("QUARKUS-1075")
@QuarkusScenario
public class AsciiMultipartResourceIT {
public class RESTEasyReactiveMultipartCharsetIT {

public static final String TEXT_WITH_DIACRITICS = "Přikrášlený žloťoučký kůň úpěl ďábelské ódy.";
private static final String EXPECTED_ASCII_TEXT = new String(TEXT_WITH_DIACRITICS.getBytes(StandardCharsets.UTF_8),
Expand All @@ -27,7 +27,7 @@ public class AsciiMultipartResourceIT {
static RestService app = new RestService().withProperties("us-asscii.properties");

@Test
public void testMultipartText() {
public void textInMultipartRequestEncodedWithDefaultCharset() {
MultiPartSpecification multiPartSpecification = new MultiPartSpecBuilder(TEXT_WITH_DIACRITICS)
.controlName("text")
.header("Content-Type", "text/plain")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@Tag("QUARKUS-1075")
@QuarkusScenario
public class MultipartResourceIT {
public class RESTEasyReactiveMultipartIT {

private static final String IMAGE_FILE_NAME = "/quarkus.png";
private static final String TEXT_WITH_DIACRITICS = "Přikrášlený žloťoučký kůň úpěl ďábelské ódy.";
Expand All @@ -35,8 +35,8 @@ public class MultipartResourceIT {

@BeforeAll
public static void beforeAll() throws IOException {
imageFile = new File(MultipartResourceIT.class.getResource(IMAGE_FILE_NAME).getFile());
imageBytes = IOUtils.toByteArray(MultipartResourceIT.class.getResourceAsStream(IMAGE_FILE_NAME));
imageFile = new File(RESTEasyReactiveMultipartIT.class.getResource(IMAGE_FILE_NAME).getFile());
imageBytes = IOUtils.toByteArray(RESTEasyReactiveMultipartIT.class.getResourceAsStream(IMAGE_FILE_NAME));
new Random().nextBytes(randomBytes);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import io.quarkus.test.scenarios.OpenShiftScenario;

@OpenShiftScenario
public class OpenShiftMultipartResourceIT extends MultipartResourceIT {
public class OpenShiftRESTEasyMultipartIT extends RESTEasyMultipartIT {
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.restassured.specification.MultiPartSpecification;

@QuarkusScenario
public class AsciiMultipartResourceIT {
public class RESTEasyMultipartCharsetIT {

public static final String TEXT_WITH_DIACRITICS = "Přikrášlený žloťoučký kůň úpěl ďábelské ódy.";
private static final String EXPECTED_ASCII_TEXT = new String(TEXT_WITH_DIACRITICS.getBytes(StandardCharsets.UTF_8),
Expand All @@ -25,7 +25,7 @@ public class AsciiMultipartResourceIT {
static RestService app = new RestService().withProperties("us-asscii.properties");

@Test
public void testMultipartText() {
public void textInMultipartRequestEncodedWithDefaultCharset() {
MultiPartSpecification multiPartSpecification = new MultiPartSpecBuilder(TEXT_WITH_DIACRITICS)
.controlName("text")
.header("Content-Type", "text/plain")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import io.restassured.specification.MultiPartSpecification;

@QuarkusScenario
public class MultipartResourceIT {
public class RESTEasyMultipartIT {

private static final String IMAGE_FILE_NAME = "/quarkus.png";
private static final String TEXT_WITH_DIACRITICS = "Přikrášlený žloťoučký kůň úpěl ďábelské ódy.";
Expand All @@ -33,8 +33,8 @@ public class MultipartResourceIT {

@BeforeAll
public static void beforeAll() throws IOException {
imageFile = new File(MultipartResourceIT.class.getResource(IMAGE_FILE_NAME).getFile());
imageBytes = IOUtils.toByteArray(MultipartResourceIT.class.getResourceAsStream(IMAGE_FILE_NAME));
imageFile = new File(RESTEasyMultipartIT.class.getResource(IMAGE_FILE_NAME).getFile());
imageBytes = IOUtils.toByteArray(RESTEasyMultipartIT.class.getResourceAsStream(IMAGE_FILE_NAME));
new Random().nextBytes(randomBytes);
}

Expand Down
4 changes: 4 additions & 0 deletions http/rest-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-jsonb</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-micrometer</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,43 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.QuarkusScenario;
import io.quarkus.test.services.QuarkusApplication;

@QuarkusScenario
public class ClientBookResourceIT {

@QuarkusApplication
static RestService app = new RestService();

@QuarkusApplication
static RestService appWithMicrometerDisabled = new RestService().withProperty("quarkus.micrometer.enabled", "false");

@Test
public void shouldGetBookFromRestClientXml() {
given().get("/client/book/xml").then().statusCode(HttpStatus.SC_OK)
app.given().get("/client/book/xml").then().statusCode(HttpStatus.SC_OK)
.body(is(
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><book><title>Title in Xml</title></book>"));
}

@Test
public void shouldGetBookFromRestClientJson() {
given().get("/client/book/json").then().statusCode(HttpStatus.SC_OK)
app.given().get("/client/book/json").then().statusCode(HttpStatus.SC_OK)
.body(is("{\"title\":\"Title in Json\"}"));
}

@Test
@Tag("QUARKUS-1376")
public void notFoundShouldNotReturnAnyResteasyImplementationDetails() {
String body = given().get("/notFound").then().statusCode(HttpStatus.SC_NOT_FOUND).extract().body().asString();
String body = app.given().get("/notFound").then().statusCode(HttpStatus.SC_NOT_FOUND).extract().body().asString();
Assertions.assertFalse(body.contains("RESTEASY"),
"Not found resource should not return any Resteasy implementation details, but was: " + body);
}

@Test
@Tag("QUARKUS-2127")
public void noNullPointerExceptionForRestClientUsageWithDisabledMicrometer() {
appWithMicrometerDisabled.given().get("/client/book/xml").then().statusCode(HttpStatus.SC_OK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import io.vertx.mutiny.ext.web.client.HttpRequest;
import io.vertx.mutiny.ext.web.client.HttpResponse;

public abstract class AbstractMongoDbIT {
public abstract class AbstractMongoClientReactiveIT {
@ParameterizedTest
@ValueSource(strings = { "/reactive_fruits" })
public void fruitsEndpoints(String path) {
public void insertAndGetSimpleEntity(String path) {
final Fruit fruit1 = new Fruit("fruit1", "fruit description 1");
final Fruit fruit2 = new Fruit("fruit2", "fruit description 2");

Expand All @@ -40,7 +40,7 @@ public void fruitsEndpoints(String path) {

@ParameterizedTest
@ValueSource(strings = { "/reactive_fruit_baskets" })
public void fruitBasketsEndpoints(String path) {
public void insertAndGetCompositeEntity(String path) {
final Fruit fruit1 = new Fruit("fruit1", "fruit description 1");
final Fruit fruit2 = new Fruit("fruit2", "fruit description 2");
final FruitBasket fruitBasket1 = new FruitBasket("null", null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io.quarkus.test.services.QuarkusApplication;

@QuarkusScenario
public class MongoDbIT extends AbstractMongoDbIT {
public class MongoClientReactiveIT extends AbstractMongoClientReactiveIT {

@Container(image = "${mongodb.image}", port = 27017, expectedLog = "Waiting for connections")
static MongoDbService database = new MongoDbService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io.quarkus.test.services.QuarkusApplication;

@OpenShiftScenario
public class OpenShiftMongoDbIT extends AbstractMongoDbIT {
public class OpenShiftMongoClientReactiveIT extends AbstractMongoClientReactiveIT {

@Container(image = "${mongodb.image}", port = 27017, expectedLog = "Waiting for connections")
static MongoDbService database = new MongoDbService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import java.util.List;

import org.apache.http.HttpStatus;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.junit.jupiter.api.Test;

import io.quarkus.test.bootstrap.MongoDbService;
import io.quarkus.test.bootstrap.RestService;
Expand All @@ -18,7 +17,7 @@
import io.restassured.path.json.JsonPath;

@QuarkusScenario
public class MongoDbIT {
public class MongoClientIT {

@Container(image = "${mongodb.image}", port = 27017, expectedLog = "Waiting for connections")
static MongoDbService database = new MongoDbService();
Expand All @@ -27,9 +26,17 @@ public class MongoDbIT {
static RestService app = new RestService()
.withProperty("quarkus.mongodb.connection-string", database::getJdbcUrl);

@ParameterizedTest
@ValueSource(strings = { "/fruits", "/codec_fruits" })
public void fruitsEndpoints(String path) {
@Test
public void insertAndGetSimpleEntity() {
insertAndGetSimpleEntity("/fruits");
}

@Test
public void insertAndGetSimpleEntityWithBsonCodec() {
insertAndGetSimpleEntity("/codec_fruits");
}

public void insertAndGetSimpleEntity(String path) {
final Fruit fruit1 = new Fruit("fruit1", "fruit description 1");
final Fruit fruit2 = new Fruit("fruit2", "fruit description 2");

Expand All @@ -49,9 +56,17 @@ public void fruitsEndpoints(String path) {
assertThat(fruits2).isEqualTo(fruits1);
}

@ParameterizedTest
@ValueSource(strings = { "/fruit_baskets", "/codec_fruit_baskets" })
public void fruitBasketsEndpoints(String path) {
@Test
public void insertAndGetCompositeEntity() {
insertAndGetCompositeEntity("/fruit_baskets");
}

@Test
public void insertAndGetCompositeEntityWithBsonCodec() {
insertAndGetCompositeEntity("/codec_fruit_baskets");
}

public void insertAndGetCompositeEntity(String path) {
final Fruit fruit1 = new Fruit("fruit1", "fruit description 1");
final Fruit fruit2 = new Fruit("fruit2", "fruit description 2");
final FruitBasket fruitBasket1 = new FruitBasket("null", null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import io.quarkus.test.scenarios.OpenShiftScenario;

@OpenShiftScenario
public class OpenShiftMongoDbIT extends MongoDbIT {
public class OpenShiftMongoClientIT extends MongoClientIT {
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import io.vertx.mutiny.ext.web.client.HttpRequest;
import io.vertx.mutiny.ext.web.client.HttpResponse;

public abstract class BaseAuthzSecurityIT {
public abstract class BaseAuthzSecurityReactiveIT {

static final String NORMAL_USER = "test-normal-user";
static final String ADMIN_USER = "test-admin-user";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io.quarkus.test.services.QuarkusApplication;

@QuarkusScenario
public class KeycloakAuthzSecurityIT extends BaseAuthzSecurityIT {
public class KeycloakAuthzSecurityReactiveIT extends BaseAuthzSecurityReactiveIT {

static final int KEYCLOAK_PORT = 8080;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@OpenShiftScenario
@EnabledIfSystemProperty(named = "ts.redhat.registry.enabled", matches = "true")
public class OpenShiftRhSsoAuthzSecurityIT extends BaseAuthzSecurityIT {
public class OpenShiftRhSsoAuthzSecurityReactiveIT extends BaseAuthzSecurityReactiveIT {

static final int KEYCLOAK_PORT = 8080;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import io.quarkus.test.services.Container;
import io.quarkus.test.services.QuarkusApplication;

public abstract class BaseIT {
public abstract class BaseOidcIT {
static final String USER = "test-user";

static final int KEYCLOAK_PORT = 8080;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.restassured.http.ContentType;

@QuarkusScenario
public class RestClientInPingPongResourcesIT extends BaseIT {
public class OidcRestClientIT extends BaseOidcIT {

static final String PING_ENDPOINT = "/%s-ping";
static final String PONG_ENDPOINT = "/%s-pong";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import io.vertx.core.json.JsonObject;

@QuarkusScenario
public class OpenApiIT extends BaseIT {
public class OpenApiStoreSchemaIT extends BaseOidcIT {

private static String directory = "target/generated/jax-rs/";
private static final String OPEN_API_DOT = "openapi.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import io.quarkus.test.scenarios.OpenShiftScenario;

@OpenShiftScenario
public class OpenShiftRestClientInPingPongResourcesIT extends RestClientInPingPongResourcesIT {
public class OpenShiftOidcRestClientIT extends OidcRestClientIT {
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import io.quarkus.test.scenarios.QuarkusScenario;

@QuarkusScenario
public class SecuredResourceIT extends BaseIT {
public class SecurityClaimsIT extends BaseOidcIT {

private static final String SECURED_PATH = "/secured";
private static final String CLAIMS_FROM_BEANS_PATH = "/getClaimsFromBeans";
Expand Down
Loading

0 comments on commit 9f34cfc

Please sign in to comment.