forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- resolves quarkusio#3919
- Loading branch information
Showing
5 changed files
with
168 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...ons/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/subresource/MyService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.quarkus.resteasy.test.subresource; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
@ApplicationScoped | ||
public class MyService { | ||
|
||
public String ping() { | ||
return "pong"; | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
.../resteasy/deployment/src/test/java/io/quarkus/resteasy/test/subresource/PingResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.quarkus.resteasy.test.subresource; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
|
||
public class PingResource { | ||
|
||
@Inject | ||
MyService service; | ||
|
||
@GET | ||
public String ping() { | ||
return service.ping(); | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
...resteasy/deployment/src/test/java/io/quarkus/resteasy/test/subresource/PingsResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.quarkus.resteasy.test.subresource; | ||
|
||
import javax.ws.rs.Path; | ||
import javax.ws.rs.container.ResourceContext; | ||
import javax.ws.rs.core.Context; | ||
|
||
@Path("pings") | ||
public class PingsResource { | ||
|
||
@Context | ||
ResourceContext resourceContext; | ||
|
||
@Path("do") | ||
public PingResource findPing() { | ||
return resourceContext.getResource(PingResource.class); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...deployment/src/test/java/io/quarkus/resteasy/test/subresource/SubresourceLocatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.quarkus.resteasy.test.subresource; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
|
||
public class SubresourceLocatorTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest runner = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(PingResource.class, PingsResource.class, MyService.class)); | ||
|
||
@Test | ||
public void testSubresourceLocator() { | ||
RestAssured.when().get("/pings/do").then().body(Matchers.is("pong")); | ||
} | ||
|
||
} |