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/06 01:28:34 UTC
svn commit: r383441 - in /incubator/woden/java/test/org/apache/woden:
tests/AllWodenTests.java
wsdl20/extensions/soap/SOAPBindingMessageReferenceExtensionsTest.java
wsdl20/extensions/soap/resources/SOAPBindingMessageReferenceExtensions.wsdl
Author: jkaputin
Date: Sun Mar 5 16:28:32 2006
New Revision: 383441
URL: http://svn.apache.org/viewcvs?rev=383441&view=rev
Log:
Added junit testcase for SOAPBindingMessageReferenceExtensions.
Added:
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingMessageReferenceExtensionsTest.java
incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingMessageReferenceExtensions.wsdl
Modified:
incubator/woden/java/test/org/apache/woden/tests/AllWodenTests.java
Modified: incubator/woden/java/test/org/apache/woden/tests/AllWodenTests.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/test/org/apache/woden/tests/AllWodenTests.java?rev=383441&r1=383440&r2=383441&view=diff
==============================================================================
--- incubator/woden/java/test/org/apache/woden/tests/AllWodenTests.java (original)
+++ incubator/woden/java/test/org/apache/woden/tests/AllWodenTests.java Sun Mar 5 16:28:32 2006
@@ -27,6 +27,7 @@
import org.apache.woden.internal.wsdl20.validation.WSDLDocumentValidatorTest;
import org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensionsTest;
import org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultExtensionsTest;
+import org.apache.woden.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensionsTest;
import org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensionsTest;
import org.apache.woden.wsdl20.xml.EndpointElementTest;
import org.apache.woden.wsdl20.xml.ServiceElementTest;
@@ -77,6 +78,7 @@
addTest(SOAPBindingExtensionsTest.suite());
addTest(SOAPBindingFaultExtensionsTest.suite());
addTest(SOAPBindingOperationExtensionsTest.suite());
+ addTest(SOAPBindingMessageReferenceExtensionsTest.suite());
}
}
Added: incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingMessageReferenceExtensionsTest.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingMessageReferenceExtensionsTest.java?rev=383441&view=auto
==============================================================================
--- incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingMessageReferenceExtensionsTest.java (added)
+++ incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/SOAPBindingMessageReferenceExtensionsTest.java Sun Mar 5 16:28:32 2006
@@ -0,0 +1,149 @@
+/**
+ * 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.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.BindingMessageReference;
+import org.apache.woden.wsdl20.BindingOperation;
+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.SoapBindingFaultExtensions.
+ * Checks that the expected API behaviour is supported by the implementation.
+ *
+ * @author jkaputin@apache.org
+ */
+public class SOAPBindingMessageReferenceExtensionsTest extends TestCase
+{
+ private WSDLFactory fFactory = null;
+ private WSDLReader fReader = null;
+ private ErrorHandler fHandler = null;
+ private DescriptionElement fDescElem = null;
+
+ private BindingOperation fBindOper = null;
+ private String fWsdlPath = "org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingMessageReferenceExtensions.wsdl";
+
+ public static Test suite()
+ {
+ return new TestSuite(SOAPBindingMessageReferenceExtensionsTest.class);
+ }
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ 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();
+
+ Binding binding = descComp.getBindings()[0];
+ assertNotNull("The Description does not contain a Binding.", binding);
+ fBindOper = binding.getBindingOperations()[0];
+ assertNotNull("The Binding does not contain a BindingOperation.", fBindOper);
+ }
+
+ /*
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+ /**
+ * Test that the <code>getSoapModules</code> method returns the expected number of SOAPModule objects
+ * parsed from <wsoap:module> elements within an <input> element.
+ */
+ public void testGetSoapModules_input()
+ {
+ BindingMessageReference bindMsgRef = fBindOper.getBindingMessageReferences()[0];
+ assertNotNull("The BindingOperation does not contain a BindingMessageReference.", bindMsgRef);
+
+ SOAPBindingMessageReferenceExtensions soapBindMsgRefExts =
+ (SOAPBindingMessageReferenceExtensions) bindMsgRef.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+ SOAPModule[] actual = soapBindMsgRefExts.getSoapModules();
+ assertEquals("Unexpected number of SOAPModule objects.", 2, actual.length);
+ }
+
+ /**
+ * Test that the <code>getSoapModules</code> method returns the expected number of SOAPModule objects
+ * parsed from <wsoap:module> elements within an <output> element.
+ */
+ public void testGetSoapModules_output()
+ {
+ BindingMessageReference bindMsgRef = fBindOper.getBindingMessageReferences()[1];
+ assertNotNull("The BindingOperation does not contain a BindingMessageReference.", bindMsgRef);
+
+ SOAPBindingMessageReferenceExtensions soapBindMsgRefExts =
+ (SOAPBindingMessageReferenceExtensions) bindMsgRef.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+ SOAPModule[] actual = soapBindMsgRefExts.getSoapModules();
+ assertEquals("Unexpected number of SOAPModule objects.", 1, actual.length);
+ }
+
+ /**
+ * Test that the <code>getSoapHeaders</code> method returns the expected number of SOAPHeader objects
+ * parsed from <wsoap:header> elements within an <input> element.
+ */
+ public void testGetSoapHeaders_input()
+ {
+ BindingMessageReference bindMsgRef = fBindOper.getBindingMessageReferences()[0];
+ assertNotNull("The BindingOperation does not contain a BindingMessageReference.", bindMsgRef);
+
+ SOAPBindingMessageReferenceExtensions soapBindMsgRefExts =
+ (SOAPBindingMessageReferenceExtensions) bindMsgRef.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+ SOAPHeaderBlock[] actual = soapBindMsgRefExts.getSoapHeaders();
+ assertEquals("Unexpected number of SOAPHeaderBlock objects.", 2, actual.length);
+ }
+
+ /**
+ * Test that the <code>getSoapHeaders</code> method returns the expected number of SOAPHeader objects
+ * parsed from <wsoap:header> elements within an <output> element.
+ */
+ public void testGetSoapHeaders_output()
+ {
+ BindingMessageReference bindMsgRef = fBindOper.getBindingMessageReferences()[1];
+ assertNotNull("The BindingOperation does not contain the expected BindingMessageReference.", bindMsgRef);
+
+ SOAPBindingMessageReferenceExtensions soapBindMsgRefExts =
+ (SOAPBindingMessageReferenceExtensions) bindMsgRef.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+ SOAPHeaderBlock[] actual = soapBindMsgRefExts.getSoapHeaders();
+ assertEquals("Unexpected number of SOAPHeaderBlock objects.", 1, actual.length);
+ }
+
+}
Added: incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingMessageReferenceExtensions.wsdl
URL: http://svn.apache.org/viewcvs/incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingMessageReferenceExtensions.wsdl?rev=383441&view=auto
==============================================================================
--- incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingMessageReferenceExtensions.wsdl (added)
+++ incubator/woden/java/test/org/apache/woden/wsdl20/extensions/soap/resources/SOAPBindingMessageReferenceExtensions.wsdl Sun Mar 5 16:28:32 2006
@@ -0,0 +1,61 @@
+<?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"
+ xmlns:soap-env="http://www.w3.org/2003/05/soap-envelope"
+ xmlns:ghns = "urn:ghns"
+ 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 SOAPBindingMessageReferenceExtensionsTest to test the SOAPBindingMessageReferenceExtensions implementation.
+ </documentation>
+
+ <interface name="interface1" />
+
+ <binding name="binding1"
+ interface="tns:interface1"
+ type="http://www.w3.org/2006/01/wsdl/soap">
+
+ <operation>
+
+ <input>
+ <documentation>Test that 2 SOAPModule and 2 SOAPHeaderBlock objects are created</documentation>
+ <wsoap:module ref="urn:ccc" required="true" />
+ <wsoap:module ref="urn:ddd" required="false" />
+ <wsoap:header element="ghns:checkAvailability" mustUnderstand="true" />
+ <wsoap:header element="ghns:checkPrice" mustUnderstand="true" />
+ </input>
+
+ <output>
+ <documentation>Test that 1 SOAPModule and 1 SOAPHeaderBlock objects are created</documentation>
+ <wsoap:module ref="urn:eee" required="false" />
+ <wsoap:header element="ghns:checkAvailability" mustUnderstand="false" />
+ </output>
+
+ </operation>
+
+ </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