cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r609520 - in /incubator/cxf/trunk/tools: common/src/main/java/org/apache/cxf/tools/common/model/ wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ wsdlto/frontend/jaxws/src/main/java/org/apac...
Date Mon, 07 Jan 2008 06:10:29 GMT
Author: ema
Date: Sun Jan  6 22:10:27 2008
New Revision: 609520

URL: http://svn.apache.org/viewvc?rev=609520&view=rev
Log:
[cxf-1354]Generate @XmlList annotation for a RPC Literal SEI when the wsdl:part type is <xs:list>


Added:
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlListAnotator.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1354/
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1354/string_array_test.wsdl
Modified:
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java?rev=609520&r1=609519&r2=609520&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
(original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
Sun Jan  6 22:10:27 2008
@@ -287,8 +287,10 @@
         StringBuffer sb = new StringBuffer();
         for (int i = 0; i < parameters.size(); i++) {
             JavaParameter parameter = parameters.get(i);
-            if (includeAnnotation && parameter.getAnnotation() != null) {
-                list.add(parameter.getAnnotation().toString());
+            if (includeAnnotation && parameter.getAnnotations().size() > 0) {
+                for (JAnnotation jan : parameter.getAnnotations()) {
+                    list.add(jan.toString());
+                }
             }
             sb.setLength(0);
             if (parameter.isHolder()) {

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java?rev=609520&r1=609519&r2=609520&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java
(original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java
Sun Jan  6 22:10:27 2008
@@ -19,21 +19,24 @@
 
 package org.apache.cxf.tools.common.model;
 
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
 
 public class JavaParameter extends JavaType implements JavaAnnotatable {
 
     private boolean holder;
     private String holderName;
-    private JAnnotation annotation;
     private String partName;
 
     private JavaMethod javaMethod;
+    private Map<String, JAnnotation> annotations = new HashMap<String, JAnnotation>();
 
     /**
      * Describe callback here.
      */
     private boolean callback;
-    
+
     public JavaParameter() {
     }
 
@@ -57,25 +60,31 @@
         this.holderName = hn;
     }
 
-    public void setAnnotation(JAnnotation anno) {
-        this.annotation = anno;
-        for (String importClz : annotation.getImports()) {
-            getMethod().getInterface().addImport(importClz);
-        }        
+    public void addAnnotation(String tag, JAnnotation ann) {
+        if (ann == null) {
+            return;
+        }
+        this.annotations.put(tag, ann);
+
     }
+    
+    public JAnnotation getAnnotation(String tag) {
+        return annotations.get(tag);
+    }
+    
 
-    public JAnnotation getAnnotation() {
-        return this.annotation;
+    public Collection<JAnnotation> getAnnotations() {
+        return this.annotations.values();
     }
 
     public void setPartName(String name) {
         this.partName = name;
     }
-    
+
     public String getPartName() {
         return this.partName;
     }
-    
+
     public String toString() {
         final StringBuffer sb = new StringBuffer();
         sb.append(super.toString());
@@ -86,14 +95,12 @@
         if (isHeader()) {
             sb.append("\nIS Header");
         }
-        sb.append("\n Annotation:");
-        sb.append(annotation);
-        
+
         sb.append("\n PartName");
         sb.append(partName);
         return sb.toString();
     }
-    
+
     public void setMethod(JavaMethod jm) {
         this.javaMethod = jm;
     }
@@ -108,7 +115,7 @@
 
     /**
      * Get the <code>Callback</code> value.
-     *
+     * 
      * @return a <code>boolean</code> value
      */
     public final boolean isCallback() {
@@ -117,7 +124,7 @@
 
     /**
      * Set the <code>Callback</code> value.
-     *
+     * 
      * @param newCallback The new Callback value.
      */
     public final void setCallback(final boolean newCallback) {

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java?rev=609520&r1=609519&r2=609520&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
Sun Jan  6 22:10:27 2008
@@ -205,7 +205,7 @@
         JAnnotation asyncHandlerAnnotation = new JAnnotation(WebParam.class);
         asyncHandlerAnnotation.addElement(new JAnnotationElement("name", "asyncHandler"));
         asyncHandlerAnnotation.addElement(new JAnnotationElement("targetNamespace", ""));
-        asyncHandler.setAnnotation(asyncHandlerAnnotation);                
+        asyncHandler.addAnnotation("WebParam", asyncHandlerAnnotation);                
 
         method.getInterface().addMethod(callbackMethod);
     }

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java?rev=609520&r1=609519&r2=609520&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
Sun Jan  6 22:10:27 2008
@@ -43,7 +43,10 @@
 import org.apache.cxf.tools.common.model.JavaType;
 import org.apache.cxf.tools.wsdlto.core.DataBindingProfile;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.WebParamAnnotator;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.XmlListAnotator;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.mapper.ParameterMapper;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaSimpleTypeList;
 
 public class ParameterProcessor extends AbstractProcessor {
     public static final String HEADER = "messagepart.isheader";
@@ -94,11 +97,11 @@
                                                  MessagePartInfo part,
                                                  JavaType.Style style)
         throws ToolException {
-        return addParameter(method, getParameterFromPart(part, style));
+        return addParameter(method, getParameterFromPart(method, part, style));
     }
 
-    private JavaParameter getParameterFromPart(MessagePartInfo part, JavaType.Style style)
{
-        return ParameterMapper.map(part, style, context);
+    private JavaParameter getParameterFromPart(JavaMethod jm, MessagePartInfo part, JavaType.Style
style) {
+        return ParameterMapper.map(jm, part, style, context);
     }
 
     protected JavaParameter addParameter(JavaMethod method, JavaParameter parameter) throws
ToolException {
@@ -127,6 +130,14 @@
         if (namespace != null && type != null && !"void".equals(type)) {
             returnType.setClassName(ProcessorUtil.getFullClzName(part, context, false));
         }
+        
+        if (part != null && part.getXmlSchema() instanceof XmlSchemaSimpleType) {
+            XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)part.getXmlSchema();
+            if (simpleType.getContent() instanceof XmlSchemaSimpleTypeList && !part.isElement())
{
+                method.annotate(new XmlListAnotator(method.getInterface()));
+            }
+        }
+        
         method.setReturn(returnType);
     }
 
@@ -170,7 +181,7 @@
             if (isOutOfBandHeader(part) && !requireOutOfBandHeader()) {
                 continue;
             }
-            addParameter(method, getParameterFromPart(part, JavaType.Style.IN));
+            addParameter(method, getParameterFromPart(method, part, JavaType.Style.IN));
         }
     }
 
@@ -207,7 +218,7 @@
                 if (!isOutOfBandHeader(hpart)) {
                     continue;
                 }
-                addParameter(method, getParameterFromPart(hpart, JavaType.Style.IN));
+                addParameter(method, getParameterFromPart(method, hpart, JavaType.Style.IN));
             }
         }
     }
@@ -227,7 +238,7 @@
                     outParts.add(outpart);
                     continue;
                 } else if (isSamePart(inpart, outpart)) {
-                    addParameter(method, getParameterFromPart(outpart, JavaType.Style.INOUT));
+                    addParameter(method, getParameterFromPart(method, outpart, JavaType.Style.INOUT));
                     continue;
                 } else if (!isSamePart(inpart, outpart)) {
                     outParts.add(outpart);
@@ -244,7 +255,7 @@
         }
         if (isRequestResponse(method)) {
             for (MessagePartInfo part : outParts) {
-                addParameter(method, getParameterFromPart(part, JavaType.Style.OUT));
+                addParameter(method, getParameterFromPart(method, part, JavaType.Style.OUT));
             }
         }
     }
@@ -261,7 +272,7 @@
                 if (!isOutOfBandHeader(hpart) || !requireOutOfBandHeader()) {
                     continue;
                 }
-                addParameter(method, getParameterFromPart(hpart, JavaType.Style.OUT));
+                addParameter(method, getParameterFromPart(method, hpart, JavaType.Style.OUT));
             }
         }
     }
