cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r595717 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/interceptor/ systests/src/test/java/org/apache/cxf/systest/fault/ testutils/ testutils/src/main/resources/wsdl/ tools/common/src/main/java/org/apache/...
Date Fri, 16 Nov 2007 16:18:47 GMT
Author: dkulp
Date: Fri Nov 16 08:18:45 2007
New Revision: 595717

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

........
  r595537 | ema | 2007-11-15 22:35:09 -0500 (Thu, 15 Nov 2007) | 2 lines
  
  Fixed issue [CXF-964]. Now client can unmarshal FaultBean which constructor arguments contains
primitive class
  Fixed wsdl2java usage xml 
........

Added:
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/fault/
      - copied from r595537, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/fault/GreeterImpl.java
      - copied unchanged from r595537, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/GreeterImpl.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/fault/IntFaultClientServerTest.java
      - copied unchanged from r595537, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/IntFaultClientServerTest.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/fault/Server.java
      - copied unchanged from r595537, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/Server.java
    incubator/cxf/branches/2.0.x-fixes/testutils/src/main/resources/wsdl/hello_world_fault.wsdl
      - copied unchanged from r595537, incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_fault.wsdl
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf964/
      - copied from r595537, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf964/
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf964/hello_world_fault.wsdl
      - copied unchanged from r595537, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf964/hello_world_fault.wsdl
Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
    incubator/cxf/branches/2.0.x-fixes/testutils/pom.xml
    incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaClass.java
    incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java
    incubator/cxf/branches/2.0.x-fixes/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java
    incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm
    incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.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/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java?rev=595717&r1=595716&r2=595717&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
Fri Nov 16 08:18:45 2007
@@ -146,7 +146,17 @@
                     e = constructor.newInstance(new Object[]{fault.getMessage()});
                 } else {
                     Class<?> beanClass = e.getClass();
-                    Constructor constructor = exClass.getConstructor(new Class[]{String.class,
beanClass});
+                    Constructor constructor = null;
+                    try {
+                        constructor = exClass.getConstructor(new Class[]{String.class, beanClass});
+                    } catch (NoSuchMethodException ex) {
+                        Class<?> cls = getPrimitiveClass(beanClass);
+                        if (cls != null) {
+                            constructor = exClass.getConstructor(new Class[]{String.class,
cls});
+                        } else {
+                            throw ex;
+                        }
+                    }
                     e = constructor.newInstance(new Object[]{fault.getMessage(), e});
                 }
                 msg.setContent(Exception.class, e);
@@ -201,5 +211,22 @@
             }
         }
 
+    }
+    
+    private Class<?> getPrimitiveClass(Class<?> cls) {
+        if (cls.isPrimitive()) {
+            return cls;
+        }
+        try {
+            Field field = cls.getField("TYPE");
+            Object obj = (Object)cls;
+            Object type = field.get(obj);
+            if (type instanceof Class) {
+                return (Class)type;
+            }
+        } catch (Exception e) {
+            // do nothing
+        }
+        return null;
     }
 }

Modified: incubator/cxf/branches/2.0.x-fixes/testutils/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/testutils/pom.xml?rev=595717&r1=595716&r2=595717&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/testutils/pom.xml (original)
+++ incubator/cxf/branches/2.0.x-fixes/testutils/pom.xml Fri Nov 16 08:18:45 2007
@@ -370,6 +370,9 @@
                                 <wsdlOption>
                                     <wsdl>${basedir}/src/main/resources/wsdl/inherit.wsdl</wsdl>
                                 </wsdlOption>
+                                <wsdlOption>
+                                    <wsdl>${basedir}/src/main/resources/wsdl/hello_world_fault.wsdl</wsdl>
+                                </wsdlOption>                                
 
                             </wsdlOptions>
                         </configuration>

