cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1225538 - in /cxf/trunk/systests/jaxrs/src/test: java/org/apache/cxf/systest/jaxrs/BookStoreSimple.java java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java resources/jaxrs_spring/WEB-INF/beans.xml
Date Thu, 29 Dec 2011 14:17:28 GMT
Author: sergeyb
Date: Thu Dec 29 14:17:28 2011
New Revision: 1225538

URL: http://svn.apache.org/viewvc?rev=1225538&view=rev
Log:
Adding some more tests with URIs containing matrix params

Added:
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSimple.java
  (with props)
Modified:
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
    cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_spring/WEB-INF/beans.xml

Added: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSimple.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSimple.java?rev=1225538&view=auto
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSimple.java
(added)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSimple.java
Thu Dec 29 14:17:28 2011
@@ -0,0 +1,37 @@
+/**
+ * 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;
+
+@Path("/simplebooks/{id}")
+public class BookStoreSimple {
+    @GET
+    public Book getBook(@PathParam("id") long id) {
+        return new Book("Simple", id);    
+    }
+    
+    @GET
+    @Path("/book")
+    public Book getBook2(@PathParam("id") long id) {
+        return getBook(id);    
+    }
+}

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

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

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java?rev=1225538&r1=1225537&r2=1225538&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java
Thu Dec 29 14:17:28 2011
@@ -25,6 +25,7 @@ import java.net.URLConnection;
 
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -39,10 +40,34 @@ public class JAXRSClientServerResourceCr
     }
     
     @Test
+    public void testGetBookSimple() throws Exception {
+        
+        String address =
+            "http://localhost:" + PORT + "/webapp/rest/simplebooks/444";
+        assertEquals(444L, WebClient.create(address).get(Book.class).getId());
+    }
+    
+    @Test
+    public void testGetBookSimpleMatrixEnd() throws Exception {
+        
+        String address =
+            "http://localhost:" + PORT + "/webapp/rest/simplebooks/444;bookId=ssn";
+        assertEquals(444L, WebClient.create(address).get(Book.class).getId());
+    }
+    
+    @Test
+    public void testGetBookSimpleMatrixMiddle() throws Exception {
+        
+        String address =
+            "http://localhost:" + PORT + "/webapp/rest/simplebooks/444;bookId=ssn/book";
+        assertEquals(444L, WebClient.create(address).get(Book.class).getId());
+    }
+    
+    @Test
     public void testGetBook123() throws Exception {
         
         String endpointAddress =
-            "http://localhost:" + PORT + "/webapp/bookstore/books/123"; 
+            "http://localhost:" + PORT + "/webapp/rest/bookstore/books/123"; 
         URL url = new URL(endpointAddress);
         URLConnection connect = url.openConnection();
         connect.addRequestProperty("Accept", "application/xml");
@@ -59,7 +84,7 @@ public class JAXRSClientServerResourceCr
     public void testPetStore() throws Exception {
         
         String endpointAddress =
-            "http://localhost:" + PORT + "/webapp/petstore/pets/24"; 
+            "http://localhost:" + PORT + "/webapp/rest/petstore/pets/24"; 
         URL url = new URL(endpointAddress);
         URLConnection connect = url.openConnection();
         connect.addRequestProperty("Accept", "text/xml");

Modified: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_spring/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_spring/WEB-INF/beans.xml?rev=1225538&r1=1225537&r2=1225538&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_spring/WEB-INF/beans.xml (original)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_spring/WEB-INF/beans.xml Thu Dec 29
14:17:28 2011
@@ -17,13 +17,6 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<!-- START SNIPPET: beans -->
-<!--beans xmlns="http://www.springframework.org/schema/beans"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xmlns:simple="http://cxf.apache.org/simple"
-  xsi:schemaLocation="
-  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-  http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd"-->
 <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:jaxrs="http://cxf.apache.org/jaxrs"
@@ -37,16 +30,16 @@ http://cxf.apache.org/schemas/jaxrs.xsd"
   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
   
   <jaxrs:server id="bookservice"
-		        address="/">
+		        address="/rest">
     <jaxrs:serviceBeans>
       <ref bean="petstore"/>	
       <ref bean="bookstore"/>
+      <ref bean="bookstoreSimple"/>
     </jaxrs:serviceBeans>		   
   </jaxrs:server>
-  <bean id="bookstore" scope="prototype" class="org.apache.cxf.systest.jaxrs.BookStore">
-  </bean>
-  <bean id="petstore" scope="prototype" class="org.apache.cxf.systest.jaxrs.PetStore">
-  </bean>
+  <bean id="bookstore" scope="prototype" class="org.apache.cxf.systest.jaxrs.BookStore"/>
+  <bean id="petstore" scope="prototype" class="org.apache.cxf.systest.jaxrs.PetStore"/>
+  <bean id="bookstoreSimple" class="org.apache.cxf.systest.jaxrs.BookStoreSimple"/>
 
 </beans>
-<!-- END SNIPPET: beans -->
+



Mime
View raw message