You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2011/10/13 23:14:46 UTC

svn commit: r1183107 - in /cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs: BookServer.java JAXRSClientServerBookTest.java SimpleBookStore.java

Author: sergeyb
Date: Thu Oct 13 21:14:46 2011
New Revision: 1183107

URL: http://svn.apache.org/viewvc?rev=1183107&view=rev
Log:
Adding a test verifying the selection algorithm

Added:
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/SimpleBookStore.java   (with props)
Modified:
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java?rev=1183107&r1=1183106&r2=1183107&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java Thu Oct 13 21:14:46 2011
@@ -38,7 +38,7 @@ public class BookServer extends Abstract
 
     protected void run() {
         JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
-        sf.setResourceClasses(BookStore.class, BookStorePerRequest.class);
+        sf.setResourceClasses(BookStore.class, SimpleBookStore.class, BookStorePerRequest.class);
         
         List<Object> providers = new ArrayList<Object>();
         

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1183107&r1=1183106&r2=1183107&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Thu Oct 13 21:14:46 2011
@@ -70,7 +70,7 @@ public class JAXRSClientServerBookTest e
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly",
-                   launchServer(BookServer.class, true));
+                   launchServer(BookServer.class));
     }
     
     @Test
@@ -950,6 +950,20 @@ public class JAXRSClientServerBookTest e
     }
     
     @Test
+    public void testGetBookSimple222() throws Exception {
+        WebClient wc = WebClient.create("http://localhost:" + PORT + "/simplebooks/222");
+        Book book = wc.get(Book.class);
+        assertEquals(222L, book.getId());
+    }
+    
+    @Test
+    public void testGetBookSimple() throws Exception {
+        WebClient wc = WebClient.create("http://localhost:" + PORT + "/simplebooks/simple");
+        Book book = wc.get(Book.class);
+        assertEquals(444L, book.getId());
+    }
+    
+    @Test
     public void testGetBook123() throws Exception {
         getAndCompareAsStrings("http://localhost:" + PORT + "/bookstore/books/123",
                                "resources/expected_get_book123.txt",

Added: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/SimpleBookStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/SimpleBookStore.java?rev=1183107&view=auto
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/SimpleBookStore.java (added)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/SimpleBookStore.java Thu Oct 13 21:14:46 2011
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.jaxrs;
+
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+@Path("/simplebooks")
+public class SimpleBookStore {
+    
+    @GET
+    @Path("simple")
+    @Produces("application/xml")
+    public Book getSimpleBook() {
+        return new Book("444", 444L);
+    }
+    
+    @GET
+    @Path("{id}")
+    @Produces("application/xml")
+    public Book getSimpleBookById(@PathParam("id") Long id) {
+        return new Book(id.toString(), id);
+    }
+}   
+
+

Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/SimpleBookStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/SimpleBookStore.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date