cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1052339 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/j...
Date Thu, 23 Dec 2010 17:49:52 GMT
Author: sergeyb
Date: Thu Dec 23 17:49:52 2010
New Revision: 1052339

URL: http://svn.apache.org/viewvc?rev=1052339&view=rev
Log:
Merged revisions 1052338 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1052338 | sergeyb | 2010-12-23 17:47:05 +0000 (Thu, 23 Dec 2010) | 1 line
  
  [JAX-RS] Enhancing FastinfoSet system test
........

Added:
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreSoapRestFastInfoset.java
      - copied unchanged from r1052338, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreSoapRestFastInfoset.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreSoapRestFastInfoset2.java
      - copied unchanged from r1052338, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreSoapRestFastInfoset2.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreSoapRestFastInfoset3.java
      - copied unchanged from r1052338, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreSoapRestFastInfoset3.java
Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreJaxrsJaxws.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreSoapRestImpl.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec 23 17:49:52 2010
@@ -1 +1 @@
-/cxf/trunk:1041183,1041790,1041993,1042346,1042571,1042724,1042805,1042821,1043225,1043229,1043902,1043907,1043954,1044085,1044238-1044305,1045024,1048915,1048919,1048930,1049078,1049426,1049937,1050005,1050021,1050095,1050102,1050113,1050156,1050165,1050280,1051115,1051613,1051790,1051792
+/cxf/trunk:1041183,1041790,1041993,1042346,1042571,1042724,1042805,1042821,1043225,1043229,1043902,1043907,1043954,1044085,1044238-1044305,1045024,1048915,1048919,1048930,1049078,1049426,1049937,1050005,1050021,1050095,1050102,1050113,1050156,1050165,1050280,1051115,1051613,1051790,1051792,1052338

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java?rev=1052339&r1=1052338&r2=1052339&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
Thu Dec 23 17:49:52 2010
@@ -40,6 +40,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriBuilder;
+import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
@@ -493,7 +494,8 @@ public class ClientProxyImpl extends Abs
             
             OperationResourceInfo ori = outMessage.getContent(OperationResourceInfo.class);
             OutputStream os = outMessage.getContent(OutputStream.class);
-            if (os == null || ori == null) {
+            if ((os == null && outMessage.getContent(XMLStreamWriter.class) == null)
+                || ori == null) {
                 return;
             }
             MessageContentsList objs = MessageContentsList.getContentsList(outMessage);
@@ -517,7 +519,6 @@ public class ClientProxyImpl extends Abs
                     writeBody(body, outMessage, body.getClass(), body.getClass(), 
                               anns, headers, os);
                 }
-                os.flush();
             } catch (Exception ex) {
                 throw new Fault(ex);
             }

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java?rev=1052339&r1=1052338&r2=1052339&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
Thu Dec 23 17:49:52 2010
@@ -214,7 +214,9 @@ public class JAXRSClientFactoryBean exte
         client.getConfiguration().setConduitSelector(getConduitSelector(ep));
         client.getConfiguration().setBus(getBus());
         client.getConfiguration().getOutInterceptors().addAll(getOutInterceptors());
+        client.getConfiguration().getOutInterceptors().addAll(ep.getOutInterceptors());
         client.getConfiguration().getInInterceptors().addAll(getInInterceptors());
+        client.getConfiguration().getInInterceptors().addAll(ep.getInInterceptors());
 
         if (headers != null && addHeaders) {
             client.headers(headers);

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java?rev=1052339&r1=1052338&r2=1052339&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
Thu Dec 23 17:49:52 2010
@@ -364,7 +364,9 @@ public class JAXRSOutInterceptor extends
                                                    BUNDLE,
                                                    parameter);
             LOG.warning(message.toString());
-            out.write(message.toString().getBytes("UTF-8"));
+            if (out != null) {
+                out.write(message.toString().getBytes("UTF-8"));
+            }
         } catch (IOException another) {
             // ignore
         }

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java?rev=1052339&r1=1052338&r2=1052339&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
Thu Dec 23 17:49:52 2010
@@ -50,8 +50,10 @@ import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.FIStaxInInterceptor;
 import org.apache.cxf.interceptor.FIStaxOutInterceptor;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.interceptor.InterceptorProvider;
 import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.jaxrs.client.ClientConfiguration;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.apache.cxf.jaxrs.client.ResponseExceptionMapper;
