Author: gturrell
Date: Mon Jan  8 15:46:34 2007
New Revision: 494262

URL: http://svn.apache.org/viewvc?view=rev&rev=494262
Log:
[WODEN-49] Unit tests  for ImportElement and IncludeElement. Run as part of the 
Woden DOM suites only (for now at least)

Added:
    
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ImportElementTest.java
    
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/IncludeElementTest.java
Modified:
    incubator/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.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=494262&r1=494261&r2=494262
==============================================================================
--- 
incubator/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java 
(original)
+++ 
incubator/woden/trunk/java/test/org/apache/woden/tests/AllWodenTestsDOM.java 
Mon Jan  8 15:46:34 2007
@@ -39,6 +39,8 @@
 import 
org.apache.woden.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensionsTest;
 import 
org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensionsTest;
 import org.apache.woden.wsdl20.xml.EndpointElementTest;
+import org.apache.woden.wsdl20.xml.ImportElementTest;
+import org.apache.woden.wsdl20.xml.IncludeElementTest;
 import org.apache.woden.wsdl20.xml.NameAttributeTest;
 import org.apache.woden.wsdl20.xml.ServiceElementTest;
 import org.apache.woden.xml.IntOrTokenAttrTest;
@@ -103,6 +105,8 @@
     addTest(HTTPLocationTest.suite());
     addTest(HTTPEndpointExtensionsTest.suite());
     addTest(SimpleURIResolverTest.suite());
+    addTest(ImportElementTest.suite());
+    addTest(IncludeElementTest.suite());
     //TODO in-progress 30May06 tests for BindingOpExt and BindingMsgRefExt
   }
 

Added: 
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?view=auto&rev=494262
==============================================================================
--- 
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ImportElementTest.java
 (added)
+++ 
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/ImportElementTest.java
 Mon Jan  8 15:46:34 2007
@@ -0,0 +1,106 @@
+/**
+ * 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 java.net.URISyntaxException;
+
+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.ImportImpl;
+
+/**
+ * Unit tests for the ImportElement class.
+ * 
+ * @author Graham Turrell ([EMAIL PROTECTED])
+ */
+public class ImportElementTest extends TestCase {
+
+       private ImportElement fImport = new ImportImpl();
+       private DescriptionElement fDescriptionElement = new DescriptionImpl();
+       private URI fURI = null;        
+       
+       public static Test suite()
+       {
+          return new TestSuite(ImportElementTest.class);
+       }
+          
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception 
+    {
+        super.setUp();
+    }
+
+    /*
+     * @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", 
+                               fImport.getDescriptionElement(), 
fDescriptionElement);
+       }
+
+       /**
+        * 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", fImport.getLocation(), fURI);
+       }
+       
+       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", fImport.getNamespace(), fURI);
+       }
+       
+       /**
+        * 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());
+       }
+       
+
+}

Added: 
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/IncludeElementTest.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/IncludeElementTest.java?view=auto&rev=494262
==============================================================================
--- 
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/IncludeElementTest.java
 (added)
+++ 
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/IncludeElementTest.java
 Mon Jan  8 15:46:34 2007
@@ -0,0 +1,69 @@
+/**
+ * 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 java.net.URISyntaxException;
+
+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.IncludeImpl;
+
+/**
+ * Unit tests for the IncludeElement class.
+ * 
+ * @author Graham Turrell ([EMAIL PROTECTED])
+ */
+public class IncludeElementTest extends TestCase {
+
+       private IncludeElement fInclude = new IncludeImpl();
+       private DescriptionElement fDescriptionElement = new DescriptionImpl();
+       private URI fURI = null;
+       
+       public static Test suite()
+       {
+          return new TestSuite(IncludeElementTest.class);
+       }
+       
+       /**
+        * Test that a Description Element can be successfully set and 
retrieved from an IncludeElement
+        */
+       public void testSetGetDescriptionElement()
+       {
+               fInclude.setDescriptionElement(fDescriptionElement);
+               assertEquals("The retrieved Description Element object is not 
that which was set", 
+                               fInclude.getDescriptionElement(), 
fDescriptionElement);
+       }
+
+       /**
+        * Test that a Location URI can be successfully set and retrieved from 
an IncludeElement
+        */
+       public void testSetGetLocation()
+       {
+               try 
+               {
+                       fURI = new URI("http://apache.org/test";);
+               } catch (URISyntaxException e) {
+                       
+               }
+               fInclude.setLocation(fURI);
+               assertEquals("The retrieved Location URI object is not that 
which was set", fInclude.getLocation(), fURI);
+       }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to