Author: hughesj
Date: Wed Jun 14 06:49:57 2006
New Revision: 414251
URL: http://svn.apache.org/viewvc?rev=414251&view=rev
Log:
WODEN-29
Really return "" from getName() when the XxxElement isn't added to a
DescriptionElement
Added:
incubator/woden/java/test/org/apache/woden/wsdl20/xml/NameAttributeTest.java
Modified:
incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
incubator/woden/java/test/org/apache/woden/tests/AllWodenTests.java
Modified:
incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java?rev=414251&r1=414250&r2=414251&view=diff
==============================================================================
---
incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
(original)
+++
incubator/woden/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
Wed Jun 14 06:49:57 2006
@@ -694,20 +694,23 @@
*/
static String getTargetNamespace(WSDLElement wElem) {
String namespace = "";
-
+
if (wElem instanceof NestedElement) {
- WSDLElement parent = ((NestedElement)wElem).getParentElement();
+ WSDLElement parent = ((NestedElement) wElem).getParentElement();
return getTargetNamespace(parent);
}
- if (wElem instanceof DescriptionElement) {
- URI tns = ((DescriptionElement)wElem).getTargetNamespace();
+ if (wElem instanceof DescriptionElement) {
+ URI tns = ((DescriptionElement) wElem).getTargetNamespace();
if (tns != null) {
namespace = tns.toString();
}
return namespace;
}
- // Huh!
- throw new RuntimeException("dunno");
+
+ // We either have a null or a subclass of WSDLElement which isn't an
instance of
+ // NestedElement or DescriptionElement - and there aren't any of those
+ // Return ""
+ return "";
}
Modified: incubator/woden/java/test/org/apache/woden/tests/AllWodenTests.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/test/org/apache/woden/tests/AllWodenTests.java?rev=414251&r1=414250&r2=414251&view=diff
==============================================================================
--- incubator/woden/java/test/org/apache/woden/tests/AllWodenTests.java
(original)
+++ incubator/woden/java/test/org/apache/woden/tests/AllWodenTests.java Wed Jun
14 06:49:57 2006
@@ -36,6 +36,7 @@
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.NameAttributeTest;
import org.apache.woden.wsdl20.xml.ServiceElementTest;
import org.apache.woden.xml.IntOrTokenAttrTest;
import org.apache.woden.xml.TokenAttrTest;
@@ -83,6 +84,7 @@
addTest(WSDLComponentValidatorTest.suite());
addTest(ServiceElementTest.suite());
addTest(EndpointElementTest.suite());
+ addTest(NameAttributeTest.suite());
addTest(IntOrTokenAttrTest.suite());
addTest(TokenAttrTest.suite());
addTest(SOAPBindingExtensionsTest.suite());
Added:
incubator/woden/java/test/org/apache/woden/wsdl20/xml/NameAttributeTest.java
URL:
http://svn.apache.org/viewvc/incubator/woden/java/test/org/apache/woden/wsdl20/xml/NameAttributeTest.java?rev=414251&view=auto
==============================================================================
---
incubator/woden/java/test/org/apache/woden/wsdl20/xml/NameAttributeTest.java
(added)
+++
incubator/woden/java/test/org/apache/woden/wsdl20/xml/NameAttributeTest.java
Wed Jun 14 06:49:57 2006
@@ -0,0 +1,47 @@
+/**
+ * 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.xml;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.woden.internal.wsdl20.InterfaceImpl;
+import org.apache.woden.types.NCName;
+
+public class NameAttributeTest extends TestCase {
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(NameAttributeTest.class);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(NameAttributeTest.class);
+ }
+
+ /**
+ * Create an InterfaceElement but don't add it to a DescriptionElement
+ * and ensure that getQName() returns a QName with a namespace value
+ * of the emptystring.
+ */
+ public void testNamespaceOfGetNameReturnValue() {
+ InterfaceElement ie = new InterfaceImpl();
+ ie.setName(new NCName("foo"));
+ String namespace = ie.getName().getNamespaceURI();
+ assertTrue("namespace value should be \"\" but is " + namespace,
namespace.equals(""));
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]