@@ -65,6 +67,8 @@ import org.apache.cxf.phase.AbstractPhas
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.systest.jaxrs.jaxws.BookSoapService;
 import org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws;
+import org.apache.cxf.systest.jaxrs.jaxws.BookStoreSoapRestFastInfoset2;
+import org.apache.cxf.systest.jaxrs.jaxws.BookStoreSoapRestFastInfoset3;
 import org.apache.cxf.systest.jaxrs.jaxws.HelloWorld;
 import org.apache.cxf.systest.jaxrs.jaxws.User;
 import org.apache.cxf.systest.jaxrs.jaxws.UserImpl;
@@ -173,6 +177,72 @@ public class JAXRSSoapBookTest extends A
     }
     
     @Test
+    public void testPostGetBookFastinfosetProxy() throws Exception {
+        
+        JAXBElementProvider p = new JAXBElementProvider();
+        p.setConsumeMediaTypes(Collections.singletonList("application/fastinfoset"));
+        p.setProduceMediaTypes(Collections.singletonList("application/fastinfoset"));
+        
+        BookStoreJaxrsJaxws client = JAXRSClientFactory.create(
+                                  "http://localhost:" + PORT + "/test/services/rest4",
+                                  BookStoreSoapRestFastInfoset2.class,
+                                  Collections.singletonList(p));
+        
+        Book b = new Book("CXF", 1L);
+        
+        Book b2 = client.addFastinfoBook(b);
+        
+        assertEquals(b2.getName(), b.getName());
+        assertEquals(b2.getId(), b.getId());
+        
+        checkFiInterceptors(WebClient.getConfig(client));
+    }
+    
+    @Test
+    public void testPostGetBookFastinfosetProxyInterceptors() throws Exception {
+        
+        JAXBElementProvider p = new JAXBElementProvider();
+        p.setConsumeMediaTypes(Collections.singletonList("application/fastinfoset"));
+        p.setProduceMediaTypes(Collections.singletonList("application/fastinfoset"));
+        
+        BookStoreJaxrsJaxws client = JAXRSClientFactory.create(
+                                  "http://localhost:" + PORT + "/test/services/rest5",
+                                  BookStoreSoapRestFastInfoset3.class,
+                                  Collections.singletonList(p));
+        
+        Book b = new Book("CXF", 1L);
+        
+        // Just to make sure it is enforced
+        Map<String, Object> props = WebClient.getConfig(client).getResponseContext();
+        props.put(FIStaxOutInterceptor.FI_ENABLED, Boolean.TRUE);
+        
+        Book b2 = client.addFastinfoBook(b);
+        
+        assertEquals(b2.getName(), b.getName());
+        assertEquals(b2.getId(), b.getId());
+        
+        checkFiInterceptors(WebClient.getConfig(client));
+        
+    }
+    
+    private void checkFiInterceptors(ClientConfiguration cfg) {
+        int count = 0;
+        for (Interceptor<?> in : cfg.getInInterceptors()) {
+            if (in instanceof FIStaxInInterceptor) {
+                count++;
+                break;
+            }
+        }
+        for (Interceptor<?> in : cfg.getOutInterceptors()) {
+            if (in instanceof FIStaxOutInterceptor) {
+                count++;
+                break;
+            }
+        }
+        assertEquals("In and Out FastInfoset interceptors are expected", 2, count);
+    }
+    
+    @Test
     public void testGetBook123ServletResponse() throws Exception {
         
         InputStream in = getHttpInputStream("http://localhost:" + PORT + "/test/services/rest/bookstore/0");
@@ -561,7 +631,7 @@ public class JAXRSSoapBookTest extends A
         
          
         
-        assertFalse(listings.contains("Atom Log Feed"));
+        //assertFalse(listings.contains("Atom Log Feed"));
     }
     
     @Test

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreJaxrsJaxws.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreJaxrsJaxws.java?rev=1052339&r1=1052338&r2=1052339&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreJaxrsJaxws.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreJaxrsJaxws.java
Thu Dec 23 17:49:52 2010
@@ -58,7 +58,7 @@ public interface BookStoreJaxrsJaxws {
     
     @POST
     @Path("/fastinfoset")
-    @Consumes({"text/xml" })
+    @Consumes({"application/fastinfoset", "text/xml" })
     @Produces({"application/fastinfoset", "text/xml", "application/xml" })
     Book addFastinfoBook(Book book);
     

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreSoapRestImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreSoapRestImpl.java?rev=1052339&r1=1052338&r2=1052339&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreSoapRestImpl.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jaxws/BookStoreSoapRestImpl.java
Thu Dec 23 17:49:52 2010
@@ -42,6 +42,7 @@ import org.apache.cxf.systest.jaxrs.Book
 import org.apache.cxf.systest.jaxrs.BookSubresource;
 import org.apache.cxf.systest.jaxrs.BookSubresourceImpl;
 
+
 public class BookStoreSoapRestImpl implements BookStoreJaxrsJaxws {
 
     private Map<Long, Book> books = new HashMap<Long, Book>();

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml?rev=1052339&r1=1052338&r2=1052339&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_soap_rest/WEB-INF/beans.xml
Thu Dec 23 17:49:52 2010
@@ -102,41 +102,55 @@ http://cxf.apache.org/schemas/jaxrs.xsd"
   </jaxrs:server>
   <bean id="bookstore2" class="org.apache.cxf.systest.jaxrs.jaxws.BookStoreSoapRestImpl2"/>
 
-  <util:list id="fastinfosetType">
-    <value>application/fastinfoset</value>
-  </util:list> 
-
-
   <jaxrs:server id="restservice3"
 		        address="/rest3">
     <jaxrs:serviceBeans>
-      <ref bean="bookstore"/>
+      <bean class="org.apache.cxf.systest.jaxrs.jaxws.BookStoreSoapRestFastInfoset"/>
     </jaxrs:serviceBeans>
     
     <jaxrs:providers>
        <ref bean="jaxbProvider" />
     </jaxrs:providers>
-        
-    <jaxrs:outInterceptors>
-      <ref bean="fastInfosetOutInterceptor" />
-    </jaxrs:outInterceptors>
-    <jaxrs:inInterceptors>
-      <ref bean="fastInfosetInInterceptor" />
-    </jaxrs:inInterceptors>
+
     <jaxrs:properties>
       <entry key="org.apache.cxf.endpoint.private" value="true"/>
     </jaxrs:properties>    		   
   </jaxrs:server> 
 
+  <jaxrs:server id="restservice4"
+		        address="/rest4">
+    <jaxrs:serviceBeans>
+      <bean class="org.apache.cxf.systest.jaxrs.jaxws.BookStoreSoapRestFastInfoset2"/>
+    </jaxrs:serviceBeans>
+    
+    <jaxrs:providers>
+       <ref bean="jaxbProvider" />
+    </jaxrs:providers>
+  </jaxrs:server>
+
+  <jaxrs:server id="restservice5"
+		        address="/rest5">
+    <jaxrs:serviceBeans>
+      <bean class="org.apache.cxf.systest.jaxrs.jaxws.BookStoreSoapRestFastInfoset3"/>
+    </jaxrs:serviceBeans>
+    
+    <jaxrs:providers>
+       <ref bean="jaxbProvider" />
+    </jaxrs:providers>
+    
+    <jaxrs:properties>
+      <entry key="org.apache.cxf.fastinfoset.enabled" value="true"/>
+    </jaxrs:properties>
+  </jaxrs:server>
+
   <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
       <property name="produceMediaTypes" ref="fastinfosetType"/>
       <property name="consumeMediaTypes" ref="fastinfosetType"/>
   </bean>
 
-   <bean id="fastInfosetOutInterceptor"
-         class="org.apache.cxf.interceptor.FIStaxOutInterceptor" />
-   <bean id="fastInfosetInInterceptor"
-         class="org.apache.cxf.interceptor.FIStaxInInterceptor" />
-
+  <util:list id="fastinfosetType">
+    <value>application/fastinfoset</value>
+  </util:list>
+   
 </beans>
 <!-- END SNIPPET: beans -->



Mime
View raw message