You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by bi...@apache.org on 2008/11/15 02:39:01 UTC

svn commit: r714212 - in /webservices/commons/trunk/modules/XmlSchema: ./ src/main/java/org/apache/ws/commons/schema/ src/test/java/tests/

Author: bimargulies
Date: Fri Nov 14 17:39:01 2008
New Revision: 714212

URL: http://svn.apache.org/viewvc?rev=714212&view=rev
Log:
Merge some fixes forward from the 1.4.x branch, mostly to show that it can be done.

Modified:
    webservices/commons/trunk/modules/XmlSchema/   (props changed)
    webservices/commons/trunk/modules/XmlSchema/build.xml
    webservices/commons/trunk/modules/XmlSchema/pom.xml
    webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java
    webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
    webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java
    webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnnotationTest.java
    webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnyTest.java
    webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RecursiveImportTest.java
    webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/TestSimpleRestriction.java

Propchange: webservices/commons/trunk/modules/XmlSchema/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Nov 14 17:39:01 2008
@@ -1 +1 @@
-/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH:1-714100
+/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH:1-714211

Modified: webservices/commons/trunk/modules/XmlSchema/build.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/build.xml?rev=714212&r1=714211&r2=714212&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/build.xml (original)
+++ webservices/commons/trunk/modules/XmlSchema/build.xml Fri Nov 14 17:39:01 2008
@@ -53,9 +53,11 @@
 	</target>
 
 	<target name="get-deps" if="downloadLibs">
-    	<get src="http://www.ibiblio.org/maven2/xmlunit/xmlunit/1.0/xmlunit-1.0.jar"
-    		dest="${build_lib.dir}/xmlunit-1.0.jar"/>
-    </target>
+	  <get src="http://www.ibiblio.org/maven2/xmlunit/xmlunit/1.0/xmlunit-1.0.jar"
+	       dest="${build_lib.dir}/xmlunit-1.0.jar"/>
+	  <get src="http://mirrors.ibiblio.org/pub/mirrors/maven2/junit/junit/3.8.2/junit-3.8.2.jar"
+	       dest="${build_lib.dir}/junit-3.8.2.jar"/>
+	</target>
 
     <target name="prepare-tests">
         <mkdir dir="${test_classes.dir}"/>

Modified: webservices/commons/trunk/modules/XmlSchema/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/pom.xml?rev=714212&r1=714211&r2=714212&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/pom.xml (original)
+++ webservices/commons/trunk/modules/XmlSchema/pom.xml Fri Nov 14 17:39:01 2008
@@ -26,7 +26,7 @@
     <groupId>org.apache.ws.commons.schema</groupId>
     <artifactId>XmlSchema</artifactId>
     <name>XmlSchema</name>
-    <version>SNAPSHOT</version>
+    <version>1.4-SNAPSHOT</version>
     <description>Commons XMLSchema is a light weight schema object model that can be used to manipualte or
         generate a schema. It has a clean, easy to use API and can easily be integrated into an existing project
         since it has almost no dependancies on third party libraries.</description>
@@ -60,129 +60,6 @@
         </mailingList>
     </mailingLists>
     <inceptionYear>2004</inceptionYear>