Modified: incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaClass.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaClass.java?rev=595717&r1=595716&r2=595717&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaClass.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaClass.java
Fri Nov 16 08:18:45 2007
@@ -44,16 +44,16 @@
     }
 
     public JavaMethod appendGetter(JavaField field) {
-        String getterName = "get" + AnnotationUtil.capitalize(field.getName());
+        String getterName = "get" + StringUtils.capitalize(field.getParaName());
         JavaMethod jMethod = new JavaMethod(this);
         jMethod.setName(getterName);
-        jMethod.setReturn(new JavaReturn(field.getName(),
+        jMethod.setReturn(new JavaReturn(field.getParaName(),
                                          field.getType(),
                                          field.getTargetNamespace()));
 
         JavaCodeBlock block = new JavaCodeBlock();
         JavaExpression exp = new JavaExpression();
-        exp.setValue("return this." + field.getName());
+        exp.setValue("return this." + field.getParaName());
         block.getExpressions().add(exp);
 
         jMethod.setJavaCodeBlock(block);
@@ -63,16 +63,16 @@
     }
 
     public JavaMethod appendSetter(JavaField field) {
-        String setterName = "set" + AnnotationUtil.capitalize(field.getName());
+        String setterName = "set" + StringUtils.capitalize(field.getParaName());
         JavaMethod jMethod = new JavaMethod(this);
         jMethod.setReturn(new JavaReturn("return", "void", null));
-        String paramName = getSetterParamName(field.getName());
+        String paramName = getSetterParamName(field.getParaName());
         jMethod.addParameter(new JavaParameter(paramName,
                                                field.getType(),
                                                field.getTargetNamespace()));
         JavaCodeBlock block = new JavaCodeBlock();
         JavaExpression exp = new JavaExpression();
-        exp.setValue("this." + field.getName() + " = " + paramName);
+        exp.setValue("this." + field.getParaName() + " = " + paramName);
         block.getExpressions().add(exp);
 
         jMethod.setJavaCodeBlock(block);

Modified: incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java?rev=595717&r1=595716&r2=595717&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java
Fri Nov 16 08:18:45 2007
@@ -54,6 +54,13 @@
     }
 
     public String getName() {
+        /*if (URIParserUtil.containsReservedKeywords(this.name)) {
+            return "_" + this.name;
+        }*/
+        return this.name;
+    }
+    
+    public String getParaName() {
         if (URIParserUtil.containsReservedKeywords(this.name)) {
             return "_" + this.name;
         }

Modified: incubator/cxf/branches/2.0.x-fixes/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java?rev=595717&r1=595716&r2=595717&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/javato/test/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java
Fri Nov 16 08:18:45 2007
@@ -59,7 +59,7 @@
         Method method = (Method)opInfo.getProperty("operation.method");
 
         JavaField field  = responseWrapper.buildFields(method, message).get(0);
-        assertEquals("_return", field.getName());
+        assertEquals("_return", field.getParaName());
         assertEquals("String[]", field.getType());
 
         // Test int[]
@@ -71,7 +71,7 @@
         method = (Method) opInfo.getProperty("operation.method");
 
         field = responseWrapper.buildFields(method, message).get(0);
-        assertEquals("_return", field.getName());
+        assertEquals("_return", field.getParaName());
         assertEquals("int[]", field.getType());
 
         // Test TestDataBean[]
@@ -83,7 +83,7 @@
         method = (Method) opInfo.getProperty("operation.method");
 
         field = responseWrapper.buildFields(method, message).get(0);
-        assertEquals("_return", field.getName());
+        assertEquals("_return", field.getParaName());
         assertEquals("org.apache.cxf.tools.fortest.withannotation.doc.TestDataBean[]", field.getType());
     }
 

Modified: incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm?rev=595717&r1=595716&r2=595717&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm
Fri Nov 16 08:18:45 2007
@@ -38,7 +38,7 @@
 #if($field.Annotation)
 $field.Annotation
 #end
-    private $field.Type $field.Name;
+    private $field.Type $field.ParaName;
 #end
 
 #foreach ($method in $bean.Methods)

Modified: incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java?rev=595717&r1=595716&r2=595717&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java
Fri Nov 16 08:18:45 2007
@@ -59,7 +59,7 @@
         Method method = (Method)opInfo.getProperty("operation.method");
 
         JavaField field  = responseWrapper.buildFields(method, message).get(0);
-        assertEquals("_return", field.getName());
+        assertEquals("_return", field.getParaName());
         assertEquals("String[]", field.getType());
 
         // Test int[]
@@ -71,7 +71,7 @@
         method = (Method) opInfo.getProperty("operation.method");
 
         field = responseWrapper.buildFields(method, message).get(0);
-        assertEquals("_return", field.getName());
+        assertEquals("_return", field.getParaName());
         assertEquals("int[]", field.getType());
 
         // Test TestDataBean[]
@@ -83,7 +83,7 @@
         method = (Method) opInfo.getProperty("operation.method");
 
         field = responseWrapper.buildFields(method, message).get(0);
-        assertEquals("_return", field.getName());
+        assertEquals("_return", field.getParaName());
         assertEquals("org.apache.cxf.tools.fortest.withannotation.doc.TestDataBean[]", field.getType());
     }
 

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml?rev=595717&r1=595716&r2=595717&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
Fri Nov 16 08:18:45 2007
@@ -85,8 +85,7 @@
                 </annotation>
                 <switch>sn</switch>
                 <associatedArgument placement="afterSpace">
-                    <valuetype>NamingSpacePackageString</valuetype>
-                    <annotation>[wsdl namespace =]Package Name</annotation>
+                    <annotation>service-name</annotation>
                 </associatedArgument>
             </option>
 

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=595717&r1=595716&r2=595717&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Fri Nov 16 08:18:45 2007
@@ -26,6 +26,7 @@
 import java.lang.reflect.Modifier;
 import javax.jws.WebService;
 import javax.xml.namespace.QName;
+import javax.xml.ws.WebFault;
 import javax.xml.ws.WebServiceClient;
 
 import org.apache.cxf.common.i18n.Message;
@@ -888,5 +889,18 @@
         assertNotNull("Customized SEI class is not found", clz);
         Method customizedMethod = clz.getMethod("myGreetMe", new Class[] {String.class});
         assertNotNull("Customized method 'myGreetMe' in MyGreeter.class is not found", customizedMethod);
-    }  
+    }
+    
+    
+    @Test
+    public void testCXF964() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, 
+                getLocation("/wsdl2java_wsdl/cxf964/hello_world_fault.wsdl"));      
+        processor.setContext(env);
+        processor.execute();
+        Class<?> clz = classLoader.loadClass("org.apache.intfault.BadRecordLitFault");
+        WebFault webFault = AnnotationUtil.getPrivClassAnnotation(clz, WebFault.class);
+        assertEquals("int", webFault.name());
+    }
+    
 }



Mime
View raw message