You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jl...@apache.org on 2007/12/14 08:08:35 UTC

svn commit: r604117 - in /incubator/cxf/trunk: distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/server/ rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ systests/src/test/java/org/apache/cxf/systest/jaxrs/

Author: jliu
Date: Thu Dec 13 23:08:34 2007
New Revision: 604117

URL: http://svn.apache.org/viewvc?rev=604117&view=rev
Log:
Fixed a bug in JAX-RS, jira CXF-1271.

Modified:
    incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/server/CustomerService.java
    incubator/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBeanTest.java
    incubator/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSUtilsTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/server/CustomerService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/server/CustomerService.java?rev=604117&r1=604116&r2=604117&view=diff
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/server/CustomerService.java (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/restful_jaxrs/src/demo/jaxrs/server/CustomerService.java Thu Dec 13 23:08:34 2007
@@ -105,12 +105,6 @@
         return c;
     }
 
-    //FIXME: wont work if remove this method, has to set hasSubResource to true
-    @UriTemplate("/items")
-    public Response getItem(@UriParam("id") String id) {
-        return null;
-    }
-
     final Customer createCustomer() {
         Customer c = new Customer();
         c.setName("John");

Modified: incubator/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBeanTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBeanTest.java?rev=604117&r1=604116&r2=604117&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBeanTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBeanTest.java Thu Dec 13 23:08:34 2007
@@ -57,16 +57,20 @@
         for (OperationResourceInfo ori : md.getOperationResourceInfos()) {
             if ("getBook".equals(ori.getMethod().getName())) {
                 assertEquals("GET", ori.getHttpMethod());
-                assertNotNull(ori.getURITemplate());              
+                assertNotNull(ori.getURITemplate());
+                assertFalse(ori.isSubResourceLocator());
             } else if ("addBook".equals(ori.getMethod().getName())) {
                 assertEquals("POST", ori.getHttpMethod());
-                assertNotNull(ori.getURITemplate());              
+                assertNotNull(ori.getURITemplate());
+                assertFalse(ori.isSubResourceLocator());
             } else if ("updateBook".equals(ori.getMethod().getName())) {
                 assertEquals("PUT", ori.getHttpMethod());
-                assertNotNull(ori.getURITemplate());              
+                assertNotNull(ori.getURITemplate());
+                assertFalse(ori.isSubResourceLocator());
             } else if ("deleteBook".equals(ori.getMethod().getName())) {
                 assertEquals("DELETE", ori.getHttpMethod());
-                assertNotNull(ori.getURITemplate());              
+                assertNotNull(ori.getURITemplate());
+                assertFalse(ori.isSubResourceLocator());
             } else {
                 fail("unexpected OperationResourceInfo" + ori.getMethod().getName());
             }
@@ -94,22 +98,26 @@
         for (OperationResourceInfo ori : md.getOperationResourceInfos()) {
             if ("getBook".equals(ori.getMethod().getName())) {
                 assertNull(ori.getHttpMethod());
-                assertNotNull(ori.getURITemplate());              
+                assertNotNull(ori.getURITemplate());
+                assertTrue(ori.isSubResourceLocator());
             } else if ("addBook".equals(ori.getMethod().getName())) {
                 assertEquals("POST", ori.getHttpMethod());
-                assertNotNull(ori.getURITemplate());              
+                assertNotNull(ori.getURITemplate());
+                assertFalse(ori.isSubResourceLocator());
             } else if ("updateBook".equals(ori.getMethod().getName())) {
                 assertEquals("PUT", ori.getHttpMethod());
-                assertNotNull(ori.getURITemplate());              
+                assertNotNull(ori.getURITemplate());
+                assertFalse(ori.isSubResourceLocator());
             } else if ("deleteBook".equals(ori.getMethod().getName())) {
                 assertEquals("DELETE", ori.getHttpMethod());
-                assertNotNull(ori.getURITemplate());              
+                assertNotNull(ori.getURITemplate());
+                assertFalse(ori.isSubResourceLocator());
             } else {
                 fail("unexpected OperationResourceInfo" + ori.getMethod().getName());
             }
         }
         
-        //Verify sub-resource ClassResourceInfo: Book
+        // Verify sub-resource ClassResourceInfo: Book
         assertEquals(1, rootCri.getSubClassResourceInfo().size());
         ClassResourceInfo subCri = rootCri.getSubClassResourceInfo().get(0);        
         assertTrue(subCri.getURITemplate() == null);

Modified: incubator/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSUtilsTest.java?rev=604117&r1=604116&r2=604117&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSUtilsTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXRSUtilsTest.java Thu Dec 13 23:08:34 2007
@@ -74,7 +74,8 @@
 
         Map<String, String> values = new HashMap<String, String>(); 
 
-        OperationResourceInfo ori = JAXRSUtils.findTargetResourceClass(resources, "/bookstore/books/123/",
+        OperationResourceInfo ori = JAXRSUtils.findTargetResourceClass(resources,
+                                                                       "/bookstore/books/123/chapter/1",
                                                                        "GET", values);       
         assertNotNull(ori);
         assertEquals("getBook", ori.getMethod().getName());

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=604117&r1=604116&r2=604117&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java Thu Dec 13 23:08:34 2007
@@ -164,12 +164,6 @@
         return c;
     }
 
-    //FIXME: wont work if remove this method, has to set hasSubResource to true
-    @UriTemplate("/cds")
-    public Response addCD(CD cd) {
-        return null;
-    }
-
     final void init() {
         Book book = new Book();
         book.setId(bookId);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=604117&r1=604116&r2=604117&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Thu Dec 13 23:08:34 2007
@@ -33,7 +33,6 @@
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase {
@@ -213,7 +212,6 @@
     } 
         
     @Test
-    @Ignore("to be fixed")
     public void testGetCDs() throws Exception {
         String endpointAddress =
             "http://localhost:9080/bookstore/cds";