You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2006/09/12 07:30:49 UTC
svn commit: r442456 [2/2] - in /incubator/tuscany/java:
samples/sca/echo.databinding/
samples/sca/echo.databinding/src/test/resources/META-INF/tuscany/
samples/sca/helloworldws/ sca/bindings/binding.axis2/
sca/databinding/databinding-axiom/ sca/databin...
Added: incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java?view=auto&rev=442456
==============================================================================
--- incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java (added)
+++ incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java Mon Sep 11 22:30:48 2006
@@ -0,0 +1,433 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.idl.wsdl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.idl.InvalidServiceContractException;
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObject;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaParticle;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
+/**
+ * Metadata for a WSDL operation
+ */
+public class WSDLOperation {
+ protected XMLSchemaRegistry schemaRegistry;
+
+ protected Operation operation;
+
+ private String defaultDataBinding;
+
+ protected org.apache.tuscany.spi.model.Operation<QName> operationModel;
+
+ protected DataType<List<DataType<QName>>> inputType;
+
+ protected DataType<QName> outputType;
+
+ protected List<DataType<QName>> faultTypes;
+
+ /**
+ * @param operation The WSDL4J operation
+ * @param defaultDataBinding The default databinding
+ * @param schemaRegistry The XML Schema registry
+ */
+ public WSDLOperation(Operation operation, String defaultDataBinding, XMLSchemaRegistry schemaRegistry) {
+ super();
+ this.operation = operation;
+ this.defaultDataBinding = defaultDataBinding;
+ this.schemaRegistry = schemaRegistry;
+ this.wrapper = new Wrapper();
+ }
+
+ private Wrapper wrapper;
+
+ private Boolean wrapperStyle;
+
+ /**
+ * Test if the operation qualifies wrapper style as defined by the JAX-WS 2.0 spec
+ *
+ * @return true if the operation qualifies wrapper style, otherwise false
+ */
+ public boolean isWrapperStyle() {
+ if (wrapperStyle == null) {
+ wrapperStyle =
+ Boolean.valueOf(wrapper.getInputChildElements() != null
+ && (operation.getOutput() == null || wrapper.getOutputChildElements() != null));
+ }
+ return wrapperStyle.booleanValue();
+ }
+
+ public Wrapper getWrapper() {
+ if (!isWrapperStyle()) {
+ throw new IllegalStateException("The operation is not wrapper style.");
+ } else {
+ return wrapper;
+ }
+ }
+
+ /**
+ * @return
+ * @throws InvalidServiceContractException
+ */
+ public DataType<List<DataType<QName>>> getInputType() throws InvalidServiceContractException {
+ if (inputType == null) {
+ Input input = operation.getInput();
+ Message message = (input == null) ? null : input.getMessage();
+ inputType = getMessageType(message);
+ inputType.setMetadata(WSDLOperation.class.getName(), this);
+ }
+ return inputType;
+ }
+
+ /**
+ * @return
+ * @throws NotSupportedWSDLException
+ */
+ public DataType<QName> getOutputType() throws InvalidServiceContractException {
+ if (outputType == null) {
+ Output output = operation.getOutput();
+ Message outputMsg = (output == null) ? null : output.getMessage();
+
+ List outputParts = (outputMsg == null) ? null : outputMsg.getOrderedParts(null);
+ if (outputParts != null || outputParts.size() > 0) {
+ if (outputParts.size() > 1) {
+ // We don't support output with multiple parts
+ throw new NotSupportedWSDLException("Multi-part output is not supported");
+ }
+ Part part = (Part) outputParts.get(0);
+ outputType = new WSDLPart(part).getDataType();
+ outputType.setMetadata(WSDLOperation.class.getName(), this);
+ }
+ }
+ return outputType;
+ }
+
+ /**
+ * @return
+ * @throws NotSupportedWSDLException
+ */
+ public List<DataType<QName>> getFaultTypes() throws InvalidServiceContractException {
+ if (faultTypes == null) {
+ Collection faults = operation.getFaults().values();
+ faultTypes = new ArrayList<DataType<QName>>();
+ for (Object f : faults) {
+ Fault fault = (Fault) f;
+ Message faultMsg = fault.getMessage();
+ List faultParts = faultMsg.getOrderedParts(null);
+ if (faultParts.size() != 1) {
+ throw new NotSupportedWSDLException("The fault message MUST have a single part");
+ }
+ Part part = (Part) faultParts.get(0);
+ WSDLPart wsdlPart = new WSDLPart(part);
+ faultTypes.add(wsdlPart.getDataType());
+ }
+ }
+ return faultTypes;
+ }
+
+ private DataType<List<DataType<QName>>> getMessageType(Message message) throws InvalidServiceContractException {
+ List<DataType<QName>> partTypes = new ArrayList<DataType<QName>>();
+ if (message != null) {
+ Collection parts = message.getOrderedParts(null);
+ for (Object p : parts) {
+ WSDLPart part = new WSDLPart((Part) p);
+ partTypes.add(part.getDataType());
+ }
+ }
+ return new DataType<List<DataType<QName>>>(defaultDataBinding, Object[].class, partTypes);
+ }
+
+ /**
+ * @return
+ * @throws NotSupportedWSDLException
+ */
+ public org.apache.tuscany.spi.model.Operation<QName> getOperation() throws InvalidServiceContractException {
+ if (operationModel == null) {
+ boolean oneway = (operation.getOutput() == null);
+ operationModel =
+ new org.apache.tuscany.spi.model.Operation<QName>(operation.getName(), getInputType(),
+ getOutputType(), getFaultTypes(), oneway, defaultDataBinding);
+ operationModel.addMetaData(WSDLOperation.class.getName(), this);
+ }
+ return operationModel;
+ }
+
+ /**
+ * Metadata for a WSDL part
+ */
+ public class WSDLPart {
+ private Part part;
+
+ private XmlSchemaElement element;
+
+ private DataType<QName> dataType;
+
+ public WSDLPart(Part part) throws InvalidWSDLException {
+ this.part = part;
+ QName elementName = part.getElementName();
+ if (elementName != null) {
+ element = schemaRegistry.getElement(elementName);
+ if (element == null) {
+ throw new InvalidWSDLException("Element cannot be resolved: " + elementName);
+ }
+ } else {
+ // Create an faked XSD element to host the metadata
+ element = new XmlSchemaElement();
+ element.setName(part.getName());
+ element.setQName(new QName(null, part.getName()));
+ QName typeName = part.getTypeName();
+ if (typeName != null) {
+ XmlSchemaType type = schemaRegistry.getType(typeName);
+ if (type == null) {
+ throw new InvalidWSDLException("Type cannot be resolved: " + typeName);
+ }
+ element.setSchemaType(type);
+ element.setSchemaTypeName(type.getQName());
+ }
+ }
+ dataType = new DataType<QName>(defaultDataBinding, Object.class, element.getQName());
+ dataType.setMetadata(WSDLPart.class.getName(), this);
+ }
+
+ /**
+ * @return the element
+ */
+ public XmlSchemaElement getElement() {
+ return element;
+ }
+
+ /**
+ * @return the part
+ */
+ public Part getPart() {
+ return part;
+ }
+
+ /**
+ * @return the dataType
+ */
+ public DataType<QName> getDataType() {
+ return dataType;
+ }
+ }
+
+ /**
+ * The "Wrapper Style" WSDL operation is defined by The Java API for XML-Based Web Services (JAX-WS) 2.0
+ * specification, section 2.3.1.2 Wrapper Style.
+ * <p>
+ * A WSDL operation qualifies for wrapper style mapping only if the following criteria are met:
+ * <ul>
+ * <li>(i) The operations input and output messages (if present) each contain only a single part
+ * <li>(ii) The input message part refers to a global element declaration whose localname is equal to the operation
+ * name
+ * <li>(iii) The output message part refers to a global element declaration
+ * <li>(iv) The elements referred to by the input and output message parts (henceforth referred to as wrapper
+ * elements) are both complex types defined using the xsd:sequence compositor
+ * <li>(v) The wrapper elements only contain child elements, they must not contain other structures such as
+ * wildcards (element or attribute), xsd:choice, substitution groups (element references are not permitted) or
+ * attributes; furthermore, they must not be nillable.
+ * </ul>
+ */
+ public class Wrapper {
+ private XmlSchemaElement inputWrapperElement;
+
+ private XmlSchemaElement outputWrapperElement;
+
+ private List<XmlSchemaElement> inputElements;
+
+ private List<XmlSchemaElement> outputElements;
+
+ private DataType<List<DataType<QName>>> unwrappedInputType;
+
+ private DataType<QName> unwrappedOutputType;
+
+ private List<XmlSchemaElement> getChildElements(XmlSchemaElement element) {
+ if (element == null) {
+ return null;
+ }
+ XmlSchemaType type = element.getSchemaType();
+ if (!(type instanceof XmlSchemaComplexType)) {
+ // Has to be a complexType
+ return null;
+ }
+ XmlSchemaComplexType complexType = (XmlSchemaComplexType) type;
+ if (complexType.getAttributes().getCount() != 0 || complexType.getAnyAttribute() != null) {
+ // No attributes
+ return null;
+ }
+ XmlSchemaParticle particle = complexType.getParticle();
+ if (particle == null) {
+ // No particle
+ return Collections.emptyList();
+ }
+ if (!(particle instanceof XmlSchemaSequence)) {
+ return null;
+ }
+ XmlSchemaSequence sequence = (XmlSchemaSequence) complexType.getParticle();
+ XmlSchemaObjectCollection items = sequence.getItems();
+ List<XmlSchemaElement> childElements = new ArrayList<XmlSchemaElement>();
+ for (int i = 0; i < items.getCount(); i++) {
+ XmlSchemaObject schemaObject = items.getItem(i);
+ if (!(schemaObject instanceof XmlSchemaElement)) {
+ return null;
+ }
+ XmlSchemaElement childElement = (XmlSchemaElement) schemaObject;
+ if (childElement.getName() == null || childElement.getRefName() != null || childElement.isNillable()) {
+ return null;
+ }
+ // TODO: Do we support maxOccurs >1 ?
+ if (childElement.getMaxOccurs() > 1) {
+ return null;
+ }
+ childElements.add(childElement);
+ }
+ return childElements;
+ }
+
+ /**
+ * Return a list of child XSD elements under the wrapped request element
+ *
+ * @return a list of child XSD elements or null if if the request element is not wrapped
+ */
+ public List<XmlSchemaElement> getInputChildElements() {
+ if (inputElements != null) {
+ return inputElements;
+ }
+ Input input = operation.getInput();
+ if (input != null) {
+ Message inputMsg = input.getMessage();
+ Collection parts = inputMsg.getParts().values();
+ if (parts.size() != 1) {
+ return null;
+ }
+ Part part = (Part) parts.iterator().next();
+ QName elementName = part.getElementName();
+ if (elementName == null) {
+ return null;
+ }
+ if (!operation.getName().equals(elementName.getLocalPart())) {
+ return null;
+ }
+ inputWrapperElement = schemaRegistry.getElement(elementName);
+ if (inputWrapperElement == null) {
+ return null;
+ }
+ inputElements = getChildElements(inputWrapperElement);
+ return inputElements;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Return a list of child XSD elements under the wrapped response element
+ *
+ * @return a list of child XSD elements or null if if the response element is not wrapped
+ */
+ public List<XmlSchemaElement> getOutputChildElements() {
+ if (outputElements != null) {
+ return outputElements;
+ }
+ Output output = operation.getOutput();
+ if (output != null) {
+ Message outputMsg = output.getMessage();
+ Collection parts = outputMsg.getParts().values();
+ if (parts.size() != 1) {
+ return null;
+ }
+ Part part = (Part) parts.iterator().next();
+ QName elementName = part.getElementName();
+ if (elementName == null) {
+ return null;
+ }
+ outputWrapperElement = schemaRegistry.getElement(elementName);
+ if (outputWrapperElement == null) {
+ return null;
+ }
+ outputElements = getChildElements(outputWrapperElement);
+ // FIXME: Do we support multiple child elements for the response?
+ return outputElements;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @return the inputWrapperElement
+ */
+ public XmlSchemaElement getInputWrapperElement() {
+ return inputWrapperElement;
+ }
+
+ /**
+ * @return the outputWrapperElement
+ */
+ public XmlSchemaElement getOutputWrapperElement() {
+ return outputWrapperElement;
+ }
+
+ public DataType<List<DataType<QName>>> getUnwrappedInputType() {
+ if (unwrappedInputType == null) {
+ List<DataType<QName>> types = new ArrayList<DataType<QName>>();
+ for (XmlSchemaElement element : getInputChildElements()) {
+ DataType<QName> type = new DataType<QName>(defaultDataBinding, Object.class, element.getQName());
+ type.setMetadata(XmlSchemaElement.class.getName(), element);
+ types.add(type);
+ }
+ unwrappedInputType = new DataType<List<DataType<QName>>>("idl:unwrapped.input", Object[].class, types);
+ }
+ return unwrappedInputType;
+ }
+
+ public DataType<QName> getUnwrappedOutputType() throws InvalidServiceContractException {
+ if (unwrappedOutputType == null) {
+ List<XmlSchemaElement> elements = getOutputChildElements();
+ if (elements != null || elements.size() > 0) {
+ if (elements.size() > 1) {
+ // We don't support output with multiple parts
+ throw new NotSupportedWSDLException("Multi-part output is not supported");
+ }
+ XmlSchemaElement element = elements.get(0);
+ unwrappedOutputType = new DataType<QName>(defaultDataBinding, Object.class, element.getQName());
+ unwrappedOutputType.setMetadata(XmlSchemaElement.class.getName(), element);
+ }
+ }
+ return unwrappedOutputType;
+ }
+ }
+
+}
Propchange: incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java (original)
+++ incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/XMLSchemaRegistryImpl.java Mon Sep 11 22:30:48 2006
@@ -79,7 +79,7 @@
for (Object ext : types.getExtensibilityElements()) {
if (ext instanceof Schema) {
Element element = ((Schema) ext).getElement();
- XmlSchema s = collection.read(element);
+ XmlSchema s = collection.read(element, element.getBaseURI());
schemas.add(s);
}
}
Modified: incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java (original)
+++ incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImplTestCase.java Mon Sep 11 22:30:48 2006
@@ -68,11 +68,11 @@
DataType<QName> returnType = operation.getOutputType();
Assert.assertNotNull(returnType);
Assert.assertEquals(0, operation.getFaultTypes().size());
- WrapperStyleOperation op =
- (WrapperStyleOperation) operation.getMetaData().get(WrapperStyleOperation.class.getName());
+ WSDLOperation op =
+ (WSDLOperation) operation.getMetaData().get(WSDLOperation.class.getName());
Assert.assertNotNull(op);
- Assert.assertEquals(1, op.getInputChildElements().size());
- Assert.assertEquals(1, op.getOutputChildElements().size());
+ Assert.assertEquals(1, op.getWrapper().getInputChildElements().size());
+ Assert.assertEquals(1, op.getWrapper().getOutputChildElements().size());
}
public final void testIntrospectPortTypePortType() throws InvalidServiceContractException {
Added: incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java?view=auto&rev=442456
==============================================================================
--- incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java (added)
+++ incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java Mon Sep 11 22:30:48 2006
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.idl.wsdl;
+
+import java.net.URL;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.DataType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+/**
+ * Test case for WSDLOperation
+ */
+public class WSDLOperationTestCase extends TestCase {
+ private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
+
+ private WSDLDefinitionRegistryImpl registry;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new WSDLDefinitionRegistryImpl();
+ registry.setSchemaRegistry(new XMLSchemaRegistryImpl());
+ }
+
+ public final void testWrappedOperation() throws Exception {
+ URL url = getClass().getResource("stockquote.wsdl");
+ Definition definition = registry.loadDefinition(null, url);
+ PortType portType = definition.getPortType(PORTTYPE_NAME);
+ Operation operation = portType.getOperation("getLastTradePrice", null, null);
+
+ WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
+
+ DataType<List<DataType<QName>>> inputType = op.getInputType();
+ Assert.assertSame(op, inputType.getMetadata(WSDLOperation.class.getName()));
+ Assert.assertEquals(1, inputType.getLogical().size());
+ Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePrice"), inputType.getLogical()
+ .get(0).getLogical());
+
+ DataType<QName> outputType = op.getOutputType();
+ Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePriceResponse"), outputType
+ .getLogical());
+ Assert.assertTrue(op.isWrapperStyle());
+
+ DataType<List<DataType<QName>>> unwrappedInputType = op.getWrapper().getUnwrappedInputType();
+ List<DataType<QName>> childTypes = unwrappedInputType.getLogical();
+ Assert.assertEquals(1, childTypes.size());
+ DataType<QName> childType = childTypes.get(0);
+ Assert.assertEquals(new QName(null, "tickerSymbol"), childType.getLogical());
+ XmlSchemaElement element = (XmlSchemaElement) childType.getMetadata(XmlSchemaElement.class.getName());
+ Assert.assertNotNull(element);
+
+ childType = op.getWrapper().getUnwrappedOutputType();
+ Assert.assertEquals(new QName(null, "price"), childType.getLogical());
+ element = (XmlSchemaElement) childType.getMetadata(XmlSchemaElement.class.getName());
+ Assert.assertNotNull(element);
+ }
+
+ public final void testUnwrappedOperation() throws Exception {
+ URL url = getClass().getResource("unwrapped-stockquote.wsdl");
+ Definition definition = registry.loadDefinition(null, url);
+ PortType portType = definition.getPortType(PORTTYPE_NAME);
+
+ Operation operation = portType.getOperation("getLastTradePrice1", null, null);
+ WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
+ Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertEquals(1, op.getInputType().getLogical().size());
+
+ operation = portType.getOperation("getLastTradePrice2", null, null);
+ op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
+ Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertEquals(2, op.getInputType().getLogical().size());
+ }
+
+}
Propchange: incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WSDLOperationTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java (original)
+++ incubator/tuscany/java/sca/idl/wsdl/src/test/java/org/apache/tuscany/idl/wsdl/WrapperStyleOperationTestCase.java Mon Sep 11 22:30:48 2006
@@ -30,7 +30,7 @@
import junit.framework.TestCase;
/**
- * Test case for WrapperStyleOperation
+ * Test case for WSDLOperation
*/
public class WrapperStyleOperationTestCase extends TestCase {
private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
@@ -51,10 +51,10 @@
Definition definition = registry.loadDefinition(null, url);
PortType portType = definition.getPortType(PORTTYPE_NAME);
Operation operation = portType.getOperation("getLastTradePrice", null, null);
- WrapperStyleOperation op = new WrapperStyleOperation(operation, registry.getSchemaRegistry());
+ WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
Assert.assertTrue(op.isWrapperStyle());
- Assert.assertEquals(1, op.getInputChildElements().size());
- Assert.assertEquals(1, op.getOutputChildElements().size());
+ Assert.assertEquals(1, op.getWrapper().getInputChildElements().size());
+ Assert.assertEquals(1, op.getWrapper().getOutputChildElements().size());
}
public final void testUnwrappedOperation() throws Exception {
@@ -62,15 +62,11 @@
Definition definition = registry.loadDefinition(null, url);
PortType portType = definition.getPortType(PORTTYPE_NAME);
Operation operation = portType.getOperation("getLastTradePrice1", null, null);
- WrapperStyleOperation op = new WrapperStyleOperation(operation, registry.getSchemaRegistry());
+ WSDLOperation op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
Assert.assertFalse(op.isWrapperStyle());
operation = portType.getOperation("getLastTradePrice2", null, null);
- op = new WrapperStyleOperation(operation, registry.getSchemaRegistry());
+ op = new WSDLOperation(operation, "org.w3c.dom.Node", registry.getSchemaRegistry());
Assert.assertFalse(op.isWrapperStyle());
- operation = portType.getOperation("getLastTradePrice3", null, null);
- op = new WrapperStyleOperation(operation, registry.getSchemaRegistry());
- Assert.assertFalse(op.isWrapperStyle());
-
}
}
Modified: incubator/tuscany/java/sca/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl?view=diff&rev=442456&r1=442455&r2=442456
==============================================================================
--- incubator/tuscany/java/sca/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl (original)
+++ incubator/tuscany/java/sca/idl/wsdl/src/test/resources/org/apache/tuscany/idl/wsdl/unwrapped-stockquote.wsdl Mon Sep 11 22:30:48 2006
@@ -33,21 +33,13 @@
<message name="GetLastTradePriceInput2">
<part name="body" element="xsd1:getLastTradePrice" />
- <part name="other" element="xsd:string"/>
+ <part name="other" type="xsd:string"/>
</message>
<message name="GetLastTradePriceOutput2">
<part name="body" element="xsd1:getLastTradePriceResponse" />
</message>
- <message name="GetLastTradePriceInput3">
- <part name="body" element="xsd1:getLastTradePrice" />
- </message>
-
- <message name="GetLastTradePriceOutput3">
- <part name="body" element="xsd1:getLastTradePriceResponse" />
- </message>
-
<portType name="StockQuotePortType">
<operation name="getLastTradePrice">
<input message="tns:GetLastTradePriceInput1" />
@@ -60,10 +52,6 @@
<operation name="getLastTradePrice2">
<input message="tns:GetLastTradePriceInput2" />
<output message="tns:GetLastTradePriceOutput2" />
- </operation>
- <operation name="getLastTradePrice3">
- <input message="tns:GetLastTradePriceInput3" />
- <output message="tns:GetLastTradePriceOutput3" />
</operation>
</portType>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org