You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/05/06 01:03:51 UTC

svn commit: r168458 - in /incubator/beehive/trunk/wsm/drt: build.xml tests/org/apache/beehive/wsm/jsr181/wsdl/WSDL2AnnotatedJavaTest.java tests/org/apache/beehive/wsm/jsr181/wsdl/web/ tests/org/apache/beehive/wsm/jsr181/wsdl/web/wsdl2javatest.wsdl.xml

Author: ekoneil
Date: Thu May  5 16:03:49 2005
New Revision: 168458

URL: http://svn.apache.org/viewcvs?rev=168458&view=rev
Log:
Add the test supplied in JIRA 606.  Chad Schoettger contributed this code.

BB: self
DRT: Beehive pass


Added:
    incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/web/
    incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/web/wsdl2javatest.wsdl.xml   (with props)
Modified:
    incubator/beehive/trunk/wsm/drt/build.xml
    incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/WSDL2AnnotatedJavaTest.java

Modified: incubator/beehive/trunk/wsm/drt/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/drt/build.xml?rev=168458&r1=168457&r2=168458&view=diff
==============================================================================
--- incubator/beehive/trunk/wsm/drt/build.xml (original)
+++ incubator/beehive/trunk/wsm/drt/build.xml Thu May  5 16:03:49 2005
@@ -1,7 +1,7 @@
 <?xml version="1.0" ?>
 
 <project name="wsmdrt" default="drt">
-    
+
     <import file="../../beehive-imports.xml"/>
 
     <property name="drt.root" location="${basedir}"/>
@@ -10,10 +10,15 @@
     <property name="drt.schemas" location="${drt.src}/schemas"/>
     <property name="build.dir" location="${drt.root}/build"/>
     <property name="build.classes" location="${build.dir}/classes"/>
+    <property name="build.gen-src-wsdl" location="${build.dir}/gen-src-wsdl"/>
+    <property name="build.gen-src-apt" location="${build.dir}/gen-src-apt"/>
     <property name="build.tests" location="${build.classes}/tests"/>
+    <property name="build.gen-tests" location="${build.classes}/gen-tests"/>
     <property name="webapp.dir" location="${drt.root}/webapp"/>
     <property name="lib.dir" value="../lib"/>
     <property name="ext.lib.dir" value="../external"/>
+    <property name="drt.wsdl.file" location="${drt.src}/org/apache/beehive/wsm/jsr181/wsdl/web/wsdl2javatest.wsdl"/>
+
 
     <condition property="drt.os" value="windows">
         <os family="windows"/>
@@ -21,7 +26,7 @@
     <condition property="drt.os" value="unix">
         <os family="unix"/>
     </condition>
-    
+
     <fileset id="axis.jars" dir="${ext.lib.dir}">
         <include name="wsdl4j.jar"/>
         <include name="saaj.jar"/>
@@ -29,7 +34,11 @@
         <include name="axis-ant.jar"/>
         <include name="axis.jar"/>
     </fileset>
-    
+
+    <path id="controls.dependency.path">
+        <fileset refid="controls.fileset"/>
+    </path>
+
     <path id="drt.classpath">
         <path refid="velocity.dependency.path"/>
         <path refid="xbean.dependency.path"/>
@@ -39,6 +48,7 @@
         <path refid="commons-codec.dependency.path"/>
         <path refid="commons-discovery.dependency.path"/>
         <path refid="commons-logging.dependency.path"/>
+        <path refid="controls.dependency.path"/>
 
         <pathelement location="${lib.dir}/beehive-wsdltypes.jar"/>
         <pathelement location="${lib.dir}/jsr181.jar"/>
@@ -74,18 +84,21 @@
         <echo message="|         WSM drt ending                         |"/>
         <echo message="--------------------------------------------------"/>
     </target>
-    
-    <target name="build" depends="dirs, xbean, build.webapp, build.tests"/>
-    
-    <target name="clean" depends="clean.tests, clean.webapp" />
-    
+
+    <target name="build" depends="dirs, xbean, gen_wsdl2java_test, build.webapp, build.tests"/>
+
+    <target name="clean" depends="clean.tests, clean.webapp"/>
+
     <target name="dirs">
         <mkdir dir="${build.classes}"/>
+        <mkdir dir="${build.gen-src-wsdl}"/>
+        <mkdir dir="${build.gen-src-apt}"/>
+        <mkdir dir="${build.gen-tests}"/>
         <mkdir dir="${build.tests}"/>
         <mkdir dir="${webapp.dir}/WEB-INF/temp"/>
         <mkdir dir="${drt.logs}"/>
     </target>
-    
+
     <target name="build.tests">
         <!-- Build the test source directory -->
         <javac srcdir="${drt.src}"
@@ -100,7 +113,7 @@
             <fileset dir="${drt.src}" includes="**/*.xml"/>
         </copy>
     </target>
-    
+
     <target name="build.webapp">
         <deploy-wsm webappDir="${webapp.dir}"/>
         <build-webapp webappDir="${webapp.dir}"/>
@@ -114,10 +127,10 @@
         </delete>
         <delete dir="${webapp.dir}/WEB-INF/temp"/>
     </target>
-    
+
     <target name="clean.webapp">
         <clean-webapp webappDir="${webapp.dir}"/>
