cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6373] Restricting a test Servlet3 Continuations
Date Mon, 27 Apr 2015 12:19:26 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 832f93bcb -> b7636a85d


[CXF-6373] Restricting a test Servlet3 Continuations


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b7636a85
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b7636a85
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b7636a85

Branch: refs/heads/3.0.x-fixes
Commit: b7636a85d51e978667971ff8df3d8514d1f2be43
Parents: 832f93b
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Mon Apr 27 13:15:00 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Mon Apr 27 13:19:06 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java    |  4 +---
 .../org/apache/cxf/jaxrs/resources/BookInterface.java  |  2 +-
 .../org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java     |  2 +-
 .../systest/jaxrs/AbstractJAXRSContinuationsTest.java  | 10 ----------
 .../java/org/apache/cxf/systest/jaxrs/BookStore.java   | 10 ++++++++++
 .../cxf/systest/jaxrs/JAXRSClientServerBookTest.java   | 13 +++++++++----
 .../systest/jaxrs/JAXRSContinuationsServlet3Test.java  | 13 ++++++++++++-
 7 files changed, 34 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b7636a85/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
index a25ff9c..55f6b1f 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
@@ -394,7 +394,6 @@ public final class JAXRSUtils {
         int methodMatched = 0;
         int consumeMatched = 0;
         
-        boolean resourceMethodsAdded = false;
         List<OperationResourceInfo> finalPathSubresources = null;
         for (Map.Entry<ClassResourceInfo, MultivaluedMap<String, String>> rEntry
: matchedResources.entrySet()) {
             ClassResourceInfo resource = rEntry.getKey();
@@ -439,7 +438,6 @@ public final class JAXRSUtils {
                                     if (matchProduceTypes(acceptType, ori)) {
                                         candidateList.put(ori, map);
                                         added = true;
-                                        resourceMethodsAdded = true;
                                         break;
                                     }
                                 }
@@ -459,7 +457,7 @@ public final class JAXRSUtils {
                 }
             }
         }
-        if (finalPathSubresources != null && resourceMethodsAdded
+        if (finalPathSubresources != null && pathMatched > 0
             && !MessageUtils.getContextualBoolean(message, KEEP_SUBRESOURCE_CANDIDATES,
false)) {
             for (OperationResourceInfo key : finalPathSubresources) {
                 candidateList.remove(key);

http://git-wip-us.apache.org/repos/asf/cxf/blob/b7636a85/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/BookInterface.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/BookInterface.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/BookInterface.java
index 8bc127b..6f2952c 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/BookInterface.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/BookInterface.java
@@ -33,6 +33,6 @@ public interface BookInterface {
     @Consumes("text/foo2")
     String getAuthor();
     
-    @Path("/books/{bookId}")
+    @Path("/books/sub/{bookId}")
     Book getBook(@PathParam("bookId") String id);
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/b7636a85/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
index ac670b2..aa051c6 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
@@ -469,7 +469,7 @@ public class JAXRSUtilsTest extends Assert {
         String contentTypes = "*/*";
         
         OperationResourceInfo ori = findTargetResourceClass(resources,
-               createMessage2(), "/bookstore/books/123", "GET", new MetadataMap<String,
String>(), contentTypes,
+               createMessage2(), "/bookstore/books/sub/123", "GET", new MetadataMap<String,
String>(), contentTypes,
                getTypes("*/*"));       
         assertNotNull(ori);
         assertEquals("getBook", ori.getMethodToInvoke().getName());

http://git-wip-us.apache.org/repos/asf/cxf/blob/b7636a85/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
index 719967c..b621a23 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AbstractJAXRSContinuationsTest.java
@@ -93,16 +93,6 @@ public abstract class AbstractJAXRSContinuationsTest extends AbstractBusClientSe
     }
     
     @Test
-    public void testGetBookUnmappedFromFilter() throws Exception {
-        WebClient wc = 
-            WebClient.create("http://localhost:" + getPort() + getBaseAddress() 
-                             + "/books/unmappedFromFilter");
-        wc.accept("text/plain");
-        Response r = wc.get();
-        assertEquals(500, r.getStatus());
-    }
-    
-    @Test
     public void testTimeoutAndCancel() throws Exception {
         doTestTimeoutAndCancel(getBaseAddress());
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/b7636a85/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
index 57da727..9ef6cbd 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
@@ -548,6 +548,16 @@ public class BookStore {
                             .build();
     }
     
+    @GET
+    @Path("/options/2")
+    public Response getOptions2() throws Exception {
+        return getOptions();
+    }
+    @Path("/options/{id}")
+    public int getOptions2Sub(@PathParam("id") int id) {
+        throw new RuntimeException();
+    }
+    
     @POST
     @Path("post401")
     public Response get401WithText() throws Exception {

http://git-wip-us.apache.org/repos/asf/cxf/blob/b7636a85/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
index 3cc7e35..a98d578 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
@@ -1181,9 +1181,15 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase
{
     
     @Test
     public void testExplicitOptions() throws Exception {
-        WebClient wc = 
-            WebClient.create("http://localhost:" 
-                             + PORT + "/bookstore/options");
+        doTestExplicitOptions("http://localhost:" + PORT + "/bookstore/options");
+    }
+    @Test
+    public void testExplicitOptions2() throws Exception {
+        doTestExplicitOptions("http://localhost:" + PORT + "/bookstore/options/2");
+    }
+    private void doTestExplicitOptions(String address) throws Exception {
+        WebClient wc = WebClient.create(address);
+        WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(1000000L);
         WebClient.getConfig(wc).getRequestContext().put("org.apache.cxf.http.header.split",
true);
         Response response = wc.options();
         List<Object> values = response.getMetadata().get("Allow");
@@ -1309,7 +1315,6 @@ public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase
{
         bean.setAddress(address);
         bean.setResourceClass(BookStore.class);
         BookStore store = bean.create(BookStore.class);
-        WebClient.getConfig(store).getHttpConduit().getClient().setReceiveTimeout(1000000L);
         double[] arr = store.getBookIndexAsDoubleArray();
         assertEquals(3, arr.length);
         assertEquals(1, arr[0], 0.0);

http://git-wip-us.apache.org/repos/asf/cxf/blob/b7636a85/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsServlet3Test.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsServlet3Test.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsServlet3Test.java
index 6e73bc4..0a44621 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsServlet3Test.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSContinuationsServlet3Test.java
@@ -19,6 +19,9 @@
 
 package org.apache.cxf.systest.jaxrs;
 
+import javax.ws.rs.core.Response;
+
+import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
 import org.apache.cxf.testutil.common.ServerLauncher;
 import org.junit.BeforeClass;
@@ -43,7 +46,15 @@ public class JAXRSContinuationsServlet3Test extends AbstractJAXRSContinuationsTe
     public void testTimeoutAndCancelAsyncExecutor() throws Exception {
         doTestTimeoutAndCancel("/asyncexecutor/bookstore");
     }
-    
+    @Test
+    public void testGetBookUnmappedFromFilter() throws Exception {
+        WebClient wc = 
+            WebClient.create("http://localhost:" + getPort() + getBaseAddress()
+                             + "/books/unmappedFromFilter");
+        wc.accept("text/plain");
+        Response r = wc.get();
+        assertEquals(500, r.getStatus());
+    }
     @Test
     public void testClientDisconnect() throws Exception {
         ServerLauncher launcher = new ServerLauncher(BookContinuationClient.class.getName());


Mime
View raw message