cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r590796 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/databinding/jaxb/pom.xml rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBEncoderDecoderTest.java rt/databinding/jaxb/src/test/resources/wsdl/jaxb/form_test.xsd
Date Wed, 31 Oct 2007 19:36:57 GMT
Author: dkulp
Date: Wed Oct 31 12:36:56 2007
New Revision: 590796

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

........
  r590691 | bimargulies | 2007-10-31 10:54:45 -0400 (Wed, 31 Oct 2007) | 2 lines
  
  Add a test case to explore the handling of form= attributes in schema by jaxb. 
........

Added:
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/test/resources/wsdl/jaxb/form_test.xsd
      - copied unchanged from r590691, incubator/cxf/trunk/rt/databinding/jaxb/src/test/resources/wsdl/jaxb/form_test.xsd
Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/pom.xml
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBEncoderDecoderTest.java

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

Modified: incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/pom.xml?rev=590796&r1=590795&r2=590796&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/pom.xml (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/pom.xml Wed Oct 31 12:36:56 2007
@@ -69,6 +69,9 @@
                                 <xsdOption>
                                     <xsd>${basedir}/src/test/resources/wsdl/jaxb/misc_test.xsd</xsd>
                                 </xsdOption>
+                                <xsdOption>
+                                    <xsd>${basedir}/src/test/resources/wsdl/jaxb/form_test.xsd</xsd>
+                                </xsdOption>
                             </xsdOptions>
                         </configuration>
                         <goals>

Modified: incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBEncoderDecoderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBEncoderDecoderTest.java?rev=590796&r1=590795&r2=590796&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBEncoderDecoderTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBEncoderDecoderTest.java
Wed Oct 31 12:36:56 2007
@@ -22,6 +22,7 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
+import java.io.StringWriter;
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 
@@ -46,6 +47,7 @@
 
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.jaxb_form.ObjectWithQualifiedElement;
 import org.apache.cxf.jaxb_misc.Base64WithDefaultValueType;
 import org.apache.cxf.jaxb_misc.ObjectFactory;
 import org.apache.cxf.service.model.MessagePartInfo;
@@ -87,7 +89,8 @@
         context = JAXBContext.newInstance(new Class[] {
             GreetMe.class,
             GreetMeResponse.class,
-            StringStruct.class
+            StringStruct.class,
+            ObjectWithQualifiedElement.class
         });
         Method method = TestUtil.getMethod(Greeter.class, "greetMe");
         wrapperAnnotation = method.getAnnotation(RequestWrapper.class);
@@ -151,6 +154,31 @@
         } catch (Fault ex) {
             //expected - not a valid object
         }
+    }
+    
+    @Test
+    public void testMarshallWithFormQualifiedElement() throws Exception {
+        ObjectWithQualifiedElement testObject = new ObjectWithQualifiedElement();
+        testObject.setString1("twine");
+        testObject.setString2("cord");
+        
+        QName elName = new QName(wrapperAnnotation.targetNamespace(),
+                                 wrapperAnnotation.localName());
+        MessagePartInfo part = new MessagePartInfo(elName, null);
+        part.setElement(true);
+        part.setElementQName(elName);
+        
+        StringWriter stringWriter = new StringWriter();
+        XMLOutputFactory opFactory = XMLOutputFactory.newInstance();
+        opFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+        XMLEventWriter writer = opFactory.createXMLEventWriter(stringWriter);
+        JAXBEncoderDecoder.marshall(context, null, testObject, part, writer);
+        writer.flush();
+        writer.close();
+        String xmlResult = stringWriter.toString();
+        // the following is a bit of a crock, but, to tell the truth, this test case most
exists
+        // so that it could be examined inside the debugger to see how JAXB works.
+        assertTrue(xmlResult.contains("ns3:string2"));
     }
 
     @Test



Mime
View raw message