cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1329279 - in /cxf/branches/2.5.x-fixes: ./ rt/databinding/jibx/src/main/java/org/apache/cxf/jibx/ systests/jaxrs/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jibx/ sy...
Date Mon, 23 Apr 2012 15:17:51 GMT
Author: sergeyb
Date: Mon Apr 23 15:17:51 2012
New Revision: 1329279

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

........
  r1329277 | sergeyb | 2012-04-23 16:14:40 +0100 (Mon, 23 Apr 2012) | 1 line
  
  [CXF-4245] Making JAX-RS DataBindingProvider and CXF JibxDataBinding work together, thanks
to Don Corley
........

Added:
    cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jibx/
      - copied from r1329277, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jibx/
    cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jibx/JibxResource.java
      - copied unchanged from r1329277, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jibx/JibxResource.java
    cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/resources/jibx/
      - copied from r1329277, cxf/trunk/systests/jaxrs/src/test/resources/jibx/
    cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/resources/jibx/types.xsd
      - copied unchanged from r1329277, cxf/trunk/systests/jaxrs/src/test/resources/jibx/types.xsd
Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    cxf/branches/2.5.x-fixes/rt/databinding/jibx/src/main/java/org/apache/cxf/jibx/JibxDataReader.java
    cxf/branches/2.5.x-fixes/rt/databinding/jibx/src/main/java/org/apache/cxf/jibx/JibxDataWriter.java
    cxf/branches/2.5.x-fixes/systests/jaxrs/pom.xml
    cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java
    cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/resources/jaxrs_databinding/WEB-INF/beans.xml

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1329277

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

