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 gt...@apache.org on 2007/01/27 01:00:20 UTC

svn commit: r500420 - in /incubator/woden/trunk/java/test/org/apache/woden: tests/ wsdl20/ wsdl20/xml/

Author: gturrell
Date: Fri Jan 26 16:00:18 2007
New Revision: 500420

URL: http://svn.apache.org/viewvc?view=rev&rev=500420
Log:
[WODEN-54] Part 3 - Created unit tests for all API methods of 
InterfaceFaultReference, 
InterfaceFault, 
InterfaceMessageReference
InterfaceOperation
Interface
InterfaceElement
InterfaceFaultReferenceElement
InterfaceMessageReferenceElement
InterfaceOperationElement

That's all the classes covered. May be one future enhancement required for InterfaceMessageReferenceElement.getElement(),
But plan to open a seperate JIRA to cover this.

Added:
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultReferenceTest.java
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultTest.java
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceMessageReferenceTest.java
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceOperationTest.java
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceTest.java
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceMessageReferenceElementTest.java
Modified:
    incubator/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceElementTest.java
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceFaultReferenceElementTest.java
    incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceOperationElementTest.java

Modified: incubator/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java?view=diff&rev=500420&r1=500419&r2=500420
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java Fri Jan 26 16:00:18 2007
@@ -31,6 +31,11 @@
 import org.apache.woden.wsdl20.DescriptionTest;
 import org.apache.woden.wsdl20.ElementDeclarationTest;
 import org.apache.woden.wsdl20.EndpointTest;
+import org.apache.woden.wsdl20.InterfaceFaultReferenceTest;
+import org.apache.woden.wsdl20.InterfaceFaultTest;
+import org.apache.woden.wsdl20.InterfaceMessageReferenceTest;
+import org.apache.woden.wsdl20.InterfaceOperationTest;
+import org.apache.woden.wsdl20.InterfaceTest;
 import org.apache.woden.wsdl20.ServiceTest;
 import org.apache.woden.wsdl20.TypeDefinitionTest;
 import org.apache.woden.wsdl20.extensions.http.HTTPBindingExtensionsTest;
@@ -51,6 +56,7 @@
 import org.apache.woden.wsdl20.xml.InterfaceElementTest;
 import org.apache.woden.wsdl20.xml.InterfaceFaultElementTest;
 import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElementTest;
+import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElementTest;
 import org.apache.woden.wsdl20.xml.InterfaceOperationElementTest;
 import org.apache.woden.wsdl20.xml.NameAttributeTest;
 import org.apache.woden.wsdl20.xml.ServiceElementTest;
@@ -130,6 +136,12 @@
     addTest(InterfaceFaultElementTest.suite());
     addTest(InterfaceOperationElementTest.suite());
     addTest(InterfaceFaultReferenceElementTest.suite());
+    addTest(InterfaceMessageReferenceElementTest.suite());
+    addTest(InterfaceTest.suite());
+    addTest(InterfaceFaultTest.suite());
+    addTest(InterfaceOperationTest.suite());
+    addTest(InterfaceFaultReferenceTest.suite());
+    addTest(InterfaceMessageReferenceTest.suite());
     //TODO in-progress 30May06 tests for BindingOpExt and BindingMsgRefExt
   }
 

Added: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultReferenceTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultReferenceTest.java?view=auto&rev=500420
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultReferenceTest.java (added)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultReferenceTest.java Fri Jan 26 16:00:18 2007
@@ -0,0 +1,121 @@
+/**
+ * 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;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.woden.internal.wsdl20.InterfaceFaultReferenceImpl;
+import org.apache.woden.internal.wsdl20.InterfaceImpl;
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.enumeration.Direction;
+import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement;
+import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
+
+/**
+ * Unit tests for the InterfaceFaultReference class.
+ * 
+ * @author Graham Turrell (gturrell@apache.org)
+ */
+public class InterfaceFaultReferenceTest extends TestCase {
+
+	private InterfaceFaultReferenceElement fFaultReferenceElement = null;
+	private InterfaceFaultReference fFaultReferenceComp = null;
+
+	public static Test suite()
+	{
+	   return new TestSuite(InterfaceFaultReferenceTest.class);	   
+	}
+	   /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception 
+    {
+    	super.setUp();
+    	fFaultReferenceElement = new InterfaceFaultReferenceImpl();
+		fFaultReferenceElement.setDirection(Direction.OUT);
+		fFaultReferenceComp = (InterfaceFaultReference)fFaultReferenceElement;
+    }
+    
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception 
+    {
+        super.tearDown();
+    }
+	
+	/*
+	 * Test that a (mandatory) direction can be successfully set and retrieved
+	 */
+	public void testSetGetDirection()
+	{		
+		assertEquals("The retrieved FaultReference direction is not that which was set", 
+				Direction.OUT, fFaultReferenceComp.getDirection());
+	}
+
+	/*
+	 * Test that the (Mandatory) message label attribute ("messageLabel") can be successfully set and retrieved
+	 */
+	public void testGetMessageLabel()
+	{
+		NCName faultRefNCName = new NCName("faultRefName");
+		fFaultReferenceElement.setMessageLabel(faultRefNCName);
+		assertEquals("The retrieved Fault Reference name is not that which was set", 
+				faultRefNCName, fFaultReferenceComp.getMessageLabel());
+	}
+
+	/* 
+	 * Test that the (Mandatory) InterfaceFault can be successfully retrieved.
+	 * The fault reference is to an Interface Fault associated with the grandparent InterfaceElement.
+	 */
+	public void testGetInterfaceFault()
+	{
+		// Create the InterfaceElement->InterfaceOperationElement->InterfaceFaultReference hierarchy
+		InterfaceElement interfaceElement = new InterfaceImpl();
+		InterfaceOperationElement interfaceOperationElement = interfaceElement.addInterfaceOperationElement();
+
+		// Add an InterfaceFault to the InterfaceElement
+		InterfaceFaultElement faultElement = interfaceElement.addInterfaceFaultElement();
+		faultElement.setName(new NCName("Fault1"));
+		
+		// create the InterfaceFaultReference to test
+		InterfaceFaultReferenceElement faultReference = interfaceOperationElement.addInterfaceFaultReferenceElement();
+		faultReference.setRef(new QName("Fault1"));
+		
+		// An alternative here would be to create a Description element on with to hang the
+		// hierarchy, call toComponent() on this and extract the InterfaceFaultReference from this.
+		// However this inadvertently tests the Description class which is out of scope for this unit test.
+		InterfaceFault retrievedFault = ((InterfaceFaultReference)faultReference).getInterfaceFault();
+		
+		assertEquals("The retrieved InterfaceFault is not that which was set", 
+				(InterfaceFault)faultElement, retrievedFault);
+	}
+
+	/*
+     * toElement()
+     */
+	public void testToElement() 
+	{	
+		assertEquals(fFaultReferenceElement, fFaultReferenceComp.toElement());
+	}
+}

