Author: hughesj
Date: Fri Jul 14 06:34:50 2006
New Revision: 421902

URL: http://svn.apache.org/viewvc?rev=421902&view=rev
Log:
Added testw3c target to build.xml
Tidied up TestRoundTripXSD output in debug mode

Modified:
    webservices/commons/trunk/modules/XmlSchema/build.xml
    
webservices/commons/trunk/modules/XmlSchema/test/tests/w3c/TestRoundTripXSD.java

Modified: webservices/commons/trunk/modules/XmlSchema/build.xml
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/build.xml?rev=421902&r1=421901&r2=421902&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/build.xml (original)
+++ webservices/commons/trunk/modules/XmlSchema/build.xml Fri Jul 14 06:34:50 
2006
@@ -14,6 +14,7 @@
     <property name="test.dir" value="${basedir}/test"/>
        <property name="test_classes.dir" value="${build.dir}/test-classes"/>
     <property name="test_reports.dir" value="${build.dir}/test-reports"/>
+    <property name="test_reports_w3c.dir" 
value="${build.dir}/test-reports-w3c"/>
 
     <target name="prepare">
                <mkdir dir="${build_classes.dir}"/>
@@ -36,6 +37,7 @@
     <target name="prepare-tests">
         <mkdir dir="${test_classes.dir}"/>
         <mkdir dir="${test_reports.dir}"/>
+       <mkdir dir="${test_reports_w3c.dir}"/>
        
        <antcall target="prepareNistTest"/>
     </target>
@@ -90,13 +92,31 @@
             <batchtest todir="${test_reports.dir}">
                 <fileset dir="${test.dir}">
                     <include name="tests/*Test*.java"/>
-                    <include name="tests/w3c/TestW3CSchemaBucket.java"/>
+                    <include name="tests/w3c/TestW3CSchemaTestSet.java"/>
                 </fileset>
             </batchtest>
 
                <sysproperty key="nistTestLocation" 
                        
value="${build.dir}/xmlschema2002-01-16/nisttest/NISTTestsAll"/>
                
+        </junit>
+    </target>
+       
+       <target name="testw3c" depends="compile-tests" description="Runs the 
full bucket of W3C unit tests">
+        <junit printsummary="yes" haltonfailure="no">
+            <classpath>
+                <pathelement location="${build_classes.dir}"/>
+                <pathelement location="${test_classes.dir}"/>
+               <fileset dir="${build_lib.dir}">
+                  <include name="*.jar" />
+               </fileset>
+            </classpath>
+            <formatter type="plain"/>
+            <batchtest todir="${test_reports_w3c.dir}">
+                <fileset dir="${test.dir}">
+                    <include name="tests/w3c/TestW3CSchemaBucket.java"/>
+                </fileset>
+            </batchtest>
         </junit>
     </target>
 

Modified: 
webservices/commons/trunk/modules/XmlSchema/test/tests/w3c/TestRoundTripXSD.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/test/tests/w3c/TestRoundTripXSD.java?rev=421902&r1=421901&r2=421902&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/XmlSchema/test/tests/w3c/TestRoundTripXSD.java
 (original)
+++ 
webservices/commons/trunk/modules/XmlSchema/test/tests/w3c/TestRoundTripXSD.java
 Fri Jul 14 06:34:50 2006
@@ -93,12 +93,16 @@
 
     
     public void testRoundTrip() throws Exception {
+        
+        XmlSchema schema = null;
+        DetailedDiff detaileddiffs = null;
+        
         try {
             if (debug) {
                 System.out.println("fileToTest=" + this.fileToTest);
                 System.out.println("valid=" + this.valid);
             }
-            XmlSchema schema = loadSchema(fileToTest);
+            schema = loadSchema(fileToTest);
 
             // TODO: if we get here and the input was meant to be invalid 
perhaps
             // should fail. Depends on whether XmlSchema is doing validation. 
For
@@ -106,32 +110,22 @@
 
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             schema.write(baos);
-            if (debug) {
-                schema.write(System.err);
-            }
-
             Diff diff = new Diff(new FileReader(fileToTest),
                     new InputStreamReader(new ByteArrayInputStream(baos
                             .toByteArray())));
 
-            DetailedDiff detaileddiffs = new DetailedDiff(diff);
+            detaileddiffs = new DetailedDiff(diff);
             detaileddiffs.overrideDifferenceListener(new SchemaAttrDiff());
             boolean result = detaileddiffs.similar();
-            if (!result && debug) {
-                System.err.println(super.getName() + " failure detail");
-                System.err.println("-----");
-                schema.write(System.err);
-                ListIterator li = 
detaileddiffs.getAllDifferences().listIterator();
-                while (li.hasNext()) {
-                    System.err.println(li.next());
-                }
-            }
+            if (!result && debug) printFailureDetail(schema, detaileddiffs); 
             assertTrue("Serialized out schema not similar to original", 
result);
         } catch (Exception e) {
             if (this.valid) {
+                if (debug) printFailureDetail(schema, detaileddiffs);
                 throw new Exception(this.fileToTest.getPath(), e);
             }
         }
+        
 
     }
 
@@ -181,4 +175,16 @@
         }
     }
 
+
+    private void printFailureDetail(XmlSchema schema, DetailedDiff 
detaileddiffs) {
+        System.err.println(super.getName() + " failure detail");
+        System.err.println("-----");
+        schema.write(System.err);
+        ListIterator li = detaileddiffs.getAllDifferences().listIterator();
+        while (li.hasNext()) {
+            System.err.println(li.next());
+        }
+    }
+
+    
 }



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

Reply via email to