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 2006/03/03 14:58:02 UTC

svn commit: r382819 - in /incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap: SOAPBindingExtensionsTest.java resources/SOAPBindingExtensions.wsdl

Author: jkaputin
Date: Fri Mar  3 05:58:01 2006
New Revision: 382819

URL: http://svn.apache.org/viewcvs?rev=382819&view=rev
Log:
Added junit testcase for SOAPBindingExtensions.

Added:
    incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensionsTest.java
    incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingExtensions.wsdl

Added: incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensionsTest.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensionsTest.java?rev=382819&view=auto
==============================================================================
--- incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensionsTest.java (added)
+++ incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingExtensionsTest.java Fri Mar  3 05:58:01 2006
@@ -0,0 +1,130 @@
+/**
+ * Copyright 2006 Apache Software Foundation 
+ *
+ * Licensed 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.woden.wsdl20.extensions.soap;
+
+import java.net.URI;
+import java.net.URL;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.woden.ErrorHandler;
+import org.apache.woden.WSDLFactory;
+import org.apache.woden.WSDLReader;
+import org.apache.woden.tests.TestErrorHandler;
+import org.apache.woden.wsdl20.Binding;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.extensions.ComponentExtensions;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+
+/**
+ * Functional verification test of org.apache.woden.wsdl20.extensions.soap.SoapBindingExtensions.
+ * Checks that the expected API behaviour is supported by the implementation.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class SOAPBindingExtensionsTest extends TestCase 
+{
+    private boolean fReset = true;
+    private WSDLFactory fFactory = null;
+    private WSDLReader fReader = null;
+    private ErrorHandler fHandler = null;
+    private DescriptionElement fDescElem = null;
+    
+    private Binding fBinding = null;
+    private SOAPBindingExtensions fSoapBindExts = null;
+    private String fWsdlPath = "org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingExtensions.wsdl";
+    
+    public static Test suite()
+    {
+        return new TestSuite(SOAPBindingExtensionsTest.class);
+    }
+    
+    protected void setUp() throws Exception 
+    {
+        fFactory = WSDLFactory.newInstance();
+        fReader = fFactory.newWSDLReader();
+        fHandler = new TestErrorHandler();
+        fReader.getErrorReporter().setErrorHandler(fHandler);
+        
+        URL wsdlURL = getClass().getClassLoader().getResource(fWsdlPath);
+        assertNotNull("Failed to find the WSDL document on the classpath using the path: " + fWsdlPath + ".", 
+                wsdlURL);
+        
+        fDescElem = fReader.readWSDL(wsdlURL.toString());
+        assertNotNull("The reader did not return a WSDL description.", fDescElem);
+        Description descComp = fDescElem.toComponent();
+        
+        fBinding = descComp.getBindings()[0];
+        assertNotNull("The Description does not contain a Binding.", fBinding);
+        
+        fSoapBindExts = (SOAPBindingExtensions)fBinding.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+        assertNotNull("The Binding does not contain a SOAPBindingExtensions object.");
+    }
+    
+    /**
+     * Test that the value for the {soap version} property returned by the <code>getSoapVersion</code> method
+     * matches the expected value parsed from the WSDL.
+     */
+    public void testGetSoapVersion()
+    {
+        String actual = fSoapBindExts.getSoapVersion();
+        assertNotNull("The value for soap version was null", actual);
+        assertTrue("The value expected for soap version was '1.2', but the actual value was '" + actual + "'.", 
+                "1.2".equals(actual));
+    }
+
+    /**
+     * Test that the value for the {soap underlying protocol} property returned by the <code>getSoapUnderlyingProtocol</code> method
+     * matches the expected value parsed from the WSDL.
+     */
+    public void testGetSoapUnderlyingProtocol()
+    {
+        URI actual = fSoapBindExts.getSoapUnderlyingProtocol();
+        assertNotNull("The value for soap underlying protocol was null", actual);
+        
+        URI expected = URI.create("http://www.w3.org/2003/05/soap/bindings/HTTP");
+        assertTrue("The value expected for soap underlying protocol was '" + expected.toString() + "', but the actual value was '" + actual.toString() + "'.", 
+                expected.equals(actual));
+    }
+    
+    /**
+     * Test that the value for the {soap mep default} property returned by the <code>getSoapMepDefault</code> method
+     * matches the expected value parsed from the WSDL.
+     */
+    public void testGetSoapMepDefault()
+    {
+        URI actual = fSoapBindExts.getSoapMepDefault();
+        assertNotNull("The value for soap mep default was null", actual);
+        
+        URI expected = URI.create("http://www.w3.org/2003/05/soap/mep/request-response");
+        assertTrue("The value expected for soap mep default was '" + expected.toString() + "', but the actual value was '" + actual.toString() + "'.", 
+                expected.equals(actual));
+    }
+    
+    /**
+     * Test that the {soap modules} property returned by the <code>getSoapModules</code> method 
+     * contains the expected number of SOAPModule objects parsed from the WSDL.
+     */
+    public void testGetSoapModulesExist()
+    {
+        SOAPModule[] actual = fSoapBindExts.getSoapModules();
+        assertTrue("Expected 2 SOAPModule objects, but the actual number was " + actual.length + ".",
+                actual.length == 2);
+    }
+
+}
\ No newline at end of file

Added: incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingExtensions.wsdl
URL: http://svn.apache.org/viewcvs/incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingExtensions.wsdl?rev=382819&view=auto
==============================================================================
--- incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingExtensions.wsdl (added)
+++ incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingExtensions.wsdl Fri Mar  3 05:58:01 2006
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- 
+ * Copyright 2006 Apache Software Foundation 
+ *
+ * Licensed 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.
+-->
+<description xmlns="http://www.w3.org/2006/01/wsdl"
+	targetNamespace="http://ws.apache.woden/endpoint"
+	xmlns:tns="http://ws.apache.woden/endpoint"
+	xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:wsoap= "http://www.w3.org/2006/01/wsdl/soap"
+	xsi:schemaLocation=
+	    "http://www.w3.org/2006/01/wsdl http://www.w3.org/2006/01/wsdl/wsdl20.xsd 
+	    http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd">
+
+	<documentation>
+	    Used by SOAPBindingExtensionsTest to test the SOAPBindingExtensions implementation.
+	    (to be) Used by SOAPModuleTest to test the SOAPModule implementation.
+	    (to be) Used by SOAPHeaderBlockTest to test the SOAPHeaderBlock implementation.
+	</documentation>
+
+	<interface name="interface1" />
+	
+	<binding name="binding1"
+	  interface="tns:interface1"
+	  type="http://www.w3.org/2005/12/wsdl/soap"
+	  wsoap:version="1.2"
+	  wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"
+	  wsoap:mepDefault="http://www.w3.org/2003/05/soap/mep/request-response">
+
+        <wsoap:module ref="urn:ccc" required="true">
+            <documentation>A soap module the processor is required to handle</documentation>
+        </wsoap:module>
+    
+        <wsoap:module ref="urn:ddd" required="false">
+            <documentation>A soap module the processor is not required to handle</documentation>
+        </wsoap:module>
+        
+	</binding>
+	
+	<service name="service1" interface="tns:interface1" />
+	
+</description>
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org