From 04c422cbbe33eb13cabec97206c1b66f05c0476e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szynkiewicz?= Date: Mon, 23 Aug 2021 09:38:47 +0200 Subject: [PATCH] RestEasy Reactive: don't bail out from scanning on no @Path annotations fixes #19556 --- .../client/reactive/NoPathInTheAppTest.java | 49 +++++++++++++++++++ .../rest/client/reactive/PlaylistService.java | 9 ++++ .../scanning/ResteasyReactiveScanner.java | 5 -- 3 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/NoPathInTheAppTest.java create mode 100644 extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/PlaylistService.java diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/NoPathInTheAppTest.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/NoPathInTheAppTest.java new file mode 100644 index 00000000000000..0c215651754db3 --- /dev/null +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/NoPathInTheAppTest.java @@ -0,0 +1,49 @@ +package io.quarkus.rest.client.reactive; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static org.assertj.core.api.Assertions.assertThat; + +import java.net.URI; + +import org.eclipse.microprofile.rest.client.RestClientBuilder; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.client.WireMock; + +import io.quarkus.test.QuarkusUnitTest; + +public class NoPathInTheAppTest { + + @RegisterExtension + static final QuarkusUnitTest TEST = new QuarkusUnitTest() + .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) + .addClasses(PlaylistService.class)); + + private WireMockServer server; + + @BeforeEach + public void setUp() { + server = new WireMockServer(8181); + server.stubFor(WireMock.get("/hello") + .willReturn(aResponse().withBody("hello, world!").withStatus(200))); + server.start(); + } + + @AfterEach + public void shutdown() { + server.shutdown(); + } + + @Test + void shouldGet() { + PlaylistService client = RestClientBuilder.newBuilder().baseUri(URI.create("http://localhost:8181/hello")) + .build(PlaylistService.class); + assertThat(client.get()).isEqualTo("hello, world!"); + } +} diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/PlaylistService.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/PlaylistService.java new file mode 100644 index 00000000000000..6ecc3182f33c92 --- /dev/null +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/PlaylistService.java @@ -0,0 +1,9 @@ +package io.quarkus.rest.client.reactive; + +import javax.ws.rs.GET; + +public interface PlaylistService { + + @GET + String get(); +} diff --git a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ResteasyReactiveScanner.java b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ResteasyReactiveScanner.java index f0e750a9626702..a2a9020bc68bb8 100644 --- a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ResteasyReactiveScanner.java +++ b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ResteasyReactiveScanner.java @@ -122,11 +122,6 @@ public static ResourceScanningResult scanResources( Collection allPaths = new ArrayList<>(paths); - if (allPaths.isEmpty()) { - // no detected @Path, bail out - return null; - } - Map scannedResources = new HashMap<>(); Map scannedResourcePaths = new HashMap<>(); Map possibleSubResources = new HashMap<>();