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 [2/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/WSDLReaderTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/WSDLReaderTest.java?rev=568937&r1=568936&r2=568937&view=diff
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/WSDLReaderTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/WSDLReaderTest.java Thu Aug 23 04:24:51 2007
@@ -1,158 +1,158 @@
-/**
+/**
  * 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;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.apache.woden.tests.TestErrorHandler;
-import org.apache.woden.wsdl20.Description;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-public class WSDLReaderTest extends TestCase 
-{
-  private WSDLFactory factory = null;
-  private WSDLReader reader = null;
-  private ErrorHandler handler = null;
-  
-  public static Test suite()
-  {
-	return new TestSuite(WSDLReaderTest.class);
-  }
-
-  protected void setUp() throws Exception 
-  {
-	handler = new TestErrorHandler();
-	try
-	{
-      factory = WSDLFactory.newInstance();
-      reader = factory.newWSDLReader();  
-    } 
-	catch (Exception e) 
-	{
-    }
-  }
-
-  protected void tearDown() throws Exception 
-  {
-	factory = null;
-	reader = null;
-	handler = null;
-  }
-  
-  public void testReadValidWSDL20()
-  {
-	  Description desc = null;
-	  try
-	  {
-        URL wsdlURL = getClass().getClassLoader().getResource("org/apache/woden/primer-hotelReservationService.wsdl");
-	    desc = reader.readWSDL(wsdlURL.toString(), handler);
-	  }
-	  catch(WSDLException e)
-	  {
-          fail("Unexpected exception: " + e.getMessage());
-	  }
-      assertNotNull("The description returned is null.", desc);
-  }
-  
-  public void testReadInvalidWSDL20()
-  {
-	  try
-	  {
-		URL wsdlURL = getClass().getClassLoader().getResource("org/apache/woden/badDescriptionTags.wsdl");
-		reader.readWSDL(wsdlURL.toString(), handler);
-        fail("Expected a WSDLException because the \"description\" tag was deliberately misspelt.");
-	  }
-	  catch(WSDLException e)
-	  {
-          assertTrue("Expected a WSDLException with message containing \"WSDL501\", but got: " + e.getMessage() ,
-             e.getMessage().indexOf("WSDL501") > -1);
-	  }
-  }
-  
-  public void testReadWSDLSourceDoc()
-  {
-      Description desc = null;
-      try
-      {
-        URL wsdlURL = getClass().getClassLoader().getResource("org/apache/woden/primer-hotelReservationService.wsdl");
-        String wsdlURLStr = wsdlURL.toString();
-        URI wsdlURI = URI.create(wsdlURLStr);
-        
-        Document doc = null;
-        try {
-            DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
-            dbFactory.setNamespaceAware(true);
-            DocumentBuilder builder = dbFactory.newDocumentBuilder();
-            doc = builder.parse(new InputSource(wsdlURLStr));
-        } catch (FactoryConfigurationError e1) {
-            fail("Unexpected exception: " + e1.getMessage());
-        } catch (ParserConfigurationException e1) {
-            fail("Unexpected exception: " + e1.getMessage());
-        } catch (SAXException e1) {
-           fail("Unexpected exception: " + e1.getMessage());
-        } catch (IOException e1) {
-            fail("Unexpected exception: " + e1.getMessage());
-        }
-        
-        WSDLSource wsdlSource = reader.createWSDLSource();
-        wsdlSource.setBaseURI(wsdlURI);
-        wsdlSource.setSource(doc);
-        desc = reader.readWSDL(wsdlSource, handler);
-      }
-      catch(WSDLException e)
-      {
-          fail("Unexpected exception: " + e.getMessage());
-      }
-      assertNotNull("The description returned is null.", desc);
-  }
-
-  public void testReadWSDLSourceIS()
-  {
-      Description desc = null;
-      try
-      {
-        URL wsdlURL = getClass().getClassLoader().getResource("org/apache/woden/primer-hotelReservationService.wsdl");
-        String wsdlURLStr = wsdlURL.toString();
-        
-        InputSource is = new InputSource(wsdlURLStr);
-        URI wsdlURI = URI.create(wsdlURLStr);
-        
-        WSDLSource wsdlSource = reader.createWSDLSource();
-        wsdlSource.setBaseURI(wsdlURI);
-        wsdlSource.setSource(is);
-        desc = reader.readWSDL(wsdlSource, handler);
-      }
-      catch(WSDLException e)
-      {
-          fail("Unexpected exception: " + e.getMessage());
-      }
-      assertNotNull("The description returned is null.", desc);
-  }
-}
+ * 
+ *     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;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.woden.tests.TestErrorHandler;
+import org.apache.woden.wsdl20.Description;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class WSDLReaderTest extends TestCase 
+{
+  private WSDLFactory factory = null;
+  private WSDLReader reader = null;
+  private ErrorHandler handler = null;
+  
+  public static Test suite()
+  {
+	return new TestSuite(WSDLReaderTest.class);
+  }
+
+  protected void setUp() throws Exception 
+  {
+	handler = new TestErrorHandler();
+	try
+	{
+      factory = WSDLFactory.newInstance();
+      reader = factory.newWSDLReader();  
+    } 
+	catch (Exception e) 
+	{
+    }
+  }
+
+  protected void tearDown() throws Exception 
+  {
+	factory = null;
+	reader = null;
+	handler = null;
+  }
+  
+  public void testReadValidWSDL20()
+  {
+	  Description desc = null;
+	  try
+	  {
+        URL wsdlURL = getClass().getClassLoader().getResource("org/apache/woden/primer-hotelReservationService.wsdl");
+	    desc = reader.readWSDL(wsdlURL.toString(), handler);
+	  }
+	  catch(WSDLException e)
+	  {
+          fail("Unexpected exception: " + e.getMessage());
+	  }
+      assertNotNull("The description returned is null.", desc);
+  }
+  
+  public void testReadInvalidWSDL20()
+  {
+	  try
+	  {
+		URL wsdlURL = getClass().getClassLoader().getResource("org/apache/woden/badDescriptionTags.wsdl");
+		reader.readWSDL(wsdlURL.toString(), handler);
+        fail("Expected a WSDLException because the \"description\" tag was deliberately misspelt.");
+	  }
+	  catch(WSDLException e)
+	  {
+          assertTrue("Expected a WSDLException with message containing \"WSDL501\", but got: " + e.getMessage() ,
+             e.getMessage().indexOf("WSDL501") > -1);
+	  }
+  }
+  
+  public void testReadWSDLSourceDoc()
+  {
+      Description desc = null;
+      try
+      {
+        URL wsdlURL = getClass().getClassLoader().getResource("org/apache/woden/primer-hotelReservationService.wsdl");
+        String wsdlURLStr = wsdlURL.toString();
+        URI wsdlURI = URI.create(wsdlURLStr);
+        
+        Document doc = null;
+        try {
+            DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+            dbFactory.setNamespaceAware(true);
+            DocumentBuilder builder = dbFactory.newDocumentBuilder();
+            doc = builder.parse(new InputSource(wsdlURLStr));
+        } catch (FactoryConfigurationError e1) {
+            fail("Unexpected exception: " + e1.getMessage());
+        } catch (ParserConfigurationException e1) {
+            fail("Unexpected exception: " + e1.getMessage());
+        } catch (SAXException e1) {
+           fail("Unexpected exception: " + e1.getMessage());
+        } catch (IOException e1) {
+            fail("Unexpected exception: " + e1.getMessage());
+        }
+        
+        WSDLSource wsdlSource = reader.createWSDLSource();
+        wsdlSource.setBaseURI(wsdlURI);
+        wsdlSource.setSource(doc);
+        desc = reader.readWSDL(wsdlSource, handler);
+      }
+      catch(WSDLException e)
+      {
+          fail("Unexpected exception: " + e.getMessage());
+      }
+      assertNotNull("The description returned is null.", desc);
+  }
+
+  public void testReadWSDLSourceIS()
+  {
+      Description desc = null;
+      try
+      {
+        URL wsdlURL = getClass().getClassLoader().getResource("org/apache/woden/primer-hotelReservationService.wsdl");
+        String wsdlURLStr = wsdlURL.toString();
+        
+        InputSource is = new InputSource(wsdlURLStr);
+        URI wsdlURI = URI.create(wsdlURLStr);
+        
+        WSDLSource wsdlSource = reader.createWSDLSource();
+        wsdlSource.setBaseURI(wsdlURI);
+        wsdlSource.setSource(is);
+        desc = reader.readWSDL(wsdlSource, handler);
+      }
+      catch(WSDLException e)
+      {
+          fail("Unexpected exception: " + e.getMessage());
+      }
+      assertNotNull("The description returned is null.", desc);
+  }
+}

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

Modified: incubator/woden/trunk/java/test/org/apache/woden/ant/ObjectIdTableTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/ant/ObjectIdTableTest.java?rev=568937&r1=568936&r2=568937&view=diff
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/ant/ObjectIdTableTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/ant/ObjectIdTableTest.java Thu Aug 23 04:24:51 2007
@@ -1,66 +1,66 @@
-/**
+/**
  * 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.ant;
-
-import org.apache.woden.ant.ObjectIdTable;
-import org.apache.woden.types.NCNameTest;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Tests ObjectIdTable.
- * 
- * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com)
- *
- */
-public class ObjectIdTableTest extends TestCase {
-
-    /**
-     * Creates a test suite for this class.
-     * 
-     * @return the test suite
-     */
-    public static Test suite()
-    {
-        return new TestSuite(ObjectIdTableTest.class);
-    }
-    
-    /**
-     * Tests the id() method.
-     * Same objects have the same id.
-     * Different objects have different ids.
-     */
-    public void testId() {
-        
-        String s1 = "s1";
-        String s2 = "s2";
-        
-        ObjectIdTable oit = new ObjectIdTable();
-        
-        int id1 = oit.id(s1);
-        assertTrue("Same object, same id", id1 == oit.id(s1));
-        
-        int id2 = oit.id(s2);
-        assertTrue("Different object, different id", id1 != id2);
-        
-        assertTrue("Same object, same id, again", id2 == oit.id(s2));
-    }
-
-}
+ * 
+ *     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.ant;
+
+import org.apache.woden.ant.ObjectIdTable;
+import org.apache.woden.types.NCNameTest;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Tests ObjectIdTable.
+ * 
+ * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com)
+ *
+ */
+public class ObjectIdTableTest extends TestCase {
+
+    /**
+     * Creates a test suite for this class.
+     * 
+     * @return the test suite
+     */
+    public static Test suite()
+    {
+        return new TestSuite(ObjectIdTableTest.class);
+    }
+    
+    /**
+     * Tests the id() method.
+     * Same objects have the same id.
+     * Different objects have different ids.
+     */
+    public void testId() {
+        
+        String s1 = "s1";
+        String s2 = "s2";
+        
+        ObjectIdTable oit = new ObjectIdTable();
+        
+        int id1 = oit.id(s1);
+        assertTrue("Same object, same id", id1 == oit.id(s1));
+        
+        int id2 = oit.id(s2);
+        assertTrue("Different object, different id", id1 != id2);
+        
+        assertTrue("Same object, same id, again", id2 == oit.id(s2));
+    }
+
+}

