axis-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r922692 - in /axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin: ./ src/main/java/org/apache/axis2/tool/ant/ src/test/java/ src/test/java/test/
Date Sat, 13 Mar 2010 23:40:34 GMT
Author: veithen
Date: Sat Mar 13 23:40:34 2010
New Revision: 922692

URL: http://svn.apache.org/viewvc?rev=922692&view=rev
Log:
AXIS2-4634: Allow to specify extraClasses on Java2WSDLTask. Based on a contribution submitted
by Vy Ho. Not updating any documentation because there is no existing documentation for this
ant task.

Added:
    axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/
    axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/
    axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/ExtraClass1.java
  (with props)
    axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/ExtraClass2.java
  (with props)
    axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/Service.java
  (with props)
Modified:
    axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/pom.xml
    axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/main/java/org/apache/axis2/tool/ant/Java2WSDLTask.java

Modified: axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/pom.xml?rev=922692&r1=922691&r2=922692&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/pom.xml Sat Mar 13 23:40:34 2010
@@ -110,6 +110,74 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <phase>test</phase>
+                        <configuration>
+                            <tasks>
+                                <taskdef name="java2wsdl" classname="org.apache.axis2.tool.ant.Java2WSDLTask">
+                                    <classpath>
+                                        <path refid="maven.test.classpath"/>
+                                    </classpath>
+                                </taskdef>
+                                
+                                <java2wsdl className="test.Service"
+                                           outputLocation="${project.build.directory}/java2wsdl"
+                                           outputFileName="extraclasses1.wsdl">
+                                    <extraclass name="test.ExtraClass1"/>
+                                    <extraclass name="test.ExtraClass2"/>
+                                </java2wsdl>
+                                
+                                <java2wsdl className="test.Service"
+                                           outputLocation="${project.build.directory}/java2wsdl"
+                                           outputFileName="extraclasses2.wsdl"
+                                           extraClasses="test.ExtraClass1,test.ExtraClass2"/>
+                                
+                                <java2wsdl className="test.Service"
+                                           outputLocation="${project.build.directory}/java2wsdl"
+                                           outputFileName="extraclasses3.wsdl"
+                                           extraClasses="test.ExtraClass1">
+                                    <extraclass name="test.ExtraClass2"/>
+                                </java2wsdl>
+                            </tasks>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.groovy.maven</groupId>
+                <artifactId>gmaven-plugin</artifactId>
+                <version>1.0</version>
+                <executions>
+                    <execution>
+                        <phase>test</phase>
+                        <goals>
+                            <goal>execute</goal>
+                        </goals>
+                        <configuration>
+                            <source>
+                                import groovy.xml.*
+                                
+                                def parser = new XmlParser()
+                                def wsdl = new Namespace('http://schemas.xmlsoap.org/wsdl/')
+                                def xs = new Namespace('http://www.w3.org/2001/XMLSchema')
+
+                                for (i in 1..3) {                                
+                                    def wsdlDoc = parser.parse(new File(project.build.directory,
"java2wsdl/extraclasses${i}.wsdl"))
+                                    def complexTypes = wsdlDoc[wsdl.types][xs.schema][xs.complexType].'@name'
+                                    assert complexTypes.contains('ExtraClass1')
+                                    assert complexTypes.contains('ExtraClass2')
+                                }
+                            </source>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
     <distributionManagement>

Modified: axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/main/java/org/apache/axis2/tool/ant/Java2WSDLTask.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/main/java/org/apache/axis2/tool/ant/Java2WSDLTask.java?rev=922692&r1=922691&r2=922692&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/main/java/org/apache/axis2/tool/ant/Java2WSDLTask.java
(original)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/main/java/org/apache/axis2/tool/ant/Java2WSDLTask.java
Sat Mar 13 23:40:34 2010
@@ -31,11 +31,25 @@ import org.apache.ws.java2wsdl.Namespace
 import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 public class Java2WSDLTask extends Task implements Java2WSDLConstants {
+    public static class ExtraClass {
+        private String name;
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+    }
+    
     public static final String OPEN_BRACKET = "[";
     public static final String CLOSE_BRACKET = "]";
     public static final String COMMA = ",";
@@ -60,6 +74,8 @@ public class Java2WSDLTask extends Task 
     //names of java types not used in the service defn. directly, but for which schema must
be generated
     private String[] extraClasses;
 
+    private final List<ExtraClass> extraClasses2 = new ArrayList<ExtraClass>();
+    
     //namespace generator classname
     private String nsGenClassName = null;
 
@@ -352,11 +368,25 @@ public class Java2WSDLTask extends Task 
     }
 
     public String[] getExtraClasses() {
-        return extraClasses;
+        List<String> list = new ArrayList<String>((extraClasses == null ? 0 :
extraClasses.length)
+                + extraClasses2.size());
+        if (extraClasses != null) {
+            list.addAll(Arrays.asList(extraClasses));
+        }
+        for (ExtraClass extraClass : extraClasses2) {
+            list.add(extraClass.getName());
+        }
+        return list.toArray(new String[list.size()]);
     }
 
-    public void setExtraClasses(String[] extraClasses) {
-        this.extraClasses = extraClasses;
+    public void setExtraClasses(String extraClasses) {
+        this.extraClasses = extraClasses.split(",");
+    }
+    
+    public ExtraClass createExtraClass() {
+        ExtraClass extraClass = new ExtraClass();
+        extraClasses2.add(extraClass);
+        return extraClass;
     }
 
     public String getNsGenClassName() {

Added: axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/ExtraClass1.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/ExtraClass1.java?rev=922692&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/ExtraClass1.java
(added)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/ExtraClass1.java
Sat Mar 13 23:40:34 2010
@@ -0,0 +1,31 @@
+/*
+ * 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 test;
+
+public class ExtraClass1 {
+    private String property;
+
+    public String getProperty() {
+        return property;
+    }
+
+    public void setProperty(String property) {
+        this.property = property;
+    }
+}

Propchange: axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/ExtraClass1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/ExtraClass2.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/ExtraClass2.java?rev=922692&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/ExtraClass2.java
(added)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/ExtraClass2.java
Sat Mar 13 23:40:34 2010
@@ -0,0 +1,31 @@
+/*
+ * 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 test;
+
+public class ExtraClass2 {
+    private String property;
+
+    public String getProperty() {
+        return property;
+    }
+
+    public void setProperty(String property) {
+        this.property = property;
+    }
+}

Propchange: axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/ExtraClass2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/Service.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/Service.java?rev=922692&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/Service.java
(added)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/Service.java
Sat Mar 13 23:40:34 2010
@@ -0,0 +1,25 @@
+/*
+ * 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 test;
+
+public class Service {
+    public String echo(String in) {
+        return in;
+    }
+}

Propchange: axis/axis2/java/core/trunk/modules/tool/axis2-ant-plugin/src/test/java/test/Service.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message