-    <developers>
-        <developer>
-            <id>dims</id>
-            <name>Davanum Srinivas</name>
-            <email>dims AT wso2.com</email>
-            <organization>WSO2</organization>
-        </developer>
-        <developer>
-            <id>sanjiva</id>
-            <name>Sanjiva Weerawarana</name>
-            <email>sanjiva AT wso2.com</email>
-            <organization>WSO2</organization>
-        </developer>
-        <developer>
-            <id>gdaniels</id>
-            <name>Glen Daniels</name>
-            <email>gdaniels AT apache.org</email>
-            <organization>Sonic Software</organization>
-        </developer>
-        <developer>
-            <id>alek</id>
-            <name>Aleksander Slominski</name>
-            <email>aslom AT cs.indiana.edu</email>
-            <organization>Indiana University Extreme! Computing Lab</organization>
-        </developer>
-        <developer>
-            <id>hemapani</id>
-            <name>Srinath Perera</name>
-            <email>hemapani AT apache.org</email>
-            <url>http://www.apache.org/~hemapani</url>
-            <organization>Lanka Software Foundation</organization>
-        </developer>
-        <developer>
-            <id>chinthaka</id>
-            <name>Eran Chinthaka</name>
-            <email>chinthaka AT wso2.com</email>
-            <url>http://www.apache.org/~chinthaka</url>
-            <organization>WSO2</organization>
-        </developer>
-        <developer>
-            <id>dasarath</id>
-            <name>Dasarath Weerathunga</name>
-            <email>dasarath AT opensource.lk</email>
-            <organization>Lanka Software Foundation</organization>
-        </developer>
-        <developer>
-            <id>jaliya</id>
-            <name>Jaliya Ekanayake</name>
-            <email>jaliya AT opensource.lk</email>
-            <url>http://www.apache.org/~jaliya</url>
-            <organization>Virtusa / Lanka Software Foundation</organization>
-        </developer>
-        <developer>
-            <id>chathura</id>
-            <name>Chathura Herath</name>
-            <email>chathura AT opensource.lk</email>
-            <url>www.apache.org/~chathura</url>
-            <organization>LSF/MIT</organization>
-        </developer>
-        <developer>
-            <id>deepal</id>
-            <name>Deepal Jayasinghe</name>
-            <email>deepal AT wso2.com</email>
-            <url>http://www.apache.org/~deepal</url>
-            <organization>WSO2</organization>
-        </developer>
-        <developer>
-            <id>ajith</id>
-            <name>Ajith Ranabahu</name>
-            <email>ajith AT apache.org</email>
-            <url>http://www.apache.org/~ajith</url>
-            <organization>WSO2</organization>
-        </developer>
-        <developer>
-            <id>venkat</id>
-            <name>Venkat Reddy</name>
-            <email>vreddyp AT gmail.com</email>
-            <organization>Computer Associates</organization>
-        </developer>
-        <developer>
-            <id>ashu</id>
-            <name>Ashutosh Shahi</name>
-            <email>Ashutosh.Shahi AT ca.com</email>
-            <organization>Computer Associates</organization>
-        </developer>
-        <developer>
-            <id>jaya</id>
-            <name>Jayachandra Sekhara Rao Sunkara</name>
-            <email>jayachandra AT gmail.com</email>
-            <organization>Computer Associates</organization>
-        </developer>
-        <developer>
-            <id>thilina</id>
-            <name>Thilina Gunarathne</name>
-            <email>thilina AT wso2.com</email>
-            <url>http://www.apache.org/~thilina</url>
-            <organization>WSO2</organization>
-        </developer>
-        <developer>
-            <id>ruchith</id>
-            <name>Ruchith Fernando</name>
-            <email>ruchith AT wso2.com</email>
-            <organization>WSO2</organization>
-        </developer>
-        <developer>
-            <id>saminda</id>
-            <name>Saminda Abeyruwan</name>
-            <email>saminda AT wso2.com</email>
-            <organization>WSO2</organization>
-        </developer>
-        <developer>
-            <id>chamil</id>
-            <name>Chamil Thanthrimudalige</name>
-            <email>chamil AT wso2.com</email>
-            <organization>WSO2</organization>
-        </developer>
-        <developer>
-            <id>dandiep</id>
-            <name>Dan Diephouse</name>
-            <email>dandiep AT apache.org</email>
-            <organization>Envoi Solutions</organization>
-        </developer>
-    </developers>
     <licenses>
         <license>
             <name>The Apache Software License, Version 2.0</name>
@@ -272,12 +149,13 @@
                 <configuration>
                     <includes>
                         <include>**/*Test.java</include>
+                        <include>**/Test*.java</include>
                         <!--        Fails in about half of the tests
                                     <include>tests/w3c/TestW3CSchemaBucket.java</include>
                         -->
                     </includes>
                     <excludes>
