This repository was archived by the owner on Oct 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Add v1 reject frontend #143
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
36 changes: 36 additions & 0 deletions
36
adoptopenjdk-api-v3-frontend/src/main/kotlin/net/adoptopenjdk/api/v3/routes/V1Route.kt
This file contains hidden or 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,36 @@ | ||
| package net.adoptopenjdk.api.v3.routes | ||
|
|
||
| import org.eclipse.microprofile.openapi.annotations.Operation | ||
| import org.eclipse.microprofile.openapi.annotations.media.Schema | ||
| import javax.ws.rs.GET | ||
| import javax.ws.rs.Path | ||
| import javax.ws.rs.Produces | ||
| import javax.ws.rs.core.MediaType | ||
| import javax.ws.rs.core.Response | ||
|
|
||
| @Path("/v1/") | ||
| @Schema(hidden = true) | ||
| @Produces(MediaType.TEXT_PLAIN) | ||
| class V1Route { | ||
|
|
||
| //Cant find a way to match nothing and something in the same request, so need 2 | ||
| @GET | ||
| @Schema(hidden = true) | ||
| @Path("/{ignore: .*}") | ||
| @Operation(hidden = true) | ||
| fun get(): Response = reject() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better names to expose the suckage |
||
|
|
||
| @GET | ||
| @Schema(hidden = true) | ||
| @Path("/") | ||
| @Operation(hidden = true) | ||
| fun getRoot(): Response = reject() | ||
|
|
||
|
|
||
| private fun reject(): Response { | ||
| return Response | ||
| .status(Response.Status.GONE) | ||
| .entity("REMOVED: V1 has now been removed, please see https://api.adoptopenjdk.net for the latest version") | ||
| .build() | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
25 changes: 25 additions & 0 deletions
25
adoptopenjdk-api-v3-frontend/src/test/kotlin/net/adoptopenjdk/api/V1RouteTest.kt
This file contains hidden or 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,25 @@ | ||
| package net.adoptopenjdk.api | ||
|
|
||
| import io.quarkus.test.junit.QuarkusTest | ||
| import io.restassured.RestAssured | ||
| import org.junit.jupiter.api.Test | ||
| import javax.ws.rs.core.Response | ||
|
|
||
| @QuarkusTest | ||
| class V1RouteTest : BaseTest() { | ||
| @Test | ||
| fun v1ReturnsGone() { | ||
| listOf("/v1", | ||
| "/v1/", | ||
| "/v1/foo", | ||
| "/v1/foo/bar") | ||
| .forEach({ route -> | ||
| RestAssured.given() | ||
| .`when`() | ||
| .get(route) | ||
| .then() | ||
| .statusCode(Response.Status.GONE.statusCode) | ||
| }) | ||
| } | ||
|
|
||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document why this sucks