cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1484517 - in /cxf/branches/2.7.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Mon, 20 May 2013 16:32:42 GMT
Author: sergeyb
Date: Mon May 20 16:32:42 2013
New Revision: 1484517

URL: http://svn.apache.org/r1484517
Log:
Merged revisions 1484513 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1484513 | sergeyb | 2013-05-20 17:21:39 +0100 (Mon, 20 May 2013) | 1 line
  
  [CXF-5027] Support for XmlAttachmentRef in the JAX-RS XOP marshaller
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBAttachmentMarshaller.java
    cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
    cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
    cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XopType.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1484513

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

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBAttachmentMarshaller.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBAttachmentMarshaller.java?rev=1484517&r1=1484516&r2=1484517&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBAttachmentMarshaller.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBAttachmentMarshaller.java
Mon May 20 16:32:42 2013
@@ -20,10 +20,12 @@
 package org.apache.cxf.jaxrs.provider;
 
 import java.util.Collection;
+import java.util.UUID;
 
 import javax.activation.DataHandler;
 import javax.xml.bind.attachment.AttachmentMarshaller;
 
+import org.apache.cxf.attachment.AttachmentImpl;
 import org.apache.cxf.attachment.AttachmentUtil;
 import org.apache.cxf.message.Attachment;
 
@@ -70,7 +72,11 @@ public class JAXBAttachmentMarshaller ex
 
     @Override
     public String addSwaRefAttachment(DataHandler handler) {
-        throw new UnsupportedOperationException();
+        String id = UUID.randomUUID() + "@apache.org";
+        AttachmentImpl att = new AttachmentImpl(id, handler);
+        att.setXOP(false);
+        atts.add(att);
+        return id;
     }
 
     @Override

Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=1484517&r1=1484516&r2=1484517&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
(original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
Mon May 20 16:32:42 2013
@@ -51,6 +51,7 @@ import org.apache.commons.httpclient.met
 import org.apache.commons.httpclient.methods.multipart.Part;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
@@ -390,7 +391,8 @@ public class JAXRSMultipartTest extends 
         HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
         conduit.getClient().setReceiveTimeout(1000000);
         conduit.getClient().setConnectionTimeout(1000000);
-        
+        WebClient.getConfig(client).getInInterceptors().add(new LoggingInInterceptor());
+        WebClient.getConfig(client).getOutInterceptors().add(new LoggingOutInterceptor());
         client.type("multipart/related").accept("multipart/related");
         
         XopType xop = new XopType();
@@ -399,6 +401,7 @@ public class JAXRSMultipartTest extends 
             getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/book.xsd");
         byte[] data = IOUtils.readBytesFromStream(is);
         xop.setAttachinfo(new DataHandler(new ByteArrayDataSource(data, "application/octet-stream")));
+        xop.setAttachInfoRef(new DataHandler(new ByteArrayDataSource(data, "application/octet-stream")));
         
         String bookXsd = IOUtils.readStringFromStream(getClass().getResourceAsStream(
             "/org/apache/cxf/systest/jaxrs/resources/book.xsd"));
@@ -412,6 +415,8 @@ public class JAXRSMultipartTest extends 
                 "/org/apache/cxf/systest/jaxrs/resources/book.xsd"));
         String bookXsd2 = IOUtils.readStringFromStream(xop2.getAttachinfo().getInputStream());
       
         assertEquals(bookXsdOriginal, bookXsd2);
+        String bookXsdRef = IOUtils.readStringFromStream(xop2.getAttachInfoRef().getInputStream());
       
+        assertEquals(bookXsdOriginal, bookXsdRef);
         
         String ctString = 
             client.getResponse().getMetadata().getFirst("Content-Type").toString();

Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java?rev=1484517&r1=1484516&r2=1484517&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
(original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
Mon May 20 16:32:42 2013
@@ -106,6 +106,10 @@ public class MultipartStore {
         if (!bookXsd.equals(bookXsd2)) {
             throw new RuntimeException("Wrong attachinfo property");
         }
+        String bookXsdRef = IOUtils.readStringFromStream(type.getAttachInfoRef().getInputStream());
+        if (!bookXsdRef.equals(bookXsd2)) {
+            throw new RuntimeException("Wrong attachinforef property");
+        }
         if (!Boolean.getBoolean("java.awt.headless") && type.getImage() == null)
{
             throw new RuntimeException("Wrong image property");
         }
@@ -118,7 +122,7 @@ public class MultipartStore {
             getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/book.xsd");
         byte[] data = IOUtils.readBytesFromStream(is);
         xop.setAttachinfo(new DataHandler(new ByteArrayDataSource(data, "application/octet-stream")));
-        
+        xop.setAttachInfoRef(new DataHandler(new ByteArrayDataSource(data, "application/octet-stream")));
         xop.setAttachinfo2(bookXsd.getBytes());
      
         xop.setImage(ImageIO.read(getClass().getResource(

Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XopType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XopType.java?rev=1484517&r1=1484516&r2=1484517&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XopType.java
(original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XopType.java
Mon May 20 16:32:42 2013
@@ -22,6 +22,7 @@ package org.apache.cxf.systest.jaxrs;
 import java.awt.Image;
 
 import javax.activation.DataHandler;
+import javax.xml.bind.annotation.XmlAttachmentRef;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlMimeType;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -32,11 +33,13 @@ import javax.xml.bind.annotation.XmlType
         "name",
         "attachinfo",
         "attachinfo2",
+        "attachInfoRef",
         "image" })
 public class XopType {
 
     private String name;
     private DataHandler attachinfo;
+    private DataHandler attachInfoRef;
     private byte[] attachinfo2;
     private Image image;
 
@@ -81,4 +84,15 @@ public class XopType {
         return image;
     }
 
+    @XmlAttachmentRef
+    @XmlElement(required = true)
+    @XmlMimeType("application/octet-stream")
+    public DataHandler getAttachInfoRef() {
+        return attachInfoRef;
+    }
+
+    public void setAttachInfoRef(DataHandler attachInfoRef) {
+        this.attachInfoRef = attachInfoRef;
+    }
+
 }



Mime
View raw message