You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2006/01/10 00:00:11 UTC

svn commit: r367424 - in /beehive/trunk/system-controls: src/webservice/control/org/apache/beehive/controls/system/webservice/generator/ test/webservice/ test/webservice/junit/ test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tes...

Author: cschoett
Date: Mon Jan  9 15:00:00 2006
New Revision: 367424

URL: http://svn.apache.org/viewcvs?rev=367424&view=rev
Log:
I've added new attribute to WebServiceControlGenerator task, 'copyWsdl' which accepts a boolean value. If set to true the WSDL file used to generate a web service control is copied into the same directory as the gen'd control.  The control's WSDL path annotation attribute value is set automatically to that location (same package as the gen'd control) unless the 'wsldRuntimePath' attribute has been set in which case it's value will be used.

I've also added a bunch of new JUnit tests for the WebServiceControlGenerator task.  The include tests for the 'copyWsdl', 'wsdlRuntimePath', 'serviceName', 'serviceNamespace' and 'servicePort' attributes.


Added:
    beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/DefaultServiceAndPortTest.java   (with props)
    beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/ExplicitServiceAndPortTest.java   (with props)
    beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathCopyWsdlTest.java   (with props)
    beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathExplicitAndCopyWsdlTest.java   (with props)
    beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathExplicitTest.java   (with props)
    beehive/trunk/system-controls/test/webservice/junit/wsdl/settings/
    beehive/trunk/system-controls/test/webservice/junit/wsdl/settings/TaskGeneratorTest.wsdl
Modified:
    beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/GeneratorUtils.java
    beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGenerator.java
    beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGeneratorTask.java
    beehive/trunk/system-controls/test/webservice/build.xml
    beehive/trunk/system-controls/test/webservice/junit/build.xml

Modified: beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/GeneratorUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/GeneratorUtils.java?rev=367424&r1=367423&r2=367424&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/GeneratorUtils.java (original)
+++ beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/GeneratorUtils.java Mon Jan  9 15:00:00 2006
@@ -16,6 +16,11 @@
 package org.apache.beehive.controls.system.webservice.generator;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Arrays;