-        <delete dir="${webapp.dir}/WEB-INF/lib" />
+        <delete dir="${webapp.dir}/WEB-INF/lib"/>
         <!-- should be target in buildWebapp.xml -->
     </target>
 
@@ -129,12 +142,44 @@
         <build-xbean schemaDir="${drt.schemas}" classgenDir="${webapp.dir}/WEB-INF/classes" xbeanBuildClasspathRef="xbean.build.classpath"/>
     </target>
 
+
+    <!-- ========================================= -->
+    <!-- wsdl2java - generate source from wsdl     -->
+    <!-- ========================================= -->
+    <target name="gen_wsdl2java_test" description="Generates a Java class from a wsdl.">
+
+        <taskdef name="wsdl2AJava" classname="org.apache.beehive.wsm.axis.ant.WSDL2AJavaTask">
+            <classpath>
+                <path refid="drt.classpath"/>
+            </classpath>
+        </taskdef>
+
+        <wsdl2AJava outputdir="${build.gen-src-wsdl}" wsdlfile="${drt.wsdl.file}">
+            <classpath>
+                <path refid="drt.classpath"/>
+            </classpath>
+        </wsdl2AJava>
+
+        <taskdef name="apt"
+            classname="org.apache.beehive.controls.runtime.generator.AptTask"
+            classpathref="controls.dependency.path" onerror="report"/>
+
+        <apt srcdir="${build.gen-src-wsdl}" destdir="${build.gen-tests}"
+             gendir="${build.gen-src-apt}" compileByExtension="true"
+             srcExtensions="*.java,*.jcx,*.jcs,*.jws">
+                <classpath>
+                    <path refid="drt.classpath"/>
+                </classpath>
+        </apt>
+    </target>
+
     <target name="run.drt">
         <echo message="** junit logfiles written to ${drt.logs} **"/>
         <junit failureproperty="wsmdrtfailed" printsummary="on" tempdir="${build.dir}" fork="yes">
             <sysproperty key="beehive.home" value="${beehive.home}"/>
             <classpath>
                 <pathelement location="${build.tests}"/>
+                <pathelement location="${build.gen-tests}"/>
                 <path refid="drt.classpath"/>
                 <pathelement location="${webapp.dir}/WEB-INF/classes"/>
             </classpath>
@@ -145,7 +190,7 @@
                 </fileset>
             </batchtest>
         </junit>
-        <fail if="wsmdrtfailed" message="One or more tests in the WSM DRT failed." />
+        <fail if="wsmdrtfailed" message="One or more tests in the WSM DRT failed."/>
     </target>
 
 </project>