@@ -545,17 +556,17 @@
                 style = JavaType.Style.INOUT;
             }
             if (part != null) {
-                addParameter(method, getParameterFromPart(part, style));
+                addParameter(method, getParameterFromPart(method, part, style));
             }
             index++;
         }
         // now from unlisted input parts
         for (MessagePartInfo part : inputUnlistedParts) {
-            addParameter(method, getParameterFromPart(part, JavaType.Style.IN));
+            addParameter(method, getParameterFromPart(method, part, JavaType.Style.IN));
         }
         // now from unlisted output parts
         for (MessagePartInfo part : outputUnlistedParts) {
-            addParameter(method, getParameterFromPart(part, JavaType.Style.INOUT));
+            addParameter(method, getParameterFromPart(method, part, JavaType.Style.INOUT));
         }
     }
 

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java?rev=609520&r1=609519&r2=609520&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
Sun Jan  6 22:10:27 2008
@@ -391,7 +391,7 @@
 
     private void setParameterAsHeader(JavaParameter parameter) {
         parameter.setHeader(true);
-        JAnnotation parameterAnnotation = parameter.getAnnotation();
+        JAnnotation parameterAnnotation = parameter.getAnnotation("WebParam");
         parameterAnnotation.addElement(new JAnnotationElement("header", true, true));
         parameterAnnotation.addElement(new JAnnotationElement("name", 
                                                                      parameter.getQName().getLocalPart()));

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java?rev=609520&r1=609519&r2=609520&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotator.java
Sun Jan  6 22:10:27 2008
@@ -83,8 +83,10 @@
             webParamAnnotation.addElement(new JAnnotationElement("targetNamespace", 
                                                                         targetNamespace));
       
         }
