Author: jkaputin
Date: Thu Jan 10 19:25:31 2008
New Revision: 611033
URL: http://svn.apache.org/viewvc?rev=611033&view=rev
Log:
WODEN-193
Test case to support the fix.
Added:
webservices/woden/trunk/java/test/testcase/documentation/
webservices/woden/trunk/java/test/testcase/documentation/extension/
webservices/woden/trunk/java/test/testcase/documentation/extension/DocExtensionNoNSTest.java
(with props)
webservices/woden/trunk/java/test/testcase/documentation/extension/resources/
webservices/woden/trunk/java/test/testcase/documentation/extension/resources/nonamespace.wsdl
(with props)
Modified:
webservices/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java
Modified:
webservices/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java
URL:
http://svn.apache.org/viewvc/webservices/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java?rev=611033&r1=611032&r2=611033&view=diff
==============================================================================
---
webservices/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java
(original)
+++
webservices/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java
Thu Jan 10 19:25:31 2008
@@ -77,6 +77,7 @@
import org.apache.woden.xml.TokenAttrTest;
import org.apache.woden.xpointer.XPointerTest;
+import testcase.documentation.extension.DocExtensionNoNSTest;
import testcase.extensions.foo.FooBindingExtensionsTest;
import testcase.resolver.schemaloc.SchemaLocationTest;
@@ -163,6 +164,7 @@
addTest(FooBindingExtensionsTest.suite());
addTest(XPointerTest.suite());
addTest(SchemaLocationTest.suite());
+ addTest(DocExtensionNoNSTest.suite());
//TODO in-progress 30May06 tests for BindingOpExt and BindingMsgRefExt
}
Added:
webservices/woden/trunk/java/test/testcase/documentation/extension/DocExtensionNoNSTest.java
URL:
http://svn.apache.org/viewvc/webservices/woden/trunk/java/test/testcase/documentation/extension/DocExtensionNoNSTest.java?rev=611033&view=auto
==============================================================================
---
webservices/woden/trunk/java/test/testcase/documentation/extension/DocExtensionNoNSTest.java
(added)
+++
webservices/woden/trunk/java/test/testcase/documentation/extension/DocExtensionNoNSTest.java
Thu Jan 10 19:25:31 2008
@@ -0,0 +1,94 @@
+/**
+ * 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 testcase.documentation.extension;
+
+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.resolver.SimpleURIResolverTest;
+import org.apache.woden.tests.TestErrorHandler;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.extensions.UnknownExtensionElement;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+import org.apache.woden.wsdl20.xml.DocumentationElement;
+
+/**
+ * Test that when no default namespace is declared in the WSDL,
+ * that documentation extension elements with no namespace are
+ * represented correctly - they should return a null NS uri.
+ */
+public class DocExtensionNoNSTest extends TestCase {
+
+ public static Test suite()
+ {
+ return new TestSuite(DocExtensionNoNSTest.class);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testNSUriIsNull() throws Exception {
+ URL wsdlURL =
getClass().getClassLoader().getResource("testcase/documentation/extension/resources/nonamespace.wsdl");
+ assertNotNull("Failed to find nonamespace.wsdl on the
classpath",wsdlURL);
+
+ WSDLFactory factory = WSDLFactory.newInstance();
+ WSDLReader reader = factory.newWSDLReader();
+ ErrorHandler handler = new TestErrorHandler();
+ reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
+ reader.getErrorReporter().setErrorHandler(handler);
+ Description descComp = reader.readWSDL(wsdlURL.toString());
+ assertNotNull("The reader did not return a WSDL description.",
descComp);
+ DescriptionElement desc = descComp.toElement();
+
+ DocumentationElement doc = null;
+ UnknownExtensionElement ee = null;
+
+ //wsdl:description
+ doc = desc.getDocumentationElements()[0];
+ ee = (UnknownExtensionElement)doc.getExtensionElements()[0];
+ assertNull(ee.getElement().getNamespaceURI());
+
+ //wsdl:types
+ doc=desc.getTypesElement().getDocumentationElements()[0];
+ ee = (UnknownExtensionElement)doc.getExtensionElements()[0];
+ assertNull(ee.getElement().getNamespaceURI());
+
+ //wsdl:interface
+ doc=desc.getInterfaceElements()[0].getDocumentationElements()[0];
+ ee = (UnknownExtensionElement)doc.getExtensionElements()[0];
+ assertNull(ee.getElement().getNamespaceURI());
+
+ //wsdl:binding
+ doc=desc.getBindingElements()[0].getDocumentationElements()[0];
+ ee = (UnknownExtensionElement)doc.getExtensionElements()[0];
+ assertNull(ee.getElement().getNamespaceURI());
+
+ //wsdl:service
+ doc=desc.getServiceElements()[0].getDocumentationElements()[0];
+ ee = (UnknownExtensionElement)doc.getExtensionElements()[0];
+ assertNull(ee.getElement().getNamespaceURI());
+ }
+
+}
Propchange:
webservices/woden/trunk/java/test/testcase/documentation/extension/DocExtensionNoNSTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
webservices/woden/trunk/java/test/testcase/documentation/extension/resources/nonamespace.wsdl
URL:
http://svn.apache.org/viewvc/webservices/woden/trunk/java/test/testcase/documentation/extension/resources/nonamespace.wsdl?rev=611033&view=auto
==============================================================================
---
webservices/woden/trunk/java/test/testcase/documentation/extension/resources/nonamespace.wsdl
(added)
+++
webservices/woden/trunk/java/test/testcase/documentation/extension/resources/nonamespace.wsdl
Thu Jan 10 19:25:31 2008
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ * 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.
+-->
+<wsdl:description targetNamespace="http://example.org/nodefaultNS"
+ xmlns:tns="http://example.org/nodefaultNS"
+ xmlns:wsdl="http://www.w3.org/ns/wsdl">
+
+ <wsdl:documentation>
+ <testcase>
+ Test that when the WSDL does not declare a default namespace,
+ no-namespace elements that extend wsdl:documentation are
+ represented in Woden with a namespace URI of 'null'.
+ </testcase>
+ </wsdl:documentation>
+
+ <wsdl:types>
+ <wsdl:documentation>
+ <docext>element docext should have a ns uri of null</docext>
+ </wsdl:documentation>
+ </wsdl:types>
+
+ <wsdl:interface name="interface1">
+ <wsdl:documentation>
+ This is <docext>stuff</docext>.
+ </wsdl:documentation>
+ </wsdl:interface>
+
+ <wsdl:binding name="binding1" interface="tns:interface1" type="urn:abc">
+ <wsdl:documentation>
+ This is more <docext>stuff</docext>
+ </wsdl:documentation>
+ </wsdl:binding>
+
+ <wsdl:service name="service1" interface="tns:interface1">
+ <wsdl:documentation>
+ Enough <docext>stuff</docext>!
+ </wsdl:documentation>
+ <wsdl:endpoint name="endpoint1" binding="tns:binding1" address="urn:xyz"
/>
+ </wsdl:service>
+
+</wsdl:description>
\ No newline at end of file
Propchange:
webservices/woden/trunk/java/test/testcase/documentation/extension/resources/nonamespace.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]