You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2001/10/24 23:17:08 UTC

cvs commit: xml-axis/java/test/wsdl Wsdl2javaAntTask.java Wsdl2javaTestSuite.java Wsdl2javaTestSuite.xml

dims        01/10/24 14:17:08

  Modified:    java/test/wsdl Wsdl2javaAntTask.java Wsdl2javaTestSuite.java
                        Wsdl2javaTestSuite.xml
  Log:
  Fixed Wsdl2javaAntTask and corresponding xml to accept namespaces.
  
  Revision  Changes    Path
  1.2       +33 -11    xml-axis/java/test/wsdl/Wsdl2javaAntTask.java
  
  Index: Wsdl2javaAntTask.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaAntTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Wsdl2javaAntTask.java	2001/10/24 18:20:39	1.1
  +++ Wsdl2javaAntTask.java	2001/10/24 21:17:08	1.2
  @@ -66,6 +66,8 @@
   import java.net.Socket;
   import java.net.URL;
   
  +import java.util.HashMap;
  +
   /**
    * Simple Ant task for running Wsdl2java utility. 
    *
  @@ -78,7 +80,7 @@
       private boolean messageContext = false;
       private boolean testCase = false;
       private boolean noImports = true;
  -    private String javaPackageName = "";
  +    private HashMap namespaceMap = new HashMap();
       private String output = "." ;
       private String deployScope = "";
       private String url = "";
  @@ -92,7 +94,7 @@
               log("\tmessageContext:" + messageContext, Project.MSG_VERBOSE);
               log("\ttestCase:" + testCase, Project.MSG_VERBOSE);
               log("\tnoImports:" + noImports, Project.MSG_VERBOSE);
  -            log("\tpackage:" + javaPackageName, Project.MSG_VERBOSE);
  +            log("\tNStoPkg:" + namespaceMap, Project.MSG_VERBOSE);
               log("\toutput:" + output, Project.MSG_VERBOSE);
               log("\tdeployScope:" + deployScope, Project.MSG_VERBOSE);
               log("\tURL:" + url, Project.MSG_VERBOSE);
  @@ -110,11 +112,10 @@
               }
               else {
                   log("Unrecognized scope:  " + deployScope + ".  Ignoring it.", Project.MSG_VERBOSE);
  +            }
  +            if (!namespaceMap.isEmpty()) {
  +                emitter.setNamespaceMap(namespaceMap);
               }
  -            if (javaPackageName == null || javaPackageName.length()<=0)
  -                emitter.generatePackageName(true);
  -            else
  -                emitter.setPackageName(javaPackageName);
               emitter.generateTestCase(testCase);
               emitter.generateImports(!noImports);
               emitter.setOutputDir(output);
  @@ -152,11 +153,6 @@
           this.noImports = Project.toBoolean(parameter);
       }
   
  -    // The setter for the "package" attribute
  -    public void setPackage(String parameter) {
  -        this.javaPackageName = parameter;
  -    }
  -
       // The setter for the "output" attribute
       public void setOutput(String parameter) {
           this.output = parameter;
  @@ -170,6 +166,32 @@
       // The setter for the "url" attribute
       public void setURL(String parameter) {
           this.url = parameter;
  +    }
  +
  +    /** the command arguments */
  +    public Mapping createMapping() {
  +        Mapping pkg = new Mapping();
  +        return pkg;
  +    }
  +
  +    /**
  +     * Used for nested package definitions.
  +     */
  +    public class Mapping {
  +        private String namespace;
  +        private String packageName;
  +
  +        public void setNamespace(String value) {
  +            namespace = value;
  +            if(namespace != null && packageName != null)
  +                namespaceMap.put(namespace, packageName);
  +        }
  +
  +        public void setPackage(String value) {
  +            packageName = value;
  +            if(namespace != null && packageName != null)
  +                namespaceMap.put(namespace, packageName);
  +        }
       }
   }
   
  
  
  
  1.2       +0 -9      xml-axis/java/test/wsdl/Wsdl2javaTestSuite.java
  
  Index: Wsdl2javaTestSuite.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Wsdl2javaTestSuite.java	2001/10/24 18:20:39	1.1
  +++ Wsdl2javaTestSuite.java	2001/10/24 21:17:08	1.2
  @@ -251,15 +251,6 @@
        */
       protected void prepareTest(String fileName, int testNum) throws Exception {
           Emitter wsdl2java = new Emitter();
  -        String packageName = "";
  -        packageName = fileName;
  -        if(packageName.indexOf(":/")!=-1){
  -            packageName = packageName.substring(packageName.indexOf(":/")+2);
  -        }
  -        packageName = packageName.substring(0, packageName.lastIndexOf('/'));
  -        packageName = packageName.replace('/', '.');
  -        wsdl2java.setPackageName(Utils.makePackageName(packageName));
  -        wsdl2java.generatePackageName(true);
           wsdl2java.setOutputDir(Wsdl2javaTestSuite.WORK_DIR);
           wsdl2java.generateSkeleton(true);
           wsdl2java.generateTestCase(true);
  
  
  
  1.2       +17 -17    xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml
  
  Index: Wsdl2javaTestSuite.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Wsdl2javaTestSuite.xml	2001/10/24 18:20:39	1.1
  +++ Wsdl2javaTestSuite.xml	2001/10/24 21:17:08	1.2
  @@ -4,37 +4,37 @@
     <taskdef name="wsdl2java" classname="test.wsdl.Wsdl2javaAntTask"/>
   
     <target name="main">
  -    <wsdl2java url="samples/addr/AddressBook.wsdl" 
  +    <wsdl2java url="samples/addr/AddressBook.wsdl"
                  deployscope="session"
  -               package="samples.addr" 
  -               output="build/work" 
  +               output="build/work"
                  testcase="no">
  +        <mapping namespace="urn:AddressFetcher2" package="samples.addr"/>
       </wsdl2java>
  -    <wsdl2java url="test/inout/inout.wsdl" 
  -               package="test.inout" 
  -               output="build/work" 
  +    <wsdl2java url="test/inout/inout.wsdl"
  +               output="build/work"
                  testcase="no">
  +        <mapping namespace="http://www.ibm.com/inout" package="test.inout"/>
       </wsdl2java>
  -    <wsdl2java url="http://www.whitemesa.com/interop/InteropTest.wsdl" 
  -               package="org.soapinterop" 
  -               output="build/work" 
  +    <!--
  +    <wsdl2java url="http://www.whitemesa.com/interop/InteropTest.wsdl"
  +               output="build/work"
                  testcase="no">
  +        <mapping namespace="http://soapinterop.org/" package="soap.interop"/>
       </wsdl2java>
  -    <wsdl2java url="http://www.whitemesa.com/interop/InteropTestB.wsdl" 
  -               package="org.soapinteropB" 
  -               output="build/work" 
  +    <wsdl2java url="http://www.whitemesa.com/interop/InteropTestB.wsdl"
  +               output="build/work"
                  testcase="no">
  +        <mapping namespace="http://soapinterop.org/" package="soap.interopB"/>
       </wsdl2java>
  -    <!--
       <wsdl2java url="http://www.whitemesa.net/wsdl/std/InteropTestC.wsdl"
  -               package="org.soapinterop.echoheadersvc" 
  -               output="build/work" 
  +               output="build/work"
                  testcase="no">
  +        <mapping namespace="*" package="org.soapinterop.echoheadersvc">
       </wsdl2java>
       <wsdl2java url="http://www.whitemesa.net/wsdl/std/echoheadersvc.wsdl"
  -               package="org.soapinterop.echoheadersvc" 
  -               output="build/work" 
  +               output="build/work"
                  testcase="no">
  +        <mapping namespace="http://soapinterop.org/" package="org.soapinterop.echoheadersvc"/>
       </wsdl2java>
       -->
     </target>