-
-        parameter.setAnnotation(webParamAnnotation);
+        for (String importClz : webParamAnnotation.getImports()) {
+            parameter.getMethod().getInterface().addImport(importClz);
+        }
+        parameter.addAnnotation("WebParam", webParamAnnotation);
     }
 }
 

Added: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlListAnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlListAnotator.java?rev=609520&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlListAnotator.java
(added)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlListAnotator.java
Sun Jan  6 22:10:27 2008
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
+
+import javax.xml.bind.annotation.XmlList;
+
+import org.apache.cxf.tools.common.model.Annotator;
+import org.apache.cxf.tools.common.model.JAnnotation;
+import org.apache.cxf.tools.common.model.JavaAnnotatable;
+import org.apache.cxf.tools.common.model.JavaInterface;
+import org.apache.cxf.tools.common.model.JavaMethod;
+import org.apache.cxf.tools.common.model.JavaParameter;
+
+public class XmlListAnotator implements Annotator {
+    private JavaInterface jf;
+
+    public XmlListAnotator(JavaInterface intf) {
+        jf = intf;
+    }
+
+    public void annotate(JavaAnnotatable jn) {
+        
+        JAnnotation jaxbAnnotation = new JAnnotation(XmlList.class);
+        if (jn instanceof JavaParameter) {
+            JavaParameter jp = (JavaParameter)jn;
+            jp.addAnnotation("XmlList", jaxbAnnotation);
+        } else if (jn instanceof JavaMethod) {
+            JavaMethod jm = (JavaMethod)jn;
+            jm.addAnnotation("XmlList", jaxbAnnotation);
+        } else {
+            throw new RuntimeException("XmlList can only annotate to JavaParameter or JavaMethod");
+        }
+        
+        jf.addImport(XmlList.class.getName());
+
+    }
+
+}

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java?rev=609520&r1=609519&r2=609520&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/mapper/ParameterMapper.java
Sun Jan  6 22:10:27 2008
@@ -22,9 +22,13 @@
 import org.apache.cxf.jaxb.JAXBUtils;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.common.model.JavaMethod;
 import org.apache.cxf.tools.common.model.JavaParameter;
 import org.apache.cxf.tools.common.model.JavaType;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.XmlListAnotator;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaSimpleTypeList;
 
 
 public final class ParameterMapper {
@@ -32,13 +36,20 @@
     private ParameterMapper() {
     }
     
-    public static JavaParameter map(MessagePartInfo part, JavaType.Style style, ToolContext
context) {
+    public static JavaParameter map(JavaMethod jm, MessagePartInfo part, 
+                                    JavaType.Style style, ToolContext context) {
         String name = ProcessorUtil.mangleNameToVariableName(part.getName().getLocalPart());
         String namespace = ProcessorUtil.resolvePartNamespace(part);
         String type = ProcessorUtil.resolvePartType(part, context);
         
         JavaParameter parameter = new JavaParameter(name, type, namespace);
         parameter.setPartName(part.getName().getLocalPart());
+        if (part.getXmlSchema() instanceof XmlSchemaSimpleType) {
+            XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)part.getXmlSchema();
+            if (simpleType.getContent() instanceof XmlSchemaSimpleTypeList && !part.isElement())
{
+                parameter.annotate(new XmlListAnotator(jm.getInterface()));
+            }
+        }
         parameter.setQName(ProcessorUtil.getElementName(part));
         parameter.setDefaultValueWriter(ProcessorUtil.getDefaultValueWriter(part, context));
         String fullJavaName = ProcessorUtil.getFullClzName(part, context, false);
@@ -55,6 +66,7 @@
             parameter.setClassName(holderClass);
         }
         parameter.setStyle(style);
+        
         return parameter;
     }
 

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java?rev=609520&r1=609519&r2=609520&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java
Sun Jan  6 22:10:27 2008
@@ -59,7 +59,7 @@
         init(method, parameter, SOAPBinding.Style.DOCUMENT, true);
         parameter.annotate(new WebParamAnnotator());
 