Added: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultTest.java?view=auto&rev=500420
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultTest.java (added)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultTest.java Fri Jan 26 16:00:18 2007
@@ -0,0 +1,119 @@
+/**
+ * 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;
+
+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.internal.wsdl20.ElementDeclarationImpl;
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultElement;
+
+/**
+ * Unit tests for the InterfaceFault class.
+ * 
+ * @author Graham Turrell (gturrell@apache.org)
+ */
+public class InterfaceFaultTest extends TestCase {
+
+	private InterfaceFaultElement fFaultElement = null;
+	private InterfaceFault fFault = null;
+	private DescriptionElement fDescriptionElement = null;
+	private Description fDescription = null;
+	private InterfaceElement fInterfaceElement = null;
+	private final String FAULT_NAME = "faultName";
+	private final String INTF_NAME = "interfaceName";
+
+	public static Test suite()
+	{
+	   return new TestSuite(InterfaceFaultTest.class);
+	}
+	
+	/*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception 
+    {
+        super.setUp();
+        fDescriptionElement = new DescriptionImpl();
+        fInterfaceElement = fDescriptionElement.addInterfaceElement();
+        fInterfaceElement.setName(new NCName(INTF_NAME));
+        fFaultElement = fInterfaceElement.addInterfaceFaultElement();
+        fFaultElement.setName(new NCName(FAULT_NAME));
+        fFaultElement.setElementName(new QName(FAULT_NAME));
+		fDescription = fDescriptionElement.toComponent();
+		Interface iface = fDescription.getInterface(new QName(INTF_NAME));
+		fFault = iface.getInterfaceFault(new QName(FAULT_NAME));
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception 
+    {
+        super.tearDown();
+    }
+	
+	/*
+	 * Test that an (optional) ElementDecalaration QName can be successfully retrieved
+	 */
+	public void testGetElementDeclaration()
+	{
+		assertNotNull(fFault);
+		
+		// Default case
+		assertNull("The retrieved Element Declaration when unset should be null", fFault.getElementDeclaration());
+		
+        // set and asscoiciate the Element Declaration
+		ElementDeclarationImpl ed = new ElementDeclarationImpl();
+        ed.setName(new QName(FAULT_NAME));
+        ((DescriptionImpl)fDescriptionElement).addElementDeclaration(ed);
+        fDescription = fDescriptionElement.toComponent();
+        fFault = fDescription.getInterface(new QName(INTF_NAME)).getInterfaceFault(new QName(FAULT_NAME));
+		assertEquals("The retrieved Element Declaration is not that which was set", 
+				ed, fFault.getElementDeclaration());
+	}
+
+	/*
+	 * Test that a (Mandatory) Name QName can be successfully retrieved
+	 */
+	public void testGetName()
+	{
+		QName faultName = new QName(FAULT_NAME);
+		NCName faultNCName = new NCName(FAULT_NAME);
+		fFaultElement.setName(faultNCName);
+		fDescription = fDescriptionElement.toComponent();
+		fFault = fDescription.getInterface(new QName(INTF_NAME)).getInterfaceFault(new QName(FAULT_NAME));
+		assertEquals("The retrieved Interface Fault name is not that which was set", 
+				faultName, fFault.getName());
+	}
+	
+	/*
+     * toElement()
+     */
+	public void testToElement() 
+	{	
+		assertEquals(fFaultElement, fFault.toElement());
+	}
+
+}

