You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/10/16 16:30:40 UTC
[cxf] 02/03: Attempting to reproduce the issue in CXF-7834
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit f5c0cc7d46aaf65105eb1014ccfe69e8c69b0edb
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Tue Oct 16 16:46:45 2018 +0100
Attempting to reproduce the issue in CXF-7834
---
.../jaxrs/cdi/AbstractBookStoreCdiTest.java | 12 ++++++++++
.../cxf/systest/jaxrs/cdi/BookStoreFeed.java | 28 ++++++++++++++++++----
2 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/systests/cdi/cdi-weld/cdi-producers-weld/src/test/java/org/apache/cxf/systest/jaxrs/cdi/AbstractBookStoreCdiTest.java b/systests/cdi/cdi-weld/cdi-producers-weld/src/test/java/org/apache/cxf/systest/jaxrs/cdi/AbstractBookStoreCdiTest.java
index c5616a2..ceb4a86 100644
--- a/systests/cdi/cdi-weld/cdi-producers-weld/src/test/java/org/apache/cxf/systest/jaxrs/cdi/AbstractBookStoreCdiTest.java
+++ b/systests/cdi/cdi-weld/cdi-producers-weld/src/test/java/org/apache/cxf/systest/jaxrs/cdi/AbstractBookStoreCdiTest.java
@@ -65,4 +65,16 @@ public abstract class AbstractBookStoreCdiTest extends AbstractCdiSingleAppTest
assertEquals(Response.Status.CREATED.getStatusCode(), r.getStatus());
}
+ @Test
+ public void testQueryParameter() {
+ Response r =
+ createWebClient(getBasePath() + "/books/param", "text/plain").query("fieldValue", "queryParam").get();
+ assertEquals("queryParam", r.readEntity(String.class));
+ assertEquals(Response.Status.OK.getStatusCode(), r.getStatus());
+
+ r = createWebClient(getBasePath() + "/books/param2", "text/plain").query("fieldValue2", "queryParam").get();
+ assertEquals("queryParam", r.readEntity(String.class));
+ assertEquals(Response.Status.OK.getStatusCode(), r.getStatus());
+ }
+
}
diff --git a/systests/cdi/cdi-weld/cdi-producers-weld/src/test/java/org/apache/cxf/systest/jaxrs/cdi/BookStoreFeed.java b/systests/cdi/cdi-weld/cdi-producers-weld/src/test/java/org/apache/cxf/systest/jaxrs/cdi/BookStoreFeed.java
index 89f0d52..b0c345f 100644
--- a/systests/cdi/cdi-weld/cdi-producers-weld/src/test/java/org/apache/cxf/systest/jaxrs/cdi/BookStoreFeed.java
+++ b/systests/cdi/cdi-weld/cdi-producers-weld/src/test/java/org/apache/cxf/systest/jaxrs/cdi/BookStoreFeed.java
@@ -23,6 +23,8 @@ import javax.validation.constraints.NotNull;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
import org.apache.abdera.model.Feed;
import org.apache.abdera.parser.stax.FOMEntry;
@@ -33,24 +35,42 @@ import org.apache.cxf.systests.cdi.base.BookStoreService;
@Path("/bookstore/")
public class BookStoreFeed {
private final BookStoreService service;
-
+
+ @QueryParam("fieldValue")
+ private String fieldValue;
+
public BookStoreFeed(BookStoreService service) {
this.service = service;
}
-
+
@GET
@Path("/books/feed")
@NotNull @Valid
@Produces("application/atom+xml")
public Feed getBooks() {
final FOMFeed feed = new FOMFeed();
-
+
for (final Book book: service.all()) {
final FOMEntry entry = new FOMEntry();
entry.addLink("/bookstore/books/" + book.getId());
feed.addEntry(entry);
}
-
+
return feed;
}
+
+ @GET
+ @Path("/books/param")
+ @Produces("text/plain")
+ public Response getFieldParam() {
+ return Response.ok().entity(fieldValue).build();
+ }
+
+ @GET
+ @Path("/books/param2")
+ @Produces("text/plain")
+ public Response getFieldParam2(@QueryParam("fieldValue2") String fieldValue2) {
+ return Response.ok().entity(fieldValue2).build();
+ }
+
}