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/23 13:24:56 UTC

svn commit: r568937 [15/17] - in /incubator/woden/trunk/java/test: javax/xml/namespace/ org/apache/woden/ org/apache/woden/ant/ org/apache/woden/internal/ org/apache/woden/internal/wsdl20/validation/ org/apache/woden/resolver/ org/apache/woden/resolver...

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingOperationElementTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingOperationElementTest.java?rev=568937&r1=568936&r2=568937&view=diff
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingOperationElementTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingOperationElementTest.java Thu Aug 23 04:24:51 2007
@@ -1,218 +1,218 @@
-/**
+/**
  * 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 org.apache.woden.wsdl20.xml;
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.apache.woden.WSDLException;
-import org.apache.woden.WSDLFactory;
-import org.apache.woden.internal.wsdl20.DescriptionImpl;
-import org.apache.woden.types.NCName;
-
-/**
- * Unit tests for the BindingOperationElement class.
- * 
- * @author Graham Turrell (gturrell@apache.org)
- */
-
-public class BindingOperationElementTest extends TestCase {
-
-	// create a parent Description to hang the Bindings off
-	private DescriptionElement fDescriptionElement = null;
-	private BindingElement fBindingElement = null;
-	private BindingOperationElement fBindingOperationElement = null;
-	private final String BOP_NAME = "BindingOperationName";
-    private WSDLFactory fFactory = null;
-
-	public static Test suite()
-	{
-	   return new TestSuite(BindingOperationElementTest.class);
-	}
-	   
-    /*
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception 
-    {
-        super.setUp();
-        
-        try {
-            fFactory = WSDLFactory.newInstance();
-        } catch (WSDLException e) {
-            fail("Can't instantiate the WSDLFactory object.");
-        }
-        
-        fDescriptionElement = fFactory.newDescription();
-        fBindingElement = fDescriptionElement.addBindingElement();
-        fBindingOperationElement = fBindingElement.addBindingOperationElement();
-    }
-
-    /*
-     * @see TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception 
-    {
-        super.tearDown();
-    }
-	
-    /*
-     * Mandatory attribute ("ref")
-     * - setRef() 
-     * - getRef() 
-     */
-	public void testGetSetRef() 
-	{	
-		fBindingOperationElement.setRef(new QName(BOP_NAME));
-		QName retrievedName = fBindingOperationElement.getRef();
-		assertEquals("Retrieved BindingOperationElement name does not match that set -", BOP_NAME, retrievedName.toString());
-	}
-	
-	/* 
-     * References to Optional child elements "infault" and "outfault"
-     * - addBindingFaultReferenceElement() 
-     * - getBindingFaultReferenceElements()
-     * - removeBindingFaultReferenceElement() 
-     */
-	public void testAddGetRemoveBindingFaultReferenceElements() 
-	{	
-		// check the default:
-		BindingFaultReferenceElement[] bfreArray = fBindingOperationElement.getBindingFaultReferenceElements();
-		assertNotNull("Expected an array of BindingFaultReferenceElement.", bfreArray);
-		assertEquals("Retrieved BindingFaultReferenceElement group should be empty if none set -", 0, bfreArray.length);
-
-		// addBindingFaultReferenceElement() -  create some BindingFaultReferenceElements
-		BindingFaultReferenceElement bfre1 = fBindingOperationElement.addBindingFaultReferenceElement();
-		BindingFaultReferenceElement bfre2 = fBindingOperationElement.addBindingFaultReferenceElement();
-		
-		// getBindingFaultReferenceElements()
-		bfreArray = fBindingOperationElement.getBindingFaultReferenceElements();
-		assertNotNull("Expected an array of BindingFaultReferenceElement.", bfreArray);
-		assertEquals("Retrieved BindingFaultReferenceElement group should be same number as those set -", 2, bfreArray.length);
-		
-		// verify all fault references returned
-		List bfreL = Arrays.asList(bfreArray);
-		assertTrue(bfreL.contains(bfre1));
-		assertTrue(bfreL.contains(bfre2));
-
-		// removeBindingFaultReferenceElement() 
-		// 1 - attempt to remove an unadded BFRE
-		BindingFaultReferenceElement bfre3 = null;
-		fBindingOperationElement.removeBindingFaultReferenceElement(bfre3);
-		bfreArray = fBindingOperationElement.getBindingFaultReferenceElements();
-		assertNotNull("Expected an array of BindingFaultReferenceElement.", bfreArray);
-		assertEquals("Retrieved BindingFaultReferenceElement group should be same number as those set -", 2, bfreArray.length);
-		
-		// 2- remove all added 
-		fBindingOperationElement.removeBindingFaultReferenceElement(bfre1);
-		fBindingOperationElement.removeBindingFaultReferenceElement(bfre2);
-		bfreArray = fBindingOperationElement.getBindingFaultReferenceElements();
-		assertNotNull("Expected an array of BindingFaultReferenceElement.", bfreArray);
-		assertEquals("Retrieved BindingFaultReferenceElement group should be empty if all removed -", 0, bfreArray.length);
-		
-		//3 - attempt to remove previously removed from empty list
-		fBindingOperationElement.removeBindingFaultReferenceElement(bfre2);
-		bfreArray = fBindingOperationElement.getBindingFaultReferenceElements();
-		assertNotNull("Expected an array of BindingFaultReferenceElement.", bfreArray);
-		assertEquals("Retrieved BindingFaultReferenceElement group should be empty if all removed -", 0, bfreArray.length);
-	}
-	
-	/* 
-     * References to Optional child elements "input" and "output"
-     * - addBindingMessageReferenceElement() 
-     * - getBindingMessageReferenceElements()
-     * - removeBindingMessageReferenceElement() 
-     */
-	public void testAddGetRemoveBindingMessageReferenceElements() 
-	{
-		// check the default:
-		BindingMessageReferenceElement[] bmreArray = fBindingOperationElement.getBindingMessageReferenceElements();
-		assertNotNull("Expected an array of BindingMessageReferenceElement.", bmreArray);
-		assertEquals("Retrieved BindingFaultReferenceElement group should be empty if none set -", 0, bmreArray.length);
-
-		// addBindingMessageReferenceElement() -  create some addBindingMessageReferenceElements
-		BindingMessageReferenceElement bmre1 = fBindingOperationElement.addBindingMessageReferenceElement();
-		BindingMessageReferenceElement bmre2 = fBindingOperationElement.addBindingMessageReferenceElement();
-		
-		// getBindingMessageReferenceElements()
-		bmreArray = fBindingOperationElement.getBindingMessageReferenceElements();
-		assertNotNull("Expected an array of BindingMessageReferenceElement.", bmreArray);
-		assertEquals("Retrieved BindingMessageReferenceElement group should be same number as those set -", 2, bmreArray.length);
-		
-		// verify all fault references returned
-		List bmreL = Arrays.asList(bmreArray);
-		assertTrue(bmreL.contains(bmre1));
-		assertTrue(bmreL.contains(bmre2));
-
-		// removeBindingMessageReferenceElement() 
-		// 1 - attempt to remove an unadded BMRE
-		BindingMessageReferenceElement bmre3 = null;
-		fBindingOperationElement.removeBindingMessageReferenceElement(bmre3);
-		bmreArray = fBindingOperationElement.getBindingMessageReferenceElements();
-		assertNotNull("Expected an array of BindingMessageReferenceElement.", bmreArray);
-		assertEquals("Retrieved BindingMessageReferenceElement group should be same number as those set -", 2, bmreArray.length);
-		
-		// 2- remove all added 
-		fBindingOperationElement.removeBindingMessageReferenceElement(bmre1);
-		fBindingOperationElement.removeBindingMessageReferenceElement(bmre2);
-		bmreArray = fBindingOperationElement.getBindingMessageReferenceElements();
-		assertNotNull("Expected an array of BindingMessageReferenceElement.", bmreArray);
-		assertEquals("Retrieved BindingMessageReferenceElement group should be empty if all removed -", 0, bmreArray.length);
-		
-		//3 - attempt to remove previously removed from empty list
-		fBindingOperationElement.removeBindingMessageReferenceElement(bmre2);
-		bmreArray = fBindingOperationElement.getBindingMessageReferenceElements();
-		assertNotNull("Expected an array of BindingMessageReferenceElement.", bmreArray);
-		assertEquals("Retrieved BindingMessageReferenceElement group should be empty if all removed -", 0, bmreArray.length);
-	}
-	
-	/* 
-     * Utility method to find the InterfaceOperation referenced by the (Mandatory) "ref" attribute
-     * - getInterfaceOperationElement() 
-     */
-	public void testGetInterfaceOperationElement() 
-	{		
-		// check the default:
-		InterfaceOperationElement retrievedIntOpElement = fBindingOperationElement.getInterfaceOperationElement();
-		assertNull("Retrieved Interface Operation Element should be null if none set -", retrievedIntOpElement);
-
-		// Create and name an Interface Element
-		DescriptionElement desc = fFactory.newDescription();
-		InterfaceElement interfaceElement = desc.addInterfaceElement();
-		interfaceElement.setName(new NCName("interface1"));
-		
-		// Create a binding from the description 
-		fBindingElement = desc.addBindingElement();
-		fBindingElement.setInterfaceName(new QName("interface1"));
-		
-		//Create and name an Interface Operation Element
-		InterfaceOperationElement intOpElement = interfaceElement.addInterfaceOperationElement();
-		intOpElement.setName(new NCName("interfaceOperation1"));
-		
-		fBindingOperationElement = fBindingElement.addBindingOperationElement();
-		fBindingOperationElement.setRef(new QName("interfaceOperation1"));
-
-		retrievedIntOpElement = fBindingOperationElement.getInterfaceOperationElement();
-		assertEquals("Retrieved Interface Element was not that expected -", intOpElement, retrievedIntOpElement);
-	}  
-}
+ * 
+ *     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 java.util.Arrays;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.woden.WSDLException;
+import org.apache.woden.WSDLFactory;
+import org.apache.woden.internal.wsdl20.DescriptionImpl;
+import org.apache.woden.types.NCName;
+
+/**
+ * Unit tests for the BindingOperationElement class.
+ * 
+ * @author Graham Turrell (gturrell@apache.org)
+ */
+
+public class BindingOperationElementTest extends TestCase {
+
+	// create a parent Description to hang the Bindings off
+	private DescriptionElement fDescriptionElement = null;
+	private BindingElement fBindingElement = null;
+	private BindingOperationElement fBindingOperationElement = null;
+	private final String BOP_NAME = "BindingOperationName";
+    private WSDLFactory fFactory = null;
+
+	public static Test suite()
+	{
+	   return new TestSuite(BindingOperationElementTest.class);
+	}
+	   
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception 
+    {
+        super.setUp();
+        
+        try {
+            fFactory = WSDLFactory.newInstance();
+        } catch (WSDLException e) {
+            fail("Can't instantiate the WSDLFactory object.");
+        }
+        
+        fDescriptionElement = fFactory.newDescription();
+        fBindingElement = fDescriptionElement.addBindingElement();
+        fBindingOperationElement = fBindingElement.addBindingOperationElement();
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception 
+    {
+        super.tearDown();
+    }
+	
+    /*
+     * Mandatory attribute ("ref")
+     * - setRef() 
+     * - getRef() 
+     */
+	public void testGetSetRef() 
+	{	
+		fBindingOperationElement.setRef(new QName(BOP_NAME));
+		QName retrievedName = fBindingOperationElement.getRef();
+		assertEquals("Retrieved BindingOperationElement name does not match that set -", BOP_NAME, retrievedName.toString());
+	}
+	
+	/* 
+     * References to Optional child elements "infault" and "outfault"
+     * - addBindingFaultReferenceElement() 
+     * - getBindingFaultReferenceElements()
+     * - removeBindingFaultReferenceElement() 
+     */
+	public void testAddGetRemoveBindingFaultReferenceElements() 
+	{	
+		// check the default:
+		BindingFaultReferenceElement[] bfreArray = fBindingOperationElement.getBindingFaultReferenceElements();
+		assertNotNull("Expected an array of BindingFaultReferenceElement.", bfreArray);
+		assertEquals("Retrieved BindingFaultReferenceElement group should be empty if none set -", 0, bfreArray.length);
+
+		// addBindingFaultReferenceElement() -  create some BindingFaultReferenceElements
+		BindingFaultReferenceElement bfre1 = fBindingOperationElement.addBindingFaultReferenceElement();
+		BindingFaultReferenceElement bfre2 = fBindingOperationElement.addBindingFaultReferenceElement();
+		
+		// getBindingFaultReferenceElements()
+		bfreArray = fBindingOperationElement.getBindingFaultReferenceElements();
+		assertNotNull("Expected an array of BindingFaultReferenceElement.", bfreArray);
+		assertEquals("Retrieved BindingFaultReferenceElement group should be same number as those set -", 2, bfreArray.length);
+		
+		// verify all fault references returned
+		List bfreL = Arrays.asList(bfreArray);
+		assertTrue(bfreL.contains(bfre1));
+		assertTrue(bfreL.contains(bfre2));
+
+		// removeBindingFaultReferenceElement() 
+		// 1 - attempt to remove an unadded BFRE
+		BindingFaultReferenceElement bfre3 = null;
+		fBindingOperationElement.removeBindingFaultReferenceElement(bfre3);
+		bfreArray = fBindingOperationElement.getBindingFaultReferenceElements();
+		assertNotNull("Expected an array of BindingFaultReferenceElement.", bfreArray);
+		assertEquals("Retrieved BindingFaultReferenceElement group should be same number as those set -", 2, bfreArray.length);
+		
+		// 2- remove all added 
+		fBindingOperationElement.removeBindingFaultReferenceElement(bfre1);
+		fBindingOperationElement.removeBindingFaultReferenceElement(bfre2);
+		bfreArray = fBindingOperationElement.getBindingFaultReferenceElements();
+		assertNotNull("Expected an array of BindingFaultReferenceElement.", bfreArray);
+		assertEquals("Retrieved BindingFaultReferenceElement group should be empty if all removed -", 0, bfreArray.length);
+		
+		//3 - attempt to remove previously removed from empty list
+		fBindingOperationElement.removeBindingFaultReferenceElement(bfre2);
+		bfreArray = fBindingOperationElement.getBindingFaultReferenceElements();
+		assertNotNull("Expected an array of BindingFaultReferenceElement.", bfreArray);
+		assertEquals("Retrieved BindingFaultReferenceElement group should be empty if all removed -", 0, bfreArray.length);
+	}
+	
+	/* 
+     * References to Optional child elements "input" and "output"
+     * - addBindingMessageReferenceElement() 
+     * - getBindingMessageReferenceElements()
+     * - removeBindingMessageReferenceElement() 
+     */
+	public void testAddGetRemoveBindingMessageReferenceElements() 
+	{
+		// check the default:
+		BindingMessageReferenceElement[] bmreArray = fBindingOperationElement.getBindingMessageReferenceElements();
+		assertNotNull("Expected an array of BindingMessageReferenceElement.", bmreArray);
+		assertEquals("Retrieved BindingFaultReferenceElement group should be empty if none set -", 0, bmreArray.length);
+
+		// addBindingMessageReferenceElement() -  create some addBindingMessageReferenceElements
+		BindingMessageReferenceElement bmre1 = fBindingOperationElement.addBindingMessageReferenceElement();
+		BindingMessageReferenceElement bmre2 = fBindingOperationElement.addBindingMessageReferenceElement();
+		
+		// getBindingMessageReferenceElements()
+		bmreArray = fBindingOperationElement.getBindingMessageReferenceElements();
+		assertNotNull("Expected an array of BindingMessageReferenceElement.", bmreArray);
+		assertEquals("Retrieved BindingMessageReferenceElement group should be same number as those set -", 2, bmreArray.length);
+		
+		// verify all fault references returned
+		List bmreL = Arrays.asList(bmreArray);
+		assertTrue(bmreL.contains(bmre1));
+		assertTrue(bmreL.contains(bmre2));
+
+		// removeBindingMessageReferenceElement() 
+		// 1 - attempt to remove an unadded BMRE
+		BindingMessageReferenceElement bmre3 = null;
+		fBindingOperationElement.removeBindingMessageReferenceElement(bmre3);
+		bmreArray = fBindingOperationElement.getBindingMessageReferenceElements();
+		assertNotNull("Expected an array of BindingMessageReferenceElement.", bmreArray);
+		assertEquals("Retrieved BindingMessageReferenceElement group should be same number as those set -", 2, bmreArray.length);
+		
+		// 2- remove all added 
+		fBindingOperationElement.removeBindingMessageReferenceElement(bmre1);
+		fBindingOperationElement.removeBindingMessageReferenceElement(bmre2);
+		bmreArray = fBindingOperationElement.getBindingMessageReferenceElements();
+		assertNotNull("Expected an array of BindingMessageReferenceElement.", bmreArray);
+		assertEquals("Retrieved BindingMessageReferenceElement group should be empty if all removed -", 0, bmreArray.length);
+		
+		//3 - attempt to remove previously removed from empty list
+		fBindingOperationElement.removeBindingMessageReferenceElement(bmre2);
+		bmreArray = fBindingOperationElement.getBindingMessageReferenceElements();
+		assertNotNull("Expected an array of BindingMessageReferenceElement.", bmreArray);
+		assertEquals("Retrieved BindingMessageReferenceElement group should be empty if all removed -", 0, bmreArray.length);
+	}
+	
+	/* 
+     * Utility method to find the InterfaceOperation referenced by the (Mandatory) "ref" attribute
+     * - getInterfaceOperationElement() 
+     */
+	public void testGetInterfaceOperationElement() 
+	{		
+		// check the default:
+		InterfaceOperationElement retrievedIntOpElement = fBindingOperationElement.getInterfaceOperationElement();
+		assertNull("Retrieved Interface Operation Element should be null if none set -", retrievedIntOpElement);
+
+		// Create and name an Interface Element
+		DescriptionElement desc = fFactory.newDescription();
+		InterfaceElement interfaceElement = desc.addInterfaceElement();
+		interfaceElement.setName(new NCName("interface1"));
+		
+		// Create a binding from the description 
+		fBindingElement = desc.addBindingElement();
+		fBindingElement.setInterfaceName(new QName("interface1"));
+		
+		//Create and name an Interface Operation Element
+		InterfaceOperationElement intOpElement = interfaceElement.addInterfaceOperationElement();
+		intOpElement.setName(new NCName("interfaceOperation1"));
+		
+		fBindingOperationElement = fBindingElement.addBindingOperationElement();
+		fBindingOperationElement.setRef(new QName("interfaceOperation1"));
+
+		retrievedIntOpElement = fBindingOperationElement.getInterfaceOperationElement();
+		assertEquals("Retrieved Interface Element was not that expected -", intOpElement, retrievedIntOpElement);
+	}  
+}

Propchange: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/BindingOperationElementTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ChildElementCreationTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ChildElementCreationTest.java?rev=568937&r1=568936&r2=568937&view=diff
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ChildElementCreationTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ChildElementCreationTest.java Thu Aug 23 04:24:51 2007
@@ -1,155 +1,155 @@
-/**
+/**
  * 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 org.apache.woden.wsdl20.xml;
-
-import java.util.Arrays;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.apache.woden.WSDLException;
-import org.apache.woden.WSDLFactory;
-import org.apache.woden.internal.wsdl20.DescriptionImpl;
-
-/**
- * Test cases to check when calling XxxxElement.addYyyyElement() that:
- * a) Xxxx.getYyyyElements() returns an array containing the added YyyyElement
- * b) The YyyyElement.getParentElement() returns the instance of XxxxElement
- * 
- * Do this for all Xxxx and Yyyy
- */
-public class ChildElementCreationTest extends TestCase {
-
-    private WSDLFactory fFactory = null;
-    
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(ChildElementCreationTest.class);
-    }
-
-    public static Test suite() {
-        return new TestSuite(ChildElementCreationTest.class);
-    }
-    
-    public void setUp() {
-        try {
-            fFactory = WSDLFactory.newInstance();
-        } catch (WSDLException e) {
-            fail("Can't instantiate the WSDLFactory object.");
-        }
-    }
-    
-    // Elements addable to Binding
-    public void testBindingFaultElement() {
-        DescriptionElement descEl = fFactory.newDescription();
-        BindingElement bindEl = descEl.addBindingElement();
-
-        BindingFaultElement bindFEl = bindEl.addBindingFaultElement();
-        
-        assertTrue("BindingElement doesn't have correct BindingFaultElement",
-                Arrays.asList(bindEl.getBindingFaultElements()).contains(bindFEl));
-        assertTrue("BindingFaultElement has incorrect parent", bindFEl.getParentElement() == bindEl);
-    }
-    
-    public void testBindingOperationElement() {
-        DescriptionElement descEl = fFactory.newDescription();
-        BindingElement bindEl = descEl.addBindingElement();
-
-        BindingOperationElement bindOpEl = bindEl.addBindingOperationElement();
-        
-        assertTrue("BindingElement doesn't have correct BindingOperationElement",
-                Arrays.asList(bindEl.getBindingOperationElements()).contains(bindOpEl));
-        assertTrue("BindingOperationElement has incorrect parent", bindOpEl.getParentElement() == bindEl);
-    }
-    
-    public void testBindingFaultReferenceElement() {
-        DescriptionElement descEl = fFactory.newDescription();
-        BindingElement bindEl = descEl.addBindingElement();
-        BindingOperationElement bindOpEl = bindEl.addBindingOperationElement();
-        BindingFaultReferenceElement bindFREl = bindOpEl.addBindingFaultReferenceElement();
-        
-        assertTrue("BindingOperationElement doesn't have correct BindingFaultReferenceElement",
-                Arrays.asList(bindOpEl.getBindingFaultReferenceElements()).contains(bindFREl));
-        assertTrue("BindingOperationElement has incorrect parent", bindOpEl.getParentElement() == bindEl);
-    }
-
-    public void testBindingMessageReferenceElement() {
-        DescriptionElement descEl = fFactory.newDescription();
-        BindingElement bindEl = descEl.addBindingElement();
-        BindingOperationElement bindOpEl = bindEl.addBindingOperationElement();
-        BindingMessageReferenceElement bindMREl = bindOpEl.addBindingMessageReferenceElement();
-        
-        assertTrue("BindingOperationElement doesn't have correct BindingMessageReferenceElement",
-                Arrays.asList(bindOpEl.getBindingMessageReferenceElements()).contains(bindMREl));
-        assertTrue("BindingOperationElement has incorrect parent", bindOpEl.getParentElement() == bindEl);
-    }
-
-    // Elements addable to Interface
-    public void testInterfaceFaultElement() {
-        DescriptionElement descEl = fFactory.newDescription();
-        InterfaceElement interfaceEl = descEl.addInterfaceElement();
-
-        InterfaceFaultElement interfaceFEl = interfaceEl.addInterfaceFaultElement();
-        
-        assertTrue("InterfaceElement doesn't have correct InterfaceFaultElement",
-                Arrays.asList(interfaceEl.getInterfaceFaultElements()).contains(interfaceFEl));
-        assertTrue("InterfaceFaultElement has incorrect parent", interfaceFEl.getParentElement() == interfaceEl);
-    }
-
-    public void testInterfaceOperationElement() {
-        DescriptionElement descEl = fFactory.newDescription();
-        InterfaceElement interfaceEl = descEl.addInterfaceElement();
-
-        InterfaceOperationElement interfaceOpEl = interfaceEl.addInterfaceOperationElement();
-        
-        assertTrue("InterfaceElement doesn't have correct InterfaceOperationElement",
-                Arrays.asList(interfaceEl.getInterfaceOperationElements()).contains(interfaceOpEl));
-        assertTrue("InterfaceOperationElement has incorrect parent", interfaceOpEl.getParentElement() == interfaceEl);
-    }
-    
-    public void testInterfaceFaultReferenceElement() {
-        DescriptionElement descEl = fFactory.newDescription();
-        InterfaceElement interfaceEl = descEl.addInterfaceElement();
-        InterfaceOperationElement interfaceOpEl = interfaceEl.addInterfaceOperationElement();
-        InterfaceFaultReferenceElement interfaceFREl = interfaceOpEl.addInterfaceFaultReferenceElement();
-        
-        assertTrue("InterfaceOperationElement doesn't have correct InterfaceFaultReferenceElement",
-                Arrays.asList(interfaceOpEl.getInterfaceFaultReferenceElements()).contains(interfaceFREl));
-        assertTrue("InterfaceFaultReferenceElement has incorrect parent", interfaceFREl.getParentElement() == interfaceOpEl);
-    }
-
-    public void testInterfaceMessageReferenceElement() {
-        DescriptionElement descEl = fFactory.newDescription();
-        InterfaceElement interfaceEl = descEl.addInterfaceElement();
-        InterfaceOperationElement interfaceOpEl = interfaceEl.addInterfaceOperationElement();
-        InterfaceMessageReferenceElement interfaceMREl = interfaceOpEl.addInterfaceMessageReferenceElement();
-        
-        assertTrue("InterfaceOperationElement doesn't have correct InterfaceMessageReferenceElement",
-                Arrays.asList(interfaceOpEl.getInterfaceMessageReferenceElements()).contains(interfaceMREl));
-        assertTrue("InterfaceMessageReferenceElement has incorrect parent", interfaceMREl.getParentElement() == interfaceOpEl);
-    }
-    
-    public void testEndpointElement() {
-        DescriptionElement descEl = fFactory.newDescription();
-        ServiceElement serviceEl = descEl.addServiceElement();
-        EndpointElement endpointEl = serviceEl.addEndpointElement();
-        
-        assertTrue("ServiceElement doesn't have correct EndpointElement",
-                Arrays.asList(serviceEl.getEndpointElements()).contains(endpointEl));
-        assertTrue("EndpointElement has incorrect parent", endpointEl.getParentElement() == serviceEl);
-    }
-}
+ * 
+ *     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 java.util.Arrays;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.woden.WSDLException;
+import org.apache.woden.WSDLFactory;
+import org.apache.woden.internal.wsdl20.DescriptionImpl;
+
+/**
+ * Test cases to check when calling XxxxElement.addYyyyElement() that:
+ * a) Xxxx.getYyyyElements() returns an array containing the added YyyyElement
+ * b) The YyyyElement.getParentElement() returns the instance of XxxxElement
+ * 
+ * Do this for all Xxxx and Yyyy
+ */
+public class ChildElementCreationTest extends TestCase {
+
+    private WSDLFactory fFactory = null;
+    
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(ChildElementCreationTest.class);
+    }
+
+    public static Test suite() {
+        return new TestSuite(ChildElementCreationTest.class);
+    }
+    
+    public void setUp() {
+        try {
+            fFactory = WSDLFactory.newInstance();
+        } catch (WSDLException e) {
+            fail("Can't instantiate the WSDLFactory object.");
+        }
+    }
+    
+    // Elements addable to Binding
+    public void testBindingFaultElement() {
+        DescriptionElement descEl = fFactory.newDescription();
+        BindingElement bindEl = descEl.addBindingElement();
+
+        BindingFaultElement bindFEl = bindEl.addBindingFaultElement();
+        
+        assertTrue("BindingElement doesn't have correct BindingFaultElement",
+                Arrays.asList(bindEl.getBindingFaultElements()).contains(bindFEl));
+        assertTrue("BindingFaultElement has incorrect parent", bindFEl.getParentElement() == bindEl);
+    }
+    
+    public void testBindingOperationElement() {
+        DescriptionElement descEl = fFactory.newDescription();
+        BindingElement bindEl = descEl.addBindingElement();
+
+        BindingOperationElement bindOpEl = bindEl.addBindingOperationElement();
+        
+        assertTrue("BindingElement doesn't have correct BindingOperationElement",
+                Arrays.asList(bindEl.getBindingOperationElements()).contains(bindOpEl));
+        assertTrue("BindingOperationElement has incorrect parent", bindOpEl.getParentElement() == bindEl);
+    }
+    
+    public void testBindingFaultReferenceElement() {
+        DescriptionElement descEl = fFactory.newDescription();
+        BindingElement bindEl = descEl.addBindingElement();
+        BindingOperationElement bindOpEl = bindEl.addBindingOperationElement();
+        BindingFaultReferenceElement bindFREl = bindOpEl.addBindingFaultReferenceElement();
+        
+        assertTrue("BindingOperationElement doesn't have correct BindingFaultReferenceElement",
+                Arrays.asList(bindOpEl.getBindingFaultReferenceElements()).contains(bindFREl));
+        assertTrue("BindingOperationElement has incorrect parent", bindOpEl.getParentElement() == bindEl);
+    }
+
+    public void testBindingMessageReferenceElement() {
+        DescriptionElement descEl = fFactory.newDescription();
+        BindingElement bindEl = descEl.addBindingElement();
+        BindingOperationElement bindOpEl = bindEl.addBindingOperationElement();
+        BindingMessageReferenceElement bindMREl = bindOpEl.addBindingMessageReferenceElement();
+        
+        assertTrue("BindingOperationElement doesn't have correct BindingMessageReferenceElement",
+                Arrays.asList(bindOpEl.getBindingMessageReferenceElements()).contains(bindMREl));
+        assertTrue("BindingOperationElement has incorrect parent", bindOpEl.getParentElement() == bindEl);
+    }
+
+    // Elements addable to Interface
+    public void testInterfaceFaultElement() {
+        DescriptionElement descEl = fFactory.newDescription();
+        InterfaceElement interfaceEl = descEl.addInterfaceElement();
+
+        InterfaceFaultElement interfaceFEl = interfaceEl.addInterfaceFaultElement();
+        
+        assertTrue("InterfaceElement doesn't have correct InterfaceFaultElement",
+                Arrays.asList(interfaceEl.getInterfaceFaultElements()).contains(interfaceFEl));
+        assertTrue("InterfaceFaultElement has incorrect parent", interfaceFEl.getParentElement() == interfaceEl);
+    }
+
+    public void testInterfaceOperationElement() {
+        DescriptionElement descEl = fFactory.newDescription();
+        InterfaceElement interfaceEl = descEl.addInterfaceElement();
+
+        InterfaceOperationElement interfaceOpEl = interfaceEl.addInterfaceOperationElement();
+        
+        assertTrue("InterfaceElement doesn't have correct InterfaceOperationElement",
+                Arrays.asList(interfaceEl.getInterfaceOperationElements()).contains(interfaceOpEl));
+        assertTrue("InterfaceOperationElement has incorrect parent", interfaceOpEl.getParentElement() == interfaceEl);
+    }
+    
+    public void testInterfaceFaultReferenceElement() {
+        DescriptionElement descEl = fFactory.newDescription();
+        InterfaceElement interfaceEl = descEl.addInterfaceElement();
+        InterfaceOperationElement interfaceOpEl = interfaceEl.addInterfaceOperationElement();
+        InterfaceFaultReferenceElement interfaceFREl = interfaceOpEl.addInterfaceFaultReferenceElement();
+        
+        assertTrue("InterfaceOperationElement doesn't have correct InterfaceFaultReferenceElement",
+                Arrays.asList(interfaceOpEl.getInterfaceFaultReferenceElements()).contains(interfaceFREl));
+        assertTrue("InterfaceFaultReferenceElement has incorrect parent", interfaceFREl.getParentElement() == interfaceOpEl);
+    }
+
+    public void testInterfaceMessageReferenceElement() {
+        DescriptionElement descEl = fFactory.newDescription();
+        InterfaceElement interfaceEl = descEl.addInterfaceElement();
+        InterfaceOperationElement interfaceOpEl = interfaceEl.addInterfaceOperationElement();
+        InterfaceMessageReferenceElement interfaceMREl = interfaceOpEl.addInterfaceMessageReferenceElement();
+        
+        assertTrue("InterfaceOperationElement doesn't have correct InterfaceMessageReferenceElement",
+                Arrays.asList(interfaceOpEl.getInterfaceMessageReferenceElements()).contains(interfaceMREl));
+        assertTrue("InterfaceMessageReferenceElement has incorrect parent", interfaceMREl.getParentElement() == interfaceOpEl);
+    }
+    
+    public void testEndpointElement() {
+        DescriptionElement descEl = fFactory.newDescription();
+        ServiceElement serviceEl = descEl.addServiceElement();
+        EndpointElement endpointEl = serviceEl.addEndpointElement();
+        
+        assertTrue("ServiceElement doesn't have correct EndpointElement",
+                Arrays.asList(serviceEl.getEndpointElements()).contains(endpointEl));
+        assertTrue("EndpointElement has incorrect parent", endpointEl.getParentElement() == serviceEl);
+    }
+}