Added: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceMessageReferenceTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceMessageReferenceTest.java?view=auto&rev=500420
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceMessageReferenceTest.java (added)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceMessageReferenceTest.java Fri Jan 26 16:00:18 2007
@@ -0,0 +1,100 @@
+/**
+ * Copyright 2005 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;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.woden.internal.wsdl20.InterfaceMessageReferenceImpl;
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.enumeration.Direction;
+import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement;
+
+
+
+/**
+ * Unit tests for the InterfaceMessageReference class.
+ * 
+ * @author Graham Turrell (gturrell@apache.org)
+ */
+public class InterfaceMessageReferenceTest extends TestCase {
+
+	private InterfaceMessageReferenceElement fMessageReferenceElement = null;
+	private InterfaceMessageReference fMessageReferenceComp = null;
+	private final String CONTENT_MODEL = "contentModel";
+	
+	public static Test suite()
+	{
+	   return new TestSuite(InterfaceMessageReferenceTest.class);	   
+	}
+	   /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception 
+    {
+    	super.setUp();
+    	fMessageReferenceElement = new InterfaceMessageReferenceImpl();
+		fMessageReferenceElement.setDirection(Direction.OUT);
+		fMessageReferenceElement.setMessageContentModel(CONTENT_MODEL);
+    	fMessageReferenceComp = (InterfaceMessageReference) fMessageReferenceElement;  	
+    }
+    
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception 
+    {
+        super.tearDown();
+    }
+	
+	/*
+	 * Test that a (mandatory) direction can be successfully retrieved
+	 */
+	public void testGetDirection()
+	{
+		assertEquals("The retrieved FaultReference direction is not that which was set", 
+				Direction.OUT, fMessageReferenceElement.getDirection());
+	}
+
+	/*
+	 * Test that the (Mandatory) message label attribute ("messageLabel") can be successfully retrieved
+	 */
+	public void testGetMessageLabel()
+	{
+		NCName messageRefNCName = new NCName("messageRefName");
+		fMessageReferenceElement.setMessageLabel(messageRefNCName);
+		assertEquals("The retrieved Element name is not that which was set", 
+				messageRefNCName, fMessageReferenceComp.getMessageLabel());
+	}
+
+	/* 
+	 * Test that the (Mandatory) Message Content Model property can be successfully retrieved 
+	 */
+	public void testGetMessageContentModel()
+	{
+		assertEquals("The retrieved Message Content Model is not that which was set", 
+				CONTENT_MODEL, fMessageReferenceComp.getMessageContentModel());
+	}
+	
+	/*
+     * toElement() - get element decalaration
+     */
+	public void testToElement() 
+	{	
+		assertEquals(fMessageReferenceElement, fMessageReferenceComp.toElement());
+	}
+}

