Arch4J 1.1

org.arch4j.xml
Class XMLStreamTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--org.arch4j.xml.XMLStreamTest
All Implemented Interfaces:
junit.framework.Test, XMLHandler

public class XMLStreamTest
extends junit.framework.TestCase
implements XMLHandler

Description: Test the SpiderLogic event-based XML parser. Basic approach of this class is to create an XML file during setup and test the parser's handling of it.

Version:
1.0
Author:
Russ Brown

Constructor Summary
XMLStreamTest(String name)
           
 
Method Summary
protected  void assertAttribute(int elementIndex, String attributeName, String expectedValue)
           
protected  void assertNumberOfElements(int numberOfElements)
           
protected  void assertWellFormed()
           
 void characters(char[] buffer, int start, int length)
          this method is called when the parser encounters plain text outside of a bracketed tag.
protected  void createFile1(String pathname)
           
protected  void createFile2(String pathname)
           
protected  void deleteFile(String pathname)
           
 void endDocument()
          called when parser reaches the end of the document
 void endElement(String name)
          this method is called whenever the parser encounters the end of an element
 void error(String message, String source, int line, int column)
          this method is called by the parser if it encounters a recoverable error.
 void fatalError(String message, String source, int line, int column)
          this method is called by the parser if it encounters a non-recoverable error.
protected  void setUp()
           
 void startDocument()
          this method is called by the parser at the start of a document
 void startElement(String name, Map attributes)
          this method is called when the parser encounters a starting element tag.
static junit.framework.Test suite()
           
 void testFatalError()
           
 void testSuccess()
           
 void warning(String message, String source, int line, int column)
          this method is called by the parser if it encounters a warning situation.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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
 

Constructor Detail

XMLStreamTest

public XMLStreamTest(String name)
Method Detail

setUp

protected void setUp()
Overrides:
setUp in class junit.framework.TestCase

suite

public static junit.framework.Test suite()

testSuccess

public void testSuccess()

testFatalError

public void testFatalError()

assertAttribute

protected void assertAttribute(int elementIndex,
                               String attributeName,
                               String expectedValue)

assertWellFormed

protected void assertWellFormed()

assertNumberOfElements

protected void assertNumberOfElements(int numberOfElements)

deleteFile

protected void deleteFile(String pathname)

createFile1

protected void createFile1(String pathname)
                    throws IOException
IOException

createFile2

protected void createFile2(String pathname)
                    throws IOException
IOException

startDocument

public void startDocument()
this method is called by the parser at the start of a document

Specified by:
startDocument in interface XMLHandler

characters

public void characters(char[] buffer,
                       int start,
                       int length)
this method is called when the parser encounters plain text outside of a bracketed tag. It provides the text in the buffer in the index range start -> end.

Specified by:
characters in interface XMLHandler
Parameters:
buffer - buffer containing plain text characters
start - start index of plain text characters in buffer
length - number of characters in plain text

startElement

public void startElement(String name,
                         Map attributes)
this method is called when the parser encounters a starting element tag.

Specified by:
startElement in interface XMLHandler
Parameters:
attributes - a map of attribute names and values found in this element

endElement

public void endElement(String name)
this method is called whenever the parser encounters the end of an element

Specified by:
endElement in interface XMLHandler
Parameters:
name - the tag of the element that is ending

endDocument

public void endDocument()
called when parser reaches the end of the document

Specified by:
endDocument in interface XMLHandler

error

public void error(String message,
                  String source,
                  int line,
                  int column)
this method is called by the parser if it encounters a recoverable error.

Specified by:
error in interface XMLHandler
Parameters:
message - error message generated by parser
source - source of XML document - generally a file name
line - line number of document on which error occurred.
column - column number at which error occurred.

fatalError

public void fatalError(String message,
                       String source,
                       int line,
                       int column)
this method is called by the parser if it encounters a non-recoverable error. The parser aborts after this callback.

Specified by:
fatalError in interface XMLHandler
Parameters:
message - error message generated by parser
source - source of XML document - generally a file name
line - line number of document on which error occurred.
column - column number at which error occurred.

warning

public void warning(String message,
                    String source,
                    int line,
                    int column)
this method is called by the parser if it encounters a warning situation.

Specified by:
warning in interface XMLHandler
Parameters:
message - error message generated by parser
source - source of XML document - generally a file name
line - line number of document on which error occurred.
column - column number at which error occurred.

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.