commit | 4329f2a73eeeae0691bbe1831b0d4a81a1e04e6f | [log] [tgz] |
---|---|---|
author | François Papon <fpapon@apache.org> | Mon Jan 20 10:40:10 2020 +0100 |
committer | GitHub <noreply@github.com> | Mon Jan 20 10:40:10 2020 +0100 |
tree | b2abc436e5e0a94959f2b44d169223ea477da20a | |
parent | 5799afe9d7020fa72b347d7e00911e2fb226c9a8 [diff] | |
parent | 93142c55d355b5df617ca383915284d0245335d3 [diff] |
Merge pull request #196 from fpapon/ASYNC_TEST [SHIRO-735] Add tests
diff --git a/samples/jaxrs/src/main/java/org/apache/shiro/samples/jaxrs/resources/HelloResource.java b/samples/jaxrs/src/main/java/org/apache/shiro/samples/jaxrs/resources/HelloResource.java index 400f503..6ba4d64 100644 --- a/samples/jaxrs/src/main/java/org/apache/shiro/samples/jaxrs/resources/HelloResource.java +++ b/samples/jaxrs/src/main/java/org/apache/shiro/samples/jaxrs/resources/HelloResource.java
@@ -24,6 +24,8 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.container.AsyncResponse; +import javax.ws.rs.container.Suspended; @Path("say") public class HelloResource { @@ -34,4 +36,12 @@ public String saySomething(@QueryParam("words") @DefaultValue("Hello!") String words) { return words; } + + @Produces({"application/json","plain/text"}) + @GET + @Path("async") + public void saySomethingAsync(@QueryParam("words") @DefaultValue("Hello!") String words, + @Suspended AsyncResponse asyncResponse) { + asyncResponse.resume(words); + } }
diff --git a/samples/jaxrs/src/test/groovy/org/apache/shiro/web/jaxrs/ContainerIntegrationIT.groovy b/samples/jaxrs/src/test/groovy/org/apache/shiro/web/jaxrs/ContainerIntegrationIT.groovy index 84899d7..f55d37d 100644 --- a/samples/jaxrs/src/test/groovy/org/apache/shiro/web/jaxrs/ContainerIntegrationIT.groovy +++ b/samples/jaxrs/src/test/groovy/org/apache/shiro/web/jaxrs/ContainerIntegrationIT.groovy
@@ -37,6 +37,16 @@ } @Test + void testNoAuthResourceAsync() { + + get(getBaseUri() + "say/async") + .then() + .assertThat() + .statusCode(is(200)).and() + .body(equalTo("Hello!")) + } + + @Test void testSecuredRequiresAuthentication() { get(getBaseUri() + "secure/RequiresAuthentication")