Propchange: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ChildElementCreationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/DescriptiontElementTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/DescriptiontElementTest.java?rev=568937&r1=568936&r2=568937&view=diff
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/DescriptiontElementTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/DescriptiontElementTest.java Thu Aug 23 04:24:51 2007
@@ -1,189 +1,189 @@
-/**
+/**
  * 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 org.apache.woden.wsdl20.xml;
-
-import java.net.URI;
-import java.util.Map;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.apache.woden.WSDLException;
-import org.apache.woden.WSDLFactory;
-import org.apache.woden.internal.wsdl20.DescriptionImpl;
-import org.apache.woden.wsdl20.Description;
-import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
-
-/**
- * Unit tests for the DescriptionElement class.
- * 
- * @author Graham Turrell (gturrell@apache.org)
- */
-public class DescriptiontElementTest extends TestCase {
-
-	private DescriptionElement fDescriptionElement = null;
-    private String fPrefix1 = "prefix1";
-    private String fPrefix2 = "prefix2";
-	private URI fNamespace1 = null;	
-	private URI fNamespace2 = null;	
-	private URI fDocBaseUri = null;
-    private WSDLFactory fFactory = null;
-	
-	public static Test suite()
-	{
-	   return new TestSuite(DescriptiontElementTest.class);
-	}
-	   
-    /*
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception 
-    {
-        super.setUp();
-        
-        try {
-            fFactory = WSDLFactory.newInstance();
-        } catch (WSDLException e) {
-            fail("Can't instantiate the WSDLFactory object.");
-        }
-        
-        fDescriptionElement = fFactory.newDescription();
-		fNamespace1 = new URI("http://apache.org/namespaceURIa");
-		fNamespace2 = new URI("http://apache.org/namespaceURIb");
-		fDocBaseUri = new URI("http://apache.org/documentbaseURI");
-    }
-
-    /*
-     * @see TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception 
-    {
-        super.tearDown();
-    }
-	
-	public void testSetGetDocumentBaseURI() {
-		fDescriptionElement.setDocumentBaseURI(fDocBaseUri);
-		URI retrievedUri = fDescriptionElement.getDocumentBaseURI();
-		assertEquals("Retrieved document base URI differs from that set", fDocBaseUri, retrievedUri);
-
-	}
-
-	public void testSetGetTargetNamespace() {
-		fDescriptionElement.setTargetNamespace(fNamespace1);
-		URI retrievedTNS = fDescriptionElement.getTargetNamespace();
-		assertEquals("Retrieved target Namespace URI differs from that set", fNamespace1, retrievedTNS);
-	}
-
-	public void testAddGetNamespace() {
-		fDescriptionElement.addNamespace(fPrefix1,fNamespace1);
-		URI uri = fDescriptionElement.getNamespace(fPrefix1);
-		assertEquals("Retrieved NamespaceURI does not match that set", fNamespace1, uri);
-	}
-	
-	/*
-	 * Test getNamespace() when the prefix & namespace pair has not been previously added
-	 */
-	public void testGetNullNamespace() {
-		assertNull("Null was not returned when a non-existent prefix was given", fDescriptionElement.getNamespace("nosuchprefix"));
-	}
-
-	public void testRemoveNamespace() {
-		fDescriptionElement.addNamespace(fPrefix1,fNamespace1);
-		assertNotNull(fDescriptionElement.getNamespace(fPrefix1));
-		fDescriptionElement.removeNamespace(fPrefix1);
-		assertNull(fDescriptionElement.getNamespace(fPrefix1));
-	}
-
-	public void testAddGetNamespaces() {
-		fDescriptionElement.addNamespace(fPrefix1,fNamespace1);
-		fDescriptionElement.addNamespace(fPrefix2,fNamespace2);
-		Map uriMap = fDescriptionElement.getNamespaces();
-		assertEquals("Expected 2 namespaces", uriMap.size(),2);
-		URI uri1 = (URI)uriMap.get(fPrefix1);
-		URI uri2 = (URI)uriMap.get(fPrefix2);
-		assertEquals("Expected NamespaceURI not found", fNamespace1, uri1);
-		assertEquals("Expected NamespaceURI not found", fNamespace2, uri2);	
-	}
-	
-
-	public void testAddGetImportElements() {
-		ImportElement importElement1 = fDescriptionElement.addImportElement();
-		ImportElement importElement2 = fDescriptionElement.addImportElement();
-		ImportElement[] imports = fDescriptionElement.getImportElements();
-		assertEquals("Expected 2 import elements", 2, imports.length);
-	}
-
-	public void testAddGetIncludeElements() {
-		IncludeElement includeElement1 = fDescriptionElement.addIncludeElement();
-		IncludeElement includeElement2 = fDescriptionElement.addIncludeElement();
-		IncludeElement[] includes = fDescriptionElement.getIncludeElements();
-		assertEquals("Expected 2 include elements", 2, includes.length);
-	}
-
-	public void testAddGetInterfaceElements() {
-		InterfaceElement interfaceElement1 = fDescriptionElement.addInterfaceElement();
-		InterfaceElement interfaceElement2 = fDescriptionElement.addInterfaceElement();
-		InterfaceElement[] interfaces = fDescriptionElement.getInterfaceElements();
-		assertEquals("Expected 2 interface elements", 2, interfaces.length);
-	}
-
-	public void testAddGetBindingElements() {
-		BindingElement bindingElement1 = fDescriptionElement.addBindingElement();
-		BindingElement bindingElement2 = fDescriptionElement.addBindingElement();
-		BindingElement[] bindings = fDescriptionElement.getBindingElements();
-		assertEquals("Expected 2 binding elements", 2, bindings.length);
-	}
-
-	public void testAddGetServiceElements() {
-		ServiceElement serviceElement1 = fDescriptionElement.addServiceElement();
-		ServiceElement serviceElement2 = fDescriptionElement.addServiceElement();
-		ServiceElement[] services = fDescriptionElement.getServiceElements();
-		assertEquals("Expected 2 service elements", 2, services.length);
-	}
-
-	/*
-	 * Call the method once to create a new TypesElement and check that its parent is the
-	 * DescriptionElement under test.
-	 * Call the method again and ensure the same TypesElement object is returned.
-	 */
-	public void testGetTypesElement() {
-		// check first getTypesElement invocation...
-		TypesElement typesElement = fDescriptionElement.getTypesElement();
-		assertNull("Method returned TypesElement but expected null", typesElement);
-		
-		// now create a new TypesElement
-		try {
-		    typesElement = fDescriptionElement.addTypesElement();
-		} catch (WSDLException e) {
-		    fail("Method could not create a new TypesElement as one already exists.");
-		}
-		assertNotNull("Method returned null but expected a TypesElement", typesElement);
-		
-		if (typesElement != null) {
-			assertSame("Expected DescriptionElement to be parent of the TypesElement",
-					typesElement.getParentElement(), fDescriptionElement);
-		}	
-		// check subsequent getTypesElement invocation...
-		assertSame(typesElement, fDescriptionElement.getTypesElement());
-	}
-
-	public void testToComponent() {
-		Description descComponent = fDescriptionElement.toComponent();
-		assertNotNull("Null component object model unexpected", descComponent);
-	}
-}
+ * 
+ *     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 java.net.URI;
+import java.util.Map;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.woden.WSDLException;
+import org.apache.woden.WSDLFactory;
+import org.apache.woden.internal.wsdl20.DescriptionImpl;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
+
+/**
+ * Unit tests for the DescriptionElement class.
+ * 
+ * @author Graham Turrell (gturrell@apache.org)
+ */
+public class DescriptiontElementTest extends TestCase {
+
+	private DescriptionElement fDescriptionElement = null;
+    private String fPrefix1 = "prefix1";
+    private String fPrefix2 = "prefix2";
+	private URI fNamespace1 = null;	
+	private URI fNamespace2 = null;	
+	private URI fDocBaseUri = null;
+    private WSDLFactory fFactory = null;
+	
+	public static Test suite()
+	{
+	   return new TestSuite(DescriptiontElementTest.class);
+	}
+	   
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception 
+    {
+        super.setUp();
+        
+        try {
+            fFactory = WSDLFactory.newInstance();
+        } catch (WSDLException e) {
+            fail("Can't instantiate the WSDLFactory object.");
+        }
+        
+        fDescriptionElement = fFactory.newDescription();
+		fNamespace1 = new URI("http://apache.org/namespaceURIa");
+		fNamespace2 = new URI("http://apache.org/namespaceURIb");
+		fDocBaseUri = new URI("http://apache.org/documentbaseURI");
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception 
+    {
+        super.tearDown();
+    }
+	
+	public void testSetGetDocumentBaseURI() {
+		fDescriptionElement.setDocumentBaseURI(fDocBaseUri);
+		URI retrievedUri = fDescriptionElement.getDocumentBaseURI();
+		assertEquals("Retrieved document base URI differs from that set", fDocBaseUri, retrievedUri);
+
+	}
+
+	public void testSetGetTargetNamespace() {
+		fDescriptionElement.setTargetNamespace(fNamespace1);
+		URI retrievedTNS = fDescriptionElement.getTargetNamespace();
+		assertEquals("Retrieved target Namespace URI differs from that set", fNamespace1, retrievedTNS);
+	}
+
+	public void testAddGetNamespace() {
+		fDescriptionElement.addNamespace(fPrefix1,fNamespace1);
+		URI uri = fDescriptionElement.getNamespace(fPrefix1);
+		assertEquals("Retrieved NamespaceURI does not match that set", fNamespace1, uri);
+	}
+	
+	/*
+	 * Test getNamespace() when the prefix & namespace pair has not been previously added
+	 */
+	public void testGetNullNamespace() {
+		assertNull("Null was not returned when a non-existent prefix was given", fDescriptionElement.getNamespace("nosuchprefix"));
+	}
+
+	public void testRemoveNamespace() {
+		fDescriptionElement.addNamespace(fPrefix1,fNamespace1);
+		assertNotNull(fDescriptionElement.getNamespace(fPrefix1));
+		fDescriptionElement.removeNamespace(fPrefix1);
+		assertNull(fDescriptionElement.getNamespace(fPrefix1));
+	}
+
+	public void testAddGetNamespaces() {
+		fDescriptionElement.addNamespace(fPrefix1,fNamespace1);
+		fDescriptionElement.addNamespace(fPrefix2,fNamespace2);
+		Map uriMap = fDescriptionElement.getNamespaces();
+		assertEquals("Expected 2 namespaces", uriMap.size(),2);
+		URI uri1 = (URI)uriMap.get(fPrefix1);
+		URI uri2 = (URI)uriMap.get(fPrefix2);
+		assertEquals("Expected NamespaceURI not found", fNamespace1, uri1);
+		assertEquals("Expected NamespaceURI not found", fNamespace2, uri2);	
+	}
+	
+
+	public void testAddGetImportElements() {
+		ImportElement importElement1 = fDescriptionElement.addImportElement();
+		ImportElement importElement2 = fDescriptionElement.addImportElement();
+		ImportElement[] imports = fDescriptionElement.getImportElements();
+		assertEquals("Expected 2 import elements", 2, imports.length);
+	}
+
+	public void testAddGetIncludeElements() {
+		IncludeElement includeElement1 = fDescriptionElement.addIncludeElement();
+		IncludeElement includeElement2 = fDescriptionElement.addIncludeElement();
+		IncludeElement[] includes = fDescriptionElement.getIncludeElements();
+		assertEquals("Expected 2 include elements", 2, includes.length);
+	}
+
+	public void testAddGetInterfaceElements() {
+		InterfaceElement interfaceElement1 = fDescriptionElement.addInterfaceElement();
+		InterfaceElement interfaceElement2 = fDescriptionElement.addInterfaceElement();
+		InterfaceElement[] interfaces = fDescriptionElement.getInterfaceElements();
+		assertEquals("Expected 2 interface elements", 2, interfaces.length);
+	}
+
+	public void testAddGetBindingElements() {
+		BindingElement bindingElement1 = fDescriptionElement.addBindingElement();
+		BindingElement bindingElement2 = fDescriptionElement.addBindingElement();
+		BindingElement[] bindings = fDescriptionElement.getBindingElements();
+		assertEquals("Expected 2 binding elements", 2, bindings.length);
+	}
+
+	public void testAddGetServiceElements() {
+		ServiceElement serviceElement1 = fDescriptionElement.addServiceElement();
+		ServiceElement serviceElement2 = fDescriptionElement.addServiceElement();
+		ServiceElement[] services = fDescriptionElement.getServiceElements();
+		assertEquals("Expected 2 service elements", 2, services.length);
+	}
+
+	/*
+	 * Call the method once to create a new TypesElement and check that its parent is the
+	 * DescriptionElement under test.
+	 * Call the method again and ensure the same TypesElement object is returned.
+	 */
+	public void testGetTypesElement() {
+		// check first getTypesElement invocation...
+		TypesElement typesElement = fDescriptionElement.getTypesElement();
+		assertNull("Method returned TypesElement but expected null", typesElement);
+		
+		// now create a new TypesElement
+		try {
+		    typesElement = fDescriptionElement.addTypesElement();
+		} catch (WSDLException e) {
+		    fail("Method could not create a new TypesElement as one already exists.");
+		}
+		assertNotNull("Method returned null but expected a TypesElement", typesElement);
+		
+		if (typesElement != null) {
+			assertSame("Expected DescriptionElement to be parent of the TypesElement",
+					typesElement.getParentElement(), fDescriptionElement);
+		}	
+		// check subsequent getTypesElement invocation...
+		assertSame(typesElement, fDescriptionElement.getTypesElement());
+	}
+
+	public void testToComponent() {
+		Description descComponent = fDescriptionElement.toComponent();
+		assertNotNull("Null component object model unexpected", descComponent);
+	}
+}

Propchange: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/DescriptiontElementTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/DocumentationElementTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/DocumentationElementTest.java?rev=568937&r1=568936&r2=568937&view=diff
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/DocumentationElementTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/DocumentationElementTest.java Thu Aug 23 04:24:51 2007
@@ -1,130 +1,130 @@
-/**
- * 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 org.apache.woden.wsdl20.xml;
-
-import java.net.URI;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.apache.woden.internal.wsdl20.DescriptionImpl;
-import org.apache.woden.WSDLException;
-import org.apache.woden.WSDLFactory;
-import org.apache.woden.XMLElement;
-
-/**
- * Unit tests for DocumentationImpl class.
- * 
- * @author John Kaputin (jkaputin@apache.org)
- *
- */
-public class DocumentationElementTest extends TestCase {
-
-    public static Test suite()
-    {
-       return new TestSuite(DocumentationElementTest.class);
-    }
-    
-    /**
-     * This is a Bare minimum test XMLElement to test the DocumentationElement.
-     */
-    private class TestXMLElement implements XMLElement {
-        public String getAttributeValue(String attrName) {
-            return null;
-        }
-
-        public XMLElement[] getChildElements() {
-            return null;
-        }
-
-        public XMLElement getFirstChildElement() {
-            return null;
-        }
-
-        public String getLocalName() {
-            return null;
-        }
-
-        public URI getNamespaceURI() throws WSDLException {
-            return null;
-        }
-
-        public XMLElement getNextSiblingElement() {
-            return null;
-        }
-
-        public QName getQName() {
-            return null;
-        }
-
-        public QName getQName(String prefixedValue) throws WSDLException {
-            return null;
-        }
-
-        public Object getSource() {
-            return null;
-        }
-
-        public void setSource(Object elem) {            
-        }
-    }
-
-    private WSDLFactory fFactory = null;
-    
-    protected void setUp() throws Exception 
-    {
-        super.setUp();
-        
-        try {
-            fFactory = WSDLFactory.newInstance();
-        } catch (WSDLException e) {
-            fail("Can't instantiate the WSDLFactory object.");
-        }
-    }
-    
-    /**
-     * Test method for {@link org.apache.woden.internal.wsdl20.DocumentationImpl#setContent(java.lang.Object)}.
-     * Test method for {@link org.apache.woden.internal.wsdl20.DocumentationImpl#setContent(java.lang.Object)}.
-     */
-    public void testSetGetContent() {
-        DescriptionElement descElem = fFactory.newDescription();
-        DocumentationElement docElem = descElem.addDocumentationElement();
-        
-        //check that the doc element is empty when first created
-        assertNull(docElem.getContent());
-        
-        //test the setter and getter methods for doc elem content
-        XMLElement xmlel = new TestXMLElement();
-        docElem.setContent(xmlel);
-        assertEquals(xmlel, docElem.getContent());
-    }
-
-    /**
-     * Test method for {@link org.apache.woden.internal.wsdl20.DocumentationImpl#getParentElement()}.
-     */
-    public void testGetParentElement() {
-        DescriptionElement descElem1 = fFactory.newDescription();
-        DocumentationElement docElem = descElem1.addDocumentationElement();
-        
-        //check the parent
-        assertEquals(descElem1, docElem.getParentElement());
-    }
-
-}
+/**
+ * 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 org.apache.woden.wsdl20.xml;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.woden.internal.wsdl20.DescriptionImpl;
+import org.apache.woden.WSDLException;
+import org.apache.woden.WSDLFactory;
+import org.apache.woden.XMLElement;
+
+/**
+ * Unit tests for DocumentationImpl class.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ *
+ */
+public class DocumentationElementTest extends TestCase {
+
+    public static Test suite()
+    {
+       return new TestSuite(DocumentationElementTest.class);
+    }
+    
+    /**
+     * This is a Bare minimum test XMLElement to test the DocumentationElement.
+     */
+    private class TestXMLElement implements XMLElement {
+        public String getAttributeValue(String attrName) {
+            return null;
+        }
+
+        public XMLElement[] getChildElements() {
+            return null;
+        }
+
+        public XMLElement getFirstChildElement() {
+            return null;
+        }
+
+        public String getLocalName() {
+            return null;
+        }
+
+        public URI getNamespaceURI() throws WSDLException {
+            return null;
+        }
+
+        public XMLElement getNextSiblingElement() {
+            return null;
+        }
+
+        public QName getQName() {
+            return null;
+        }
+
+        public QName getQName(String prefixedValue) throws WSDLException {
+            return null;
+        }
+
+        public Object getSource() {
+            return null;
+        }
+
+        public void setSource(Object elem) {            
+        }
+    }
+
+    private WSDLFactory fFactory = null;
+    
+    protected void setUp() throws Exception 
+    {
+        super.setUp();
+        
+        try {
+            fFactory = WSDLFactory.newInstance();
+        } catch (WSDLException e) {
+            fail("Can't instantiate the WSDLFactory object.");
+        }
+    }
+    
+    /**
+     * Test method for {@link org.apache.woden.internal.wsdl20.DocumentationImpl#setContent(java.lang.Object)}.
+     * Test method for {@link org.apache.woden.internal.wsdl20.DocumentationImpl#setContent(java.lang.Object)}.
+     */
+    public void testSetGetContent() {
+        DescriptionElement descElem = fFactory.newDescription();
+        DocumentationElement docElem = descElem.addDocumentationElement();
+        
+        //check that the doc element is empty when first created
+        assertNull(docElem.getContent());
+        
+        //test the setter and getter methods for doc elem content
+        XMLElement xmlel = new TestXMLElement();
+        docElem.setContent(xmlel);
+        assertEquals(xmlel, docElem.getContent());
+    }
+
+    /**
+     * Test method for {@link org.apache.woden.internal.wsdl20.DocumentationImpl#getParentElement()}.
+     */
+    public void testGetParentElement() {
+        DescriptionElement descElem1 = fFactory.newDescription();
+        DocumentationElement docElem = descElem1.addDocumentationElement();
+        
+        //check the parent
+        assertEquals(descElem1, docElem.getParentElement());
+    }
+
+}

Propchange: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/DocumentationElementTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/EndpointElementTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/EndpointElementTest.java?rev=568937&r1=568936&r2=568937&view=diff
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/EndpointElementTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/EndpointElementTest.java Thu Aug 23 04:24:51 2007
@@ -1,198 +1,198 @@
-/**
+/**
  * 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 org.apache.woden.wsdl20.xml;
-
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-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.internal.wsdl20.EndpointImpl;
-import org.apache.woden.tests.TestErrorHandler;
-import org.apache.woden.types.NCName;
-import org.apache.woden.wsdl20.Description;
-
-/**
- * Functional verification test of org.apache.woden.wsdl20.xml.EndpointElement.
- * Checks that the expected API behaviour is supported by the implementation.
- * 
- * @author jkaputin@apache.org
- */
-public class EndpointElementTest extends TestCase 
-{
-    private WSDLFactory fFactory = null;
-    private WSDLReader fReader = null;
-    private ErrorHandler fHandler = null;
-    private DescriptionElement fParsedDesc = null;
-    private EndpointElement[] fParsedEndpoints = null;
-    
-    private String fTargetNS = "http://ws.apache.woden/endpoint";
-
-    public static Test suite()
-    {
-        return new TestSuite(EndpointElementTest.class);
-    }
-
-    protected void setUp() throws Exception 
-    {
-        fFactory = WSDLFactory.newInstance();
-        fReader = fFactory.newWSDLReader();
-        fHandler = new TestErrorHandler();
-        fReader.getErrorReporter().setErrorHandler(fHandler);
-        
-        URL wsdlURL = getClass().getClassLoader().getResource(
-            "org/apache/woden/wsdl20/xml/resources/EndpointElementTest.wsdl");
-        assertNotNull("Failed to find the WSDL document on the classpath.", wsdlURL);
-        
-        Description descComp = fReader.readWSDL(wsdlURL.toString());
-        assertNotNull("The reader did not return a description.", descComp);
-        fParsedDesc = descComp.toElement();
-        
-        ServiceElement service = fParsedDesc.getServiceElements()[0];
-        assertNotNull("The description does not contain a service.", service);
-        
-        fParsedEndpoints = service.getEndpointElements();
-        assertTrue("The service does not contain 3 endpoints as expected.",
-                fParsedEndpoints.length == 3);
-    }
-
-    protected void tearDown() throws Exception 
-    {
-        fFactory = null;
-        fReader = null;
-        fHandler = null;
-        fParsedDesc = null;
-        fParsedEndpoints = null;
-    }
-    
-    /**
-     * Test that the getName method returns the expected NCName parsed from a WSDL document.
-     */
-    public void testGetNameParsed() 
-    {
-        NCName ncName = fParsedEndpoints[0].getName();
-        assertNotNull("EndpointElement.getName() returned null, but an NCName was expected.",
-                ncName);
-        
-        assertTrue("NCName returned by EndpointElement.getName() was not the one expected.",
-                "endpoint1".equals(ncName.toString()) );
-    }
-
-    /**
-     * Test that the NCName specified on the setName method is returned by getName.
-     */
-    public void testSetAndGetName()
-    {
-        EndpointElement endpoint = new EndpointImpl();
-        NCName ncName = new NCName("dummy");
-
-        endpoint.setName(ncName);
-        assertTrue("NCName returned by EndpointElement.getName() was not the one set by setName().",
-                ncName.equals(endpoint.getName()));
-    }
-
-    /**
-     * Test that the getBindingName method returns the QName of the binding
-     * associated with this endpoint, as specified by the "binding" attribute
-     * of the <endpoint> element in a parsed WSDL document.
-     */
-    public void testGetBindingNameParsed()
-    {
-        QName qname = fParsedEndpoints[0].getBindingName();
-        assertNotNull("EndpointElement.getBindingName() returned null, but a QName was expected.",
-                      qname);
-        
-        QName expectedQN = new QName(fTargetNS, "binding1");
-        assertTrue("QName returned by EndpointElement.getBindingName() was not the one expected.",
-                   expectedQN.equals(qname));
-    }
-
-    /**
-     * Test that the QName specified on the setBindingName method is returned by 
-     * the getBindingName method.
-     */
-    public void testSetAndGetBindingName()
-    {
-        EndpointElement endpoint = new EndpointImpl();
-        QName qname = new QName("urn:woden","dummy");
-        endpoint.setBindingName(qname);
-        QName returnedQN = endpoint.getBindingName();
-        assertTrue("QName returned by EndpointElement.getBindingName() was not the one set by setBindingName().",
-                   returnedQN.equals(qname));
-    }
-    
-    /**
-     * Test that the getBindingElement method returns a BindingElement 
-     * defined within the description, that is referred to by QName in the 
-     * "binding" attribute of the <endpoint> element of a parsed WSDL 
-     * document. This tests that the QName is correctly dereferenced to an object.
-     */
-    public void testGetBindingElementParsed()
-    {
-        BindingElement bindingDefined = fParsedDesc.getBindingElements()[0];
-        BindingElement bindingReferred = fParsedEndpoints[0].getBindingElement();
-        assertNotNull("EndpointElement.getBindingElement() returned null, but a BindingElement was expected.",
-                bindingReferred);
-        
-        assertTrue("The BindingElement returned by EndpointElement.getBindingElement() was not the one expected.",
-                bindingReferred == bindingDefined);
-    }
-
-    /**
-     * Test that the getAddress method returns the expected URI parsed from a WSDL document.
-     */
-    public void testGetAddressParsed() 
-    {
-        URI uri = fParsedEndpoints[0].getAddress();
-        assertNotNull("EndpointElement.getAddress() returned null, but a URI was expected.",
-                uri);
-        
-        assertTrue("URI returned by EndpointElement.getAddress() was not the one expected.",
-                "urn:abc".equals(uri.toString()) );
-    }
-
-    /**
-     * Test the optionality of the 'address' attribute by invoking the getAddress
-     * method on a parsed <endpoint> element that does not have an
-     * 'address' specified and check that it returns null.
-     */
-    public void testGetAddressParsedOptional() 
-    {
-        URI uri = fParsedEndpoints[1].getAddress();
-        assertNull("EndpointElement.getAddress() did not return null, as expected.",
-                uri);
-    }
-
-    /**
-     * Test that the URI specified on the setAddress method is returned by getAddress.
-     */
-    public void testSetAndGetAddress() throws Exception
-    {
-        EndpointElement endpoint = new EndpointImpl();
-        URI uri = new URI("urn:dummy");
-        endpoint.setAddress(uri);
-        assertTrue("URI returned by EndpointElement.getAddress() was not the one set by setAddress().",
-                   "urn:dummy".equals(endpoint.getAddress().toString()));
-    }
-}
+ * 
+ *     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 java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+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.internal.wsdl20.EndpointImpl;
+import org.apache.woden.tests.TestErrorHandler;
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.Description;
+
+/**
+ * Functional verification test of org.apache.woden.wsdl20.xml.EndpointElement.
+ * Checks that the expected API behaviour is supported by the implementation.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class EndpointElementTest extends TestCase 
+{
+    private WSDLFactory fFactory = null;
+    private WSDLReader fReader = null;
+    private ErrorHandler fHandler = null;
+    private DescriptionElement fParsedDesc = null;
+    private EndpointElement[] fParsedEndpoints = null;
+    
+    private String fTargetNS = "http://ws.apache.woden/endpoint";
+
+    public static Test suite()
+    {
+        return new TestSuite(EndpointElementTest.class);
+    }
+
+    protected void setUp() throws Exception 
+    {
+        fFactory = WSDLFactory.newInstance();
+        fReader = fFactory.newWSDLReader();
+        fHandler = new TestErrorHandler();
+        fReader.getErrorReporter().setErrorHandler(fHandler);
+        
+        URL wsdlURL = getClass().getClassLoader().getResource(
+            "org/apache/woden/wsdl20/xml/resources/EndpointElementTest.wsdl");
+        assertNotNull("Failed to find the WSDL document on the classpath.", wsdlURL);
+        
+        Description descComp = fReader.readWSDL(wsdlURL.toString());
+        assertNotNull("The reader did not return a description.", descComp);
+        fParsedDesc = descComp.toElement();
+        
+        ServiceElement service = fParsedDesc.getServiceElements()[0];
+        assertNotNull("The description does not contain a service.", service);
+        
+        fParsedEndpoints = service.getEndpointElements();
+        assertTrue("The service does not contain 3 endpoints as expected.",
+                fParsedEndpoints.length == 3);
+    }
+
+    protected void tearDown() throws Exception 
+    {
+        fFactory = null;
+        fReader = null;
+        fHandler = null;
+        fParsedDesc = null;
+        fParsedEndpoints = null;
+    }
+    
+    /**
+     * Test that the getName method returns the expected NCName parsed from a WSDL document.
+     */
+    public void testGetNameParsed() 
+    {
+        NCName ncName = fParsedEndpoints[0].getName();
+        assertNotNull("EndpointElement.getName() returned null, but an NCName was expected.",
+                ncName);
+        
+        assertTrue("NCName returned by EndpointElement.getName() was not the one expected.",
+                "endpoint1".equals(ncName.toString()) );
+    }
+
+    /**
+     * Test that the NCName specified on the setName method is returned by getName.
+     */
+    public void testSetAndGetName()
+    {
+        EndpointElement endpoint = new EndpointImpl();
+        NCName ncName = new NCName("dummy");
+
+        endpoint.setName(ncName);
+        assertTrue("NCName returned by EndpointElement.getName() was not the one set by setName().",
+                ncName.equals(endpoint.getName()));
+    }
+
+    /**
+     * Test that the getBindingName method returns the QName of the binding
+     * associated with this endpoint, as specified by the "binding" attribute
+     * of the <endpoint> element in a parsed WSDL document.
+     */
+    public void testGetBindingNameParsed()
+    {
+        QName qname = fParsedEndpoints[0].getBindingName();
+        assertNotNull("EndpointElement.getBindingName() returned null, but a QName was expected.",
+                      qname);
+        
+        QName expectedQN = new QName(fTargetNS, "binding1");
+        assertTrue("QName returned by EndpointElement.getBindingName() was not the one expected.",
+                   expectedQN.equals(qname));
+    }
+
+    /**
+     * Test that the QName specified on the setBindingName method is returned by 
+     * the getBindingName method.
+     */
+    public void testSetAndGetBindingName()
+    {
+        EndpointElement endpoint = new EndpointImpl();
+        QName qname = new QName("urn:woden","dummy");
+        endpoint.setBindingName(qname);
+        QName returnedQN = endpoint.getBindingName();
+        assertTrue("QName returned by EndpointElement.getBindingName() was not the one set by setBindingName().",
+                   returnedQN.equals(qname));
+    }
+    
+    /**
+     * Test that the getBindingElement method returns a BindingElement 
+     * defined within the description, that is referred to by QName in the 
+     * "binding" attribute of the <endpoint> element of a parsed WSDL 
+     * document. This tests that the QName is correctly dereferenced to an object.
+     */
+    public void testGetBindingElementParsed()
+    {
+        BindingElement bindingDefined = fParsedDesc.getBindingElements()[0];
+        BindingElement bindingReferred = fParsedEndpoints[0].getBindingElement();
+        assertNotNull("EndpointElement.getBindingElement() returned null, but a BindingElement was expected.",
+                bindingReferred);
+        
+        assertTrue("The BindingElement returned by EndpointElement.getBindingElement() was not the one expected.",
+                bindingReferred == bindingDefined);
+    }
+
+    /**
+     * Test that the getAddress method returns the expected URI parsed from a WSDL document.
+     */
+    public void testGetAddressParsed() 
+    {
+        URI uri = fParsedEndpoints[0].getAddress();
+        assertNotNull("EndpointElement.getAddress() returned null, but a URI was expected.",
+                uri);
+        
+        assertTrue("URI returned by EndpointElement.getAddress() was not the one expected.",
+                "urn:abc".equals(uri.toString()) );
+    }
+
+    /**
+     * Test the optionality of the 'address' attribute by invoking the getAddress
+     * method on a parsed <endpoint> element that does not have an
+     * 'address' specified and check that it returns null.
+     */
+    public void testGetAddressParsedOptional() 
+    {
+        URI uri = fParsedEndpoints[1].getAddress();
+        assertNull("EndpointElement.getAddress() did not return null, as expected.",
+                uri);
+    }
+
+    /**
+     * Test that the URI specified on the setAddress method is returned by getAddress.
+     */
+    public void testSetAndGetAddress() throws Exception
+    {
+        EndpointElement endpoint = new EndpointImpl();
+        URI uri = new URI("urn:dummy");
+        endpoint.setAddress(uri);
+        assertTrue("URI returned by EndpointElement.getAddress() was not the one set by setAddress().",
+                   "urn:dummy".equals(endpoint.getAddress().toString()));
+    }
+}

