-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4814 from mkouba/issue-4787
RESTEasy standalone - handle @ApplicationPath value correctly
- Loading branch information
Showing
6 changed files
with
173 additions
and
27 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
51 changes: 51 additions & 0 deletions
51
...y/deployment/src/test/java/io/quarkus/resteasy/test/root/ApplicationPathHttpRootTest.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,51 @@ | ||
package io.quarkus.resteasy.test.root; | ||
|
||
import javax.ws.rs.ApplicationPath; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.Application; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
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; | ||
|
||
/** | ||
* Test a combination of application path and http root path. | ||
*/ | ||
public class ApplicationPathHttpRootTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest runner = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(HelloResource.class, HelloApp.class) | ||
.addAsResource(new StringAsset("quarkus.http.root-path=/foo"), "application.properties")); | ||
|
||
@Test | ||
public void testResources() { | ||
// Note that /foo is added automatically by RestAssuredURLManager | ||
RestAssured.when().get("/hello/world").then().body(Matchers.is("hello world")); | ||
RestAssured.when().get("/world").then().statusCode(404); | ||
} | ||
|
||
@Path("world") | ||
public static class HelloResource { | ||
|
||
@GET | ||
public String hello() { | ||
return "hello world"; | ||
} | ||
|
||
} | ||
|
||
@ApplicationPath("hello") | ||
public static class HelloApp extends Application { | ||
|
||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
.../resteasy/deployment/src/test/java/io/quarkus/resteasy/test/root/ApplicationPathTest.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,45 @@ | ||
package io.quarkus.resteasy.test.root; | ||
|
||
import javax.ws.rs.ApplicationPath; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.Application; | ||
|
||
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 ApplicationPathTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest runner = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(HelloResource.class, HelloApp.class)); | ||
|
||
@Test | ||
public void testResources() { | ||
RestAssured.when().get("/hello/world").then().body(Matchers.is("hello world")); | ||
RestAssured.when().get("/world").then().statusCode(404); | ||
} | ||
|
||
@Path("world") | ||
public static class HelloResource { | ||
|
||
@GET | ||
public String hello() { | ||
return "hello world"; | ||
} | ||
|
||
} | ||
|
||
@ApplicationPath("hello") | ||
public static class HelloApp extends Application { | ||
|
||
} | ||
|
||
} |
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
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
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