Skip to content

Commit

Permalink
RestEasy Reactive: don't bail out from scanning on no @path annotations
Browse files Browse the repository at this point in the history
fixes #19556
  • Loading branch information
michalszynkiewicz committed Aug 23, 2021
1 parent 768e1cb commit 04c422c
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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!");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.quarkus.rest.client.reactive;

import javax.ws.rs.GET;

public interface PlaylistService {

@GET
String get();
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ public static ResourceScanningResult scanResources(

Collection<AnnotationInstance> allPaths = new ArrayList<>(paths);

if (allPaths.isEmpty()) {
// no detected @Path, bail out
return null;
}

Map<DotName, ClassInfo> scannedResources = new HashMap<>();
Map<DotName, String> scannedResourcePaths = new HashMap<>();
Map<DotName, ClassInfo> possibleSubResources = new HashMap<>();
Expand Down

0 comments on commit 04c422c

Please sign in to comment.