Modified: cxf/branches/2.5.x-fixes/rt/databinding/jibx/src/main/java/org/apache/cxf/jibx/JibxDataReader.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/databinding/jibx/src/main/java/org/apache/cxf/jibx/JibxDataReader.java?rev=1329279&r1=1329278&r2=1329279&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/databinding/jibx/src/main/java/org/apache/cxf/jibx/JibxDataReader.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/databinding/jibx/src/main/java/org/apache/cxf/jibx/JibxDataReader.java
Mon Apr 23 15:17:51 2012
@@ -62,7 +62,12 @@ public class JibxDataReader implements D
     }
 
     public Object read(QName elementQName, XMLStreamReader input, Class type) {
-        throw new UnsupportedOperationException("Not Implemented");
+        try {
+            UnmarshallingContext ctx = getUnmarshallingContext(input, type);
+            return ctx.unmarshalElement(type);
+        } catch (JiBXException e) {
+            throw new RuntimeException(e);
+        }
     }
 
     public void setAttachments(Collection<Attachment> attachments) {

Modified: cxf/branches/2.5.x-fixes/rt/databinding/jibx/src/main/java/org/apache/cxf/jibx/JibxDataWriter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/databinding/jibx/src/main/java/org/apache/cxf/jibx/JibxDataWriter.java?rev=1329279&r1=1329278&r2=1329279&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/databinding/jibx/src/main/java/org/apache/cxf/jibx/JibxDataWriter.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/databinding/jibx/src/main/java/org/apache/cxf/jibx/JibxDataWriter.java
Mon Apr 23 15:17:51 2012
@@ -40,6 +40,15 @@ import org.jibx.runtime.impl.StAXWriter;
 public class JibxDataWriter implements DataWriter<XMLStreamWriter> {
 
     public void write(Object obj, XMLStreamWriter output) {
+        try {
+            IBindingFactory factory = BindingDirectory.getFactory(obj.getClass());
+            IMarshallingContext ctx = getMarshallingContext(obj);
+            StAXWriter writer = new StAXWriter(factory.getNamespaces(), output);
+            ctx.setXmlWriter(writer);
+            ((IMarshallable)obj).marshal(ctx);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
     }
 
     public void write(Object obj, MessagePartInfo part, XMLStreamWriter output) {

Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/pom.xml?rev=1329279&r1=1329278&r2=1329279&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/jaxrs/pom.xml (original)
+++ cxf/branches/2.5.x-fixes/systests/jaxrs/pom.xml Mon Apr 23 15:17:51 2012
@@ -182,6 +182,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-databinding-jibx</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-management-web</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>
@@ -333,6 +338,41 @@
                 </executions>
             </plugin>
             <plugin>
+        <groupId>org.jibx</groupId>
+        <artifactId>jibx-maven-plugin</artifactId>
+        <version>${cxf.jibx.version}</version>
+        <executions>
+            <execution>
+                <id>generate-java-code-from-schema</id>
+                <goals>
+                    <goal>schema-codegen</goal>
+                </goals>
+                <configuration>
+                    <schemaLocation>${basedir}/src/test/resources/jibx</schemaLocation>
+                    <schemaBindingDirectory>${basedir}/target/generated/src/main/java</schemaBindingDirectory>
+                    <options>
+                        <package>org.apache.cxf.systest.jaxrs.codegen.jibx</package>
+                    </options>
+                </configuration>
+            </execution>
+            <execution>
+                <id>compile-binding</id>
+                <goals>
+                    <goal>bind</goal>
+                </goals>
+                <configuration>
+                    <schemaBindingDirectory>${basedir}/target/generated/src/main/java</schemaBindingDirectory>
+                    <includeSchemaBindings>
+                      <includeSchemaBindings>binding.xml</includeSchemaBindings>
+                    </includeSchemaBindings>
+                    <load>true</load>
+                    <validate>true</validate>
+                    <verify>true</verify>
+                </configuration>
+            </execution>
+        </executions>
+    </plugin>
+            <plugin>
                 <groupId>org.apache.cxf</groupId>
                 <artifactId>cxf-wadl2java-plugin</artifactId>
                 <version>${project.version}</version>

Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java?rev=1329279&r1=1329278&r2=1329279&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java
(original)
+++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSDataBindingTest.java
Mon Apr 23 15:17:51 2012
@@ -30,8 +30,10 @@ import org.apache.cxf.jaxrs.client.JAXRS
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.provider.AegisElementProvider;
 import org.apache.cxf.jaxrs.provider.DataBindingJSONProvider;
+import org.apache.cxf.jibx.JibxDataBinding;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.sdo.SDODataBinding;
+import org.apache.cxf.systest.jaxrs.jibx.JibxResource;
 import org.apache.cxf.systest.jaxrs.sdo.SDOResource;
 import org.apache.cxf.systest.jaxrs.sdo.Structure;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -58,7 +60,17 @@ public class JAXRSDataBindingTest extend
         assertEquals("CXF in Action", book.getName());
     }
     
-    //@org.junit.Ignore
+    @Test
+    public void testGetBookJIBX() throws Exception {
+        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
+        bean.setDataBinding(new JibxDataBinding());
+        bean.setAddress("http://localhost:" + PORT + "/databinding/jibx");
+        bean.setResourceClass(JibxResource.class);
+        JibxResource client = bean.create(JibxResource.class);
+        org.apache.cxf.systest.jaxrs.codegen.jibx.Book b = client.getBook();
+        assertEquals("JIBX", b.getName());
+    }
+    
     @Test
     public void testGetBookAegis() throws Exception {
         WebClient client = WebClient.create("http://localhost:"

Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/resources/jaxrs_databinding/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/resources/jaxrs_databinding/WEB-INF/beans.xml?rev=1329279&r1=1329278&r2=1329279&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/resources/jaxrs_databinding/WEB-INF/beans.xml
(original)
+++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/resources/jaxrs_databinding/WEB-INF/beans.xml
Mon Apr 23 15:17:51 2012
@@ -55,6 +55,15 @@ http://cxf.apache.org/schemas/core.xsd">
       <bean class="org.apache.cxf.jaxb.JAXBDataBinding"/>
     </jaxrs:dataBinding> 
   </jaxrs:server>
+  <jaxrs:server id="jibx" address="/jibx">
+    <jaxrs:serviceBeans>
+      <bean class="org.apache.cxf.systest.jaxrs.jibx.JibxResource" />
+    </jaxrs:serviceBeans>		   
+    <jaxrs:dataBinding> 
+      <bean class="org.apache.cxf.jibx.JibxDataBinding"/>
+    </jaxrs:dataBinding> 
+  </jaxrs:server>
+  
   <jaxrs:server id="aegisbook" address="/aegis">
     <jaxrs:serviceBeans>
       <ref bean="serviceBean" />



Mime
View raw message