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.
Merge pull request quarkusio#5235 from machi1990/fix/5150
feat: list openapi, swaggerui, metrics and health endpoints in not found page
- Loading branch information
Showing
10 changed files
with
121 additions
and
7 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
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
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
39 changes: 39 additions & 0 deletions
39
...us/smallrye/openapi/test/hotreload/DisplayOpenAPiEndpointInNotFoundExceptionPageTest.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,39 @@ | ||
package io.quarkus.smallrye.openapi.test.hotreload; | ||
|
||
import static org.hamcrest.Matchers.containsString; | ||
|
||
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.QuarkusDevModeTest; | ||
import io.restassured.RestAssured; | ||
import io.restassured.http.ContentType; | ||
|
||
public class DisplayOpenAPiEndpointInNotFoundExceptionPageTest { | ||
private static final String OPEN_API_PATH = "/openapi-path"; | ||
private static final String SWAGGER_UI_PATH = "/swagger-path"; | ||
|
||
@RegisterExtension | ||
static final QuarkusDevModeTest test = new QuarkusDevModeTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(MyResource.class) | ||
.addAsResource(new StringAsset( | ||
"quarkus.smallrye-openapi.path=" + OPEN_API_PATH + "\nquarkus.swagger-ui.path=" + SWAGGER_UI_PATH), | ||
"application.properties")); | ||
|
||
@Test | ||
public void shouldDisplayOpenApiAndSwaggerUiEndpointsInNotFoundPage() { | ||
RestAssured | ||
.given() | ||
.accept(ContentType.HTML) | ||
.when() | ||
.get("/open") | ||
.then() | ||
.statusCode(404) | ||
.body(containsString(OPEN_API_PATH)) | ||
.body(containsString(SWAGGER_UI_PATH)); | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
...va/io/quarkus/vertx/http/deployment/devmode/NotFoundPageDisplayableEndpointBuildItem.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,15 @@ | ||
package io.quarkus.vertx.http.deployment.devmode; | ||
|
||
import io.quarkus.builder.item.MultiBuildItem; | ||
|
||
final public class NotFoundPageDisplayableEndpointBuildItem extends MultiBuildItem { | ||
private final String endpoint; | ||
|
||
public NotFoundPageDisplayableEndpointBuildItem(String endpoint) { | ||
this.endpoint = endpoint; | ||
} | ||
|
||
public String getEndpoint() { | ||
return endpoint; | ||
} | ||
} |