-                        <exclude>tests/w3c/SchemaTest.java</exclude>
+                        <exclude>tests/w3c/**.java</exclude>
                     </excludes>
                 </configuration>
             </plugin>
@@ -287,7 +165,7 @@
                     <descriptors>
                         <descriptor>src/main/assembly/bin.xml</descriptor>
                         <descriptor>src/main/assembly/src.xml</descriptor>
-						<descriptor>src/main/assembly/doc.xml</descriptor>
+			<descriptor>src/main/assembly/doc.xml</descriptor>
                     </descriptors>
                     <tarLongFileMode>gnu</tarLongFileMode>
                 </configuration>
@@ -307,6 +185,7 @@
             </plugin>
             
         </plugins>
+        <defaultGoal>install</defaultGoal>
     </build>
     <profiles>
         <profile>
@@ -351,13 +230,14 @@
         				<configuration>
         					<includes>
         						<include>**/*Test.java</include>
+        						<include>**/Test*.java</include>
         						<!--        Fails in about half of the tests
         							<include>tests/w3c/TestW3CSchemaBucket.java</include>
         						-->
         					</includes>
         					<excludes>
         						<exclude>
-        							tests/w3c/SchemaTest.java
+        							tests/w3c/**.java
         						</exclude>
         					</excludes>
         					<systemProperties>

Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java?rev=714212&r1=714211&r2=714212&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java Fri Nov 14 17:39:01 2008
@@ -28,7 +28,6 @@
 import javax.xml.transform.*;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
 import java.io.*;
 import java.util.Map;
 import java.util.HashMap;

Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java?rev=714212&r1=714211&r2=714212&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java Fri Nov 14 17:39:01 2008
@@ -19,34 +19,40 @@
 
 package org.apache.ws.commons.schema;
 
+import java.io.IOException;
+import java.io.Reader;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
 import org.apache.ws.commons.schema.constants.Constants;
 import org.apache.ws.commons.schema.extensions.ExtensionRegistry;
 import org.apache.ws.commons.schema.resolver.DefaultURIResolver;
 import org.apache.ws.commons.schema.resolver.URIResolver;
+import org.apache.ws.commons.schema.utils.DOMUtil;
 import org.apache.ws.commons.schema.utils.NamespacePrefixList;
 import org.apache.ws.commons.schema.utils.TargetNamespaceValidator;
-import org.apache.ws.commons.schema.utils.DOMUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamSource;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.*;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-
 /**
  * Contains a cache of XML Schema definition language (XSD).
  *

Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java?rev=714212&r1=714211&r2=714212&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java Fri Nov 14 17:39:01 2008
@@ -48,6 +48,11 @@
         finalDerivation = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE);
     }
 
+    /**
+     * This function returns null. It is intended at some point to return the base type in the event of a restriction,
+     * but that functionality is not implemented.
+     * @return null
+     */
     public Object getBaseSchemaType() {
         return baseSchemaType;
     }

Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnnotationTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnnotationTest.java?rev=714212&r1=714211&r2=714212&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnnotationTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnnotationTest.java Fri Nov 14 17:39:01 2008
@@ -59,7 +59,7 @@
                                      "emptyAppinfo");
         InputStream is = new FileInputStream(Resources.asURI("annotation.xsd"));
         XmlSchemaCollection schemaCol = new XmlSchemaCollection();
-        XmlSchema schema = schemaCol.read(new StreamSource(is), null);
+        schemaCol.read(new StreamSource(is), null);
 
         XmlSchemaSimpleType simpleType =
             (XmlSchemaSimpleType)schemaCol.getTypeByQName(TYPE_QNAME);
@@ -125,7 +125,7 @@
                                      "emptyDocumentation");
         InputStream is = new FileInputStream(Resources.asURI("annotation.xsd"));
         XmlSchemaCollection schemaCol = new XmlSchemaCollection();