-        JAnnotation annotation = parameter.getAnnotation();
+        JAnnotation annotation = parameter.getAnnotation("WebParam");
         assertEquals("@WebParam(name = \"x\", targetNamespace = \"http://apache.org/cxf\")",

                          annotation.toString());
         List<JAnnotationElement> elements = annotation.getElements();
@@ -78,7 +78,7 @@
 
         parameter.annotate(new WebParamAnnotator());
 
-        JAnnotation annotation = parameter.getAnnotation();
+        JAnnotation annotation = parameter.getAnnotation("WebParam");
         assertEquals("@WebParam(partName = \"y\", name = \"x\", " 
                      + "targetNamespace = \"http://apache.org/cxf\")", 
                          annotation.toString());
@@ -95,7 +95,7 @@
     public void testAnnotateRPC() throws Exception {
         init(method, parameter, SOAPBinding.Style.RPC, true);
         parameter.annotate(new WebParamAnnotator());
-        JAnnotation annotation = parameter.getAnnotation();
+        JAnnotation annotation = parameter.getAnnotation("WebParam");
         assertEquals(2, annotation.getElements().size());
         assertEquals("@WebParam(partName = \"y\", name = \"y\")",
                      annotation.toString());

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=609520&r1=609519&r2=609520&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Sun Jan  6 22:10:27 2008
@@ -33,6 +33,7 @@
 import javax.jws.WebResult;
 import javax.jws.WebService;
 import javax.jws.soap.SOAPBinding;
+import javax.xml.bind.annotation.XmlList;
 import javax.xml.ws.Holder;
 import javax.xml.ws.RequestWrapper;
 import javax.xml.ws.ResponseWrapper;
@@ -1183,5 +1184,25 @@
         processor.setContext(env);
         processor.execute();
     }
