tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r665980 - in /incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test: java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/ resources/policy/
Date Tue, 10 Jun 2008 04:48:46 GMT
Author: lresende
Date: Mon Jun  9 21:48:46 2008
New Revision: 665980

URL: http://svn.apache.org/viewvc?rev=665980&view=rev
Log:
Unit tests for wsdl policy extensions

Added:
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java
  (with props)
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/resources/policy/
    incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/resources/policy/stockquote_policy.wsdl
  (with props)

Added: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java?rev=665980&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java
(added)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java
Mon Jun  9 21:48:46 2008
@@ -0,0 +1,78 @@
+/*
+ * 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.InvalidInterfaceException;
+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);
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/resources/policy/stockquote_policy.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/resources/policy/stockquote_policy.wsdl?rev=665980&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/resources/policy/stockquote_policy.wsdl
(added)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/resources/policy/stockquote_policy.wsdl
Mon Jun  9 21:48:46 2008
@@ -0,0 +1,61 @@
+<?xml version="1.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.    
+-->
+<definitions name="StockQuote" 
+    targetNamespace="http://example.com/stockquote.wsdl"
+    xmlns:tns="http://example.com/stockquote.wsdl" 
+    xmlns:xsd="http://example.com/stockquote.xsd"
+    xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+    xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+    <types>
+        <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
+            <element name="getLastTradePrice">
+                <complexType>
+                    <sequence>
+                        <element name="tickerSymbol" type="string" />
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="getLastTradePriceResponse">
+                <complexType>
+                    <sequence>
+                        <element name="price" type="float" />
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </types>
+
+    <message name="GetLastTradePriceInput">
+        <part name="body" element="xsd:getLastTradePrice" />
+    </message>
+
+    <message name="GetLastTradePriceOutput">
+        <part name="body" element="xsd:getLastTradePriceResponse" />
+    </message>
+
+    <portType name="StockQuotePortType" sca:requires="sca:conversational tns:PolicyIntent">
+        <operation name="getLastTradePrice">
+            <input message="tns:GetLastTradePriceInput" />
+            <output message="tns:GetLastTradePriceOutput" />
+        </operation>
+    </portType>
+
+</definitions>
\ No newline at end of file

Propchange: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/resources/policy/stockquote_policy.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/resources/policy/stockquote_policy.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/test/resources/policy/stockquote_policy.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message