cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1049078 - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/src/test/java/org/ap...
Date Tue, 14 Dec 2010 13:30:54 GMT
Author: sergeyb
Date: Tue Dec 14 13:30:54 2010
New Revision: 1049078

URL: http://svn.apache.org/viewvc?rev=1049078&view=rev
Log:
[JAX-RS] Support for oneways in user models

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/UserOperation.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsInterface.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources2.xml
    cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/resources2.xml
    cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_simple_security/WEB-INF/web.xml

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java?rev=1049078&r1=1049077&r2=1049078&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java
Tue Dec 14 13:30:54 2010
@@ -77,13 +77,16 @@ public class OperationResourceInfo {
         checkOneway();
     }
     
+    //CHECKSTYLE:OFF
     public OperationResourceInfo(Method m, 
                                  ClassResourceInfo cri,
                                  URITemplate template,
                                  String httpVerb,
                                  String consumeMediaTypes,
                                  String produceMediaTypes,
-                                 List<Parameter> params) {
+                                 List<Parameter> params,
+                                 boolean oneway) {
+    //CHECKSTYLE:ON    
         methodToInvoke = m;
         annotatedMethod = null;
         classResourceInfo = cri;
@@ -91,8 +94,9 @@ public class OperationResourceInfo {
         httpMethod = httpVerb;
         checkMediaTypes(consumeMediaTypes, produceMediaTypes);
         parameters = params;
+        this.oneway = oneway;
     }
-
+    
     private void checkOneway() {
         if (annotatedMethod != null) {
             oneway = AnnotationUtils.getAnnotation(annotatedMethod.getAnnotations(), Oneway.class)
!= null;

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/UserOperation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/UserOperation.java?rev=1049078&r1=1049077&r2=1049078&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/UserOperation.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/UserOperation.java
Tue Dec 14 13:30:54 2010
@@ -31,6 +31,7 @@ public class UserOperation {
     private String consumesTypes;
     private String producesTypes;
     private List<Parameter> params; 
+    private boolean oneway;
     
     public UserOperation() {
         
@@ -108,4 +109,12 @@ public class UserOperation {
         return params == null ? CastUtils.cast(Collections.emptyList(), Parameter.class)
             : Collections.unmodifiableList(params);
     }
+
+    public void setOneway(boolean oneway) {
+        this.oneway = oneway;
+    }
+
+    public boolean isOneway() {
+        return oneway;
+    }
 }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java?rev=1049078&r1=1049077&r2=1049078&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
Tue Dec 14 13:30:54 2010
@@ -166,7 +166,8 @@ public final class ResourceUtils {
             OperationResourceInfo ori = 
                 new OperationResourceInfo(m, cri, URITemplate.createTemplate(op.getPath()),
                                           op.getVerb(), op.getConsumes(), op.getProduces(),
-                                          op.getParameters());
+                                          op.getParameters(),
+                                          op.isOneway());
             String rClassName = m.getReturnType().getName();
             if (op.getVerb() == null) {
                 if (resources.containsKey(rClassName)) {
@@ -499,6 +500,7 @@ public final class ResourceUtils {
         op.setName(e.getAttribute("name"));
         op.setVerb(e.getAttribute("verb"));
         op.setPath(e.getAttribute("path"));
+        op.setOneway(Boolean.parseBoolean(e.getAttribute("oneway")));
         op.setConsumes(e.getAttribute("consumes"));
         op.setProduces(e.getAttribute("produces"));
         List<Element> paramEls = 

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java?rev=1049078&r1=1049077&r2=1049078&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java
Tue Dec 14 13:30:54 2010
@@ -73,5 +73,9 @@ public class BookStoreNoAnnotationsImpl 
     public List<Book> getBooks(List<Book> thebooks) {
         return thebooks;
     }
+
+    public void pingBookStore() {
+        // complete
+    }
     
 }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsInterface.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsInterface.java?rev=1049078&r1=1049077&r2=1049078&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsInterface.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsInterface.java
Tue Dec 14 13:30:54 2010
@@ -28,6 +28,8 @@ public interface BookStoreNoAnnotationsI
     
     List<Book> getBooks(List<Book> thebooks);
         
+    void pingBookStore();
+    
     ChapterNoAnnotations getBookChapter(Long id) throws BookNotFoundFault;
     
 }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java?rev=1049078&r1=1049077&r2=1049078&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java
Tue Dec 14 13:30:54 2010
@@ -41,7 +41,7 @@ public class JAXRSClientServerNonSpringB
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly",
-                   launchServer(BookNonSpringServer.class));
+                   launchServer(BookNonSpringServer.class, true));
     }
     
     
@@ -83,7 +83,6 @@ public class JAXRSClientServerNonSpringB
             JAXRSClientFactory.createFromModel("http://localhost:" + PORT + "/usermodel2",

                                               BookStoreNoAnnotationsInterface.class,
                               "classpath:org/apache/cxf/systest/jaxrs/resources/resources2.xml",
null);
-        WebClient.getConfig(proxy).getHttpConduit().getClient().setReceiveTimeout(10000000);
         Book book = new Book("From Model", 1L);
         List<Book> books = new ArrayList<Book>();
         books.add(book);
@@ -95,6 +94,17 @@ public class JAXRSClientServerNonSpringB
     }
     
     @Test
+    public void testUserModelInterfaceOneWay() throws Exception {
+        BookStoreNoAnnotationsInterface proxy = 
+            JAXRSClientFactory.createFromModel("http://localhost:" + PORT + "/usermodel2",

+                                              BookStoreNoAnnotationsInterface.class,
+                              "classpath:org/apache/cxf/systest/jaxrs/resources/resources2.xml",
null);
+        
+        proxy.pingBookStore();
+        assertEquals(202, WebClient.client(proxy).getResponse().getStatus());
+    }
+    
+    @Test
     public void testGetBook123ApplicationSingleton() throws Exception {
         getAndCompareAsStrings("http://localhost:" + PORT + "/application/bookstore/books/123",
                                "resources/expected_get_book123.txt",

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources2.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources2.xml?rev=1049078&r1=1049077&r2=1049078&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources2.xml
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources2.xml
Tue Dec 14 13:30:54 2010
@@ -8,7 +8,8 @@
     </operation> 
     <operation name="getBookChapter" path="/books/{id}/chapter">
         <param name="id" type="PATH"/>
-    </operation> 
+    </operation>
+    <operation name="pingBookStore" path="/oneway" verb="POST" oneway="true"/>
  </resource>
  <resource name="org.apache.cxf.systest.jaxrs.ChapterNoAnnotations">
     <operation name="getItself" verb="GET"/>

Modified: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/resources2.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/resources2.xml?rev=1049078&r1=1049077&r2=1049078&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/resources2.xml (original)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/resources2.xml Tue
Dec 14 13:30:54 2010
@@ -8,9 +8,11 @@
     </operation>  
     <operation name="getBookChapter" path="/books/{id}/chapter">
         <param name="id" type="PATH"/>
-    </operation> 
+    </operation>
+    <operation name="pingBookStore" path="/oneway" verb="POST" oneway="true"/> 
  </resource>
  <resource name="org.apache.cxf.systest.jaxrs.ChapterNoAnnotations">
     <operation name="getItself" verb="GET"/>
  </resource>
+ 
 </model>
\ No newline at end of file

Modified: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_simple_security/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_simple_security/WEB-INF/web.xml?rev=1049078&r1=1049077&r2=1049078&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_simple_security/WEB-INF/web.xml (original)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_simple_security/WEB-INF/web.xml Tue
Dec 14 13:30:54 2010
@@ -65,7 +65,7 @@
     </login-config>
 <!--
 <security-role>
-<role-name>JBossAdmin</role-name>
+<role-name>ROLE_BOOK_OWNER</role-name>
 </security-role>
 -->	
 </web-app>



Mime
View raw message