commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bur...@apache.org
Subject cvs commit: jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/test TestAtom.java TestFeedParserUTF8.java
Date Wed, 18 Feb 2004 21:07:23 GMT
burton      2004/02/18 13:07:23

  Modified:    feedparser TODO build.xml
               feedparser/src/java/org/apache/commons/feedparser/test
                        TestAtom.java TestFeedParserUTF8.java
  Log:
  init of junit XML conformance tests
  
  Revision  Changes    Path
  1.2       +5 -1      jakarta-commons-sandbox/feedparser/TODO
  
  Index: TODO
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/TODO,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TODO	18 Feb 2004 20:05:19 -0000	1.1
  +++ TODO	18 Feb 2004 21:07:22 -0000	1.2
  @@ -17,4 +17,8 @@
       - OCS directory support (pending)
       - FOAF support (pending)
   
  -- Migrate away from JDOM (slow)
  \ No newline at end of file
  +- Migrate away from JDOM (slower than just using DOM/SAX)
  +
  +- Don't use libs from the KSA.  
  +
  +- Test cases shouldn't use absolute paths.
  \ No newline at end of file
  
  
  
  1.2       +34 -0     jakarta-commons-sandbox/feedparser/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/build.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build.xml	18 Feb 2004 20:05:19 -0000	1.1
  +++ build.xml	18 Feb 2004 21:07:23 -0000	1.2
  @@ -14,6 +14,18 @@
   
       <path id="project.classpath">
   
  +        <fileset dir="lib">
  +
  +             <include name="*.jar"/>
  +
  +        </fileset>
  +
  +        <fileset dir="/projects/ksa/lib">
  +
  +             <include name="*.jar"/>
  +
  +        </fileset>
  +
       </path>
   
       <target name="compile">
  @@ -48,6 +60,28 @@
   
           </jar>
   
  +    </target>
  +
  +    <target name="junit" depends="jakarta-feedparser.jar" description="Run junit tests.">
  +
  +        <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
  +
  +        <junit printsummary="withOutAndErr"
  +               fork="true"
  +               filtertrace="true"
  +               haltonfailure="true">
  +
  +            <classpath refid="project.classpath"/>
  +               
  +            <formatter type="plain" usefile="false"/>
  +
  +            <test name="org.apache.commons.feedparser.test.TestAtom"/>
  +            <test name="org.apache.commons.feedparser.test.TestFeedParserUTF8"/>
  +
  +        </junit>
  +
  +        <echo message="tests done"/>
  +    
       </target>
   
   </project>
  
  
  
  1.2       +2 -2      jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/test/TestAtom.java
  
  Index: TestAtom.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/test/TestAtom.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestAtom.java	18 Feb 2004 20:06:27 -0000	1.1
  +++ TestAtom.java	18 Feb 2004 21:07:23 -0000	1.2
  @@ -90,7 +90,7 @@
   
       public void test1() throws Exception {
   
  -        String resource = "file:///projects/feedparser/src/java/org/peerfear/feedparser/test/TestAtom.xml";
  +        String resource = "file:///projects/feedparser/src/java/org/apache/commons/feedparser/test/TestAtom.xml";
           
           FeedParser parser = FeedParserFactory.newFeedParser();
   
  
  
  
  1.2       +48 -14    jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/test/TestFeedParserUTF8.java
  
  Index: TestFeedParserUTF8.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/test/TestFeedParserUTF8.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestFeedParserUTF8.java	18 Feb 2004 20:06:27 -0000	1.1
  +++ TestFeedParserUTF8.java	18 Feb 2004 21:07:23 -0000	1.2
  @@ -76,6 +76,8 @@
   import org.apache.commons.feedparser.*;
   import org.apache.commons.feedparser.impl.*;
   
  +import javax.xml.parsers.*;
  +
   /**
    *
    * @author <a href="mailto:burton@peerfear.org">Kevin A. Burton</a>
  @@ -87,30 +89,62 @@
           super( name );
       }
   
  -    public void testParse() throws Exception {
  +    public void testAssertXerces() throws Exception {
  +
  +        String v;
  +        
  +        DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
  +
  +        v = db.getClass().getName();
  +        
  +        if ( ! v.equals( "org.apache.xerces.jaxp.DocumentBuilderImpl" ) )
  +            throw new Exception( "Incorrect version of Xerces: " + v );
  +
  +        v = org.apache.xerces.impl.Version.fVersion;
  +        
  +        if ( v.indexOf( "2.6" ) == -1 )
  +            throw new Exception( "Incorrect version of Xerces: " + v);
  +
  +    }
  +
  +    public void test( String path ) throws Exception {
   
           FeedParser parser = FeedParserFactory.newFeedParser();
   
           FeedParserListener listener = new DebugFeedParserListener();
   
  -        parser.parse( listener, new FileInputStream( "src/java/ksa/test/TestFeedParserUTF8.rss"
) );
  +        parser.parse( listener, new FileInputStream( "src/java/org/apache/commons/feedparser/test/"
+ path) );
  +
  +    }
  +
  +    public void test1() throws Exception {
  +
  +        test( "TestFeedParserUTF8.rss" );
  +
  +    }
           
  +    public void test2() throws Exception {
  +
  +        test( "broken-UTF8-feed.rss" );
       }
   
  -    public static void main( String[] args ) {
  +    public void test3() throws Exception {
  +
  +        test( "Invalid-byte-2-of-3-byte-UTF-8-sequence.xml" );
  +    }
  +
  +    public void test4() throws Exception {
  +
  +        test( "salon_use.rdf" );
  +    }
   
  -        try { 
  +    public static void main( String[] args ) throws Exception {
   
  -            TestFeedParserUTF8 test = new TestFeedParserUTF8( null );
  +        TestFeedParserUTF8 test = new TestFeedParserUTF8( null );
   
  -            //test.testGetWeblogLinkForResource();
  -            test.testParse();
  -            
  -        } catch ( Throwable t ) {
  -            
  -            t.printStackTrace();
  -            
  -        }
  +        //test.testGetWeblogLinkForResource();
  +        //test.testParse();
  +        test.test2();
           
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message