Propchange: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/EndpointElementTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ImportElementTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ImportElementTest.java?rev=568937&r1=568936&r2=568937&view=diff
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ImportElementTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ImportElementTest.java Thu Aug 23 04:24:51 2007
@@ -1,124 +1,124 @@
-/**
- * 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 org.apache.woden.wsdl20.xml;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.apache.woden.WSDLException;
-import org.apache.woden.WSDLFactory;
-import org.apache.woden.internal.wsdl20.DescriptionImpl;
-import org.apache.woden.internal.wsdl20.ImportImpl;
-
-/**
- * Unit tests for the ImportElement class.
- * 
- * @author Graham Turrell (gturrell@apache.org)
- */
-public class ImportElementTest extends TestCase {
-
-	private ImportElement fImport = new ImportImpl();
-	private DescriptionElement fDescriptionElement = null;
-	private URI fURI = null;	
-    private WSDLFactory fFactory = null;
-	
-	public static Test suite()
-	{
-	   return new TestSuite(ImportElementTest.class);
-	}
-	   
-    /*
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception 
-    {
-        super.setUp();
-        
-        try {
-            fFactory = WSDLFactory.newInstance();
-        } catch (WSDLException e) {
-            fail("Can't instantiate the WSDLFactory object.");
-        }
-        
-        fDescriptionElement = fFactory.newDescription();
-    }
-
-    /*
-     * @see TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception 
-    {
-        super.tearDown();
-    }
-	
-	/**
-	 * Test that a Description Element can be successfully set and retrieved from an ImportElement
-	 */
-	public void testSetGetDescriptionElement()
-	{
-		fImport.setDescriptionElement(fDescriptionElement);
-		assertEquals("The retrieved Description Element object is not that which was set", 
-                fDescriptionElement, fImport.getDescriptionElement());
-	}
-
-	/**
-	 * Test that a Location URI can be successfully set and retrieved from an ImportElement
-	 */
-	public void testSetGetLocation()
-	{
-		try 
-		{
-			fURI = new URI("http://apache.org/test");
-		} catch (URISyntaxException e) {
-			
-		}
-		fImport.setLocation(fURI);
-		assertEquals("The retrieved Location URI object is not that which was set", fURI, fImport.getLocation());
-	}
-	
-	public void testSetGetNamespace()
-	{
-		try 
-		{
-			fURI = new URI("http://apache.org/test");
-		} catch (URISyntaxException e) {
-			
-		}
-		fImport.setNamespace(fURI);
-		assertEquals("The retrieved Location URI object is not that which was set", fURI, fImport.getNamespace());
-	}
-	
-	/**
-	 * Test that an ImportElement without its optional Namespace attribute set, returns null from its getter method
-	 */
-	public void testGetNamespaceDefault()
-	{	
-		assertNull("The namespace was unset but appears set.", fImport.getNamespace());
-	}
-	
-    public void testGetParentElement() {
-        DescriptionElement desc = fFactory.newDescription();
-        ImportElement importEl = desc.addImportElement();
-        DescriptionElement parent = (DescriptionElement)importEl.getParentElement();
-        assertSame("The import's parent should be the description that created it", desc, parent);
-                
-    }
-}
+/**
+ * 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 org.apache.woden.wsdl20.xml;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.woden.WSDLException;
+import org.apache.woden.WSDLFactory;
+import org.apache.woden.internal.wsdl20.DescriptionImpl;
+import org.apache.woden.internal.wsdl20.ImportImpl;
+
+/**
+ * Unit tests for the ImportElement class.
+ * 
+ * @author Graham Turrell (gturrell@apache.org)
+ */
+public class ImportElementTest extends TestCase {
+
+	private ImportElement fImport = new ImportImpl();
+	private DescriptionElement fDescriptionElement = null;
+	private URI fURI = null;	
+    private WSDLFactory fFactory = null;
+	
+	public static Test suite()
+	{
+	   return new TestSuite(ImportElementTest.class);
+	}
+	   
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception 
+    {
+        super.setUp();
+        
+        try {
+            fFactory = WSDLFactory.newInstance();
+        } catch (WSDLException e) {
+            fail("Can't instantiate the WSDLFactory object.");
+        }
+        
+        fDescriptionElement = fFactory.newDescription();
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception 
+    {
+        super.tearDown();
+    }
+	
+	/**
+	 * Test that a Description Element can be successfully set and retrieved from an ImportElement
+	 */
+	public void testSetGetDescriptionElement()
+	{
+		fImport.setDescriptionElement(fDescriptionElement);
+		assertEquals("The retrieved Description Element object is not that which was set", 
+                fDescriptionElement, fImport.getDescriptionElement());
+	}
+
+	/**
+	 * Test that a Location URI can be successfully set and retrieved from an ImportElement
+	 */
+	public void testSetGetLocation()
+	{
+		try 
+		{
+			fURI = new URI("http://apache.org/test");
+		} catch (URISyntaxException e) {
+			
+		}
+		fImport.setLocation(fURI);
+		assertEquals("The retrieved Location URI object is not that which was set", fURI, fImport.getLocation());
+	}
+	
+	public void testSetGetNamespace()
+	{
+		try 
+		{
+			fURI = new URI("http://apache.org/test");
+		} catch (URISyntaxException e) {
+			
+		}
+		fImport.setNamespace(fURI);
+		assertEquals("The retrieved Location URI object is not that which was set", fURI, fImport.getNamespace());
+	}
+	
+	/**
+	 * Test that an ImportElement without its optional Namespace attribute set, returns null from its getter method
+	 */
+	public void testGetNamespaceDefault()
+	{	
+		assertNull("The namespace was unset but appears set.", fImport.getNamespace());
+	}
+	
+    public void testGetParentElement() {
+        DescriptionElement desc = fFactory.newDescription();
+        ImportElement importEl = desc.addImportElement();
+        DescriptionElement parent = (DescriptionElement)importEl.getParentElement();
+        assertSame("The import's parent should be the description that created it", desc, parent);
+                
+    }
+}

Propchange: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ImportElementTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



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