Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.esau.ptarmigan.impl.test
Class PtarmiganTest  view PtarmiganTest download PtarmiganTest.java

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.esau.ptarmigan.impl.test.PtarmiganTest
All Implemented Interfaces:
junit.framework.Test

public class PtarmiganTest
extends junit.framework.TestCase

Test Suite for the default implementation of Ptarmigan

This suite presently relies on JDOM to (1) build documents from SAX events and (2) output XML.

This suite presently relies on xmlunit.Diff to detect parsing problems.

TODO: how to handle different property/feature combinations? Different directories for test files? Something in the filename?


Field Summary
(package private) static org.apache.commons.logging.Log log
          logging object
(package private)  boolean m_incl_digest
           
(package private)  boolean m_incl_playlist_entries
           
(package private)  boolean m_recursive
           
(package private)  java.lang.String m_test_control_dir
           
(package private)  java.lang.String m_test_input_dir
           
(package private)  java.lang.String m_test_output_dir
           
(package private)  boolean m_validate
           
(package private)  boolean m_verify
           
(package private) static java.lang.String SAX_PARSER_XERCES
          this will do schema validation
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
PtarmiganTest(java.lang.String name)
           
 
Method Summary
(package private)  void assignNamespace(org.jdom.Element root)
           
(package private)  org.jdom.Document build(java.lang.String system_id, boolean validate)
          build a JDOM document, optionall using the validation machinery in the SAX XML parser to validate the document
(package private)  org.jdom.Document buildDocument(java.io.File infile)
          Build a JDOM document from a media file source using SAX and our own parser.
(package private)  boolean getPropertyBool(java.lang.String name, boolean def_value)
           
(package private)  void parseDirectory(java.io.File dir)
          run generator against all files in specified directory
(package private)  void parseFile(java.io.File infile)
          run generator against one file
static junit.framework.Test suite()
           
 void testAll()
          run generator against all files specified in property "test.input.dir"
(package private)  void verify(java.io.File file1, java.io.File file2)
          Compare two XML files and fail the TestCase if there are any differences.
(package private)  void verify(java.io.Reader reader1, java.io.Reader reader2)
          Compare two XML readers and fail the TestCase if there are any differences.
(package private)  void writeDocument(org.jdom.Document doc, java.io.File file)
          output a JDOM document as XML
(package private)  void writeDocument(org.jdom.Document doc, java.io.Writer writer)
          output a JDOM document as XML
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SAX_PARSER_XERCES

static final java.lang.String SAX_PARSER_XERCES
this will do schema validation

See Also:
Constant Field Values

m_test_input_dir

java.lang.String m_test_input_dir

m_test_control_dir

java.lang.String m_test_control_dir

m_test_output_dir

java.lang.String m_test_output_dir

m_recursive

boolean m_recursive

m_validate

boolean m_validate

m_verify

boolean m_verify

m_incl_digest

boolean m_incl_digest

m_incl_playlist_entries

boolean m_incl_playlist_entries

log

static org.apache.commons.logging.Log log
logging object

Constructor Detail

PtarmiganTest

public PtarmiganTest(java.lang.String name)
Method Detail

suite

public static junit.framework.Test suite()

testAll

public void testAll()
run generator against all files specified in property "test.input.dir"


parseDirectory

void parseDirectory(java.io.File dir)
              throws java.lang.Exception
run generator against all files in specified directory


parseFile

void parseFile(java.io.File infile)
         throws java.lang.Exception
run generator against one file


buildDocument

org.jdom.Document buildDocument(java.io.File infile)
                          throws java.lang.Exception
Build a JDOM document from a media file source using SAX and our own parser.

Note that we do the dual assignment of InputStream/system_id to the InputSource. This is because we can be sure that the system-id will be properly resolved to a filename, so we open it ourselves. The system-id is provided so that the Ptarmigan generator can extract details from the file for output as SAX events.


assignNamespace

void assignNamespace(org.jdom.Element root)
               throws java.io.IOException

writeDocument

void writeDocument(org.jdom.Document doc,
                   java.io.File file)
             throws java.io.IOException,
                    org.jdom.JDOMException
output a JDOM document as XML


writeDocument

void writeDocument(org.jdom.Document doc,
                   java.io.Writer writer)
             throws java.io.IOException,
                    org.jdom.JDOMException
output a JDOM document as XML


build

org.jdom.Document build(java.lang.String system_id,
                        boolean validate)
                  throws java.io.IOException,
                         org.jdom.JDOMException
build a JDOM document, optionall using the validation machinery in the SAX XML parser to validate the document


verify

void verify(java.io.File file1,
            java.io.File file2)
      throws java.io.IOException,
             org.xml.sax.SAXException,
             javax.xml.parsers.ParserConfigurationException
Compare two XML files and fail the TestCase if there are any differences.


verify

void verify(java.io.Reader reader1,
            java.io.Reader reader2)
      throws java.io.IOException,
             org.xml.sax.SAXException,
             javax.xml.parsers.ParserConfigurationException
Compare two XML readers and fail the TestCase if there are any differences.


getPropertyBool

boolean getPropertyBool(java.lang.String name,
                        boolean def_value)