cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r580028 - in /incubator/cxf/trunk: distribution/src/main/release/samples/integration/jca/outbound/src/demo/servlet/ rt/core/src/main/java/org/apache/cxf/wsdl11/ tools/common/src/main/java/org/apache/cxf/tools/common/model/ tools/common/src/...
Date Thu, 27 Sep 2007 14:40:30 GMT
Author: mmao
Date: Thu Sep 27 07:40:23 2007
New Revision: 580028

URL: http://svn.apache.org/viewvc?rev=580028&view=rev
Log:
CXF-991 JaxWs2.1 - XmlSeeAlso, tools wsdltojava part

Also fixed:
* If the complextType is abstract, then the parameter is not wrapped style
* JavaAnnotation support enum of classes
* Fix the checks of a sample


Added:
    incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaAnnotationTest.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotator.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotatorTest.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/types/
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/types/A.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/types/ObjectFactory.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cardealer.wsdl
Modified:
    incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/outbound/src/demo/servlet/HelloWorldServlet.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaAnnotation.java
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/ClassCollector.java
    incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/ClassNameAllocatorImpl.java
    incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_sayHi

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/outbound/src/demo/servlet/HelloWorldServlet.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/outbound/src/demo/servlet/HelloWorldServlet.java?rev=580028&r1=580027&r2=580028&view=diff
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/outbound/src/demo/servlet/HelloWorldServlet.java
(original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/outbound/src/demo/servlet/HelloWorldServlet.java
Thu Sep 27 07:40:23 2007
@@ -81,7 +81,10 @@
 
         // create the connection 
         //
-        CXFConnectionRequestInfo requestInfo = new CXFConnectionRequestInfo(Greeter.class,
wsdlLocation, serviceName, portName);
+        CXFConnectionRequestInfo requestInfo = new CXFConnectionRequestInfo(Greeter.class,

+                                                                            wsdlLocation,

+                                                                            serviceName,

+                                                                            portName);
         return (Connection)factory.getConnection(requestInfo);
     }
 

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=580028&r1=580027&r2=580028&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
Thu Sep 27 07:40:23 2007
@@ -703,6 +703,9 @@
 
             if (outputEl != null && outputEl.getSchemaType() instanceof XmlSchemaComplexType)
{
                 xsct = (XmlSchemaComplexType)outputEl.getSchemaType();
+                if (xsct.isAbstract()) {
+                    passedRule = false;
+                }
                 if (hasAttributes(xsct)
                     || !isWrappableSequence(xsct, outputEl.getQName().getNamespaceURI(),
unwrappedOutput,
                                             allowRefs)) {

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaAnnotation.java?rev=580028&r1=580027&r2=580028&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaAnnotation.java
(original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaAnnotation.java
Thu Sep 27 07:40:23 2007
@@ -19,7 +19,10 @@
 
 package org.apache.cxf.tools.common.model;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import org.apache.cxf.common.util.StringUtils;
 
@@ -29,6 +32,8 @@
     private String tagName;
     private final Map<String, String>  arguments = new HashMap<String, String>();
 
+    private final List<String> classList = new ArrayList<String>();
+
     public JavaAnnotation() {
     }
 
@@ -36,6 +41,10 @@
         this.tagName = tn;
     }
 
+    public List<String> getClassList() {
+        return classList;
+    }
+
     public void addArgument(String key, String value, String quote) {
         if (!StringUtils.isEmpty(value)) {
             arguments.put(key, quote + value + quote);
@@ -56,10 +65,7 @@
         return arguments;
     }
 
-    public String toString() {
-        StringBuffer sb = new StringBuffer();
-        sb.append("@");
-        sb.append(this.tagName);
+    private void nameValueStyle(final StringBuffer sb) {
         Object[] keys = arguments.keySet().toArray();
         if (keys.length > 0) {
             sb.append("(");
@@ -81,6 +87,31 @@
             }
             sb.append(")");
         }
+    }
+
+    private void enumStyle(final StringBuffer sb) {
+        sb.append("({");
+        for (int i = 0; i < classList.size(); i++) {
+            String cls = classList.get(i);
+            sb.append(cls);
+            sb.append(".class");
+            if (i < classList.size() - 1) {
+                sb.append(",");
+            }
+        }
+        sb.append("})");
+    }
+
+    public String toString() {
+        StringBuffer sb = new StringBuffer();
+        sb.append("@");
+        sb.append(this.tagName);
+        if (arguments.size() > 0) {
+            nameValueStyle(sb);
+        } else if (classList.size() > 0) {
+            enumStyle(sb);
+        }
+
         return sb.toString();
     }
 }

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/ClassCollector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/ClassCollector.java?rev=580028&r1=580027&r2=580028&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/ClassCollector.java
(original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/ClassCollector.java
Thu Sep 27 07:40:23 2007
@@ -21,8 +21,10 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 public class ClassCollector {
 
@@ -33,7 +35,8 @@
     private final Map<String, String> implClassNames = new HashMap<String, String>();
     private final Map<String, String> clientClassNames = new HashMap<String, String>();
     private final Map<String, String> serverClassNames = new HashMap<String, String>();
-    
+
+    private final Set<String> typesFactory = new HashSet<String>();
 
     public boolean containSeiClass(String packagename, String type) {
         return seiClassNames.containsKey(key(packagename, type));
@@ -83,6 +86,10 @@
         return packagename + "#" + type;
     }
 
+    public Set<String> getTypesFactory() {
+        return typesFactory;
+    }
+
     public List<String> getGeneratedFileInfo() {
         List<String> generatedFileList = new ArrayList<String>();
         generatedFileList.addAll(seiClassNames.values());
@@ -94,4 +101,4 @@
         return generatedFileList;
     }
 
-}
\ No newline at end of file
+}

Added: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaAnnotationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaAnnotationTest.java?rev=580028&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaAnnotationTest.java
(added)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaAnnotationTest.java
Thu Sep 27 07:40:23 2007
@@ -0,0 +1,32 @@
+/**
+ * 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.common.model;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class JavaAnnotationTest extends Assert {
+    @Test
+    public void testEnum() throws Exception {
+        JavaAnnotation annotation = new JavaAnnotation("XmlSeeAlso");
+        annotation.getClassList().add("XmlSeeAlso");
+        assertEquals("@XmlSeeAlso({XmlSeeAlso.class})", annotation.toString());
+    }
+}

Modified: incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/ClassNameAllocatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/ClassNameAllocatorImpl.java?rev=580028&r1=580027&r2=580028&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/ClassNameAllocatorImpl.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/ClassNameAllocatorImpl.java
Thu Sep 27 07:40:23 2007
@@ -20,7 +20,6 @@
 package org.apache.cxf.tools.wsdlto.databinding.jaxb;
 
 import com.sun.tools.xjc.api.ClassNameAllocator;
-
 import org.apache.cxf.tools.util.ClassCollector;
 
 public class ClassNameAllocatorImpl implements ClassNameAllocator {
@@ -41,6 +40,7 @@
         if (isNameCollision(packageName, className)) {
             fullClzName = className + TYPE_SUFFIX;
         }
+
         collector.addTypesClassName(packageName, className, packageName + "." + fullClzName);
         return fullClzName;
     }

Modified: incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=580028&r1=580027&r2=580028&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Thu Sep 27 07:40:23 2007
@@ -297,6 +297,14 @@
 
             if (rawJaxbModelGenCode instanceof S2JJAXBModel) {
                 S2JJAXBModel schem2JavaJaxbModel = (S2JJAXBModel)rawJaxbModelGenCode;
+
+                ClassCollector classCollector = context.get(ClassCollector.class);
+                for (String cls : schem2JavaJaxbModel.getClassList()) {
+                    if (cls.endsWith("ObjectFactory")) {
+                        classCollector.getTypesFactory().add(cls);
+                    }
+                }
+
                 JCodeModel jcodeModel = schem2JavaJaxbModel.generateCode(null, null);
 
                 if (!isSuppressCodeGen()) {
@@ -304,6 +312,7 @@
                 }
 
                 context.put(JCodeModel.class, jcodeModel);
+
                 for (String str : fileCodeWriter.getExcludeFileList()) {
                     context.getExcludeFileList().add(str);
                 }

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.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/WSDLToJavaProcessor.java?rev=580028&r1=580027&r2=580028&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
Thu Sep 27 07:40:23 2007
@@ -24,7 +24,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.i18n.Message;
@@ -34,11 +33,13 @@
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.common.model.JavaInterface;
 import org.apache.cxf.tools.common.model.JavaModel;
+import org.apache.cxf.tools.util.ClassCollector;
 import org.apache.cxf.tools.wsdlto.core.WSDLToProcessor;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.PortTypeProcessor;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ServiceProcessor;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.BindingAnnotator;
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.WebServiceAnnotator;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.XmlSeeAlsoAnnotator;
 
 public class WSDLToJavaProcessor extends WSDLToProcessor implements ClassNameProcessor {
     private static final String MODEL_MAP = WSDLToProcessor.class.getName() 
@@ -92,6 +93,7 @@
         for (JavaInterface intf : javaModel.getInterfaces().values()) {
             if (!interfaces.contains(intf)) {
                 intf.annotate(new WebServiceAnnotator());
+                intf.annotate(new XmlSeeAlsoAnnotator(context.get(ClassCollector.class)));
                 if (serviceInfo.getBindings().size() > 0) {
                     intf.annotate(new BindingAnnotator());
                 }

Added: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotator.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/XmlSeeAlsoAnnotator.java?rev=580028&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotator.java
(added)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotator.java
Thu Sep 27 07:40:23 2007
@@ -0,0 +1,60 @@
+/**
+ * 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 org.apache.cxf.tools.common.model.Annotator;
+import org.apache.cxf.tools.common.model.JavaAnnotatable;
+import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JavaInterface;
+import org.apache.cxf.tools.util.ClassCollector;
+
+public final class XmlSeeAlsoAnnotator implements Annotator {
+    private ClassCollector collector;
+
+    public XmlSeeAlsoAnnotator(ClassCollector c) {
+        this.collector = c;
+    }
+    
+    public void annotate(JavaAnnotatable  ja) {
+        if (collector == null || collector.getTypesFactory().isEmpty()) {
+            return;
+        }
+
+        JavaInterface intf = null;
+        if (ja instanceof JavaInterface) {
+            intf = (JavaInterface) ja;
+        } else {
+            throw new RuntimeException("XmlSeeAlso can only annotate JavaInterface");
+        }
+
+        JavaAnnotation jaxbAnnotation = new JavaAnnotation("XmlSeeAlso");
+        intf.addImport("javax.xml.bind.annotation.XmlSeeAlso");
+        
+        for (String factory : collector.getTypesFactory()) {
+            if ((intf.getPackageName() + ".ObjectFactory").equals(factory)) {
+                jaxbAnnotation.getClassList().add("ObjectFactory");
+            } else {
+                jaxbAnnotation.getClassList().add(factory);
+            }
+        }
+        intf.addAnnotation(jaxbAnnotation.toString());
+    }
+}
+

Added: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotatorTest.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/XmlSeeAlsoAnnotatorTest.java?rev=580028&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotatorTest.java
(added)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/XmlSeeAlsoAnnotatorTest.java
Thu Sep 27 07:40:23 2007
@@ -0,0 +1,47 @@
+/**
+ * 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 java.util.Iterator;
+
+import org.apache.cxf.tools.common.model.JavaInterface;
+import org.apache.cxf.tools.util.ClassCollector;
+import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.types.ObjectFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class XmlSeeAlsoAnnotatorTest extends Assert {
+
+    @Test
+    public void testAddXmlSeeAlsoAnnotation() throws Exception {
+        JavaInterface intf = new JavaInterface();
+        assertFalse(intf.getImports().hasNext());
+
+        ClassCollector collector = new ClassCollector();
+        collector.getTypesFactory().add(ObjectFactory.class.getName());
+        intf.annotate(new XmlSeeAlsoAnnotator(collector));
+
+        Iterator iter = intf.getImports();
+        assertEquals("javax.xml.bind.annotation.XmlSeeAlso", iter.next());
+     
+        assertEquals("@XmlSeeAlso({" + ObjectFactory.class.getName() + ".class})", 
+                     intf.getAnnotations().iterator().next());
+    }
+}

Added: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/types/A.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/types/A.java?rev=580028&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/types/A.java
(added)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/types/A.java
Thu Sep 27 07:40:23 2007
@@ -0,0 +1,24 @@
+/**
+ * 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.types;
+
+public class A {
+    // a dummy type class
+}

Added: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/types/ObjectFactory.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/types/ObjectFactory.java?rev=580028&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/types/ObjectFactory.java
(added)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/types/ObjectFactory.java
Thu Sep 27 07:40:23 2007
@@ -0,0 +1,24 @@
+/**
+ * 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.types;
+
+public class ObjectFactory {
+    // a dummy ObjectFactory class
+}

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=580028&r1=580027&r2=580028&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Thu Sep 27 07:40:23 2007
@@ -178,16 +178,13 @@
         assertTrue("Generate " + clz.getName() + "error", clz.isInterface());
     }
 
-
-
-
     @Test
     public void testBug305772() throws Exception {
         env.put(ToolConstants.CFG_COMPILE, "compile");
         env.put(ToolConstants.CFG_ANT, ToolConstants.CFG_ANT);
         env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
         env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
-        // env.put(ToolConstants.CFG_CLIENT, ToolConstants.CFG_CLIENT);
+        env.put(ToolConstants.CFG_CLIENT, ToolConstants.CFG_CLIENT);
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/bug305772/hello_world.wsdl"));
         processor.setContext(env);
         processor.execute();

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=580028&r1=580027&r2=580028&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
Thu Sep 27 07:40:23 2007
@@ -1119,4 +1119,17 @@
         assertTrue(contents.indexOf("SOAPBinding.ParameterStyle.BARE") != -1);
         assertTrue(contents.indexOf("@ResponseWrapper") == -1);
     }
+
+    @Test
+    public void testXmlSeeAlso() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cardealer.wsdl"));
+
+        processor.setContext(env);
+        processor.execute();
+
+        File sei = new File(output, "type_substitution/server/CarDealer.java");
+        assertTrue(output.exists());
+        String contents = getStringFromFile(sei);
+        assertTrue(contents.indexOf("@XmlSeeAlso({ObjectFactory.class})") != -1);
+    }
 }

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime?rev=580028&r1=580027&r2=580028&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime
Thu Sep 27 07:40:23 2007
@@ -25,10 +25,12 @@
 import javax.jws.soap.SOAPBinding;
 import javax.jws.WebMethod;
 import javax.jws.WebResult;
+import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.ws.RequestWrapper;
 import javax.xml.ws.ResponseWrapper;
 
 @WebService(targetNamespace = "http://apache.org/hello_world_mime", name = "Hello")
+@XmlSeeAlso({org.apache.cxf.mime.ObjectFactory.class})
 @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
 
 public interface Hello {
@@ -58,4 +60,4 @@
         @WebParam(targetNamespace = "", mode = Mode.INOUT, partName = "mime", name = "mime")
         javax.xml.ws.Holder<byte[]> mime
     );
-}
+}
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_sayHi
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_sayHi?rev=580028&r1=580027&r2=580028&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_sayHi
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_sayHi
Thu Sep 27 07:40:23 2007
@@ -1,21 +1,4 @@
-/**
- * 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.sayhi;
 
 import javax.jws.WebParam.Mode;
@@ -25,11 +8,19 @@
 import javax.jws.soap.SOAPBinding;
 import javax.jws.WebMethod;
 import javax.jws.WebResult;
+import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.ws.RequestWrapper;
 import javax.xml.ws.ResponseWrapper;
 
+/**
+ * This class was generated by the CXF 2.1-incubator-SNAPSHOT
+ * Thu Sep 27 20:10:08 CST 2007
+ * Generated source version: 2.1-incubator-SNAPSHOT
+ * 
+ */
 
 @WebService(targetNamespace = "http://apache.org/sayHi", name = "SayHi")
+@XmlSeeAlso({ObjectFactory.class})
 
 public interface SayHi {
 

Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cardealer.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cardealer.wsdl?rev=580028&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cardealer.wsdl
(added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cardealer.wsdl
Thu Sep 27 07:40:23 2007
@@ -0,0 +1,114 @@
+<?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.
+-->
+<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+	     xmlns:tns="http://server.type_substitution/" 
+	     xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+	     xmlns="http://schemas.xmlsoap.org/wsdl/" 
+	     targetNamespace="http://server.type_substitution/" name="CarDealerService">
+    <types>
+	<xsd:schema targetNamespace="http://server.type_substitution/">
+	    <xsd:element name="getSedans" type="tns:getSedans"></xsd:element>
+
+	    <xsd:element name="getSedansResponse" type="tns:getSedansResponse"></xsd:element>
+
+	    <xsd:element name="tradeIn" type="tns:car"></xsd:element>
+
+	    <xsd:element name="tradeInResponse" type="tns:car"></xsd:element>
+
+	    <xsd:complexType name="car" abstract="true">
+		<xsd:sequence>
+		    <xsd:element name="make" type="xsd:string" minOccurs="0"></xsd:element>
+		    <xsd:element name="model" type="xsd:string" minOccurs="0"></xsd:element>
+		    <xsd:element name="year" type="xsd:string" minOccurs="0"></xsd:element>
+		</xsd:sequence>
+	    </xsd:complexType>
+
+	    <xsd:complexType name="porsche">
+		<xsd:complexContent>
+		    <xsd:extension base="tns:car">
+			<xsd:sequence>
+			    <xsd:element name="color" type="xsd:string" minOccurs="0"></xsd:element>
+			</xsd:sequence>
+		    </xsd:extension>
+		</xsd:complexContent>
+	    </xsd:complexType>
+
+	    <xsd:complexType name="getSedans">
+		<xsd:sequence>
+		    <xsd:element name="arg0" type="xsd:string" minOccurs="0"></xsd:element>
+		</xsd:sequence>
+	    </xsd:complexType>
+
+	    <xsd:complexType name="getSedansResponse">
+		<xsd:sequence>
+		    <xsd:element name="return" type="tns:car" nillable="true" minOccurs="0" maxOccurs="unbounded"></xsd:element>
+		</xsd:sequence>
+	    </xsd:complexType>
+	</xsd:schema>
+    </types>
+    <message name="getSedans">
+	<part name="parameters" element="tns:getSedans"></part>
+    </message>
+    <message name="getSedansResponse">
+	<part name="parameters" element="tns:getSedansResponse"></part>
+    </message>
+    <message name="tradeIn">
+	<part name="tradeIn" element="tns:tradeIn"></part>
+    </message>
+    <message name="tradeInResponse">
+	<part name="tradeInResponse" element="tns:tradeInResponse"></part>
+    </message>
+    <portType name="CarDealer">
+	<operation name="getSedans">
+	    <input message="tns:getSedans"></input>
+	    <output message="tns:getSedansResponse"></output>
+	</operation>
+	<operation name="tradeIn">
+	    <input message="tns:tradeIn"></input>
+	    <output message="tns:tradeInResponse"></output>
+	</operation>
+    </portType>
+    <binding name="CarDealerPortBinding" type="tns:CarDealer">
+	<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
+	<operation name="getSedans">
+	    <soap:operation soapAction=""></soap:operation>
+	    <input>
+		<soap:body use="literal"></soap:body>
+	    </input>
+	    <output>
+		<soap:body use="literal"></soap:body>
+	    </output>
+	</operation>
+	<operation name="tradeIn">
+	    <soap:operation soapAction=""></soap:operation>
+	    <input>
+		<soap:body use="literal"></soap:body>
+	    </input>
+	    <output>
+		<soap:body use="literal"></soap:body>
+	    </output>
+	</operation>
+    </binding>
+    <service name="CarDealerService">
+	<port name="CarDealerPort" binding="tns:CarDealerPortBinding">
+	    <soap:address location="http://localhost:8080/jaxws-type_substitution/cardealer"></soap:address>
+	</port>
+    </service>
+</definitions>
\ No newline at end of file



Mime
View raw message