From 95c83c38d814e6dbcceb9efdcd4b62d60a16c051 Mon Sep 17 00:00:00 2001 From: rfeng Date: Fri, 31 Oct 2008 04:01:44 +0000 Subject: Resolve a lot of OSGi access violations. More to be fixed. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@709339 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/interfacedef/wsdl/xml/WSDLConstants.java | 6 +- .../wsdl/xml/WSDLDocumentProcessor.java | 3 +- .../wsdl/xml/WSDLInterfaceProcessor.java | 4 +- .../interfacedef/wsdl/AbstractWSDLTestCase.java | 68 ------------ .../WSDLInterfaceIntrospectorTestCase.java | 83 --------------- .../WSDLOperationIntrospectorTestCase.java | 117 --------------------- ...licyAnnotatedInterfaceIntrospectorTestCase.java | 87 --------------- .../introspect/WrapperStyleOperationTestCase.java | 70 ------------ .../sca/interfacedef/wsdl/xml/ReadTestCase.java | 14 +-- 9 files changed, 6 insertions(+), 446 deletions(-) delete mode 100644 branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java delete mode 100644 branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java delete mode 100644 branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java delete mode 100644 branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java delete mode 100644 branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java (limited to 'branches/sca-equinox/modules/interface-wsdl-xml/src') diff --git a/branches/sca-equinox/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java b/branches/sca-equinox/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java index f9ddda6d98..82d18ca319 100644 --- a/branches/sca-equinox/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java +++ b/branches/sca-equinox/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java @@ -20,17 +20,15 @@ package org.apache.tuscany.sca.interfacedef.wsdl.xml; import javax.xml.namespace.QName; -import org.apache.tuscany.sca.assembly.xml.Constants; - /** * Constants for WSDL. * * @version $Rev$ $Date$ */ public interface WSDLConstants { - + String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0"; String INTERFACE_WSDL = "interface.wsdl"; - QName INTERFACE_WSDL_QNAME = new QName(Constants.SCA10_NS, "interface.wsdl"); + QName INTERFACE_WSDL_QNAME = new QName(SCA10_NS, "interface.wsdl"); String INTERFACE = "interface"; String CALLBACK_INTERFACE = "callbackInterface"; String WSDL_LOCATION = "wsdlLocation"; diff --git a/branches/sca-equinox/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java b/branches/sca-equinox/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java index 7f9f6b0146..8331215067 100644 --- a/branches/sca-equinox/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java +++ b/branches/sca-equinox/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java @@ -43,9 +43,8 @@ import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.Problem.Severity; -import org.apache.tuscany.sca.monitor.impl.ProblemImpl; -import org.apache.tuscany.sca.xsd.XSDefinition; import org.apache.tuscany.sca.xsd.XSDFactory; +import org.apache.tuscany.sca.xsd.XSDefinition; /** * An ArtifactProcessor for WSDL documents. diff --git a/branches/sca-equinox/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/branches/sca-equinox/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java index 6a364fe164..d40aac9434 100644 --- a/branches/sca-equinox/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java +++ b/branches/sca-equinox/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java @@ -27,7 +27,6 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; -import org.apache.tuscany.sca.assembly.xml.Constants; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; @@ -43,7 +42,6 @@ import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.Problem.Severity; -import org.apache.tuscany.sca.monitor.impl.ProblemImpl; /** * @@ -162,7 +160,7 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor - writer.writeStartElement(Constants.SCA10_NS, INTERFACE_WSDL); + writer.writeStartElement(WSDLConstants.SCA10_NS, INTERFACE_WSDL); // Write interface name WSDLInterface wsdlInterface = (WSDLInterface)wsdlInterfaceContract.getInterface(); diff --git a/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java b/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java deleted file mode 100644 index 8ed7ba395b..0000000000 --- a/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.sca.interfacedef.wsdl; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.ContributionFactory; -import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.xsd.XSDFactory; - -/** - * Test case for WSDLOperation. - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractWSDLTestCase extends TestCase { - protected URLArtifactProcessor documentProcessor; - protected ModelResolver resolver; - protected WSDLFactory wsdlFactory; - protected XSDFactory xsdFactory; - - /** - * @see junit.framework.TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); - wsdlFactory = modelFactories.getFactory(WSDLFactory.class); - xsdFactory = modelFactories.getFactory(XSDFactory.class); - - ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class); - Contribution contribution = contributionFactory.createContribution(); - ModelResolverExtensionPoint modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); - resolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories); - contribution.setModelResolver(resolver); - - URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); - documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null); - } - -} diff --git a/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java b/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java deleted file mode 100644 index dc7e1ced38..0000000000 --- a/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.sca.interfacedef.wsdl.introspect; - -import java.net.URI; -import java.net.URL; -import java.util.List; - -import javax.wsdl.PortType; -import javax.xml.namespace.QName; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.interfacedef.DataType; -import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.util.XMLType; -import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; - -/** - * Test case for InterfaceWSDLIntrospectorImpl. - * - * @version $Rev$ $Date$ - */ -public class WSDLInterfaceIntrospectorTestCase extends AbstractWSDLTestCase { - private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType"); - - private PortType portType; - private WSDLDefinition definition; - - /** - * @see junit.framework.TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - - URL url = getClass().getResource("../xml/stockquote.wsdl"); - definition = (WSDLDefinition)documentProcessor.read(null, new URI("stockquote.wsdl"), url); - resolver.addModel(definition); - definition = resolver.resolveModel(WSDLDefinition.class, definition); - portType = definition.getDefinition().getPortType(PORTTYPE_NAME); - } - - @SuppressWarnings("unchecked") - public final void testIntrospectPortType() throws InvalidInterfaceException { - WSDLInterface contract = wsdlFactory.createWSDLInterface(portType, definition, resolver); - Assert.assertEquals(contract.getName().getLocalPart(), "StockQuotePortType"); - List operations = contract.getOperations(); - Assert.assertEquals(1, operations.size()); - Operation operation = operations.get(0); - Assert.assertEquals("getLastTradePrice", operation.getName()); - DataType> inputType = operation.getInputType(); - Assert.assertEquals(1, inputType.getLogical().size()); - DataType returnType = operation.getOutputType(); - Assert.assertNotNull(returnType); - Assert.assertEquals(0, operation.getFaultTypes().size()); - // Assert.assertEquals(1, - // operation.getWrapper().getInputChildElements().size()); - // Assert.assertEquals(1, - // operation.getWrapper().getOutputChildElements().size()); - } - -} diff --git a/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java b/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java deleted file mode 100644 index c392b92f8a..0000000000 --- a/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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.sca.interfacedef.wsdl.introspect; - -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; - -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.AbstractWSDLTestCase; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; -import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl; - -/** - * Test case for WSDLOperation. - * - * @version $Rev$ $Date$ - */ -public class WSDLOperationIntrospectorTestCase extends AbstractWSDLTestCase { - private static final QName PORTTYPE_NAME = - new QName("http://example.com/stockquote.wsdl", "StockQuotePortType"); - - - @SuppressWarnings("unchecked") - public final void testWrappedOperation() throws Exception { - URL url = getClass().getResource("../xml/stockquote.wsdl"); - WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("stockquote.wsdl"), url); - 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); - - DataType> inputType = op.getInputType(); - Assert.assertEquals(1, inputType.getLogical().size()); - DataType type = inputType.getLogical().get(0); - Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePrice"), type.getLogical().getElementName()); - - DataType outputType = op.getOutputType(); - Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePriceResponse"), - outputType.getLogical().getElementName()); - Assert.assertTrue(op.isWrapperStyle()); - - DataType> unwrappedInputType = op.getWrapper().getWrapperInfo().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(); - Assert.assertEquals(new QName(null, "price"), childType.getLogical().getElementName()); - } - - public final void testUnwrappedOperation() throws Exception { - URL url = getClass().getResource("../xml/unwrapped-stockquote.wsdl"); - WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("unwrapped-stockquote.wsdl"), url); - 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); - 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); - Assert.assertFalse(op.isWrapperStyle()); - Assert.assertEquals(2, op.getInputType().getLogical().size()); - } - - public final void testInvalidWSDL() throws Exception { - URL url = getClass().getResource("../xml/invalid-stockquote.wsdl"); - WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("invalid-stockquote.wsdl"), url); - 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); - - try { - op.isWrapperStyle(); - fail("InvalidWSDLException should have been thrown"); - } catch (InvalidInterfaceException e) { - // Expected - } - - } - -} diff --git a/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java b/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java deleted file mode 100644 index cf379a1b11..0000000000 --- a/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.sca.interfacedef.wsdl.introspect; - -import java.net.URI; -import java.net.URL; - -import javax.wsdl.PortType; -import javax.xml.namespace.QName; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.interfacedef.ConversationSequence; -import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; -import org.apache.tuscany.sca.policy.Intent; - -/** - * Test case for InterfaceWSDLIntrospectorImpl. - * - * @version $Rev$ $Date$ - */ -public class WSDLPolicyAnnotatedInterfaceIntrospectorTestCase extends AbstractWSDLTestCase { - private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType"); - private static final QName INTENT = new QName("http://example.com/stockquote.wsdl", "PolicyIntent"); - - private PortType portType; - private WSDLDefinition definition; - - /** - * @see junit.framework.TestCase#setUp() - */ - @Override - protected void setUp() throws Exception { - super.setUp(); - - URL url = getClass().getResource("/policy/stockquote_policy.wsdl"); - definition = (WSDLDefinition)documentProcessor.read(null, new URI("stockquote.wsdl"), url); - resolver.addModel(definition); - definition = resolver.resolveModel(WSDLDefinition.class, definition); - portType = definition.getDefinition().getPortType(PORTTYPE_NAME); - } - - @SuppressWarnings("unchecked") - public final void testIntrospectPortType() throws InvalidInterfaceException { - WSDLInterface contract = wsdlFactory.createWSDLInterface(portType, definition, resolver); - Assert.assertEquals(contract.getName().getLocalPart(), "StockQuotePortType"); - Assert.assertTrue(contract.isConversational()); - - boolean foundIntent = false; - - for(Intent intent : contract.getRequiredIntents()) { - if(INTENT.equals(intent.getName())) { - foundIntent = true; - } - } - - Assert.assertTrue(foundIntent); - - for(Operation operation : contract.getOperations()) { - if(operation.getName().equals("cancel")) { - Assert.assertEquals(operation.getConversationSequence(), ConversationSequence.CONVERSATION_END); - } - } - - } -} diff --git a/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java b/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java deleted file mode 100644 index ff18c65c69..0000000000 --- a/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.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.AbstractWSDLTestCase; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; -import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl; - -/** - * Test case for WSDLOperation. - * - * @version $Rev$ $Date$ - */ -public class WrapperStyleOperationTestCase extends AbstractWSDLTestCase { - private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType"); - - public final void testWrappedOperation() throws Exception { - URL url = getClass().getResource("../xml/stockquote.wsdl"); - WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("stockquote.wsdl"), url); - 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); - Assert.assertTrue(op.isWrapperStyle()); - Assert.assertEquals(1, op.getWrapper().getInputChildElements().size()); - Assert.assertEquals(1, op.getWrapper().getOutputChildElements().size()); - } - - public final void testUnwrappedOperation() throws Exception { - URL url = getClass().getResource("../xml/unwrapped-stockquote.wsdl"); - WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("unwrapped-stockquote.wsdl"), url); - 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); - Assert.assertFalse(op.isWrapperStyle()); - operation = portType.getOperation("getLastTradePrice2", null, null); - op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver); - Assert.assertFalse(op.isWrapperStyle()); - } - -} diff --git a/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java b/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java index 21e8e44046..7f17f7463f 100644 --- a/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java +++ b/branches/sca-equinox/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java @@ -26,22 +26,17 @@ import javax.xml.stream.XMLStreamReader; import junit.framework.TestCase; -import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.ComponentType; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.ConstrainingType; -import org.apache.tuscany.sca.assembly.SCABindingFactory; import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; -import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl; +import org.apache.tuscany.sca.assembly.builder.CompositeBuilderExtensionPoint; import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; /** * Test reading WSDL interfaces. @@ -62,12 +57,7 @@ public class ReadTestCase extends TestCase { staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null); FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); - AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class); - IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); - compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper); + compositeBuilder = extensionPoints.getExtensionPoint(CompositeBuilderExtensionPoint.class).getCompositeBuilder("org.apache.tuscany.sca.assembly.builder.CompositeBuilder"); } public void testReadComponentType() throws Exception { -- cgit v1.2.3