Return-Path: Delivered-To: apmail-incubator-beehive-commits-archive@www.apache.org Received: (qmail 85288 invoked from network); 14 Sep 2004 00:05:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 14 Sep 2004 00:05:27 -0000 Received: (qmail 65891 invoked by uid 500); 14 Sep 2004 00:05:26 -0000 Delivered-To: apmail-incubator-beehive-commits-archive@incubator.apache.org Received: (qmail 65811 invoked by uid 500); 14 Sep 2004 00:05:25 -0000 Mailing-List: contact beehive-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: "Beehive Dev" Delivered-To: mailing list beehive-commits@incubator.apache.org Received: (qmail 65795 invoked by uid 500); 14 Sep 2004 00:05:25 -0000 Delivered-To: apmail-incubator-beehive-cvs@incubator.apache.org Received: (qmail 65792 invoked by uid 99); 14 Sep 2004 00:05:25 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Mon, 13 Sep 2004 17:05:23 -0700 Received: (qmail 85244 invoked by uid 65534); 14 Sep 2004 00:05:22 -0000 Date: 14 Sep 2004 00:05:22 -0000 Message-ID: <20040914000522.85241.qmail@minotaur.apache.org> From: mmerz@apache.org To: beehive-cvs@incubator.apache.org Subject: svn commit: rev 46004 - in incubator/beehive/trunk/wsm: . drt drt/tests/org/apache/beehive/wsm/axis src/runtime/org/apache/beehive/wsm/jsr181/model src/runtime/org/apache/beehive/wsm/jsr181/wsdl X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: mmerz Date: Mon Sep 13 17:05:21 2004 New Revision: 46004 Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/AxisHookTest.java (contents, props changed) Modified: incubator/beehive/trunk/wsm/build.xml incubator/beehive/trunk/wsm/drt/build.xml incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceMETHODMetadata.java incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceTYPEMetadata.java incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/WSDLProcessor.java Log: Modified the drt to test some axis dependent components and modified the constructors of the metadata classes to take a few required values in cases where no annotations are available. Modified: incubator/beehive/trunk/wsm/build.xml ============================================================================== --- incubator/beehive/trunk/wsm/build.xml (original) +++ incubator/beehive/trunk/wsm/build.xml Mon Sep 13 17:05:21 2004 @@ -334,7 +334,7 @@ - + Modified: incubator/beehive/trunk/wsm/drt/build.xml ============================================================================== --- incubator/beehive/trunk/wsm/drt/build.xml (original) +++ incubator/beehive/trunk/wsm/drt/build.xml Mon Sep 13 17:05:21 2004 @@ -21,6 +21,9 @@ + + + @@ -39,12 +42,27 @@ + + + + + + + + + + + - - - + + + + + + + @@ -79,12 +97,8 @@ - - - - - - + + Added: incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/AxisHookTest.java ============================================================================== --- (empty file) +++ incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/AxisHookTest.java Mon Sep 13 17:05:21 2004 @@ -0,0 +1,193 @@ +/* + * AxisHookTest.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. + * + */ +package org.apache.beehive.wsm.axis; + +import junit.framework.TestCase; + +import javax.jws.WebParam; +import javax.jws.soap.SOAPBinding; + +import org.apache.axis.description.ServiceDesc; +//import org.apache.axis.description.JavaServiceDesc; +import org.apache.axis.description.ParameterDesc; +import org.apache.axis.description.OperationDesc; +import org.apache.beehive.wsm.axis.badtiger.EnumWrapper; +import org.apache.beehive.wsm.jsr181.model.WebServiceTYPEMetadata; +import org.apache.beehive.wsm.jsr181.model.WebServiceMETHODMetadata; +import org.apache.beehive.wsm.jsr181.model.WebServicePARAMETERMetadata; +import org.apache.beehive.wsm.jsr181.model.SOAPBindingInfo; + +/******************************************************************************* + * + * + * @author Jonathan Colwell + */ +public class AxisHookTest extends TestCase { + + + public static final Class WS_CLASS = FakeWebService.class; + public static final String WM_JAVAMETHODNAME = "fakeWebMethod"; + public static final String WM_JAVAONEWAYMETHODNAME = "fakeOneWayWebMethod"; + public static final String WS_NAME = "WebServiceName"; + //public static final String WS_SERVICENAME = WS_NAME + "Service"; + public static final String WS_NAMESPACE = "http://web.service/namespace"; + public static final String WM_OPERATION = "OperationName"; + public static final String WM_ACTION = "Lights_Camera_Action!"; + public static final String WM_RESULT = "ResultName"; + public static final String WM_ONEWAY = "Oneway"; + public static final String WM_TWOWAYPARAM = "number"; + public static final String WM_ONEWAYPARAM = "text"; + + public void setUp() { + + } + + public void tearDown() { + } + + public void testCreateServiceDesc() throws Exception + { + WebServiceTYPEMetadata wsm = makeFakeMetadata(); + ServiceDesc sd = AxisHook.createServiceDesc(wsm, null); + + examineServiceDesc(sd); + } + + /** + * @return true if the ServiceDesc contains the expected values + */ + protected void examineServiceDesc(ServiceDesc sd) + { + assertEquals(WS_NAME, sd.getName()); + assertEquals(WS_NAMESPACE, sd.getDefaultNamespace()); + assertEquals(EnumWrapper.LITERAL, sd.getUse()); + + /* + * NOTE jcolwell@bea.com 2004-Sep-13 -- + * in AXIS, WRAPPED is considered a Style and overrides DOCUMENT + * rather than living next to it as ParameterStyle does in jsr-181 + */ + //assertTrue(EnumWrapper.DOCUMENT.equals(sd.getStyle())); + assertEquals(EnumWrapper.WRAPPED, sd.getStyle()); + OperationDesc twoWayOp = sd.getOperationByName(WM_JAVAMETHODNAME); + assertNotNull(twoWayOp); + if (twoWayOp != null) { + assertEquals(WM_ACTION, twoWayOp.getSoapAction()); + // NOTE jcolwell@bea.com 2004-Sep-13 -- + //check that this is method returns something + ParameterDesc param = twoWayOp.getParameter(0); + assertNotNull(param); + if (param != null) { + assertEquals(WM_TWOWAYPARAM, param.getName()); + assertEquals(Integer.TYPE, param.getJavaType()); + assertEquals(ParameterDesc.INOUT, param.getMode()); + } + } + + OperationDesc oneWayOp = sd.getOperationByName(WM_JAVAONEWAYMETHODNAME); + assertNotNull(oneWayOp); + if (oneWayOp != null) { + assertEquals(WM_ONEWAY + WM_ACTION, oneWayOp.getSoapAction()); + // NOTE jcolwell@bea.com 2004-Sep-13 -- + // make sure this method does not return anything + ParameterDesc param = oneWayOp.getParameter(0); + assertNotNull(param); + if (param != null) { + assertEquals(WM_ONEWAYPARAM, param.getName()); + assertEquals(String.class, param.getJavaType()); + assertEquals(ParameterDesc.IN, param.getMode()); + } + } + } + + protected WebServiceTYPEMetadata makeFakeMetadata() + { + WebServiceTYPEMetadata wstm = + new WebServiceTYPEMetadata(WS_CLASS.getName()); + wstm.setWsName(WS_NAME); + /* + * NOTE jcolwell@bea.com 2004-Sep-13 -- + * service name not used in the ServiceDesc + */ + //wstm.setWsServiceName(WS_SERVICENAME); + wstm.setWsTargetNamespace(WS_NAMESPACE); + wstm.setSoapBinding(makeFakeSoapBinding()); + wstm.addMethod(makeFakeMethod()); + wstm.addMethod(makeFakeOnewayMethod()); + + return wstm; + } + + protected WebServiceMETHODMetadata makeFakeOnewayMethod() + { + WebServiceMETHODMetadata wsmm = + new WebServiceMETHODMetadata(WM_JAVAONEWAYMETHODNAME, Void.TYPE); + wsmm.setWmOperationName(WM_ONEWAY + WM_OPERATION); + wsmm.setWmAction(WM_ONEWAY + WM_ACTION); + wsmm.setOneWay(true); + + WebServicePARAMETERMetadata wspm = new WebServicePARAMETERMetadata(); + wspm.setJavaType(String.class); + wspm.setWpName(WM_ONEWAYPARAM); + wspm.setWpMode(WebParam.Mode.IN); + wsmm.addParam(wspm); + + return wsmm; + } + + + protected WebServiceMETHODMetadata makeFakeMethod() + { + WebServiceMETHODMetadata wsmm = + new WebServiceMETHODMetadata(WM_JAVAMETHODNAME, String.class); + wsmm.setWmOperationName(WM_OPERATION); + wsmm.setWmAction(WM_ACTION); + wsmm.setWrName(WM_RESULT); + wsmm.setOneWay(false); + + WebServicePARAMETERMetadata wspm = new WebServicePARAMETERMetadata(); + wspm.setJavaType(Integer.TYPE); + wspm.setWpName(WM_TWOWAYPARAM); + wspm.setWpMode(WebParam.Mode.INOUT); + wsmm.addParam(wspm); + + return wsmm; + } + + protected SOAPBindingInfo makeFakeSoapBinding() + { + SOAPBindingInfo sbi = new SOAPBindingInfo(); + sbi.setStyle(SOAPBinding.Style.DOCUMENT); + sbi.setUse(SOAPBinding.Use.LITERAL); + sbi.setParameterStyle(SOAPBinding.ParameterStyle.WRAPPED); + return sbi; + } + + public static class FakeWebService { + + public String fakeWebMethod(int num) { + return "You're number " + Integer.toString(num) + '!'; + } + + public void fakeOneWayWebMethod(String text) { + //do nothing + } + } +} Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceMETHODMetadata.java ============================================================================== --- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceMETHODMetadata.java (original) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceMETHODMetadata.java Mon Sep 13 17:05:21 2004 @@ -63,13 +63,17 @@ /** * */ - public WebServiceMETHODMetadata() { + public WebServiceMETHODMetadata(String methodName, + Class returnType) { super(); + javaMethodName = methodName; + javaReturnType = returnType; } public WebServiceMETHODMetadata(javax.jws.WebMethod methodAnnotation, String javaMethodName, Class javaReturnType, Collection annotations, List< ? extends WebServicePARAMETERMetadata> webParams) { + super(); // check parameters if ((null == javaMethodName) || (null == javaReturnType)) { throw new IllegalArgumentException( @@ -349,4 +353,4 @@ return javaReturnType; } -} \ No newline at end of file +} Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceTYPEMetadata.java ============================================================================== --- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceTYPEMetadata.java (original) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceTYPEMetadata.java Mon Sep 13 17:05:21 2004 @@ -63,8 +63,10 @@ /** * */ - public WebServiceTYPEMetadata() { + public WebServiceTYPEMetadata(String fqClassName) { super(); + + javaFQClassName = fqClassName; } // TODO: not used anymore, remove it. @@ -432,4 +434,4 @@ public String getJavaFQClassName() { return javaFQClassName; } -} \ No newline at end of file +} Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/WSDLProcessor.java ============================================================================== --- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/WSDLProcessor.java (original) +++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/WSDLProcessor.java Mon Sep 13 17:05:21 2004 @@ -83,7 +83,7 @@ throws IllegalAccessException, NoSuchFieldException { - WebServiceTYPEMetadata wsm = new WebServiceTYPEMetadata(); + WebServiceTYPEMetadata wsm = new WebServiceTYPEMetadata(null); Map methodMap = new HashMap(); TDefinitions defs = defDoc.getDefinitions(); @@ -169,12 +169,9 @@ WebServiceMETHODMetadata> methodMap, Map messageMap) { - WebServiceMETHODMetadata wmm = new WebServiceMETHODMetadata(); String opName = op.getName(); - //wmm.setJavaMethodName(opName); - wmm.setWmOperationName(opName); - methodMap.put(opName, wmm); TParam outputParam = op.getOutput(); + Class returnType = Void.TYPE; if (outputParam != null) { TPart[] returnTypes = messageMap .get(outputParam.getMessage().getLocalPart()); @@ -183,20 +180,20 @@ String returnName = returnTypes[0].getName(); QName qReturnType = returnTypes[0].getType(); + /* - wmm.setJavaReturnType(qReturnType - .getNamespaceURI() - + '.' + qReturnType - .getLocalPart()); - */ - } - else { - //wmm.setJavaReturnType("void"); + * FIXME jcolwell@bea.com 2004-Sep-13 -- + * properly convert the QName to a java class + */ + returnType = null; } } - else { - //wmm.setJavaReturnType("void"); - } + WebServiceMETHODMetadata wmm = + new WebServiceMETHODMetadata(opName, returnType); + //wmm.setJavaMethodName(opName); + wmm.setWmOperationName(opName); + methodMap.put(opName, wmm); + List paramOrder = op.getParameterOrder(); if (paramOrder != null) {