@@ -257,11 +262,31 @@
     }
 
     /**
+     * Copy src file to dest file.
+     *
+     * @param src  Source file.
+     * @param dest Destination file.
+     * @throws IOException On error.
+     */
+    static void copyFile(File src, File dest) throws IOException {
+        InputStream is = new FileInputStream(src);
+        OutputStream os = new FileOutputStream(dest);
+
+        byte[] buf = new byte[1024];
+        int len;
+        while ((len = is.read(buf)) > 0) {
+            os.write(buf, 0, len);
+        }
+        is.close();
+        os.close();
+    }
+
+    /**
      * Add a new segement to a package name. Be sure to check that seqement is not
      * an java reserved word, if it is transform it into something safe.
      *
      * @param sb        the buffer to append to
-     * @param id      the word to append
+     * @param id        the word to append
      * @param firstWord a flag indicating whether this is the first word
      */
     private static void addToPackageName(StringBuilder sb, String id, boolean firstWord) {

Modified: beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGenerator.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGenerator.java?rev=367424&r1=367423&r2=367424&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGenerator.java (original)
+++ beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGenerator.java Mon Jan  9 15:00:00 2006
@@ -67,14 +67,16 @@
      * @param wsdlDirectory      Directory of WSDLs to process.
      * @param pkgName            Package name of generated controls. If null, package name will be generated
      *                           from the WSDL's target namespace.
-     * @param wsdlRuntimePath WSDL path annotation value for generated controls.
+     * @param wsdlRuntimePath   WSDL path annotation value for generated controls.
+     * @param copyWsdl          Copy the wsdl to the web service control destination directory.
      * @throws Exception
      */
-    static void generateJCXs(File wsdlDirectory, File outputDir, String pkgName, String wsdlRuntimePath)
+    static void generateJCXs(File wsdlDirectory, File outputDir, String pkgName,
+                             String wsdlRuntimePath, boolean copyWsdl)
             throws Exception {
         assert wsdlDirectory.isDirectory() : "wsdlLocation must be a directory!";
         for (File wsdlFile : wsdlDirectory.listFiles(FILE_FILTER_WSDL)) {
-            generateJCX(wsdlFile, outputDir, pkgName, wsdlRuntimePath, null, null);
+            generateJCX(wsdlFile, outputDir, pkgName, wsdlRuntimePath, copyWsdl, null, null);
         }
     }
 
@@ -85,25 +87,46 @@
      * @param pkgName            Package name of generated controls. If null, package name will be generated
      *                           from the WSDL's target namespace.
      * @param wsdlRuntimePath WSDL path annotation value for generated control.
+     * @param copyWsdl          Copy the wsdl to the web service control destination directory.
      * @param serviceQName        Name of the service to generate the control.
      * @param servicePortName     Name of the service port used to generate the control.
      * @throws Exception
      */
     static void generateJCX(File wsdlFile, File outputDir, String pkgName,
-                            String wsdlRuntimePath, QName serviceQName, String servicePortName)
-            throws Exception {
+                            String wsdlRuntimePath, boolean copyWsdl,
+                            QName serviceQName,  String servicePortName) throws Exception {
+
         assert wsdlFile.isFile() : "wsdlFile must be a file!";
-        final String wsdlPath;
 
         // load and parse the WSDL file
         Wsdl wsdl = new Wsdl(wsdlFile.toURI(), serviceQName, servicePortName);
-
         if (pkgName == null) {
             pkgName = GeneratorUtils.generatePackageName(wsdl.getTargetNamespace());
         }
 
+        //
+        // determinig the wsdl runtime path:
+        // 1) if the wsdlRuntimePath is not null, use its value
+        // 2) if copyWsdl has been set to true, set the wsdl path to the same as the generated control
+        // 3) default -- set the wsdl path to the URL of the WSDL file.
+        //
+        String wsdlPath;
         if (wsdlRuntimePath != null) {
-            wsdlPath = genWsdlPath(wsdlRuntimePath + File.separatorChar + wsdlFile.getName());
+            if (wsdlRuntimePath.endsWith(File.separator)) {
+                wsdlPath = genWsdlPath(wsdlRuntimePath + wsdlFile.getName());
+            }
+            else {
+                wsdlPath = genWsdlPath(wsdlRuntimePath + File.separatorChar + wsdlFile.getName());
+            }
+        }
+        else if (copyWsdl) {
+            String dirName = GeneratorUtils.packageNameToDirectoryName(pkgName);
+            if (dirName.endsWith(File.separator)) {
+                wsdlPath =  dirName + wsdlFile.getName();
+            }
+            else {
+                wsdlPath =  dirName + File.separatorChar + wsdlFile.getName();
+            }
         }
         else {
             wsdlPath = wsdlFile.toURL().toString();
@@ -133,6 +156,15 @@
         } finally {
             jcxWriter.close();
         }
+
+        if (copyWsdl) {
+            // adjust the wsdlPath value if it was previously set an explicit location.
+            if (wsdlRuntimePath != null) {
+                wsdlPath =  GeneratorUtils.packageNameToDirectoryName(pkgName) + File.separatorChar + wsdlFile.getName();
+            }
+            File wsdlCopy = new File(outputDir, wsdlPath);
+            GeneratorUtils.copyFile(wsdlFile, wsdlCopy);
+        }
     }
 
     /* ------------------------------------------------------------------------------------------- */
@@ -247,7 +279,7 @@
      * @param xmlType
      * @param itemXmlType
      * @param isArray
-     * @return
+     * @return The class which the xmlType maps to. void.class if xmlType is null.
      */
     static private Class getClass(QName xmlType, QName itemXmlType, boolean isArray) {
 

Modified: beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGeneratorTask.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGeneratorTask.java?rev=367424&r1=367423&r2=367424&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGeneratorTask.java (original)
+++ beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGeneratorTask.java Mon Jan  9 15:00:00 2006
@@ -52,7 +52,8 @@
     private String _serviceNamespace;
     private String _servicePortName;
 
-    //@todo: add option for copying wsdl to location of generated webservice control
+    private boolean _copyWsdl = false;
+
     //@todo: add option to compile generated service control
 
     /**
@@ -63,22 +64,13 @@
     }
 
     /**
-     * Set the source file (wsdl) to generate the service control from.
-     *
-     * @param srcfile WSDL used to generate a service control.
+     * Should the WSDL used to generate the web service control be copied to the location of the generated control?
+     * Optional. Defaults to false.
+     * @param copyWsdl true if the WSDL used to generate the web service control should be copied to the location of
+     * the control.
      */
-    public void setSrcfile(File srcfile) {
-        _srcfile = srcfile;
-    }
-
-    /**
-     * Set the source directory to generate service control(s) from.  All WSDL files
-     * in the directory will be processed, each one producing a service control.
-     *
-     * @param srcdir The directory to process WSDLs in.
-     */
-    public void setSrcdir(File srcdir) {
-        _srcdir = srcdir;
+    public void setCopyWsdl(boolean copyWsdl) {
+        _copyWsdl = copyWsdl;
     }
 
     /**
@@ -136,6 +128,25 @@
     }
 
     /**
+     * Set the source directory to generate service control(s) from.  All WSDL files
+     * in the directory will be processed, each one producing a service control.
+     *
+     * @param srcdir The directory to process WSDLs in.
+     */
+    public void setSrcdir(File srcdir) {
+        _srcdir = srcdir;
+    }
+
+    /**
+     * Set the source file (wsdl) to generate the service control from.
+     *
+     * @param srcfile WSDL used to generate a service control.
+     */
+    public void setSrcfile(File srcfile) {
+        _srcfile = srcfile;
+    }
+
+    /**
      * A web service control needs to be able to locate the WSDL it was generated from at runtime. This value may be
      * in the form of a URL or fully qualified location within the classpath of the application at runtime.  It is
      * not necessary to include the name of the WSDL, just its path information.
@@ -169,10 +180,12 @@
         try {
             if (_srcfile != null) {
                 WebServiceControlGenerator.generateJCX(_srcfile, _destdir, _destPackageName,
-                                                    _wsdlRuntimePath, serviceQName, _servicePortName);
+                                                       _wsdlRuntimePath, _copyWsdl, serviceQName,
+                                                       _servicePortName);
             }
             else {
-                WebServiceControlGenerator.generateJCXs(_srcdir, _destdir, _destPackageName, _wsdlRuntimePath);
+                WebServiceControlGenerator.generateJCXs(_srcdir, _destdir, _destPackageName,
+                                                        _wsdlRuntimePath, _copyWsdl);
             }
         }
         catch (Exception e) {
@@ -216,6 +229,10 @@
 
         if (!_destdir.isDirectory()) {
             throw new BuildException("destDir must be a directory");
+        }
+
+        if (_wsdlRuntimePath != null && _copyWsdl) {
+            log("Warning: 'wsdlRuntimePath' and 'copyWsdl' attributes have both been set.  The generated web service control will use the value of 'wsdlRuntimePath' to locate the WSDL file at runtime.");
         }
     }
 }

Modified: beehive/trunk/system-controls/test/webservice/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/webservice/build.xml?rev=367424&r1=367423&r2=367424&view=diff
==============================================================================
--- beehive/trunk/system-controls/test/webservice/build.xml (original)
+++ beehive/trunk/system-controls/test/webservice/build.xml Mon Jan  9 15:00:00 2006
@@ -259,13 +259,10 @@
 
         <javac srcdir="${client.axisgen}" destdir="${client.classes}" classpathref="client.classpath" debug="true"/>
 
-        <webservice-control-gen srcdir="${wsdls.dir}" destdir="${client.jcxgensrc}" destPackageName="${client.jcxgen.packageName}"/>
-        <webservice-control-gen srcdir="${rpc.encoded.wsdls.dir}" destdir="${client.jcxgensrc}" destPackageName="${client.jcxgen.packageName}"/>
-
-        <copy todir="${client.jcxgensrc}/${client.jcxgen.packageName}">
-            <fileset dir="${wsdls.dir}" includes="*.wsdl"/>
-            <fileset dir="${rpc.encoded.wsdls.dir}" includes="**/*.wsdl"/>
-        </copy>
+        <webservice-control-gen srcdir="${wsdls.dir}" destdir="${client.jcxgensrc}"
+                                copyWsdl="yes" destPackageName="${client.jcxgen.packageName}"/>
+        <webservice-control-gen srcdir="${rpc.encoded.wsdls.dir}" destdir="${client.jcxgensrc}"
+                                copyWsdl="true" destPackageName="${client.jcxgen.packageName}"/>
     </target>
 
     <!-- =================================================================== -->

Modified: beehive/trunk/system-controls/test/webservice/junit/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/webservice/junit/build.xml?rev=367424&r1=367423&r2=367424&view=diff
==============================================================================
--- beehive/trunk/system-controls/test/webservice/junit/build.xml (original)
+++ beehive/trunk/system-controls/test/webservice/junit/build.xml Mon Jan  9 15:00:00 2006
@@ -17,13 +17,14 @@
   
    $Header:$
 -->
-<project name="Beehive/ServiceControl DRT For JCX Generation" default="drt" basedir=".">
+<project name="Beehive/ServiceControl DRT For WebService Control Generation" default="drt" basedir=".">
 
     <property environment="os"/>
     <import file="../../../systemcontrols-imports.xml"/>
 
     <property name="junit-source.dir" location="src"/>
     <property name="wsdls.dir" location="wsdl"/>
+    <property name="wsdls.settings.dir" location="${wsdls.dir}/settings"/>
 
     <property name="wscgen.build.dir" location="../build/junit-wscgen"/>
 
@@ -88,12 +89,51 @@
         <echo message="-----------------------------------------------------"/>
     </target>
 
+    <!-- Test overall generation as well as variations of genertor task arguments. -->
     <target name="generate_wscs" depends="gen_xmlbeans" description="Generate web service controls for JUnit tests">
         <taskdef name="webservice-control-gen"
                  classname="org.apache.beehive.controls.system.webservice.generator.WebServiceControlGeneratorTask"
                  classpathref="wscgen.classpath"/>
 
-        <webservice-control-gen srcdir="${wsdls.dir}" destdir="${wscgen.gensrc}"/>
+        <!-- general task tests -->
+        <webservice-control-gen srcdir="${wsdls.dir}"
+                                destdir="${wscgen.gensrc}"/>
+
+        <!-- *** task parameter / settings tests *** -->
+
+        <!-- wsdl runtime path not set -->
+        <webservice-control-gen srcfile="${wsdls.settings.dir}/TaskGeneratorTest.wsdl"
+                                destdir="${wscgen.gensrc}"
+                                destPackageName="test1"/>
+
+        <!-- wsdl runtime path set to location of generated control-->
+        <webservice-control-gen srcfile="${wsdls.settings.dir}/TaskGeneratorTest.wsdl"
+                                destdir="${wscgen.gensrc}"
+                                copyWsdl="yes"
+                                destPackageName="test2"/>
+
+        <!-- wsdl runtime path explicitly set -->
+        <webservice-control-gen srcfile="${wsdls.settings.dir}/TaskGeneratorTest.wsdl"
+                                destdir="${wscgen.gensrc}"
+                                wsdlRuntimePath="/tmp"
+                                destPackageName="test3"/>
+
+        <!-- wsdl runtime path explicitly set, so is copyWsdl -->
+        <webservice-control-gen srcfile="${wsdls.settings.dir}/TaskGeneratorTest.wsdl"
+                                destdir="${wscgen.gensrc}"
+                                wsdlRuntimePath="/tmp/"
+                                copyWsdl="yes"
+                                destPackageName="test4"/>
+
+        <!-- explictly set the service name and port name we are looking for -->
+        <webservice-control-gen srcfile="${wsdls.settings.dir}/TaskGeneratorTest.wsdl"
+                                destdir="${wscgen.gensrc}"
+                                copyWsdl="yes"
+                                serviceName="TestService1"
+                                serviceNamespace="http://foo"
+                                servicePort="TestService1"
+                                destPackageName="test5"/>
+
     </target>
 
     <target name="gen_xmlbeans" depends="checkxbean" unless="noxbeanrebuild">

Added: beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/DefaultServiceAndPortTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/DefaultServiceAndPortTest.java?rev=367424&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/DefaultServiceAndPortTest.java (added)
+++ beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/DefaultServiceAndPortTest.java Mon Jan  9 15:00:00 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed 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.beehive.controls.system.webservice.tests.jcxgen;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.beehive.controls.system.webservice.ServiceControl;
+
+/**
+ * If a WSDL file contains multiple services and a service name is not specfied for the
+ * web service control, the last service defined will be the one the generator uses to
+ * gen the wsc.
+ */
+public class DefaultServiceAndPortTest extends TestCase {
+
+    private final Class genWsc = test1.TestService2.class;
+
+    public void testServiceName() throws Exception {
+        ServiceControl.WSDL wsdl =
+                (ServiceControl.WSDL) genWsc.getAnnotation(ServiceControl.WSDL.class);
+        assertEquals("TestService2", wsdl.service());
+    }
+
+    public void testPortName() throws Exception {
+        ServiceControl.WSDL wsdl =
+                (ServiceControl.WSDL) genWsc.getAnnotation(ServiceControl.WSDL.class);
+        assertEquals("TestService2", wsdl.portName());
+    }
+
+    public static Test suite() {
+        return new TestSuite(DefaultServiceAndPortTest.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+}
+
+
+

Propchange: beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/DefaultServiceAndPortTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/ExplicitServiceAndPortTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/ExplicitServiceAndPortTest.java?rev=367424&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/ExplicitServiceAndPortTest.java (added)
+++ beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/ExplicitServiceAndPortTest.java Mon Jan  9 15:00:00 2006
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed 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.beehive.controls.system.webservice.tests.jcxgen;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.beehive.controls.system.webservice.ServiceControl;
+
+/**
+ * Test setting a specific service and port in the WSDL used to gen the wsc, with the
+ * 'serviceName', 'serviceNamespace', and 'servicePort' attributes.
+ */
+public class ExplicitServiceAndPortTest extends TestCase {
+
+    private final Class genWsc = test5.TestService1.class;
+
+    public void testServiceName() throws Exception {
+        ServiceControl.WSDL wsdl =
+                (ServiceControl.WSDL) genWsc.getAnnotation(ServiceControl.WSDL.class);
+        assertEquals("TestService1", wsdl.service());
+    }
+
+    public void testServiceNamespace() throws Exception {
+        ServiceControl.WSDL wsdl =
+                (ServiceControl.WSDL) genWsc.getAnnotation(ServiceControl.WSDL.class);
+        assertEquals("http://foo", wsdl.serviceTns());
+    }
+
+    public void testPortName() throws Exception {
+        ServiceControl.WSDL wsdl =
+                (ServiceControl.WSDL) genWsc.getAnnotation(ServiceControl.WSDL.class);
+        assertEquals("TestService1", wsdl.portName());
+    }
+
+    public static Test suite() {
+        return new TestSuite(ExplicitServiceAndPortTest.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+}
+
+
+

Propchange: beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/ExplicitServiceAndPortTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathCopyWsdlTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathCopyWsdlTest.java?rev=367424&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathCopyWsdlTest.java (added)
+++ beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathCopyWsdlTest.java Mon Jan  9 15:00:00 2006
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed 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.beehive.controls.system.webservice.tests.jcxgen;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.beehive.controls.system.webservice.ServiceControl;
+
+/**
+ * Test the result of setting the webservicecontrol generator's 'copyWsdl' attribute to true.
+ */
+public class WsdlPathCopyWsdlTest extends TestCase {
+
+    private final Class genWsc = test2.TestService2.class;
+
+    public void testWSDLPath() throws Exception {
+        ServiceControl.WSDL wsdl =
+                (ServiceControl.WSDL) genWsc.getAnnotation(ServiceControl.WSDL.class);
+        assertEquals("test2/TaskGeneratorTest.wsdl", wsdl.path());
+        assertEquals("TestService2", wsdl.service());
+    }
+
+    public static Test suite() {
+        return new TestSuite(WsdlPathCopyWsdlTest.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+}
+
+
+

Propchange: beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathCopyWsdlTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathExplicitAndCopyWsdlTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathExplicitAndCopyWsdlTest.java?rev=367424&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathExplicitAndCopyWsdlTest.java (added)
+++ beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathExplicitAndCopyWsdlTest.java Mon Jan  9 15:00:00 2006
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed 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.beehive.controls.system.webservice.tests.jcxgen;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.beehive.controls.system.webservice.ServiceControl;
+
+/**
+ * Test the result of setting the webservicecontrol generator's 'wsdlRuntimePath' attribute
+ * and the 'copyWsdl' attribute.
+ */
+public class WsdlPathExplicitAndCopyWsdlTest extends TestCase {
+
+    private final Class genWsc = test4.TestService2.class;
+
+    public void testWSDLPath() throws Exception {
+        ServiceControl.WSDL wsdl =
+                (ServiceControl.WSDL) genWsc.getAnnotation(ServiceControl.WSDL.class);
+        assertEquals("/tmp/TaskGeneratorTest.wsdl", wsdl.path());
+        assertEquals("TestService2", wsdl.service());
+    }
+
+    public static Test suite() {
+        return new TestSuite(WsdlPathExplicitAndCopyWsdlTest.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+}
+
+
+

Propchange: beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathExplicitAndCopyWsdlTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathExplicitTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathExplicitTest.java?rev=367424&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathExplicitTest.java (added)
+++ beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathExplicitTest.java Mon Jan  9 15:00:00 2006
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed 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.beehive.controls.system.webservice.tests.jcxgen;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.beehive.controls.system.webservice.ServiceControl;
+
+/**
+ * Test the result of setting the webservicecontrol generator's 'wsdlRuntimePath' attribute.
+ */
+public class WsdlPathExplicitTest extends TestCase {
+
+    private final Class genWsc = test3.TestService2.class;
+
+    public void testWSDLPath() throws Exception {
+        ServiceControl.WSDL wsdl =
+                (ServiceControl.WSDL) genWsc.getAnnotation(ServiceControl.WSDL.class);
+        assertEquals("/tmp/TaskGeneratorTest.wsdl", wsdl.path());
+        assertEquals("TestService2", wsdl.service());
+    }
+
+    public static Test suite() {
+        return new TestSuite(WsdlPathExplicitTest.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+}
+
+
+

Propchange: beehive/trunk/system-controls/test/webservice/junit/src/org/apache/beehive/controls/system/webservice/tests/jcxgen/WsdlPathExplicitTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/system-controls/test/webservice/junit/wsdl/settings/TaskGeneratorTest.wsdl
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/webservice/junit/wsdl/settings/TaskGeneratorTest.wsdl?rev=367424&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/webservice/junit/wsdl/settings/TaskGeneratorTest.wsdl (added)
+++ beehive/trunk/system-controls/test/webservice/junit/wsdl/settings/TaskGeneratorTest.wsdl Mon Jan  9 15:00:00 2006
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://foo" xmlns:apachesoap="http://xml.apache.org/xml-soap"
+                  xmlns:impl="http://foo" xmlns:intf="http://foo"
+                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+                  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <wsdl:types>
+        <schema elementFormDefault="qualified" targetNamespace="http://foo"
+                xmlns="http://www.w3.org/2001/XMLSchema">
+            <element name="echoString">
+                <complexType>
+                    <sequence>
+                        <element name="inputString" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="echoString2">
+                <complexType>
+                    <sequence>
+                        <element name="inputString" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="echoStringResponse">
+                <complexType>
+                    <sequence>
+                        <element name="return" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="echoString2Response">
+                <complexType>
+                    <sequence>
+                        <element name="return" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+
+    <wsdl:message name="echoStringRequest">
+        <wsdl:part element="impl:echoString" name="parameters"/>
+    </wsdl:message>
+
+    <wsdl:message name="echoString2Request">
+        <wsdl:part element="impl:echoString2" name="parameters"/>
+    </wsdl:message>
+
+    <wsdl:portType name="TestService1">
+        <wsdl:operation name="echoString">
+            <wsdl:input message="impl:echoStringRequest" name="echoStringRequest"/>
+            <wsdl:output message="impl:echoStringResponse" name="echoStringResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <wsdl:portType name="TestService2">
+        <wsdl:operation name="echoString2">
+            <wsdl:input message="impl:echoString2Request" name="echoString2Request"/>
+            <wsdl:output message="impl:echoString2Response" name="echoString2Response"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+
+    <!-- Define 2 bindings -->
+    <wsdl:binding name="TestSoapBinding1" type="impl:TestService1">
+        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="echoString">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="echoStringRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="echoStringResponse">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <wsdl:binding name="TestSoapBinding2" type="impl:TestService2">
+        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="echoString2">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="echoString2Request">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="echoString2Response">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <!-- Define two services for this wsdl -->
+    <wsdl:service name="TestService1">
+        <wsdl:port binding="impl:TestSoapBinding1" name="TestService1">
+            <wsdlsoap:address location="http://foo.jws"/>
+        </wsdl:port>
+        <wsdl:port binding="impl:TestSoapBinding2" name="TestService1">
+            <wsdlsoap:address location="http://foo22.jws"/>
+        </wsdl:port>
+    </wsdl:service>
+
+    <wsdl:service name="TestService2">
+        <wsdl:port binding="impl:TestSoapBinding2" name="TestService2">
+            <wsdlsoap:address location="http://foo2.jws"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>