diff --git a/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/NativePojoResourceIT.java b/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/NativePojoResourceIT.java new file mode 100644 index 0000000000000..420304372d6fd --- /dev/null +++ b/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/NativePojoResourceIT.java @@ -0,0 +1,8 @@ +package io.quarkus.it.mongodb; + +import io.quarkus.it.mongodb.pojo.PojoResource; +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +public class NativePojoResourceIT extends PojoResource { +} diff --git a/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/NativeVehicleResourceIT.java b/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/NativeVehicleResourceIT.java new file mode 100644 index 0000000000000..4a9b44d14d413 --- /dev/null +++ b/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/NativeVehicleResourceIT.java @@ -0,0 +1,7 @@ +package io.quarkus.it.mongodb; + +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +public class NativeVehicleResourceIT extends VehicleResourceTest { +} diff --git a/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/PojoResourceTest.java b/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/PojoResourceTest.java new file mode 100644 index 0000000000000..7e57a263e5c05 --- /dev/null +++ b/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/PojoResourceTest.java @@ -0,0 +1,32 @@ +package io.quarkus.it.mongodb; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.is; + +import java.util.Optional; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; + +import io.quarkus.it.mongodb.pojo.Pojo; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.mongodb.MongoTestResource; + +@QuarkusTest +@QuarkusTestResource(MongoTestResource.class) +@DisabledOnOs(OS.WINDOWS) +public class PojoResourceTest { + @Test + public void testPojoEndpoint() { + Pojo pojo = new Pojo(); + pojo.description = "description"; + pojo.optionalString = Optional.of("optional"); + given().header("Content-Type", "application/json").body(pojo) + .when().post("/pojos") + .then().statusCode(201); + + given().get("/pojos").then().statusCode(200).body("size()", is(1)); + } +} diff --git a/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/VehicleResourceTest.java b/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/VehicleResourceTest.java new file mode 100644 index 0000000000000..d8aa81592e4f0 --- /dev/null +++ b/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/VehicleResourceTest.java @@ -0,0 +1,39 @@ +package io.quarkus.it.mongodb; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.is; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; + +import io.quarkus.it.mongodb.discriminator.Car; +import io.quarkus.it.mongodb.discriminator.Moto; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.mongodb.MongoTestResource; + +@QuarkusTest +@QuarkusTestResource(MongoTestResource.class) +@DisabledOnOs(OS.WINDOWS) +public class VehicleResourceTest { + @Test + public void testVehicleEndpoint() { + Car car = new Car(); + car.name = "Renault Clio"; + car.type = "CAR"; + car.seatNumber = 5; + given().header("Content-Type", "application/json").body(car) + .when().post("/vehicles") + .then().statusCode(201); + + Moto moto = new Moto(); + moto.name = "Harley Davidson Sportster"; + moto.type = "MOTO"; + given().header("Content-Type", "application/json").body(moto) + .when().post("/vehicles") + .then().statusCode(201); + + given().get("/vehicles").then().statusCode(200).body("size()", is(2)); + } +}