diff --git a/integration-tests/qute/pom.xml b/integration-tests/qute/pom.xml index 1e6870c1a471f..4f9f70242985f 100644 --- a/integration-tests/qute/pom.xml +++ b/integration-tests/qute/pom.xml @@ -16,7 +16,7 @@ io.quarkus - quarkus-resteasy-qute + quarkus-rest-qute io.quarkus @@ -51,7 +51,7 @@ io.quarkus - quarkus-resteasy-qute-deployment + quarkus-rest-qute-deployment ${project.version} pom test diff --git a/integration-tests/qute/src/test/java/io/quarkus/it/qute/HiResource.java b/integration-tests/qute/src/test/java/io/quarkus/it/qute/HiResource.java new file mode 100644 index 0000000000000..e07090553c995 --- /dev/null +++ b/integration-tests/qute/src/test/java/io/quarkus/it/qute/HiResource.java @@ -0,0 +1,25 @@ +package io.quarkus.it.qute; + +import jakarta.inject.Inject; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; + +import io.quarkus.qute.Template; +import io.quarkus.qute.TemplateInstance; + +@Path("/hi") +public class HiResource { + + @Inject + Template hi; + + @GET + @Produces(MediaType.TEXT_PLAIN) + public TemplateInstance get(@QueryParam("name") String name) { + return hi.data("name", name); + } + +} diff --git a/integration-tests/qute/src/test/java/io/quarkus/it/qute/QuteTestCase.java b/integration-tests/qute/src/test/java/io/quarkus/it/qute/QuteTestCase.java index 7044d12b806c8..4f43b07e835c1 100644 --- a/integration-tests/qute/src/test/java/io/quarkus/it/qute/QuteTestCase.java +++ b/integration-tests/qute/src/test/java/io/quarkus/it/qute/QuteTestCase.java @@ -2,10 +2,12 @@ import static jakarta.ws.rs.core.Response.Status.NOT_FOUND; import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import org.junit.jupiter.api.Test; +import io.quarkus.test.junit.DisabledOnIntegrationTest; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.http.ContentType; @@ -33,4 +35,12 @@ public void testNotFoundPageStatusCode() { .body(containsString("Not Found!")) .statusCode(NOT_FOUND.getStatusCode()); } + + // Keep in mind that src/test/java is not part of the native image + @DisabledOnIntegrationTest + @Test + public void testTemplateLocatedInTestSource() { + RestAssured.when().get("/hi?name=Ciri").then().body(equalTo("Hi Ciri!")); + } + } diff --git a/integration-tests/qute/src/test/resources/templates/hi.txt b/integration-tests/qute/src/test/resources/templates/hi.txt new file mode 100644 index 0000000000000..3f988823f5f04 --- /dev/null +++ b/integration-tests/qute/src/test/resources/templates/hi.txt @@ -0,0 +1 @@ +Hi {name}! \ No newline at end of file