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/01/29 03:40:34 UTC
svn commit: r500924 -
/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceTest.java
Author: jkaputin
Date: Sun Jan 28 18:40:34 2007
New Revision: 500924
URL: http://svn.apache.org/viewvc?view=rev&rev=500924
Log:
WODEN-87 unit tests for new Interface methods
that flatten interface inheritance.
Modified:
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceTest.java
Modified: 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=diff&rev=500924&r1=500923&r2=500924
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceTest.java Sun Jan 28 18:40:34 2007
@@ -24,7 +24,7 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.woden.internal.wsdl20.DescriptionImpl;
+import org.apache.woden.WSDLFactory;
import org.apache.woden.types.NCName;
import org.apache.woden.wsdl20.xml.DescriptionElement;
import org.apache.woden.wsdl20.xml.InterfaceElement;
@@ -56,7 +56,8 @@
protected void setUp() throws Exception
{
super.setUp();
- fDescriptionElement = new DescriptionImpl();
+ //fDescriptionElement = new DescriptionImpl();
+ fDescriptionElement = WSDLFactory.newInstance().newDescription();
fInterfaceElement = fDescriptionElement.addInterfaceElement();
fInterfaceElement.setName(new NCName(INTF_NAME));
fDescription = fDescriptionElement.toComponent();
@@ -211,6 +212,101 @@
assertNull(retrievedIfop);
}
+ /*
+ * Gets Interface Faults declared and inherited.
+ */
+ public void testGetAllInterfaceFaults()
+ {
+ /*
+ * create some InterfaceElements to extend, add them to parent,
+ * add some named faults and access them via:
+ * - getAllInterfaceFaults()
+ * - getFromAllInterfaceFaults(QName)
+ */
+
+ // create InterfaceElements and name them
+ InterfaceElement ife = fDescriptionElement.addInterfaceElement();
+ InterfaceElement xife1 = fDescriptionElement.addInterfaceElement();
+ InterfaceElement xife2 = fDescriptionElement.addInterfaceElement();
+ ife.setName(new NCName("Interface"));
+ xife1.setName(new NCName("extendedI1"));
+ xife2.setName(new NCName("extendedI2"));
+ ife.addExtendedInterfaceName(new QName("extendedI1"));
+ ife.addExtendedInterfaceName(new QName("extendedI2"));
+
+ InterfaceFaultElement fault = ife.addInterfaceFaultElement();
+ InterfaceFaultElement fault1 = xife1.addInterfaceFaultElement();
+ InterfaceFaultElement fault2 = xife2.addInterfaceFaultElement();
+ InterfaceFaultElement fault3 = xife2.addInterfaceFaultElement();
+
+ fault.setName(new NCName("fault"));
+ fault1.setName(new NCName("fault1"));
+ fault2.setName(new NCName("fault2"));
+ fault3.setName(new NCName("fault3"));
+
+
+ fDescription = fDescriptionElement.toComponent();
+ Interface intface = fDescription.getInterface(new QName("Interface"));
+
+ //test getAllInterfaceFaults()
+ InterfaceFault[] allFaults = intface.getAllInterfaceFaults();
+ assertEquals("Incorrect number of interface faults", 4, allFaults.length);
+
+ //test getFromAllInterfaceFaults(QName)
+ InterfaceFault intFault1 = intface.getFromAllInterfaceFaults(new QName("fault1"));
+ assertEquals(fault1, intFault1);
+
+ InterfaceFault intFault3 = intface.getFromAllInterfaceFaults(new QName("fault3"));
+ assertEquals(fault3, intFault3);
+ }
+
+ /*
+ * Gets Interface Operations declared and inherited.
+ */
+ public void testGetAllInterfaceOperations()
+ {
+ /*
+ * create some InterfaceElements to extend, add them to parent,
+ * add some named operations and access them via:
+ * - getAllInterfaceOperations()
+ * - getFromAllInterfaceOperations(QName)
+ */
+
+ // create InterfaceElements and name them
+ InterfaceElement ife = fDescriptionElement.addInterfaceElement();
+ InterfaceElement xife1 = fDescriptionElement.addInterfaceElement();
+ InterfaceElement xife2 = fDescriptionElement.addInterfaceElement();
+ ife.setName(new NCName("Interface"));
+ xife1.setName(new NCName("extendedI1"));
+ xife2.setName(new NCName("extendedI2"));
+ ife.addExtendedInterfaceName(new QName("extendedI1"));
+ ife.addExtendedInterfaceName(new QName("extendedI2"));
+
+ InterfaceOperationElement oper = ife.addInterfaceOperationElement();
+ InterfaceOperationElement oper1 = xife1.addInterfaceOperationElement();
+ InterfaceOperationElement oper2 = xife1.addInterfaceOperationElement();
+ InterfaceOperationElement oper3 = xife2.addInterfaceOperationElement();
+
+ oper.setName(new NCName("oper"));
+ oper1.setName(new NCName("oper1"));
+ oper2.setName(new NCName("oper2"));
+ oper3.setName(new NCName("oper3"));
+
+ fDescription = fDescriptionElement.toComponent();
+ Interface intface = fDescription.getInterface(new QName("Interface"));
+
+ //test getAllInterfaceOperations()
+ InterfaceOperation[] allOperations = intface.getAllInterfaceOperations();
+ assertEquals("Incorrect number of interface operations", 4, allOperations.length);
+
+ //test getFromAllInterfaceOperations(QName)
+ InterfaceOperation intOper2 = intface.getFromAllInterfaceOperations(new QName("oper2"));
+ assertEquals(oper2, intOper2);
+
+ InterfaceOperation intOper3 = intface.getFromAllInterfaceOperations(new QName("oper3"));
+ assertEquals(oper3, intOper3);
+ }
+
/*
* toElement()
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org