forked from quarkus-qe/quarkus-test-suite
-
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.
Improve reactive rest client "process paths before sub resources" sce…
…nario There is an issue in upstream (quarkusio/quarkus#29821) that only happends under some RestClient definition hierarchy. This commit reproduces the problem in Quarkus 2.12 and earlier versions
- Loading branch information
pablo gonzalez granados
committed
Jan 14, 2023
1 parent
2fad57f
commit 6862185
Showing
16 changed files
with
138 additions
and
122 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
...-reactive/src/main/java/io/quarkus/ts/http/restclient/reactive/AuthorizationResource.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,8 @@ | ||
package io.quarkus.ts.http.restclient.reactive; | ||
|
||
import javax.ws.rs.Path; | ||
|
||
public interface AuthorizationResource { | ||
@Path("/permission") | ||
PermissionsResource permissions(); | ||
} |
10 changes: 10 additions & 0 deletions
10
...-client-reactive/src/main/java/io/quarkus/ts/http/restclient/reactive/ClientResource.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,10 @@ | ||
package io.quarkus.ts.http.restclient.reactive; | ||
|
||
import javax.ws.rs.Path; | ||
|
||
public interface ClientResource { | ||
|
||
@Path("/authz/resource-server") | ||
AuthorizationResource authorization(); | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...client-reactive/src/main/java/io/quarkus/ts/http/restclient/reactive/ClientsResource.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,9 @@ | ||
package io.quarkus.ts.http.restclient.reactive; | ||
|
||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
|
||
public interface ClientsResource { | ||
@Path("{id}") | ||
ClientResource get(@PathParam("id") String id); | ||
} |
8 changes: 8 additions & 0 deletions
8
...nt-reactive/src/main/java/io/quarkus/ts/http/restclient/reactive/PermissionsResource.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,8 @@ | ||
package io.quarkus.ts.http.restclient.reactive; | ||
|
||
import javax.ws.rs.Path; | ||
|
||
public interface PermissionsResource { | ||
@Path("resource") | ||
ResourcePermissionsResource resource(); | ||
} |
51 changes: 0 additions & 51 deletions
51
...ient-reactive/src/main/java/io/quarkus/ts/http/restclient/reactive/PlainRootResource.java
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
...tive/src/main/java/io/quarkus/ts/http/restclient/reactive/ReactiveClientRootResource.java
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
...t-client-reactive/src/main/java/io/quarkus/ts/http/restclient/reactive/RealmResource.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.ts.http.restclient.reactive; | ||
|
||
import javax.ws.rs.Consumes; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders; | ||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; | ||
|
||
@RegisterRestClient | ||
@RegisterClientHeaders | ||
@Consumes(MediaType.TEXT_PLAIN) | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public interface RealmResource { | ||
@Path("clients") | ||
ClientsResource clients(); | ||
} |
8 changes: 8 additions & 0 deletions
8
...tive/src/main/java/io/quarkus/ts/http/restclient/reactive/ResourcePermissionResource.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,8 @@ | ||
package io.quarkus.ts.http.restclient.reactive; | ||
|
||
import javax.ws.rs.DELETE; | ||
|
||
public interface ResourcePermissionResource { | ||
@DELETE | ||
String remove(); | ||
} |
9 changes: 9 additions & 0 deletions
9
...ive/src/main/java/io/quarkus/ts/http/restclient/reactive/ResourcePermissionsResource.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,9 @@ | ||
package io.quarkus.ts.http.restclient.reactive; | ||
|
||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
|
||
public interface ResourcePermissionsResource { | ||
@Path("{id}") | ||
ResourcePermissionResource findById(@PathParam("id") String id); | ||
} |
38 changes: 0 additions & 38 deletions
38
...ent-reactive/src/main/java/io/quarkus/ts/http/restclient/reactive/SubResourcesClient.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...estclient/reactive/PlainBookResource.java → ...reactive/resources/PlainBookResource.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
43 changes: 43 additions & 0 deletions
43
...ain/java/io/quarkus/ts/http/restclient/reactive/resources/PlainComplexClientResource.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,43 @@ | ||
package io.quarkus.ts.http.restclient.reactive.resources; | ||
|
||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.Consumes; | ||
import javax.ws.rs.DELETE; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.QueryParam; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.eclipse.microprofile.rest.client.RestClientBuilder; | ||
import org.eclipse.microprofile.rest.client.inject.RestClient; | ||
|
||
import io.quarkus.ts.http.restclient.reactive.RealmResource; | ||
|
||
@Path("clients/{clientId}/clientResource") | ||
@Consumes("text/plain") | ||
@Produces("text/plain") | ||
public class PlainComplexClientResource { | ||
@Inject | ||
@RestClient | ||
RealmResource realmResource; | ||
|
||
@DELETE | ||
@Path("/{id}") | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String deleteClientResource(@PathParam("clientId") String rootParam, @PathParam("id") String id) { | ||
return realmResource.clients().get(rootParam).authorization().permissions().resource().findById(id).remove(); | ||
} | ||
|
||
@DELETE | ||
@Path("/{id}/manual/build") | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String deleteClientResource(@PathParam("clientId") String rootParam, @PathParam("id") String id, | ||
@QueryParam("baseUri") String baseUri) throws URISyntaxException { | ||
RealmResource rClient = RestClientBuilder.newBuilder().baseUri(new URI(baseUri)).build(RealmResource.class); | ||
return rClient.clients().get(rootParam).authorization().permissions().resource().findById(id).remove(); | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
.../java/io/quarkus/ts/http/restclient/reactive/resources/ReactivecomplexClientResource.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,14 @@ | ||
package io.quarkus.ts.http.restclient.reactive.resources; | ||
|
||
import javax.ws.rs.DELETE; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
|
||
@Path("/clients/{rootPath}/authz/resource-server/permission/resource") | ||
public class ReactivecomplexClientResource { | ||
@Path("/{id}") | ||
@DELETE | ||
public String deleteById(@PathParam("rootPath") String rootPath, @PathParam("id") String id) { | ||
return "/clients/" + rootPath + "/authz/resource-server/permission/resource/" + id; | ||
} | ||
} |
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