+    
+    @Test
+    public void testGenerateXmlListAnno() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf-1354/string_array_test.wsdl"));
+        processor.setContext(env);
+        processor.execute();
+        
+        Class sei =  classLoader.loadClass("org.apache.stringarray.StringListTest");
+        Method method = sei.getMethods()[0];
+        assertNotNull("@XmlList is not generated for method", method.getAnnotation(XmlList.class));
+        boolean xmlListGenerated = false;
+        for (Annotation ann : method.getParameterAnnotations()[0]) {
+            if (ann instanceof XmlList) {
+                xmlListGenerated = true;
+            }
+        }
+        assertTrue("@XmlList is not generated for paramter", xmlListGenerated);
+        
+    }
+    
     
 }

Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1354/string_array_test.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1354/string_array_test.wsdl?rev=609520&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1354/string_array_test.wsdl
(added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf-1354/string_array_test.wsdl
Sun Jan  6 22:10:27 2008
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	Licensed to the Apache Software Foundation (ASF) under one
+	or more contributor license agreements. See the NOTICE file
+	distributed with this work for additional information
+	regarding copyright ownership. The ASF licenses this file
+	to you under the Apache License, Version 2.0 (the
+	"License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0
+	
+	Unless required by applicable law or agreed to in writing,
+	software distributed under the License is distributed on an
+	"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+	KIND, either express or implied. See the License for the
+	specific language governing permissions and limitations
+	under the License.
+-->
+<wsdl:definitions name="HelloWorld"
+	targetNamespace="http://apache.org/stringarray"
+	xmlns="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+	xmlns:tns="http://apache.org/stringarray"
+	xmlns:x1="http://apache.org/stringarray/types"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+	<wsdl:types>
+		<schema targetNamespace="http://apache.org/stringarray/types"
+			xmlns="http://www.w3.org/2001/XMLSchema"
+			elementFormDefault="qualified">
+			  <simpleType name="StringListType">
+			    <list itemType="string" />
+                          </simpleType>
+                          <simpleType name="IntegerRangeType">
+			      <restriction base="integer">
+			        <minInclusive value="100" />
+			        <maxInclusive value="99999999999999999999999999999999999999999999999" />
+			      </restriction>
+                       </simpleType>
+		</schema>
+	</wsdl:types>
+
+	<wsdl:message name="StringListRequest">
+		<wsdl:part type="x1:StringListType" name="in"/>
+	</wsdl:message>
+
+	<wsdl:message name="IntegerRangeResponse">
+		<wsdl:part type="x1:StringListType" name="out"/>
+	</wsdl:message>
+
+	<wsdl:portType name="StringListTest">
+		<wsdl:operation name="StringListTest">
+			<wsdl:input message="tns:StringListRequest"
+				name="stringListRequest" />
+			<wsdl:output message="tns:IntegerRangeResponse"
+				name="integerRangeResponse" />
+		</wsdl:operation>
+
+	</wsdl:portType>
+
+	<wsdl:binding name="Test_SOAPBinding_RPCLit"
+		type="tns:StringListTest">
+
+		<soap:binding style="rpc"
+			transport="http://schemas.xmlsoap.org/soap/http" />
+
+		<wsdl:operation name="StringListTest">
+			<soap:operation soapAction="" style="rpc" />
+			<wsdl:input>
+				<soap:body namespace="http://apache.org/stringarray"
+					use="literal" />
+			</wsdl:input>
+			<wsdl:output>
+				<soap:body namespace="http://apache.org/stringarray"
+					use="literal" />
+			</wsdl:output>
+		</wsdl:operation>
+	</wsdl:binding>
+
+	<wsdl:service name="SOAPServiceRPCLit">
+		<wsdl:port binding="tns:Test_SOAPBinding_RPCLit"
+			name="SoapPortRPCLit">
+			<soap:address
+				location="http://localhost:9992/SOAPServiceRPCLit/SoapPort" />
+		</wsdl:port>
+	</wsdl:service>
+</wsdl:definitions>



Mime
View raw message