Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 31442 invoked from network); 23 Dec 2010 17:50:18 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Dec 2010 17:50:18 -0000 Received: (qmail 30142 invoked by uid 500); 23 Dec 2010 17:50:18 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 30064 invoked by uid 500); 23 Dec 2010 17:50:18 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 30057 invoked by uid 99); 23 Dec 2010 17:50:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Dec 2010 17:50:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Dec 2010 17:50:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 14782238897A; Thu, 23 Dec 2010 17:49:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@cxf.apache.org From: sergeyb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101223174953.14782238897A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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 books = new HashMap(); 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" - - application/fastinfoset - - - - + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + application/fastinfoset + +