From 80ccc206b5c86dbd8f4d6ba30307e8de2e4764bf Mon Sep 17 00:00:00 2001 From: slaws Date: Mon, 15 Nov 2010 14:05:17 +0000 Subject: Tag for 2.0-Beta1-RC3 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1035279 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/binding/ws/xml/ReadTestCase.java | 106 ++++++++++++++++ .../tuscany/sca/binding/ws/xml/WriteTestCase.java | 82 +++++++++++++ .../ws/xml/Calculator-bad-wsdlElement.composite | 59 +++++++++ .../sca/binding/ws/xml/Calculator.composite | 63 ++++++++++ .../binding/ws/xml/CalculatorImpl.componentType | 45 +++++++ .../binding/ws/xml/PoliciedCalculator.composite | 60 +++++++++ .../apache/tuscany/sca/binding/ws/xml/example.wsdl | 26 ++++ .../sca/binding/ws/xml/invalid-stockquote.wsdl | 58 +++++++++ .../org/apache/tuscany/sca/binding/ws/xml/ipo.xsd | 136 +++++++++++++++++++++ .../tuscany/sca/binding/ws/xml/stockquote.wsdl | 58 +++++++++ .../apache/tuscany/sca/binding/ws/xml/test1.wsdl | 45 +++++++ .../apache/tuscany/sca/binding/ws/xml/test1.xsd | 33 +++++ .../apache/tuscany/sca/binding/ws/xml/test2.wsdl | 63 ++++++++++ .../sca/binding/ws/xml/unwrapped-stockquote.wsdl | 76 ++++++++++++ 14 files changed, 910 insertions(+) create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator-bad-wsdlElement.composite create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/PoliciedCalculator.composite create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl create mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl (limited to 'sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test') diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java new file mode 100644 index 0000000000..85d41bd15c --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java @@ -0,0 +1,106 @@ +/* + * 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.binding.ws.xml; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.fail; + +import java.io.InputStream; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.sca.assembly.ComponentType; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.contribution.processor.ContributionReadException; +import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.ProcessorContext; +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.junit.BeforeClass; +import org.junit.Test; + +/** + * Test reading WSDL interfaces. + * + * @version $Rev$ $Date$ + */ +public class ReadTestCase { + + private static XMLInputFactory inputFactory; + private static StAXArtifactProcessor staxProcessor; + private static ProcessorContext context; + + @BeforeClass + public static void setUp() throws Exception { + DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); + context = new ProcessorContext(extensionPoints); + inputFactory = XMLInputFactory.newInstance(); + StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); + staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null); + } + + @Test + public void testReadComponentType() throws Exception { + InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType"); + XMLStreamReader reader = inputFactory.createXMLStreamReader(is); + ComponentType componentType = (ComponentType)staxProcessor.read(reader, context); + assertNotNull(componentType); + } + + @Test + public void testReadComposite() throws Exception { + InputStream is = getClass().getResourceAsStream("Calculator.composite"); + XMLStreamReader reader = inputFactory.createXMLStreamReader(is); + Composite composite = (Composite)staxProcessor.read(reader, context); + assertNotNull(composite); + } + + @Test + public void testReadPolicies() throws Exception { + InputStream is = getClass().getResourceAsStream("PoliciedCalculator.composite"); + XMLStreamReader reader = inputFactory.createXMLStreamReader(is); + Composite composite = (Composite)staxProcessor.read(reader, context); + assertNotNull(composite); + } + + /** + * This test makes sure that an exception is thrown when a bad wsdlElement is present along with EndpointReference. + * + * Ref: Web Service Binding Specification v1.0 - Sec 2.1 - Lines 61 to 65. + * When an EndpointReference is present along with the wsdlElement attribute on the parent element, the wsdlElement attribute value MUST + * be of the 'Binding' form. + */ + @Test + public void testReadBadWsdlElement() throws Exception { + InputStream is = getClass().getResourceAsStream("Calculator-bad-wsdlElement.composite"); + XMLStreamReader reader = inputFactory.createXMLStreamReader(is); + try { + staxProcessor.read(reader, context); + fail("ContributionReadException expected."); + } catch(ContributionReadException e) { + // Expected + assertNotSame(-1, e.getMessage().indexOf("must use wsdl.binding when using wsa:EndpointReference")); + } + } +} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java new file mode 100644 index 0000000000..805b1862ce --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java @@ -0,0 +1,82 @@ +/* + * 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.binding.ws.xml; + +import static org.junit.Assert.assertNotNull; + +import java.io.ByteArrayOutputStream; +import java.io.InputStream; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLOutputFactory; + +import org.apache.tuscany.sca.assembly.ComponentType; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.ProcessorContext; +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.junit.BeforeClass; +import org.junit.Test; + +/** + * Test reading/write WSDL interfaces. + * + * @version $Rev$ $Date$ + */ +public class WriteTestCase { + + private static XMLInputFactory inputFactory; + private static XMLOutputFactory outputFactory; + private static StAXArtifactProcessor staxProcessor; + private static ProcessorContext context; + + @BeforeClass + public static void setUp() throws Exception { + DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); + context = new ProcessorContext(extensionPoints); + inputFactory = XMLInputFactory.newInstance(); + outputFactory = XMLOutputFactory.newInstance(); + StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); + staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory); + } + + @Test + public void testReadWriteComponentType() throws Exception { + InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType"); + ComponentType componentType = (ComponentType)staxProcessor.read(inputFactory.createXMLStreamReader(is), context); + assertNotNull(componentType); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + staxProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos), context); + } + + @Test + public void testReadWriteComposite() throws Exception { + InputStream is = getClass().getResourceAsStream("Calculator.composite"); + Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is), context); + assertNotNull(composite); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos), context); + System.out.println(bos.toString()); + } + +} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator-bad-wsdlElement.composite b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator-bad-wsdlElement.composite new file mode 100644 index 0000000000..2404e9ba28 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator-bad-wsdlElement.composite @@ -0,0 +1,59 @@ + + + + + + + + + http://localhost:8085/Calculator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite new file mode 100644 index 0000000000..64965a689c --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite @@ -0,0 +1,63 @@ + + + + + + + + + + + + + http://localhost:8085/services/HelloWorldWebService + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType new file mode 100644 index 0000000000..b86683b79a --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + myURI + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/PoliciedCalculator.composite b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/PoliciedCalculator.composite new file mode 100644 index 0000000000..1b6423be1d --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/PoliciedCalculator.composite @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl new file mode 100644 index 0000000000..5e8e5dad0d --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl @@ -0,0 +1,26 @@ + + + + + + + diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl new file mode 100644 index 0000000000..ad81fc7867 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd new file mode 100644 index 0000000000..241ec15d36 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd @@ -0,0 +1,136 @@ + + + + + + International Purchase order schema for Example.com + Copyright 2000 Example.com. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl new file mode 100644 index 0000000000..39cd5547d9 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl new file mode 100644 index 0000000000..d53104b0ca --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd new file mode 100644 index 0000000000..c2210f4a94 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl new file mode 100644 index 0000000000..529b395fd5 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl new file mode 100644 index 0000000000..666a7e4069 --- /dev/null +++ b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-ws/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3