cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1516754 - in /cxf/trunk: rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
Date Fri, 23 Aug 2013 08:57:48 GMT
Author: ema
Date: Fri Aug 23 08:57:48 2013
New Revision: 1516754

URL: http://svn.apache.org/r1516754
Log:
[CXF-5219]:Apply patch from Kyle and add testcase

Modified:
    cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
    cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java

Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java?rev=1516754&r1=1516753&r2=1516754&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
(original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
Fri Aug 23 08:57:48 2013
@@ -340,6 +340,14 @@ class JAXBContextInitializer extends Ser
             Field fields[] = ReflectionUtil.getDeclaredFields(cls); 
             for (Field f : fields) {
                 if (isFieldAccepted(f, accessType)) {
+                    XmlJavaTypeAdapter xjta = Utils.getFieldXJTA(f);
+                    if (xjta != null) {
+                        Type t = Utils.getTypeFromXmlAdapter(xjta);
+                        if (t != null) {
+                            addType(t);
+                            continue;
+                        }
+                    }
                     addType(f.getGenericType());
                 }
             }
@@ -350,6 +358,14 @@ class JAXBContextInitializer extends Ser
             Method methods[] = ReflectionUtil.getDeclaredMethods(cls); 
             for (Method m : methods) {
                 if (isMethodAccepted(m, accessType)) {
+                    XmlJavaTypeAdapter xjta = Utils.getMethodXJTA(m);
+                    if (xjta != null) {
+                        Type t = Utils.getTypeFromXmlAdapter(xjta);
+                        if (t != null) {
+                            addType(t);
+                            continue;
+                        }
+                    }
                     addType(m.getGenericReturnType());
                     for (Type t : m.getGenericParameterTypes()) {
                         addType(t);

Modified: cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?rev=1516754&r1=1516753&r2=1516754&view=diff
==============================================================================
--- cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
(original)
+++ cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
Fri Aug 23 08:57:48 2013
@@ -798,6 +798,28 @@ public class JavaToProcessorTest extends
 
     }
     
+    @Test
+    public void testExceptionTypeAdapter() throws Exception {
+        env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/exception-type-adapter.wsdl");
+        env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.exception.TypeAdapterEcho");
+        env.put(ToolConstants.CFG_VERBOSE, ToolConstants.CFG_VERBOSE);
+        try {
+            processor.setEnvironment(env);
+            processor.process();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        
+        File wsdlFile = new File(output, "exception-type-adapter.wsdl");
+        assertTrue(wsdlFile.exists());
+        String wsdlContent = getStringFromFile(wsdlFile).replaceAll("  ", " ");
+        int class2Element = wsdlContent.indexOf("<xs:complexType name=\"myClass2\">");
+        assertTrue(class2Element > -1);
+        int refElement = wsdlContent.indexOf("<xs:element name=\"adapted\" nillable=\"true\"
type=\"tns:myClass2\"/>");
+        assertTrue(refElement > -1);
+
+    }
+    
     
     @Test
     public void testCXF4877() throws Exception {



Mime
View raw message