Added: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceOperationTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceOperationTest.java?view=auto&rev=500420
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceOperationTest.java (added)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceOperationTest.java Fri Jan 26 16:00:18 2007
@@ -0,0 +1,209 @@
+/**
+ * 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;
+
+import java.net.URI;
+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.internal.ErrorReporterImpl;
+import org.apache.woden.internal.wsdl20.DescriptionImpl;
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement;
+import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement;
+import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
+
+/**
+ * Unit tests for the InterfaceOperation class.
+ * 
+ * @author Graham Turrell (gturrell@apache.org)
+ */
+public class InterfaceOperationTest extends TestCase {
+
+	// create a parent Description to hang the Interfaces off
+	private DescriptionElement fDescriptionElement = null;
+	private Description fDescription = null;
+	private InterfaceElement fInterfaceElement = null;
+	private InterfaceOperationElement fInterfaceOperationElement = null;
+	private InterfaceOperation fInterfaceOperation = null;
+	private final String INTF_NAME = "interfaceOperationName";
+	private final String INTOP_NAME = "faultName";
+	private URI fPattern = null;
+	private URI fStyleURI1 = null;
+	private URI fStyleURI2 = null;
+
+	public static Test suite()
+	{
+	   return new TestSuite(InterfaceOperationTest.class);
+	}
+	   
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception 
+    {
+        super.setUp();
+        fDescriptionElement = new DescriptionImpl();
+        fInterfaceElement = fDescriptionElement.addInterfaceElement();
+        fInterfaceElement.setName(new NCName(INTF_NAME));
+        fInterfaceOperationElement = fInterfaceElement.addInterfaceOperationElement();
+        fInterfaceOperationElement.setName(new NCName(INTOP_NAME));
+
+        fPattern = new URI("http://www.w3.org/0000/00/wsdl/in-out");       
+        fInterfaceOperationElement.setPattern(fPattern);
+        
+        // TODO - should this stanza be strictly necessary for DescriptionElement.toComponent() not to NPE?
+        ExtensionRegistry er = new ExtensionRegistry();
+        er.setErrorReporter(new ErrorReporterImpl());
+        fDescriptionElement.setExtensionRegistry(er);
+		
+        fDescription = fDescriptionElement.toComponent();
+
+		Interface iface = fDescription.getInterface(new QName(INTF_NAME));
+		fInterfaceOperation = iface.getInterfaceOperation(new QName(INTOP_NAME));
+		
+        fStyleURI1 = new URI("http://www.w3.org/0000/00/apacheStyle");
+        fStyleURI2 = new URI("http://www.w3.org/0000/00/anotherApacheStyle");      
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception 
+    {
+        super.tearDown();
+    }
+	
+    /*
+     * Mandatory attribute ("name")
+     * - getName() 
+     */
+	public void testGetName() 
+	{	
+		QName retrievedName = fInterfaceOperation.getName();
+		assertEquals("Retrieved InterfaceOperation name does not match that set -", INTOP_NAME, retrievedName.toString());
+	}
+
+	/*
+     * Mandatory attribute ("pattern") (message exchange pattern)
+     * - getMessageExchangePattern() 
+     */
+	public void testGetMessageExchangePattern() 
+	{	
+		URI uri = fInterfaceOperation.getMessageExchangePattern();
+		assertEquals("Retrieved InterfaceOperation mep does not match that set -", fPattern, uri);
+	}
+	
+	/*
+     * Optional attribute ("style")
+     * style comprises a list of URIs
+     * - getStyle() returns the list
+     */
+	public void testGetStyle() 
+	{		
+		// check the default:
+		URI[] style = fInterfaceOperation.getStyle();
+		assertNotNull(style);
+		assertEquals("Retrieved InterfaceOperation style should be empty if none set -", 0, style.length);
+		
+		// add some uri's a couple of times
+		fInterfaceOperationElement.addStyleURI(fStyleURI1);
+		fInterfaceOperationElement.addStyleURI(fStyleURI2);
+		fDescription = fDescriptionElement.toComponent();
+		
+		// getStyle()
+		style = fInterfaceOperation.getStyle();
+		assertNotNull(style);
+		assertEquals("Unexpected number of URIs in the style -", 2, style.length);
+		// check that all added URIs appear in the style
+		List sdL = Arrays.asList(style);
+		assertTrue(sdL.contains(fStyleURI1));
+		assertTrue(sdL.contains(fStyleURI2));
+	}   
+	
+	/* 
+     * References to Optional child elements "infault" and "outfault"
+     * - getInterfaceFaultReferences()
+     */
+	public void testGetInterfaceFaultReferences() 
+	{	
+		// check the default:
+		InterfaceFaultReference[] ifrArray = fInterfaceOperation.getInterfaceFaultReferences();
+		assertNotNull("Expected an array of InterfaceFaultReference.", ifrArray);
+		assertEquals("Retrieved InterfaceFaultReferenceElement group should be empty if none set -", 0, ifrArray.length);
+
+		// create some InterfaceFaultReferenceElements
+		InterfaceFaultReferenceElement ifr1 = fInterfaceOperationElement.addInterfaceFaultReferenceElement();
+		InterfaceFaultReferenceElement ifr2 = fInterfaceOperationElement.addInterfaceFaultReferenceElement();
+		fDescription = fDescriptionElement.toComponent();
+		
+		// getInterfaceFaultReferenceElements()
+		ifrArray = fInterfaceOperation.getInterfaceFaultReferences();
+		assertNotNull("Expected an array of InterfaceFaultReference.", ifrArray);
+		assertEquals("Retrieved InterfaceFaultReference group should be same number as those set -", 2, ifrArray.length);
+		
+		// verify all fault references returned
+		List ifreL = Arrays.asList(ifrArray);
+		assertTrue(ifreL.contains(ifr1));
+		assertTrue(ifreL.contains(ifr2));
+	}
+	
+	/* 
+     * References to (Optional) child elements "input" and "output"
+     * - getInterfaceMessageReferences()
+     */
+	public void testGetInterfaceMessageReferences() 
+	{
+		// check the default:
+		InterfaceMessageReference[] imrArray = fInterfaceOperation.getInterfaceMessageReferences();
+		assertNotNull("Expected an array of InterfaceMessageReference.", imrArray);
+		assertEquals("Retrieved InterfaceFaultReference group should be empty if none set -", 0, imrArray.length);
+
+		// create some InterfaceMessageReferenceElements
+		InterfaceMessageReferenceElement imre1 = fInterfaceOperationElement.addInterfaceMessageReferenceElement();
+		InterfaceMessageReferenceElement imre2 = fInterfaceOperationElement.addInterfaceMessageReferenceElement();
+		fDescription = fDescriptionElement.toComponent();
+		
+		// getInterfaceMessageReferences()
+		imrArray = fInterfaceOperation.getInterfaceMessageReferences();
+		assertNotNull("Expected an array of InterfaceMessageReference.", imrArray);
+		assertEquals("Retrieved InterfaceMessageReference group should be same number as those set -", 2, imrArray.length);
+		
+		// verify all fault references returned
+		List imreL = Arrays.asList(imrArray);
+		assertTrue(imreL.contains(imre1));
+		assertTrue(imreL.contains(imre2));
+	}
+	
+	/*
+     * toElement()
+     */
+	public void testToElement() 
+	{	
+		assertEquals(fInterfaceOperationElement, fInterfaceOperation.toElement());
+	}
+
+}

Added: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceTest.java?view=auto&rev=500420
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceTest.java (added)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceTest.java Fri Jan 26 16:00:18 2007
@@ -0,0 +1,222 @@
+/**
+ * Copyright 2005 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;
+
+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.internal.wsdl20.DescriptionImpl;
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultElement;
+import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
+
+/**
+ * Unit tests for the Interface class.
+ * 
+ * @author Graham Turrell (gturrell@apache.org)
+ */
+public class InterfaceTest extends TestCase {
+
+	// create a parent Description to hang the Interfaces off
+	private DescriptionElement fDescriptionElement = null;
+	private Description fDescription = null;
+	private InterfaceElement fInterfaceElement = null;
+	private Interface fInterface = null;
+	private final String INTF_NAME = "interfaceName";
+	
+	public static Test suite()
+	{
+	   return new TestSuite(InterfaceTest.class);
+	}
+	   
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception 
+    {
+        super.setUp();
+        fDescriptionElement = new DescriptionImpl();
+        fInterfaceElement = fDescriptionElement.addInterfaceElement();
+		fInterfaceElement.setName(new NCName(INTF_NAME));
+		fDescription = fDescriptionElement.toComponent();
+		fInterface = fDescription.getInterface(new QName(INTF_NAME));
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception 
+    {
+        super.tearDown();
+    }
+	
+    /*
+     * Mandatory attribute ("name")
+     * - getName() 
+     */
+	public void testGetName() 
+	{	
+		QName uri = fInterface.getName();
+		assertEquals("Retrieved InterfaceElement name does not match that set -", INTF_NAME, uri.toString());
+	}
+	
+	/*
+	 * Gets Interfaces referenced by the "extends" attribute (optional)
+	 */
+	public void testGetExtendedInterfaceInterfaces() 
+	{
+		/*
+		 * create some InterfaceElements to extend, add them to parent,
+		 * access them via :
+		 * - getExtendedInterface()
+		 * - getExtendedInterfaces()
+		 */
+		
+		// check the default:
+		Interface[] ifArray = fInterface.getExtendedInterfaces();
+		assertEquals("Retrieved Extended Interface group should be empty if none set -", 0, ifArray.length);
+			
+		// create further InterfaceElements and name them
+		InterfaceElement xife1 = fDescriptionElement.addInterfaceElement();
+		InterfaceElement xife2 = fDescriptionElement.addInterfaceElement();
+		xife1.setName(new NCName("extendedI1"));
+		xife2.setName(new NCName("extendedI2"));
+		fInterfaceElement.addExtendedInterfaceName(new QName("extendedI1"));
+		fInterfaceElement.addExtendedInterfaceName(new QName("extendedI2"));
+		
+		fInterfaceElement.setParentElement(fDescriptionElement);
+		xife1.setParentElement(fDescriptionElement);
+		xife2.setParentElement(fDescriptionElement);
+		
+		// getExtendedInterfaces()
+		fDescription = fDescriptionElement.toComponent();
+		fInterface = fDescription.getInterface(new QName(INTF_NAME));
+		ifArray = fInterface.getExtendedInterfaces();
+		assertEquals("Incorrect number of retrieved Extended Interfaces -", 2, ifArray.length);
+		// verify object equivalence
+		List ifL = Arrays.asList(ifArray);
+		assertTrue(ifL.contains(xife1));
+		assertTrue(ifL.contains(xife2));
+		
+		// getExtendedInterface()
+		fDescription = fDescriptionElement.toComponent();
+		fInterface = fDescription.getInterface(new QName(INTF_NAME));
+		Interface retrievedIf = fInterface.getExtendedInterface(new QName("extendedI1"));
+		assertEquals("Retrieved Extended Interface unexpected -", (Interface)xife1, retrievedIf);
+		retrievedIf = fInterface.getExtendedInterface(new QName("randomUnset"));
+		assertNull("The name of a non-existent Interface should not return one -", retrievedIf);
+	}
+	
+	/*
+     * Optional element ("fault")
+     * - getInterfaceFault() 
+     * - getInterfaceFaults() 
+     */
+	public void testGetInterfaceFaultFaults() 
+	{		
+		// check the default:
+		InterfaceFault[] iffArray = fInterface.getInterfaceFaults();
+		assertNotNull("Expected an array of InterfaceFaults -", iffArray);
+		assertEquals("Retrieved InterfaceFault group should be empty if none set -", 0, iffArray.length);
+
+		// create some InterfaceFaults
+		InterfaceFaultElement iffe1 = fInterfaceElement.addInterfaceFaultElement();
+		InterfaceFaultElement iffe2 = fInterfaceElement.addInterfaceFaultElement();
+
+		// getInterfaceFaults()
+		fDescription = fDescriptionElement.toComponent();
+		fInterface = fDescription.getInterface(new QName(INTF_NAME));
+		iffArray = fInterface.getInterfaceFaults();
+		assertNotNull("Expected an array of InterfaceFaults -", iffArray);
+		assertEquals("Incorrect number of retrieved InterfaceFaults -", 2, iffArray.length);
+
+		// verify all Fault objects returned
+		List iffeL = Arrays.asList(iffArray);
+		assertTrue(iffeL.contains(iffe1));
+		assertTrue(iffeL.contains(iffe2));
+	
+		// getInterfaceFault()
+		// name one of them
+		iffe1.setName(new NCName("FaultName"));
+		fDescription = fDescriptionElement.toComponent();
+		fInterface = fDescription.getInterface(new QName(INTF_NAME));
+		InterfaceFault retrievedIff = fInterface.getInterfaceFault(new QName("FaultName"));
+		assertNotNull(retrievedIff);
+		assertEquals("Retrieved InterfaceFault differs from that expected", (InterfaceFault)iffe1, retrievedIff);
+		// try a non-existent fault - should return null
+		retrievedIff = fInterface.getInterfaceFault(new QName("nonExistentFault"));
+		assertNull(retrievedIff);
+	}    
+    
+	/*
+     * Optional element ("operation")
+     * - getInterfaceOperation() 
+     * - getInterfaceOperations() 
+     */
+	public void testGetInterfaceOperationOperations() 
+	{		
+		// check the default:
+		InterfaceOperation[] ifopArray = fInterface.getInterfaceOperations();
+		assertNotNull("Expected an array of InterfaceOperations -", ifopArray);
+		assertEquals("Retrieved InterfaceOperation group should be empty if none set -", 0, ifopArray.length);
+
+		// create some InterfaceOperationElement() to test
+		InterfaceOperationElement ifop1 = fInterfaceElement.addInterfaceOperationElement();
+		InterfaceOperationElement ifop2 = fInterfaceElement.addInterfaceOperationElement();
+
+		// getInterfaceOperations()
+		fDescription = fDescriptionElement.toComponent();
+		fInterface = fDescription.getInterface(new QName(INTF_NAME));
+
+		ifopArray = fInterface.getInterfaceOperations();
+		assertNotNull("Expected an array of InterfaceOperationElements -", ifopArray);
+		assertEquals("Incorrect number of retrieved InterfaceOperationElements -", 2, ifopArray.length);
+
+		// verify all Operation objects returned
+		List ifopL = Arrays.asList(ifopArray);
+		assertTrue(ifopL.contains(ifop1));
+		assertTrue(ifopL.contains(ifop2));
+	
+		// getInterfaceOperation()
+		// name one of them
+		ifop1.setName(new NCName("OperationName"));
+		fDescription = fDescriptionElement.toComponent();
+		fInterface = fDescription.getInterface(new QName(INTF_NAME));
+		InterfaceOperation retrievedIfop = fInterface.getInterfaceOperation(new QName("OperationName"));
+		assertNotNull(retrievedIfop);
+		assertEquals("Retrieved InterfaceOperationElement differs from that expected", ifop1, retrievedIfop);
+		// try a non-existent operation - should return null
+		retrievedIfop = fInterface.getInterfaceOperation(new QName("nonExistentOperation"));
+		assertNull(retrievedIfop);
+	}   
+	
+	/*
+     * toElement()
+     */
+	public void testToElement() 
+	{	
+		assertEquals(fInterfaceElement, fInterface.toElement());
+	}
+
+}

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceElementTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceElementTest.java?view=diff&rev=500420&r1=500419&r2=500420
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceElementTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceElementTest.java Fri Jan 26 16:00:18 2007
@@ -73,8 +73,8 @@
      * - setName() 
      * - getName() 
      */
-	public void testGetSetName() {
-		
+	public void testGetSetName() 
+	{	
 		fInterfaceElement.setName(new NCName("interfaceName"));
 		QName uri = fInterfaceElement.getName();
 		assertEquals("Retrieved InterfaceElement name does not match that set -", "interfaceName", uri.toString());
@@ -83,23 +83,19 @@
 	/*
 	 * Gets InterfaceElements referenced by the "extends" attribute (optional)
 	 */
-	public void testGetExtendedInterfaceElementElements() {
+	public void testGetExtendedInterfaceElementElements() 
+	{
 		/*
 		 * create some InterfaceElements to extend, add them to parent,
 		 * access them via :
 		 * - getExtendedInterfaceElement()
 		 * - getExtendedInterfaceElements()
-		 * 
-		 * TODO - this test closely linked to 
-		 * testAddGetRemoveExtendedInterfaceNames()
 		 */
 		
 		// check the default:
 		InterfaceElement[] ifeArray = fInterfaceElement.getExtendedInterfaceElements();
 		assertEquals("Retrieved Extended InterfaceElement group should be empty if none set -", 0, ifeArray.length);
-		
-
-		
+	
 		// create further InterfaceElements and name them
 		InterfaceElement xife1 = fDescriptionElement.addInterfaceElement();
 		InterfaceElement xife2 = fDescriptionElement.addInterfaceElement();
@@ -133,8 +129,8 @@
      * - getExtendedInterfaceNames()
      * - removeExtendedInterfaceName() 
      */
-	public void testAddGetRemoveExtendedInterfaceNames() {
-		
+	public void testAddGetRemoveExtendedInterfaceNames() 
+	{	
 		// check the default:
 		QName[] ifeQnameArray = fInterfaceElement.getExtendedInterfaceNames();
 		assertEquals("Retrieved Extended InterfaceElement QName group should be empty if none set -", 0, ifeQnameArray.length);
@@ -189,7 +185,8 @@
      * - getStyleDefault() returns the list
      * - addStyleDefaultURI() adds to the list
      */
-	public void testAddGetStyleDefault() {		
+	public void testAddGetStyleDefault() 
+	{		
 		// check the default:
 		URI[] styleDefault = fInterfaceElement.getStyleDefault();
 		assertNotNull(styleDefault);
@@ -215,8 +212,8 @@
      * - getInterfaceFaultElement() 
      * - getInterfaceFaultElements() 
      */
-	public void testAddGetInterfaceFaultElements() {	
-		
+	public void testAddGetInterfaceFaultElements() 
+	{		
 		// check the default:
 		InterfaceFaultElement[] iffeArray = fInterfaceElement.getInterfaceFaultElements();
 		assertNotNull("Expected an array of InterfaceFaultElements -", iffeArray);
@@ -255,7 +252,8 @@
      * - getInterfaceOperationElement() 
      * - getInterfaceOperationElements() 
      */
-	public void testAddGetInterfaceOperationElements() {		
+	public void testAddGetInterfaceOperationElements() 
+	{		
 		// check the default:
 		InterfaceOperationElement[] ifopArray = fInterfaceElement.getInterfaceOperationElements();
 		assertNotNull("Expected an array of InterfaceOperationElements -", ifopArray);
@@ -287,7 +285,4 @@
 		retrievedIfop = fInterfaceElement.getInterfaceOperationElement(new QName("nonExistentOperation"));
 		assertNull(retrievedIfop);
 	}   
-	
-	// TODO test equals()
-
 }

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceFaultReferenceElementTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceFaultReferenceElementTest.java?view=diff&rev=500420&r1=500419&r2=500420
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceFaultReferenceElementTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceFaultReferenceElementTest.java Fri Jan 26 16:00:18 2007
@@ -71,7 +71,6 @@
 				Direction.IN, fFaultReference.getDirection());
 	}
 
-
 	/*
 	 * Test that the (Mandatory) message label attribute ("messageLabel") can be successfully set and retrieved
 	 */
@@ -112,9 +111,7 @@
 		InterfaceFaultReferenceElement faultReference = interfaceOperationElement.addInterfaceFaultReferenceElement();
 		faultReference.setRef(new QName("Fault1"));
 		InterfaceFaultElement retrievedFault = faultReference.getInterfaceFaultElement();
-		assertEquals("The retrieved InterfaceFault is not that which was set", 
+		assertEquals("The retrieved InterfaceFaultElement is not that which was set", 
 				faultElement, retrievedFault);
 	}
-
-
 }

Added: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceMessageReferenceElementTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceMessageReferenceElementTest.java?view=auto&rev=500420
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceMessageReferenceElementTest.java (added)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceMessageReferenceElementTest.java Fri Jan 26 16:00:18 2007
@@ -0,0 +1,203 @@
+/**
+ * Copyright 2005 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 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.ErrorReporterImpl;
+import org.apache.woden.internal.schema.ImportedSchemaImpl;
+import org.apache.woden.internal.wsdl20.Constants;
+import org.apache.woden.internal.wsdl20.DescriptionImpl;
+import org.apache.woden.internal.wsdl20.ElementDeclarationImpl;
+import org.apache.woden.internal.wsdl20.InterfaceMessageReferenceImpl;
+import org.apache.woden.internal.wsdl20.extensions.InterfaceOperationExtensionsImpl;
+import org.apache.woden.schema.Schema;
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.ElementDeclaration;
+import org.apache.woden.wsdl20.InterfaceOperation;
+import org.apache.woden.wsdl20.enumeration.Direction;
+import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+
+
+
+/**
+ * Unit tests for the InterfaceMessageReferenceElement class.
+ * 
+ * @author Graham Turrell (gturrell@apache.org)
+ */
+public class InterfaceMessageReferenceElementTest extends TestCase {
+
+	private InterfaceMessageReferenceElement fMessageReference = null;
+	ExtensionRegistry fExtensionRegistry = null;
+	private URI fNamespace = null;
+
+	public static Test suite()
+	{
+	   return new TestSuite(InterfaceMessageReferenceElementTest.class);
+	   
+	}
+	   /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception 
+    {
+    	super.setUp();
+    	fMessageReference = new InterfaceMessageReferenceImpl();
+    	fNamespace = new URI("http://apache.org/testns");
+    	fExtensionRegistry = new ExtensionRegistry();
+        fExtensionRegistry.setErrorReporter(new ErrorReporterImpl());  	
+    }
+    
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception 
+    {
+        super.tearDown();
+    }
+	
+	/*
+	 * Test that a (mandatory) direction can be successfully set and retrieved
+	 */
+	public void testSetGetDirection()
+	{
+		// Default case
+		assertNull("The retrieved Element name when unset should be null", fMessageReference.getDirection());
+		
+		fMessageReference.setDirection(Direction.OUT);
+		assertEquals("The retrieved FaultReference direction is not that which was set", 
+				Direction.OUT, fMessageReference.getDirection());
+	}
+
+	/*
+	 * Test that the (Mandatory) message label attribute ("messageLabel") can be successfully set and retrieved
+	 */
+	public void testSetGetMessageLabel()
+	{
+		NCName messageRefNCName = new NCName("messageRefName");
+		fMessageReference.setMessageLabel(messageRefNCName);
+		assertEquals("The retrieved Element name is not that which was set", 
+				messageRefNCName, fMessageReference.getMessageLabel());
+	}
+
+	/* 
+	 * Test that the (Mandatory) Message Content Model property can be successfully set and retrieved 
+	 */
+	public void testSetGetMessageContentModel()
+	{
+		fMessageReference.setMessageContentModel("contentModel");
+		assertEquals("The retrieved Message Content Model is not that which was set", 
+				"contentModel", fMessageReference.getMessageContentModel());
+	}
+	
+
+	/*
+	 * Test that the (Mandatory) Element Name attribute ("element") can be successfully set and retrieved
+	 */
+	public void testSetGetElementName()
+	{
+		QName elementName = new QName("ElementName");
+		fMessageReference.setElementName(elementName);
+		assertEquals("The retrieved Element Name attribute is not that which was set", 
+				elementName, fMessageReference.getElementName());
+	}
+	
+	/* 
+	 * Test that the (Optional) Element Declaration property can be successfully retrieved.
+	 * The element reference is to an Element Declaration associated with a TypeDef below the ancestor Description,
+	 * of the name set in setElementName().
+	 * 
+	 * TODO Need to check model structure for XmlSchema
+	 */
+
+	public void testGetElement()
+	{
+		// Create the DescriptionElement->InterfaceElement->InterfaceOperationElement->InterfaceMessageReferenceElement hierarchy
+		DescriptionElement descriptionElement = new DescriptionImpl();
+		InterfaceElement interfaceElement = descriptionElement.addInterfaceElement();
+		InterfaceOperationElement interfaceOperationElement = interfaceElement.addInterfaceOperationElement();
+		
+		// TODO - should this be strictly necessary for DescriptionElement.toComponent() not to NPE?
+        descriptionElement.setExtensionRegistry(fExtensionRegistry);
+		
+		// create the InterfaceMessageReferenceElement to test
+		InterfaceMessageReferenceElement messageReference = interfaceOperationElement.addInterfaceMessageReferenceElement();
+		
+		// Default case:
+		XmlSchemaElement retrievedElement = messageReference.getElement();
+		assertNull("Unset Element Declaration should return null", retrievedElement);
+
+		// populated case 1 - (with Message Content Model set to #ANY or #NONE).
+		ElementDeclaration ed = new ElementDeclarationImpl();
+		((DescriptionImpl)descriptionElement).addElementDeclaration(ed);		
+		messageReference.setMessageContentModel(Constants.NMTOKEN_NONE);
+
+		descriptionElement.toComponent(); 
+
+		retrievedElement = messageReference.getElement();
+		assertNull("The retrieved Element Declation should return null when message content model is #NONE", 
+				retrievedElement);
+		
+		messageReference.setMessageContentModel(Constants.NMTOKEN_ANY);		
+		descriptionElement.toComponent(); 
+		retrievedElement = messageReference.getElement();
+		assertNull("The retrieved Element Declaration should return null when message content model is #ANY", 
+				retrievedElement);
+		
+		/* TODO following populated case (with Message Content Model set) requires XmlSchema "element" field to be set.
+		 * (probably via org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement())
+		 */
+/*      
+		// populated case 2 - success:
+				
+		// Add a TypesElement to the Description
+		TypesElement typesElement = descriptionElement.getTypesElement();
+		
+		// Add a namespace-identified schema element declaration to the Types element
+		XmlSchemaCollection xsc = new XmlSchemaCollection();
+		XmlSchema xmlSchema = new XmlSchema("ElementName", xsc);
+		Schema schema = new ImportedSchemaImpl(); // arbitrary schema
+		schema.setNamespace(fNamespace);
+		schema.setSchemaDefinition(xmlSchema);
+		typesElement.addSchema(schema);
+				        
+        fExtensionRegistry.registerComponentExtension(InterfaceOperation.class, 
+        		InterfaceOperationExtensionsImpl.URI_NS_EXTENSIONS, InterfaceOperationExtensionsImpl.class);
+    
+	    descriptionElement.setExtensionRegistry(fExtensionRegistry);
+		
+		// set the element name reference
+	    QName elementName = new QName("http://apache.org/testns", "ElementName");
+		messageReference.setElementName(elementName);
+		messageReference.setMessageContentModel(Constants.NMTOKEN_ELEMENT);
+		
+		//descriptionElement.toComponent(); // quick test of model integrity for testing purposes
+		
+		retrievedElement = messageReference.getElement();
+		assertEquals("The retrieved Element is not that which was set", 
+				schema, retrievedElement);
+*/
+	}
+}

Modified: incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceOperationElementTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceOperationElementTest.java?view=diff&rev=500420&r1=500419&r2=500420
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceOperationElementTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceOperationElementTest.java Fri Jan 26 16:00:18 2007
@@ -34,6 +34,7 @@
  * 
  * @author Graham Turrell (gturrell@apache.org)
  */
+
 public class InterfaceOperationElementTest extends TestCase {
 
 	// create a parent Description to hang the Interfaces off
@@ -76,8 +77,8 @@
      * - setName() 
      * - getName() 
      */
-	public void testGetSetName() {
-		
+	public void testGetSetName() 
+	{	
 		fInterfaceOperationElement.setName(new NCName("interfaceOperationName"));
 		QName retrievedName = fInterfaceOperationElement.getName();
 		assertEquals("Retrieved InterfaceOperationElement name does not match that set -", "interfaceOperationName", retrievedName.toString());
@@ -88,8 +89,8 @@
      * - setPattern() 
      * - getPattern() 
      */
-	public void testGetSetPattern() {
-		
+	public void testGetSetPattern() 
+	{	
 		fInterfaceOperationElement.setPattern(fPattern);
 		URI uri = fInterfaceOperationElement.getPattern();
 		assertEquals("Retrieved InterfaceOperationElement mep does not match that set -", fPattern, uri);
@@ -102,7 +103,8 @@
      * - addStyleURI() adds to the list
      * - removeStyleURI() removes from the list
      */
-	public void testAddGetRemoveStyle() {		
+	public void testAddGetRemoveStyle() 
+	{		
 		// check the default:
 		URI[] style = fInterfaceOperationElement.getStyle();
 		assertNotNull(style);
@@ -129,14 +131,14 @@
 		assertEquals("Unexpected number of URIs in the style -", 0, style.length);
 	}   
 	
-	/* TODO
+	/* 
      * References to Optional child elements "infault" and "outfault"
      * - addInterfaceFaultReferenceElement() 
      * - getInterfaceFaultReferenceElements()
      * - removeInterfaceFaultReferenceElement() 
      */
-	public void testAddGetRemoveInterfaceFaultReferenceElements() {
-		
+	public void testAddGetRemoveInterfaceFaultReferenceElements() 
+	{	
 		// check the default:
 		InterfaceFaultReferenceElement[] ifreArray = fInterfaceOperationElement.getInterfaceFaultReferenceElements();
 		assertNotNull("Expected an array of InterfaceFaultReferenceElement.", ifreArray);
@@ -178,14 +180,14 @@
 		assertEquals("Retrieved InterfaceFaultReferenceElement group should be empty if all removed -", 0, ifreArray.length);
 	}
 	
-	/* TODO
+	/* 
      * References to Optional child elements "input" and "output"
      * - addInterfaceMessageReferenceElement() 
      * - getInterfaceMessageReferenceElements()
      * - removeInterfaceMessageReferenceElement() 
      */
-	public void testAddGetRemoveInterfaceMessageReferenceElements() {
-		// base on testAddGetRemoveInterfaceFaultReferenceElements
+	public void testAddGetRemoveInterfaceMessageReferenceElements() 
+	{
 		// check the default:
 		InterfaceMessageReferenceElement[] imreArray = fInterfaceOperationElement.getInterfaceMessageReferenceElements();
 		assertNotNull("Expected an array of InterfaceMessageReferenceElement.", imreArray);



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