-        XmlSchema schema = schemaCol.read(new StreamSource(is), null);
+        schemaCol.read(new StreamSource(is), null);
 
         XmlSchemaSimpleType simpleType =
             (XmlSchemaSimpleType)schemaCol.getTypeByQName(TYPE_QNAME);
@@ -189,7 +189,7 @@
                                      "emptyAppinfoDocumentation");
         InputStream is = new FileInputStream(Resources.asURI("annotation.xsd"));
         XmlSchemaCollection schemaCol = new XmlSchemaCollection();
-        XmlSchema schema = schemaCol.read(new StreamSource(is), null);
+        schemaCol.read(new StreamSource(is), null);
 
         XmlSchemaSimpleType simpleType =
             (XmlSchemaSimpleType)schemaCol.getTypeByQName(TYPE_QNAME);
@@ -227,7 +227,7 @@
                                      "annotationTest");
         InputStream is = new FileInputStream(Resources.asURI("annotation.xsd"));
         XmlSchemaCollection schemaCol = new XmlSchemaCollection();
-        XmlSchema schema = schemaCol.read(new StreamSource(is), null);
+        schemaCol.read(new StreamSource(is), null);
 
         XmlSchemaSimpleType simpleType =
             (XmlSchemaSimpleType)schemaCol.getTypeByQName(TYPE_QNAME);

Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnyTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnyTest.java?rev=714212&r1=714211&r2=714212&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnyTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/AnyTest.java Fri Nov 14 17:39:01 2008
@@ -82,7 +82,7 @@
                                         "department");
         InputStream is = new FileInputStream(Resources.asURI("any.xsd"));
         XmlSchemaCollection schemaCol = new XmlSchemaCollection();
-        XmlSchema schema = schemaCol.read(new StreamSource(is), null);
+        schemaCol.read(new StreamSource(is), null);
 
         verifyAccuracy(ELEMENT_QNAME, schemaCol,5L,10L);
 
@@ -121,7 +121,7 @@
         schema.write(baos);
         
         XmlSchemaCollection schemaCol2 = new XmlSchemaCollection();
-        XmlSchema schema2 = schemaCol2.read(new StreamSource(new ByteArrayInputStream(baos.toByteArray())), null);
+        schemaCol2.read(new StreamSource(new ByteArrayInputStream(baos.toByteArray())), null);
         
         verifyAccuracy(ELEMENT_QNAME, schemaCol2,0,0);
        

Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RecursiveImportTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RecursiveImportTest.java?rev=714212&r1=714211&r2=714212&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RecursiveImportTest.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/RecursiveImportTest.java Fri Nov 14 17:39:01 2008
@@ -26,7 +26,6 @@
 
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.namespace.QName;
-import java.io.File;
 
 public class RecursiveImportTest extends TestCase {
 

Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/TestSimpleRestriction.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/TestSimpleRestriction.java?rev=714212&r1=714211&r2=714212&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/TestSimpleRestriction.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/TestSimpleRestriction.java Fri Nov 14 17:39:01 2008
@@ -21,6 +21,8 @@
 import junit.framework.TestCase;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction;
 import org.apache.ws.commons.schema.XmlSchemaType;
 
 import javax.xml.namespace.QName;
@@ -55,8 +57,10 @@
     	schema.read(new StreamSource(is), null);
     	XmlSchemaType principalId = schema.getTypeByQName(new QName("", "XdwsPrincipalId"));
     	assertNotNull(principalId);
-    	XmlSchemaType groupId = schema.getTypeByQName(new QName("", "XdwsGroupId"));
+    	XmlSchemaSimpleType groupId = (XmlSchemaSimpleType)schema.getTypeByQName(new QName("", "XdwsGroupId"));
     	assertNotNull(groupId);
-    	assertEquals(groupId.getBaseSchemaType(), principalId);
+    	QName baseName = ((XmlSchemaSimpleTypeRestriction)groupId.getContent()).getBaseTypeName();
+
+    	assertEquals(principalId.getQName(), baseName);
     }
 }