From 2acb7e5e335a57662f031a1be5dd773dea5bbdab Mon Sep 17 00:00:00 2001 From: rfeng Date: Wed, 3 Dec 2008 22:46:31 +0000 Subject: Fix access violations git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@723111 13f79535-47bb-0310-9956-ffa450edef68 --- .../interface-wsdl-xml/META-INF/MANIFEST.MF | 3 +-- .../WSDLOperationIntrospectorTestCase.java | 29 +++++++++++----------- .../introspect/WrapperStyleOperationTestCase.java | 17 ++++++------- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/java/sca/modules/interface-wsdl-xml/META-INF/MANIFEST.MF b/java/sca/modules/interface-wsdl-xml/META-INF/MANIFEST.MF index e4e7ad08cb..eafd4517cd 100644 --- a/java/sca/modules/interface-wsdl-xml/META-INF/MANIFEST.MF +++ b/java/sca/modules/interface-wsdl-xml/META-INF/MANIFEST.MF @@ -17,7 +17,6 @@ Import-Package: javax.wsdl, javax.wsdl.xml, javax.xml.namespace, javax.xml.stream, - org.apache.tuscany.sca.assembly;version="1.4";resolution:=optional, org.apache.tuscany.sca.assembly.builder;version="1.4";resolution:=optional, org.apache.tuscany.sca.contribution;version="1.4", @@ -27,13 +26,13 @@ Import-Package: javax.wsdl, org.apache.tuscany.sca.core;version="1.4", org.apache.tuscany.sca.definitions;version="1.4.0";resolution:=optional, org.apache.tuscany.sca.interfacedef;version="1.4", + org.apache.tuscany.sca.interfacedef.util;version="1.4", org.apache.tuscany.sca.interfacedef.wsdl;version="1.4", org.apache.tuscany.sca.monitor;version="1.4", org.apache.tuscany.sca.policy;version="1.4";resolution:=optional, org.apache.tuscany.sca.xsd;version="1.4", org.apache.tuscany.sca.xsd.xml;version="1.4", org.apache.ws.commons.schema, - org.w3c.dom, org.xml.sax Bundle-SymbolicName: org.apache.tuscany.sca.interface.wsdl.xml diff --git a/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java b/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java index e5d61ddf4c..7c2d22c997 100644 --- a/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java +++ b/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java @@ -23,7 +23,6 @@ import java.net.URI; import java.net.URL; import java.util.List; -import javax.wsdl.Operation; import javax.wsdl.PortType; import javax.xml.namespace.QName; @@ -32,9 +31,10 @@ import junit.framework.Assert; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; import org.apache.tuscany.sca.interfacedef.util.XMLType; -import org.apache.tuscany.sca.interfacedef.wsdl.xml.AbstractWSDLTestCase; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; -import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; +import org.apache.tuscany.sca.interfacedef.wsdl.xml.AbstractWSDLTestCase; /** * Test case for WSDLOperation. @@ -53,9 +53,9 @@ public class WSDLOperationIntrospectorTestCase extends AbstractWSDLTestCase { resolver.addModel(definition); definition = resolver.resolveModel(WSDLDefinition.class, definition); PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME); - Operation operation = portType.getOperation("getLastTradePrice", null, null); - - WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver); + + WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver); + WSDLOperation op = (WSDLOperation) wi.getOperations().get(0); DataType> inputType = op.getInputType(); Assert.assertEquals(1, inputType.getLogical().size()); @@ -67,13 +67,13 @@ public class WSDLOperationIntrospectorTestCase extends AbstractWSDLTestCase { outputType.getLogical().getElementName()); Assert.assertTrue(op.isWrapperStyle()); - DataType> unwrappedInputType = op.getWrapper().getWrapperInfo().getUnwrappedInputType(); + DataType> unwrappedInputType = op.getWrapper().getUnwrappedInputType(); List childTypes = unwrappedInputType.getLogical(); Assert.assertEquals(1, childTypes.size()); DataType childType = childTypes.get(0); Assert.assertEquals(new QName(null, "tickerSymbol"), childType.getLogical().getElementName()); - childType = op.getWrapper().getWrapperInfo().getUnwrappedOutputType(); + childType = op.getWrapper().getUnwrappedOutputType(); Assert.assertEquals(new QName(null, "price"), childType.getLogical().getElementName()); } @@ -84,13 +84,12 @@ public class WSDLOperationIntrospectorTestCase extends AbstractWSDLTestCase { definition = resolver.resolveModel(WSDLDefinition.class, definition); PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME); - Operation operation = portType.getOperation("getLastTradePrice1", null, null); - WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver); + WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver); + WSDLOperation op = (WSDLOperation) wi.getOperations().get(1); Assert.assertFalse(op.isWrapperStyle()); Assert.assertEquals(1, op.getInputType().getLogical().size()); - operation = portType.getOperation("getLastTradePrice2", null, null); - op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver); + op = (WSDLOperation) wi.getOperations().get(2); Assert.assertFalse(op.isWrapperStyle()); Assert.assertEquals(2, op.getInputType().getLogical().size()); } @@ -102,10 +101,10 @@ public class WSDLOperationIntrospectorTestCase extends AbstractWSDLTestCase { definition = resolver.resolveModel(WSDLDefinition.class, definition); PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME); - Operation operation = portType.getOperation("getLastTradePrice", null, null); - WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver); - try { + WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver); + WSDLOperation op = (WSDLOperation) wi.getOperations().get(0); + op.isWrapperStyle(); fail("InvalidWSDLException should have been thrown"); } catch (InvalidInterfaceException e) { diff --git a/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java b/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java index 06ab562257..8fda9ac11b 100644 --- a/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java +++ b/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java @@ -22,15 +22,15 @@ package org.apache.tuscany.sca.interfacedef.wsdl.introspect; import java.net.URI; import java.net.URL; -import javax.wsdl.Operation; import javax.wsdl.PortType; import javax.xml.namespace.QName; import junit.framework.Assert; -import org.apache.tuscany.sca.interfacedef.wsdl.xml.AbstractWSDLTestCase; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; -import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation; +import org.apache.tuscany.sca.interfacedef.wsdl.xml.AbstractWSDLTestCase; /** * Test case for WSDLOperation. @@ -46,8 +46,8 @@ public class WrapperStyleOperationTestCase extends AbstractWSDLTestCase { resolver.addModel(definition); definition = resolver.resolveModel(WSDLDefinition.class, definition); PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME); - Operation operation = portType.getOperation("getLastTradePrice", null, null); - WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver); + WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver); + WSDLOperation op = (WSDLOperation) wi.getOperations().get(0); Assert.assertTrue(op.isWrapperStyle()); Assert.assertEquals(1, op.getWrapper().getInputChildElements().size()); Assert.assertEquals(1, op.getWrapper().getOutputChildElements().size()); @@ -59,11 +59,10 @@ public class WrapperStyleOperationTestCase extends AbstractWSDLTestCase { resolver.addModel(definition); definition = resolver.resolveModel(WSDLDefinition.class, definition); PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME); - Operation operation = portType.getOperation("getLastTradePrice1", null, null); - WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver); + WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver); + WSDLOperation op = (WSDLOperation) wi.getOperations().get(1); Assert.assertFalse(op.isWrapperStyle()); - operation = portType.getOperation("getLastTradePrice2", null, null); - op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver); + op = (WSDLOperation) wi.getOperations().get(2); Assert.assertFalse(op.isWrapperStyle()); } -- cgit v1.2.3