Modified: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/WSDL2AnnotatedJavaTest.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/WSDL2AnnotatedJavaTest.java?rev=168458&r1=168457&r2=168458&view=diff
==============================================================================
--- incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/WSDL2AnnotatedJavaTest.java (original)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/WSDL2AnnotatedJavaTest.java Thu May  5 16:03:49 2005
@@ -1,345 +1,237 @@
-/*
- * XmlBeanWSDLProcessorTest.java
- * 
- * Copyright 2001-2004 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.
- * 
- * 
- * Original author: Daryoush Mehrtash
- */
-package org.apache.beehive.wsm.jsr181.wsdl;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.OutputStreamWriter;
-import java.io.StringBufferInputStream;
-import java.io.StringWriter;
-import java.util.Collection;
-import java.util.List;
-import java.util.Iterator;
-import java.util.Properties;
-
-import javax.jws.WebParam;
-import javax.jws.soap.SOAPBinding;
-import javax.wsdl.OperationType;
-
-import junit.framework.TestCase;
-import org.apache.axis.constants.Style;
-import org.apache.axis.constants.Use;
-import org.apache.axis.description.OperationDesc;
-import org.apache.axis.description.ParameterDesc;
-import org.apache.axis.description.ServiceDesc;
-import org.apache.beehive.wsm.axis.databinding.SystemTypeLookupService;
-import org.apache.beehive.wsm.axis.tools.Wsdl2AJava;
-import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
-import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
-import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
-import org.apache.beehive.wsm.model.jsr181.Jsr181MethodMetadataImpl;
-import org.apache.beehive.wsm.model.jsr181.Jsr181ParameterMetadataImpl;
-//import org.apache.beehive.wsm.jsr181.model.jsr181.Jsr181TypeMetadataImpl;
-import org.apache.beehive.wsm.model.wsdl.XmlBeanWSDLProcessor;
-import org.apache.velocity.Template;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
-
-/*******************************************************************************
- * 
- *
- * @author Daryoush Mehrtash
- */
-public class WSDL2AnnotatedJavaTest extends TestCase {
-
-
-
-    public void setUp() throws Exception {
-    }
-
-    public void tearDown() {
-    }
-
-    public void testSrcCodeGeneration() throws Exception {
-            
-            StringWriter result = new StringWriter();
-            //FileInputStream src = new FileInputStream("temp.wsdl");
-			
-	        XmlBeanWSDLProcessor wsdlProc = new XmlBeanWSDLProcessor(new StringBufferInputStream(theWSDL));
-			
-			BeehiveWsTypeMetadata om = wsdlProc.getObjectModel(new SystemTypeLookupService());
-            
-            Collection<? extends BeehiveWsMethodMetadata> methods =om.getMethods();
-            System.out.println("Size of my mehtod list: " + om.getMethods().size());
-            for(BeehiveWsMethodMetadata method : methods) {
-                System.out.println("NEXT METHOD NAME: " + method.getJavaMethodName());
-                
-            }
-            
-//            Jsr181TypeMetadata om = new Jsr181TypeMetadataImpl("myClassName");
-//            om.setWsName("MyWebService");
-//            om.setWsTargetNamespace("http://beehive.apache.org/mywebservice");
-//            om.setWsWsdlLocation("myWsdlLocation");
-//            
-//            Jsr181MethodMetadata method1 = new Jsr181MethodMetadataImpl("firstMethod", void.class);
-//            method1.setOneWay(true);
-//            method1.setWmOperationName("myFirstMethodOperationName");
-//            om.addMethod(method1);
-// 
-//            
-//            Jsr181MethodMetadata method2 = new Jsr181MethodMetadataImpl("secondMethod", String.class);
-//            method2.setOneWay(false);
-//            method2.setWmOperationName("mySecondMethodOperationName");
-//            Jsr181ParameterMetadata param1 = new Jsr181ParameterMetadataImpl();
-//            param1.setJavaType(String.class);
-//            param1.setWpName("myStringParam");
-//            param1.setWpTargetNamespace("http://beehive.apache.org/myparameters");
-//            param1.setWpMode(WebParam.Mode.INOUT);
-//            method2.addParam(param1);
-//            method2.setWrName("method2Result");
-//            method2.setWrTargetNamespace("http://beehive.apache.org//myresults");
-//            om.addMethod(method2);
-// 
-//            Jsr181MethodMetadata method3 = new Jsr181MethodMetadataImpl("thirdMethod", String.class);
-//            method3.setOneWay(false);
-//            method3.setWmOperationName("myThirdMethodOperationName");
-//            Jsr181ParameterMetadata param3_1 = new Jsr181ParameterMetadataImpl();
-//            param3_1.setJavaType(String.class);
-//            param3_1.setWpName("myStringParam1");
-//            param3_1.setWpTargetNamespace("http://beehive.apache.org//myparameters");
-//            param3_1.setWpMode(WebParam.Mode.INOUT);
-//            method3.addParam(param3_1);
-//            Jsr181ParameterMetadata param3_2 = new Jsr181ParameterMetadataImpl();
-//            param3_2.setJavaType(String.class);
-//            param3_2.setWpName("myStringParam2");
-//            param3_2.setWpTargetNamespace("http://beehive.apache.org//myparameters");
-//            param3_2.setWpMode(WebParam.Mode.IN);
-//            method3.addParam(param3_2);
-//            method3.setWrName("method3Result");
-//            method3.setWrTargetNamespace("http://beehive.apache.org//myresults");
-//            om.addMethod(method3);
-// 
-            
-            Wsdl2AJava processor = new Wsdl2AJava();
-            processor.init();
-            processor.generateAnnotatedJavaFromOM(om, result);
-            System.out.println("Outputfile: \n" +   result.getBuffer().toString());
- 
-    }
-    
-    String theWSDL = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-    "<wsdl:definitions targetNamespace=\"http://beehive.apache.org/AddressBook\" xmlns:apachesoap=\"http://xml.apache.org/xml-soap\" xmlns:impl=\"http://beehive.apache.org/AddressBook\" xmlns:intf=\"http://beehive.apache.org/AddressBook\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:wsdlsoap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
-    "<!--WSDL created by Apache Axis version: 1.2RC2Built on Nov 16, 2004 (12:19:44 EST)-->" +
-     "<wsdl:types>" +
-      "<schema elementFormDefault=\"qualified\" targetNamespace=\"http://beehive.apache.org/AddressBook\" xmlns=\"http://www.w3.org/2001/XMLSchema\">" +
-       "<element name=\"oneWayWithParam\">" +
-        "<complexType>" +
-         "<sequence>" +
-          "<element name=\"in0\" type=\"xsd:string\"/>" +
-         "</sequence>" +
-        "</complexType>" +
-       "</element>" +
-       "<element name=\"getAddressFromName\">" +
-        "<complexType>" +
-         "<sequence>" +
-          "<element name=\"in0\" type=\"xsd:string\"/>" +
-         "</sequence>" +
-        "</complexType>" +
-       "</element>" +
-       "<element name=\"getAddressFromNameResponse\">" +
-        "<complexType>" +
-         "<sequence>" +
-          "<element name=\"result\" type=\"impl:Address\"/>" +
-         "</sequence>" +
-        "</complexType>" +
-       "</element>" +
-       "<complexType name=\"Phone\">" +
-        "<sequence>" +
-         "<element name=\"areaCode\" type=\"xsd:int\"/>" +
-         "<element name=\"exchange\" nillable=\"true\" type=\"xsd:string\"/>" +
-         "<element name=\"number\" nillable=\"true\" type=\"xsd:string\"/>" +
-        "</sequence>" +
-       "</complexType>" +
-       "<complexType name=\"StateType\">" +
-        "<sequence>" +
-         "<element name=\"state\" nillable=\"true\" type=\"xsd:string\"/>" +
-        "</sequence>" +
-       "</complexType>" +
-       "<complexType name=\"Address\">" +
-        "<sequence>" +
-         "<element name=\"city\" nillable=\"true\" type=\"xsd:string\"/>" +
-         "<element name=\"phoneNumber\" nillable=\"true\" type=\"impl:Phone\"/>" +
-         "<element name=\"state\" nillable=\"true\" type=\"impl:StateType\"/>" +
-         "<element name=\"streetName\" nillable=\"true\" type=\"xsd:string\"/>" +
-         "<element name=\"streetNum\" type=\"xsd:int\"/>" +
-         "<element name=\"zip\" type=\"xsd:int\"/>" +
-        "</sequence>" +
-       "</complexType>" +
-       "<element name=\"oneWayWithNoParameter\">" +
-        "<complexType/>" +
-       "</element>" +
-       "<element name=\"addEntry\">" +
-        "<complexType>" +
-         "<sequence>" +
-          "<element name=\"in0\" type=\"xsd:string\"/>" +
-          "<element name=\"in1\" type=\"impl:Address\"/>" +
-         "</sequence>" +
-        "</complexType>" +
-       "</element>" +
-       "<element name=\"addEntryResponse\">" +
-        "<complexType/>" +
-       "</element>" +
-       "<element name=\"getAddressFromNames\">" +
-        "<complexType>" +
-         "<sequence>" +
-          "<element maxOccurs=\"unbounded\" name=\"in0\" type=\"xsd:string\"/>" +
-         "</sequence>" +
-        "</complexType>" +
-       "</element>" +
-       "<element name=\"getAddressFromNamesResponse\">" +
-        "<complexType>" +
-         "<sequence>" +
-          "<element maxOccurs=\"unbounded\" name=\"result\" type=\"impl:Address\"/>" +
-         "</sequence>" +
-        "</complexType>" +
-       "</element>" +
-       "<element name=\"simpleNoParamMethod\">" +
-        "<complexType/>" +
-       "</element>" +
-       "<element name=\"simpleNoParamMethodResponse\">" +
-        "<complexType>" +
-         "<sequence>" +
-          "<element name=\"result\" type=\"xsd:string\"/>" +
-         "</sequence>" +
-        "</complexType>" +
-       "</element>" +
-      "</schema>" +
-     "</wsdl:types>" +
-       "<wsdl:message name=\"getAddressFromNamesResponse\">" +
-          "<wsdl:part element=\"impl:getAddressFromNamesResponse\" name=\"parameters\"/>" +
-       "</wsdl:message>" +
-       "<wsdl:message name=\"addEntryRequest\">" +
-          "<wsdl:part element=\"impl:addEntry\" name=\"parameters\"/>" +
-       "</wsdl:message>" +
-       "<wsdl:message name=\"simpleNoParamMethodResponse\">" +
-          "<wsdl:part element=\"impl:simpleNoParamMethodResponse\" name=\"parameters\"/>" +
-       "</wsdl:message>" +
-       "<wsdl:message name=\"getAddressFromNamesRequest\">" +
-          "<wsdl:part element=\"impl:getAddressFromNames\" name=\"parameters\"/>" +
-       "</wsdl:message>" +
-       "<wsdl:message name=\"addEntryResponse\">" +
-          "<wsdl:part element=\"impl:addEntryResponse\" name=\"parameters\"/>" +
-       "</wsdl:message>" +
-       "<wsdl:message name=\"oneWayWithNoParameterRequest\">" +
-          "<wsdl:part element=\"impl:oneWayWithNoParameter\" name=\"parameters\"/>" +
-       "</wsdl:message>" +
-       "<wsdl:message name=\"getAddressFromNameResponse\">" +
-          "<wsdl:part element=\"impl:getAddressFromNameResponse\" name=\"parameters\"/>" +
-       "</wsdl:message>" +
-       "<wsdl:message name=\"oneWayWithParamRequest\">" +
-          "<wsdl:part element=\"impl:oneWayWithParam\" name=\"parameters\"/>" +
-       "</wsdl:message>" +
-       "<wsdl:message name=\"getAddressFromNameRequest\">" +
-          "<wsdl:part element=\"impl:getAddressFromName\" name=\"parameters\"/>" +
-       "</wsdl:message>" +
-       "<wsdl:message name=\"simpleNoParamMethodRequest\">" +
-          "<wsdl:part element=\"impl:simpleNoParamMethod\" name=\"parameters\"/>" +
-       "</wsdl:message>" +
-       "<wsdl:portType name=\"Service\">" +
-          "<wsdl:operation name=\"oneWayWithParam\">" +
-             "<wsdl:input message=\"impl:oneWayWithParamRequest\" name=\"oneWayWithParamRequest\"/>" +
-          "</wsdl:operation>" +
-          "<wsdl:operation name=\"getAddressFromName\">" +
-             "<wsdl:input message=\"impl:getAddressFromNameRequest\" name=\"getAddressFromNameRequest\"/>" +
-             "<wsdl:output message=\"impl:getAddressFromNameResponse\" name=\"getAddressFromNameResponse\"/>" +
-          "</wsdl:operation>" +
-          "<wsdl:operation name=\"oneWayWithNoParameter\">" +
-             "<wsdl:input message=\"impl:oneWayWithNoParameterRequest\" name=\"oneWayWithNoParameterRequest\"/>" +
-          "</wsdl:operation>" +
-          "<wsdl:operation name=\"addEntry\">" +
-             "<wsdl:input message=\"impl:addEntryRequest\" name=\"addEntryRequest\"/>" +
-             "<wsdl:output message=\"impl:addEntryResponse\" name=\"addEntryResponse\"/>" +
-          "</wsdl:operation>" +
-          "<wsdl:operation name=\"getAddressFromNames\">" +
-             "<wsdl:input message=\"impl:getAddressFromNamesRequest\" name=\"getAddressFromNamesRequest\"/>" +
-             "<wsdl:output message=\"impl:getAddressFromNamesResponse\" name=\"getAddressFromNamesResponse\"/>" +
-          "</wsdl:operation>" +
-          "<wsdl:operation name=\"simpleNoParamMethod\">" +
-             "<wsdl:input message=\"impl:simpleNoParamMethodRequest\" name=\"simpleNoParamMethodRequest\"/>" +
-             "<wsdl:output message=\"impl:simpleNoParamMethodResponse\" name=\"simpleNoParamMethodResponse\"/>" +
-          "</wsdl:operation>" +
-       "</wsdl:portType>" +
-       "<wsdl:binding name=\"ServiceSoapBinding\" type=\"impl:Service\">" +
-          "<wsdlsoap:binding style=\"document\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>" +
-          "<wsdl:operation name=\"oneWayWithParam\">" +
-             "<wsdlsoap:operation soapAction=\"\"/>" +
-             "<wsdl:input name=\"oneWayWithParamRequest\">" +
-                "<wsdlsoap:body use=\"literal\"/>" +
-             "</wsdl:input>" +
-          "</wsdl:operation>" +
-          "<wsdl:operation name=\"getAddressFromName\">" +
-             "<wsdlsoap:operation soapAction=\"\"/>" +
-             "<wsdl:input name=\"getAddressFromNameRequest\">" +
-                "<wsdlsoap:body use=\"literal\"/>" +
-             "</wsdl:input>" +
-             "<wsdl:output name=\"getAddressFromNameResponse\">" +
-                "<wsdlsoap:body use=\"literal\"/>" +
-             "</wsdl:output>" +
-          "</wsdl:operation>" +
-          "<wsdl:operation name=\"oneWayWithNoParameter\">" +
-             "<wsdlsoap:operation soapAction=\"\"/>" +
-             "<wsdl:input name=\"oneWayWithNoParameterRequest\">" +
-                "<wsdlsoap:body use=\"literal\"/>" +
-             "</wsdl:input>" +
-          "</wsdl:operation>" +
-          "<wsdl:operation name=\"addEntry\">" +
-             "<wsdlsoap:operation soapAction=\"\"/>" +
-             "<wsdl:input name=\"addEntryRequest\">" +
-                "<wsdlsoap:body use=\"literal\"/>" +
-             "</wsdl:input>" +
-             "<wsdl:output name=\"addEntryResponse\">" +
-                "<wsdlsoap:body use=\"literal\"/>" +
-             "</wsdl:output>" +
-          "</wsdl:operation>" +
-          "<wsdl:operation name=\"getAddressFromNames\">" +
-             "<wsdlsoap:operation soapAction=\"\"/>" +
-             "<wsdl:input name=\"getAddressFromNamesRequest\">" +
-                "<wsdlsoap:body use=\"literal\"/>" +
-             "</wsdl:input>" +
-             "<wsdl:output name=\"getAddressFromNamesResponse\">" +
-                "<wsdlsoap:body use=\"literal\"/>" +
-             "</wsdl:output>" +
-          "</wsdl:operation>" +
-          "<wsdl:operation name=\"simpleNoParamMethod\">" +
-             "<wsdlsoap:operation soapAction=\"\"/>" +
-             "<wsdl:input name=\"simpleNoParamMethodRequest\">" +
-                "<wsdlsoap:body use=\"literal\"/>" +
-             "</wsdl:input>" +
-             "<wsdl:output name=\"simpleNoParamMethodResponse\">" +
-                "<wsdlsoap:body use=\"literal\"/>" +
-             "</wsdl:output>" +
-          "</wsdl:operation>" +
-       "</wsdl:binding>" +
-       "<wsdl:service name=\"ServiceService\">" +
-          "<wsdl:port binding=\"impl:ServiceSoapBinding\" name=\"Service\">" +
-             "<wsdlsoap:address location=\"http://localhost:8080/AddressBook/web/Service.jws\"/>" +
-          "</wsdl:port>" +
-       "</wsdl:service>" +
-    "</wsdl:definitions>";
-
-}
+/*
+ * XmlBeanWSDLProcessorTest.java
+ * 
+ * Copyright 2001-2004 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.
+ * 
+ * 
+ * Original author: Daryoush Mehrtash
+ */
+
+package org.apache.beehive.wsm.jsr181.wsdl;
+
+import junit.framework.TestCase;
+
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+/**
+ * Test the generation of java class with webservice annotations from a WSDL.
+ * The java class is generated during the build process for this drt, from
+ * the wsdl2ajava ant task.
+ */
+public class WSDL2AnnotatedJavaTest extends TestCase {
+
+    private static final String generatedFromWSDL = "web.Service";
+
+    public void setUp() throws Exception { }
+
+    public void tearDown() { }
+
+    
+    public void testWebServiceAnnotationGeneration() throws Exception {
+
+        Class fromWsdl = Class.forName(generatedFromWSDL);
+        assertNotNull(fromWsdl);
+
+        WebService a = (WebService) fromWsdl.getAnnotation(javax.jws.WebService.class);
+
+        assertNotNull(a);
+        assertEquals("Service", a.name());
+        assertEquals("http://beehive.apache.org/AddressBook", a.targetNamespace());
+    }
+
+    public void testSoapBindingAnnotationGeneration() throws Exception {
+
+        Class fromWsdl = Class.forName(generatedFromWSDL);
+        assertNotNull(fromWsdl);
+
+        SOAPBinding a = (SOAPBinding) fromWsdl.getAnnotation(javax.jws.soap.SOAPBinding.class);
+        assertNotNull(a);
+        assertEquals(SOAPBinding.Style.DOCUMENT, a.style());
+        assertEquals(SOAPBinding.Use.LITERAL, a.use());
+        assertEquals(SOAPBinding.ParameterStyle.WRAPPED, a.parameterStyle());
+    }
+
+    // test all annotations / annotation values for the oneWayWithParam method
+    public void testOneWayWithParam() throws Exception {
+        Class fromWsdl = Class.forName(generatedFromWSDL);
+        assertNotNull(fromWsdl);
+
+        Method m = fromWsdl.getMethod("oneWayWithParam", new Class[]{String.class});
+        assertNotNull(m);
+
+        WebMethod a = m.getAnnotation(javax.jws.WebMethod.class);
+        assertNotNull(a);
+        assertEquals("oneWayWithParam", a.operationName());
+        assertEquals(" oneWayWithParam", a.action());
+
+        Oneway o = m.getAnnotation(javax.jws.Oneway.class);
+        assertNotNull(o);
+
+        Annotation[][] paramAnnotations = m.getParameterAnnotations();
+        assertNotNull(paramAnnotations);
+        assertNotNull(paramAnnotations[0]);
+        assertEquals(1, paramAnnotations[0].length);
+
+        assertTrue(paramAnnotations[0][0] instanceof javax.jws.WebParam);
+        WebParam wp = (WebParam) paramAnnotations[0][0];
+        assertEquals("in0", wp.name());
+        assertEquals("http://beehive.apache.org/AddressBook", wp.targetNamespace());
+        assertEquals(WebParam.Mode.IN, wp.mode());
+        assertFalse(wp.header());
+    }
+
+    public void testOneWayWithNoParameter() throws Exception {
+        Class fromWsdl = Class.forName(generatedFromWSDL);
+        assertNotNull(fromWsdl);
+
+        Method m = fromWsdl.getMethod("oneWayWithNoParameter", null);
+        assertNotNull(m);
+
+        WebMethod a = m.getAnnotation(javax.jws.WebMethod.class);
+        assertNotNull(a);
+        assertEquals("oneWayWithNoParameter", a.operationName());
+        assertEquals(" oneWayWithNoParameter", a.action());
+
+        Oneway o = m.getAnnotation(javax.jws.Oneway.class);
+        assertNotNull(o);
+    }
+
+    public void testAddEntry() throws Exception {
+        Class fromWsdl = Class.forName(generatedFromWSDL);
+        assertNotNull(fromWsdl);
+
+        Method m = fromWsdl.getMethod("addEntry", new Class[]{String.class, Object.class});
+        assertNotNull(m);
+
+        WebMethod a = m.getAnnotation(javax.jws.WebMethod.class);
+        assertNotNull(a);
+        assertEquals("addEntry", a.operationName());
+        assertEquals(" addEntry", a.action());
+
+        Oneway o = m.getAnnotation(javax.jws.Oneway.class);
+        assertNotNull(o);
+
+        Annotation[][] paramAnnotations = m.getParameterAnnotations();
+        assertNotNull(paramAnnotations);
+        assertNotNull(paramAnnotations[0]);
+        assertNotNull(paramAnnotations[1]);
+        assertEquals(1, paramAnnotations[0].length);
+        assertEquals(1, paramAnnotations[1].length);
+
+        assertTrue(paramAnnotations[0][0] instanceof javax.jws.WebParam);
+        assertTrue(paramAnnotations[1][0] instanceof javax.jws.WebParam);
+
+        WebParam wp = (WebParam) paramAnnotations[0][0];
+        assertEquals("in0", wp.name());
+        assertEquals("http://beehive.apache.org/AddressBook", wp.targetNamespace());
+        assertEquals(WebParam.Mode.IN, wp.mode());
+        assertFalse(wp.header());
+
+        wp = (WebParam) paramAnnotations[1][0];
+        assertEquals("in1", wp.name());
+        assertEquals("http://beehive.apache.org/AddressBook", wp.targetNamespace());
+        assertEquals(WebParam.Mode.IN, wp.mode());
+        assertFalse(wp.header());
+    }
+
+    public void testGetAddressFromNames() throws Exception {
+
+        Class fromWsdl = Class.forName(generatedFromWSDL);
+        assertNotNull(fromWsdl);
+
+        Method m = fromWsdl.getMethod("getAddressFromNames", new Class[]{String[].class});
+        assertNotNull(m);
+
+        WebMethod a = m.getAnnotation(javax.jws.WebMethod.class);
+        assertNotNull(a);
+        assertEquals("getAddressFromNames", a.operationName());
+        assertEquals(" getAddressFromNames", a.action());
+
+        WebResult r = m.getAnnotation(javax.jws.WebResult.class);
+        assertNotNull(r);
+        assertEquals("result", r.name());
+        assertEquals("http://beehive.apache.org/AddressBook", r.targetNamespace());
+
+        Annotation[][] paramAnnotations = m.getParameterAnnotations();
+        assertNotNull(paramAnnotations);
+        assertNotNull(paramAnnotations[0]);
+        assertEquals(1, paramAnnotations[0].length);
+
+        assertTrue(paramAnnotations[0][0] instanceof javax.jws.WebParam);
+        WebParam wp = (WebParam) paramAnnotations[0][0];
+        assertEquals("in0", wp.name());
+        assertEquals("http://beehive.apache.org/AddressBook", wp.targetNamespace());
+        assertEquals(WebParam.Mode.IN, wp.mode());
+        assertFalse(wp.header());
+    }
+
+    public void testGetAddressFromName() throws Exception {
+
+        Class fromWsdl = Class.forName(generatedFromWSDL);
+        assertNotNull(fromWsdl);
+
+        Method m = fromWsdl.getMethod("getAddressFromName", new Class[]{String.class});
+        assertNotNull(m);
+
+        WebMethod a = m.getAnnotation(javax.jws.WebMethod.class);
+        assertNotNull(a);
+        assertEquals("getAddressFromName", a.operationName());
+        assertEquals(" getAddressFromName", a.action());
+
+        WebResult r = m.getAnnotation(javax.jws.WebResult.class);
+        assertNotNull(r);
+        assertEquals("result", r.name());
+        assertEquals("http://beehive.apache.org/AddressBook", r.targetNamespace());
+
+        Annotation[][] paramAnnotations = m.getParameterAnnotations();
+        assertNotNull(paramAnnotations);
+        assertNotNull(paramAnnotations[0]);
+        assertEquals(1, paramAnnotations[0].length);
+
+        assertTrue(paramAnnotations[0][0] instanceof javax.jws.WebParam);
+        WebParam wp = (WebParam) paramAnnotations[0][0];
+        assertEquals("in0", wp.name());
+        assertEquals("http://beehive.apache.org/AddressBook", wp.targetNamespace());
+        assertEquals(WebParam.Mode.IN, wp.mode());
+        assertFalse(wp.header());
+    }
+
+    public void testSimpleNoParamMethod() throws Exception {
+
+        Class fromWsdl = Class.forName(generatedFromWSDL);
+        assertNotNull(fromWsdl);
+
+        Method m = fromWsdl.getMethod("simpleNoParamMethod", null);
+        assertNotNull(m);
+
+        WebMethod a = m.getAnnotation(javax.jws.WebMethod.class);
+        assertNotNull(a);
+        assertEquals("simpleNoParamMethod", a.operationName());
+        assertEquals(" simpleNoParamMethod", a.action());
+
+        WebResult r = m.getAnnotation(javax.jws.WebResult.class);
+        assertNotNull(r);
+        assertEquals("result", r.name());
+        assertEquals("http://beehive.apache.org/AddressBook", r.targetNamespace());
+    }
+}

Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/web/wsdl2javatest.wsdl.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/web/wsdl2javatest.wsdl.xml?rev=168458&view=auto
==============================================================================
--- incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/web/wsdl2javatest.wsdl.xml (added)
+++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/web/wsdl2javatest.wsdl.xml Thu May  5 16:03:49 2005
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://beehive.apache.org/AddressBook"
+    xmlns:apachesoap="http://xml.apache.org/xml-soap"
+    xmlns:impl="http://beehive.apache.org/AddressBook"
+    xmlns:intf="http://beehive.apache.org/AddressBook"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <!--WSDL created by Apache Axis version: 1.2RC2Built on Nov 16, 2004 (12:19:44 EST)-->
+    <wsdl:types>
+        <schema elementFormDefault="qualified" targetNamespace="http://beehive.apache.org/AddressBook" xmlns="http://www.w3.org/2001/XMLSchema">
+
+            <element name="oneWayWithParam">
+                <complexType>
+                    <sequence>
+                        <element name="in0" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+
+            <element name="getAddressFromName">
+                <complexType>
+                    <sequence>
+                        <element name="in0" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+
+            <element name="getAddressFromNameResponse">
+                <complexType>
+                    <sequence>
+                        <element name="result" type="impl:Address"/>
+                    </sequence>
+                </complexType>
+            </element>
+
+            <complexType name="Phone">
+                <sequence>
+                    <element name="areaCode" type="xsd:int"/>
+                    <element name="exchange" nillable="true" type="xsd:string"/>
+                    <element name="number" nillable="true" type="xsd:string"/>
+                </sequence>
+            </complexType>
+
+            <complexType name="StateType">
+                <sequence>
+                    <element name="state" nillable="true" type="xsd:string"/>
+                </sequence>
+            </complexType>
+            <complexType name="Address">
+                <sequence>
+                    <element name="city" nillable="true" type="xsd:string"/>
+                    <element name="phoneNumber" nillable="true" type="impl:Phone"/>
+                    <element name="state" nillable="true" type="impl:StateType"/>
+                    <element name="streetName" nillable="true" type="xsd:string"/>
+                    <element name="streetNum" type="xsd:int"/>
+                    <element name="zip" type="xsd:int"/>
+                </sequence>
+            </complexType>
+            <element name="oneWayWithNoParameter">
+                <complexType/>
+            </element>
+            <element name="addEntry">
+                <complexType>
+                    <sequence>
+                        <element name="in0" type="xsd:string"/>
+                        <element name="in1" type="impl:Address"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="addEntryResponse">
+                <complexType/>
+            </element>
+            <element name="getAddressFromNames">
+                <complexType>
+                    <sequence>
+                        <element maxOccurs="unbounded" name="in0" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="getAddressFromNamesResponse">
+                <complexType>
+                    <sequence>
+                        <element maxOccurs="unbounded" name="result" type="impl:Address"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="simpleNoParamMethod">
+                <complexType/>
+            </element>
+            <element name="simpleNoParamMethodResponse">
+                <complexType>
+                    <sequence>
+                        <element name="result" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="getAddressFromNamesResponse">
+        <wsdl:part element="impl:getAddressFromNamesResponse" name="parameters"/>
+    </wsdl:message>
+    <wsdl:message name="addEntryRequest">
+        <wsdl:part element="impl:addEntry" name="parameters"/>
+    </wsdl:message>
+    <wsdl:message name="simpleNoParamMethodResponse">
+        <wsdl:part element="impl:simpleNoParamMethodResponse" name="parameters"/>
+    </wsdl:message>
+    <wsdl:message name="getAddressFromNamesRequest">
+        <wsdl:part element="impl:getAddressFromNames" name="parameters"/>
+    </wsdl:message>
+    <wsdl:message name="addEntryResponse">
+        <wsdl:part element="impl:addEntryResponse" name="parameters"/>
+    </wsdl:message>
+    <wsdl:message name="oneWayWithNoParameterRequest">
+        <wsdl:part element="impl:oneWayWithNoParameter" name="parameters"/>
+    </wsdl:message>
+    <wsdl:message name="getAddressFromNameResponse">
+        <wsdl:part element="impl:getAddressFromNameResponse" name="parameters"/>
+    </wsdl:message>
+    <wsdl:message name="oneWayWithParamRequest">
+        <wsdl:part element="impl:oneWayWithParam" name="parameters"/>
+    </wsdl:message>
+    <wsdl:message name="getAddressFromNameRequest">
+        <wsdl:part element="impl:getAddressFromName" name="parameters"/>
+    </wsdl:message>
+    <wsdl:message name="simpleNoParamMethodRequest">
+        <wsdl:part element="impl:simpleNoParamMethod" name="parameters"/>
+    </wsdl:message>
+    <wsdl:portType name="Service">
+        <wsdl:operation name="oneWayWithParam">
+            <wsdl:input message="impl:oneWayWithParamRequest" name="oneWayWithParamRequest"/>
+        </wsdl:operation>
+        <wsdl:operation name="getAddressFromName">
+            <wsdl:input message="impl:getAddressFromNameRequest" name="getAddressFromNameRequest"/>
+            <wsdl:output message="impl:getAddressFromNameResponse" name="getAddressFromNameResponse"/>
+        </wsdl:operation>
+        <wsdl:operation name="oneWayWithNoParameter">
+            <wsdl:input message="impl:oneWayWithNoParameterRequest" name="oneWayWithNoParameterRequest"/>
+        </wsdl:operation>
+        <wsdl:operation name="addEntry">
+            <wsdl:input message="impl:addEntryRequest" name="addEntryRequest"/>
+            <wsdl:output message="impl:addEntryResponse" name="addEntryResponse"/>
+        </wsdl:operation>
+        <wsdl:operation name="getAddressFromNames">
+            <wsdl:input message="impl:getAddressFromNamesRequest" name="getAddressFromNamesRequest"/>
+            <wsdl:output message="impl:getAddressFromNamesResponse" name="getAddressFromNamesResponse"/>
+        </wsdl:operation>
+        <wsdl:operation name="simpleNoParamMethod">
+            <wsdl:input message="impl:simpleNoParamMethodRequest" name="simpleNoParamMethodRequest"/>
+            <wsdl:output message="impl:simpleNoParamMethodResponse" name="simpleNoParamMethodResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="ServiceSoapBinding" type="impl:Service">
+        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="oneWayWithParam">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="oneWayWithParamRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+        </wsdl:operation>
+        <wsdl:operation name="getAddressFromName">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="getAddressFromNameRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="getAddressFromNameResponse">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="oneWayWithNoParameter">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="oneWayWithNoParameterRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+        </wsdl:operation>
+        <wsdl:operation name="addEntry">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="addEntryRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="addEntryResponse">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="getAddressFromNames">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="getAddressFromNamesRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="getAddressFromNamesResponse">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="simpleNoParamMethod">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="simpleNoParamMethodRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="simpleNoParamMethodResponse">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="ServiceService">
+        <wsdl:port binding="impl:ServiceSoapBinding" name="Service">
+            <wsdlsoap:address location="http://localhost:8080/AddressBook/web/Service.jws"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>

Propchange: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/jsr181/wsdl/web/wsdl2javatest.wsdl.xml
------------------------------------------------------------------------------
    svn:eol-style = native