cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r686839 - in /cxf/branches/2.0.x-fixes: ./ tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/
Date Mon, 18 Aug 2008 18:09:21 GMT
Author: dkulp
Date: Mon Aug 18 11:09:19 2008
New Revision: 686839

URL: http://svn.apache.org/viewvc?rev=686839&view=rev
Log:
Merged revisions 686827 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.1.x-fixes

................
  r686827 | dkulp | 2008-08-18 13:37:05 -0400 (Mon, 18 Aug 2008) | 9 lines
  
  Merged revisions 686820 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r686820 | dkulp | 2008-08-18 13:12:23 -0400 (Mon, 18 Aug 2008) | 2 lines
    
    [CXF-1752] Fix problems in generated wrapper types
  ........
................

Modified:
    cxf/branches/2.0.x-fixes/   (props changed)
    cxf/branches/2.0.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
    cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapperTest.java

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug 18 11:09:19 2008
@@ -1,3 +1,3 @@
-/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765
-/cxf/trunk:651669-686342,686344-686363,686764
+/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827
+/cxf/trunk:651669-686342,686344-686363,686764,686820
 /incubator/cxf/trunk:434594-651668

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Aug 18 11:09:19 2008
@@ -1 +1 @@
-/cxf/branches/2.1.x-fixes:1-686313,686315-686332,686334-686346,686348-686766
+/cxf/branches/2.1.x-fixes:1-686313,686315-686332,686334-686346,686348-686828

Modified: cxf/branches/2.0.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java?rev=686839&r1=686838&r2=686839&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
(original)
+++ cxf/branches/2.0.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
Mon Aug 18 11:09:19 2008
@@ -19,9 +19,11 @@
 
 package org.apache.cxf.tools.java2wsdl.processor.internal.jaxws;
 
+import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
+import javax.xml.ws.Holder;
 
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.service.model.MessageInfo;
@@ -58,16 +60,10 @@
         return buildFields(getMethod(), getOperationInfo().getUnwrappedOperation().getInput());
     }
     
-    protected List<JavaField> buildFields(final Method method, final MessageInfo message)
{
-        List<JavaField> fields = new ArrayList<JavaField>();
-        String name;
-        String type;
-
-        final Class[] paramClasses = method.getParameterTypes();
-        for (MessagePartInfo mpi : message.getMessageParts()) {
-            int idx = mpi.getIndex();
-            name = mpi.getName().getLocalPart();
-            Class clz = paramClasses[idx];
+    private String getTypeString(Type t) {
+        String type = "Object";
+        if (t instanceof Class) {
+            Class clz = (Class) t;
             if (clz.isArray()) {
                 if (isBuiltInTypes(clz.getComponentType())) {
                     type = clz.getComponentType().getSimpleName() + "[]";
@@ -77,10 +73,38 @@
             } else {
                 type = clz.getName();
             }
+        } else if (t instanceof ParameterizedType) {
+            ParameterizedType pt = (ParameterizedType) t;
+            Class c = (Class)pt.getRawType();
+            if (Holder.class.isAssignableFrom(c)
+                && pt.getActualTypeArguments().length == 1
+                && pt.getActualTypeArguments()[0] instanceof Class) {
+                type = getTypeString(pt.getActualTypeArguments()[0]);
+            } else {
+                type = t.toString();
+            }
+        } else if (t instanceof GenericArrayType) {
+            GenericArrayType gat = (GenericArrayType)t;
+            type = gat.toString();
+        }
+        type = type.replace('$', '.');
+        return type;
+    }
+    
+    
+    protected List<JavaField> buildFields(final Method method, final MessageInfo message)
{
+        List<JavaField> fields = new ArrayList<JavaField>();
+
+        final Type[] paramClasses = method.getGenericParameterTypes();
+        for (MessagePartInfo mpi : message.getMessageParts()) {
+            int idx = mpi.getIndex();
+            String name = mpi.getName().getLocalPart();
+            Type t = paramClasses[idx];
+            String type = getTypeString(t);
+
             JavaField field = new JavaField(name, type, "");
             field.setTargetNamespace("");
             fields.add(field);
-            
         }
 
         return fields;

Modified: cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapperTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapperTest.java?rev=686839&r1=686838&r2=686839&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapperTest.java
(original)
+++ cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapperTest.java
Mon Aug 18 11:09:19 2008
@@ -30,6 +30,7 @@
 import org.apache.cxf.tools.common.model.JavaField;
 import org.apache.cxf.tools.common.model.JavaMethod;
 import org.apache.cxf.tools.fortest.withannotation.doc.GreeterArray;
+import org.apache.cxf.tools.fortest.xmllist.AddNumbersPortType;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -164,4 +165,21 @@
         assertEquals(pkgName, wrapper.getJavaClass().getPackageName());
         assertEquals("SayHi", wrapper.getJavaClass().getName());
     }
+    
+    @Test
+    public void testCXF1752() throws Exception {
+        OperationInfo opInfo = getOperation(AddNumbersPortType.class, "testCXF1752");
+        RequestWrapper wrapper = new RequestWrapper();
+        wrapper.setOperationInfo(opInfo);
+        
+        wrapper.buildWrapperBeanClass();
+        List<JavaField> fields = wrapper.getJavaClass().getFields();
+        assertEquals(6, fields.size());
+        assertEquals("java.util.List<java.lang.Long>", fields.get(0).getClassName());
+        assertEquals("byte[]", fields.get(2).getClassName());
+        assertEquals("org.apache.cxf.tools.fortest.xmllist.AddNumbersPortType.UserObject[]",
+                     fields.get(3).getClassName());
+        assertEquals("java.util.List<org.apache.cxf.tools.fortest.xmllist.AddNumbersPortType.UserObject>",
+                     fields.get(4).getClassName());
+    }
 }



Mime
View raw message