Propchange: incubator/woden/trunk/java/test/org/apache/woden/ant/ObjectIdTableTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/woden/trunk/java/test/org/apache/woden/badDescriptionTags.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/woden/trunk/java/test/org/apache/woden/internal/ReaderFeaturesTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/internal/ReaderFeaturesTest.java?rev=568937&r1=568936&r2=568937&view=diff
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/internal/ReaderFeaturesTest.java (original)
+++ incubator/woden/trunk/java/test/org/apache/woden/internal/ReaderFeaturesTest.java Thu Aug 23 04:24:51 2007
@@ -1,87 +1,87 @@
-/**
+/**
  * 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.internal;
-
-import org.apache.woden.WSDLReader;
-
-import junit.framework.TestCase;
-
-/**
- * Unit tests for the ReaderFeatures class.
- * 
- * TODO: Add tests for all features.
- */
-public class ReaderFeaturesTest extends TestCase {
-
-	private ReaderFeatures defaultFeatures = new ReaderFeatures();
-	private ReaderFeatures features = new ReaderFeatures();
-	
-	/**
-	 * Test that the validation feature is off by default.
-	 */
-	public void testValidationDefault()
-	{
-		assertFalse("The validation feature is not off by default.", defaultFeatures.getValue(WSDLReader.FEATURE_VALIDATION));
-	}
-	
-	/**
-	 * Test that the getValue method throws an exception for invalid
-	 * features.
-	 */
-	public void testGetValueForInvalidFeature()
-	{
-		try
-		{
-			features.getValue("http://invalidfeatureid");
-			fail("An IllegalStateException was not thrown when getValue is called for an invalid feature ID.");
-		}
-		catch(IllegalArgumentException e)
-		{
-			// The successful case will reach here. Nothing to do at this point.
-		}
-	}
-	
-	/**
-	 * Test that the setValue method throws an exception for invalid
-	 * features.
-	 */
-	public void testSetValueForInvalidFeature()
-	{
-		try
-		{
-			features.setValue("http://invalidfeatureid", true);
-			fail("An IllegalStateException was not thrown when setValue is called for an invalid feature ID.");
-		}
-		catch(IllegalArgumentException e)
-		{
-			// The successful case will reach here. Nothing to do at this point.
-		}
-	}
-	
-	/**
-	 * Test that setting values to on or off works correctly.
-	 */
-	public void testSetValue()
-	{
-		features.setValue(WSDLReader.FEATURE_VALIDATION, true);
-		assertTrue("The validation feature is not set to true.", features.getValue(WSDLReader.FEATURE_VALIDATION));
-		
-		features.setValue(WSDLReader.FEATURE_VALIDATION, false);
-		assertFalse("The validation feature is not set to false.", features.getValue(WSDLReader.FEATURE_VALIDATION));
-	}
-
-}
+ * 
+ *     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.internal;
+
+import org.apache.woden.WSDLReader;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit tests for the ReaderFeatures class.
+ * 
+ * TODO: Add tests for all features.
+ */
+public class ReaderFeaturesTest extends TestCase {
+
+	private ReaderFeatures defaultFeatures = new ReaderFeatures();
+	private ReaderFeatures features = new ReaderFeatures();
+	
+	/**
+	 * Test that the validation feature is off by default.
+	 */
+	public void testValidationDefault()
+	{
+		assertFalse("The validation feature is not off by default.", defaultFeatures.getValue(WSDLReader.FEATURE_VALIDATION));
+	}
+	
+	/**
+	 * Test that the getValue method throws an exception for invalid
+	 * features.
+	 */
+	public void testGetValueForInvalidFeature()
+	{
+		try
+		{
+			features.getValue("http://invalidfeatureid");
+			fail("An IllegalStateException was not thrown when getValue is called for an invalid feature ID.");
+		}
+		catch(IllegalArgumentException e)
+		{
+			// The successful case will reach here. Nothing to do at this point.
+		}
+	}
+	
+	/**
+	 * Test that the setValue method throws an exception for invalid
+	 * features.
+	 */
+	public void testSetValueForInvalidFeature()
+	{
+		try
+		{
+			features.setValue("http://invalidfeatureid", true);
+			fail("An IllegalStateException was not thrown when setValue is called for an invalid feature ID.");
+		}
+		catch(IllegalArgumentException e)
+		{
+			// The successful case will reach here. Nothing to do at this point.
+		}
+	}
+	
+	/**
+	 * Test that setting values to on or off works correctly.
+	 */
+	public void testSetValue()
+	{
+		features.setValue(WSDLReader.FEATURE_VALIDATION, true);
+		assertTrue("The validation feature is not set to true.", features.getValue(WSDLReader.FEATURE_VALIDATION));
+		
+		features.setValue(WSDLReader.FEATURE_VALIDATION, false);
+		assertFalse("The validation feature is not set to false.", features.getValue(WSDLReader.FEATURE_VALIDATION));
+	}
+
+}

Propchange: incubator/woden/trunk/java/test/org/apache/woden/internal/ReaderFeaturesTest.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