You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2007/08/13 00:02:34 UTC
svn commit: r565170 - in
/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids:
FragmentIdentificationTest.java greatH.wsdl
Author: jkaputin
Date: Sun Aug 12 15:02:34 2007
New Revision: 565170
URL: http://svn.apache.org/viewvc?view=rev&rev=565170
Log:
WODEN-32
testcases for toString() fragid solution.
Added:
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/FragmentIdentificationTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/greatH.wsdl
Added: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/FragmentIdentificationTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/FragmentIdentificationTest.java?view=auto&rev=565170
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/FragmentIdentificationTest.java (added)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/FragmentIdentificationTest.java Sun Aug 12 15:02:34 2007
@@ -0,0 +1,104 @@
+package org.apache.woden.wsdl20.fragids;
+
+import java.net.URL;
+
+import org.apache.woden.WSDLFactory;
+import org.apache.woden.WSDLReader;
+import org.apache.woden.wsdl20.Description;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class FragmentIdentificationTest extends TestCase {
+ private WSDLFactory factory;
+ private WSDLReader reader;
+
+ public static Test suite()
+ {
+ return new TestSuite(FragmentIdentificationTest.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ factory = WSDLFactory.newInstance();
+ reader = factory.newWSDLReader();
+ }
+
+ public void testSerialisation(){
+ Description desc = null;
+
+ //Load in a WSDL 2.0 file
+ URL wsdlURL2 = getClass().getClassLoader().getResource("org/apache/woden/wsdl20/fragids/greatH.wsdl");
+
+ try {
+ desc = reader.readWSDL(wsdlURL2.toString());
+ } catch(Exception e) {
+
+ }
+
+ assertEquals("wsdl.description()", desc.toString());
+ //Elements
+ assertEquals("xmlns(ghns=http://greath.example.com/2004/schemas/resSvc)wsdl.elementDeclaration(ghns:checkAvailability)",
+ desc.getElementDeclaration(new QName("http://greath.example.com/2004/schemas/resSvc","checkAvailability")).toString());
+
+ assertEquals("xmlns(ghns=http://greath.example.com/2004/schemas/resSvc)wsdl.elementDeclaration(ghns:checkAvailabilityResponse)",
+ desc.getElementDeclaration(new QName("http://greath.example.com/2004/schemas/resSvc","checkAvailabilityResponse")).toString());
+
+ assertEquals("xmlns(ghns=http://greath.example.com/2004/schemas/resSvc)wsdl.elementDeclaration(ghns:invalidDataError)",
+ desc.getElementDeclaration(new QName("http://greath.example.com/2004/schemas/resSvc","invalidDataError")).toString());
+
+ //Types
+ assertEquals("xmlns(ghns=http://greath.example.com/2004/schemas/resSvc)wsdl.typeDefinition(ghns:tCheckAvailability)",
+ desc.getTypeDefinition(new QName("http://greath.example.com/2004/schemas/resSvc","tCheckAvailability")).toString());
+
+ //Interface
+ assertEquals("wsdl.interface(reservationInterface)",
+ desc.getInterface(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationInterface")).toString());
+
+ assertEquals("wsdl.interfaceFault(reservationInterface/invalidDataFault)",
+ desc.getInterface(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationInterface")).getInterfaceFault(new QName("http://greath.example.com/2004/wsdl/resSvc", "invalidDataFault")).toString());
+
+ assertEquals("wsdl.interfaceOperation(reservationInterface/opCheckAvailability)",
+ desc.getInterface(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationInterface")).getInterfaceOperation(new QName("http://greath.example.com/2004/wsdl/resSvc", "opCheckAvailability")).toString());
+
+ assertEquals("wsdl.interfaceMessageReference(reservationInterface/opCheckAvailability/In)",
+ desc.getInterface(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationInterface")).getInterfaceOperation(new QName("http://greath.example.com/2004/wsdl/resSvc", "opCheckAvailability")).getInterfaceMessageReferences()[0].toString());
+
+ assertEquals("wsdl.interfaceMessageReference(reservationInterface/opCheckAvailability/Out)",
+ desc.getInterface(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationInterface")).getInterfaceOperation(new QName("http://greath.example.com/2004/wsdl/resSvc", "opCheckAvailability")).getInterfaceMessageReferences()[1].toString());
+
+ assertEquals("xmlns(tns=http://greath.example.com/2004/wsdl/resSvc)wsdl.interfaceFaultReference(reservationInterface/opCheckAvailability/Out/tns:invalidDataFault)",
+ desc.getInterface(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationInterface")).getInterfaceOperation(new QName("http://greath.example.com/2004/wsdl/resSvc", "opCheckAvailability", "tns")).getInterfaceFaultReferences()[0].toString());
+
+ //Binding
+ assertEquals("wsdl.binding(reservationSOAPBinding)",
+ desc.getBinding(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationSOAPBinding")).toString());
+
+ assertEquals("xmlns(tns=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingFault(reservationSOAPBinding/tns:invalidDataFault)",
+ desc.getBinding(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationSOAPBinding")).getBindingFaults()[0].toString());
+
+ assertEquals("xmlns(tns=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingOperation(reservationSOAPBinding/tns:opCheckAvailability)",
+ desc.getBinding(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationSOAPBinding")).getBindingOperations()[0].toString());
+
+ assertEquals("xmlns(tns=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingMessageReference(reservationSOAPBinding/tns:opCheckAvailability/In)",
+ desc.getBinding(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationSOAPBinding")).getBindingOperations()[0].getBindingMessageReferences()[0].toString());
+
+ assertEquals("xmlns(tns=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingMessageReference(reservationSOAPBinding/tns:opCheckAvailability/Out)",
+ desc.getBinding(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationSOAPBinding")).getBindingOperations()[0].getBindingMessageReferences()[1].toString());
+
+ assertEquals("xmlns(tns=http://greath.example.com/2004/wsdl/resSvc)wsdl.bindingFaultReference(reservationSOAPBinding/tns:opCheckAvailability/Out/tns:invalidDataFault)",
+ desc.getBinding(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationSOAPBinding")).getBindingOperations()[0].getBindingFaultReferences()[0].toString());
+
+ //Service
+ assertEquals("wsdl.service(reservationService)",
+ desc.getService(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationService")).toString());
+
+ assertEquals("wsdl.endpoint(reservationService/reservationEndpoint)",
+ desc.getService(new QName("http://greath.example.com/2004/wsdl/resSvc", "reservationService")).getEndpoints()[0].toString());
+
+ //TODO add tests for BindingMessageReference, BindingFaultReference, Extensions.
+ }
+}
Added: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/greatH.wsdl
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/greatH.wsdl?view=auto&rev=565170
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/greatH.wsdl (added)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/fragids/greatH.wsdl Sun Aug 12 15:02:34 2007
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<description
+ xmlns="http://www.w3.org/ns/wsdl"
+ targetNamespace= "http://greath.example.com/2004/wsdl/resSvc"
+ xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc"
+ xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc"
+ xmlns:wsoap= "http://www.w3.org/ns/wsdl/soap"
+ xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
+ xmlns:wsdlx= "http://www.w3.org/ns/wsdl-extensions">
+
+ <documentation>
+ This document describes the GreatH Web service. Additional
+ application-level requirements for use of this service --
+ beyond what WSDL 2.0 is able to describe -- are available
+ at http://greath.example.com/2004/reservation-documentation.html
+ </documentation>
+
+ <types>
+ <xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://greath.example.com/2004/schemas/resSvc"
+ xmlns="http://greath.example.com/2004/schemas/resSvc">
+
+ <xs:element name="checkAvailability" type="tCheckAvailability"/>
+ <xs:complexType name="tCheckAvailability">
+ <xs:sequence>
+ <xs:element name="checkInDate" type="xs:date"/>
+ <xs:element name="checkOutDate" type="xs:date"/>
+ <xs:element name="roomType" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="checkAvailabilityResponse" type="xs:double"/>
+
+ <xs:element name="invalidDataError" type="xs:string"/>
+
+ </xs:schema>
+ </types>
+
+ <interface name = "reservationInterface" >
+
+ <fault name = "invalidDataFault"
+ element = "ghns:invalidDataError"/>
+
+ <operation name="opCheckAvailability"
+ pattern="http://www.w3.org/ns/wsdl/in-out"
+ style="http://www.w3.org/ns/wsdl/style/iri"
+ wsdlx:safe = "true">
+ <input messageLabel="In"
+ element="ghns:checkAvailability" />
+ <output messageLabel="Out"
+ element="ghns:checkAvailabilityResponse" />
+ <outfault ref="tns:invalidDataFault" messageLabel="Out"/>
+ </operation>
+
+ </interface>
+
+ <binding name="reservationSOAPBinding"
+ interface="tns:reservationInterface"
+ type="http://www.w3.org/ns/wsdl/soap"
+ wsoap:version="1.2"
+ wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/">
+
+ <fault ref="tns:invalidDataFault"
+ wsoap:code="soap:Sender"/>
+
+ <operation ref="tns:opCheckAvailability" wsoap:mep="http://www.w3.org/2003/05/soap/mep/soap-response">
+ <input />
+ <output />
+ <outfault ref="tns:invalidDataFault" />
+ </operation>
+
+ </binding>
+
+ <service name="reservationService"
+ interface="tns:reservationInterface">
+
+ <endpoint name="reservationEndpoint"
+ binding="tns:reservationSOAPBinding"
+ address ="http://greath.example.com/2004/reservation"/>
+
+ </service>
+
+</description>
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org