|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.eclipse.birt.report.tests.model.BaseTestCase
This class is abstract class used for tests, which contains the design file name and report design handle, and provides the basic design file reading methods. This class performs mainly the following functionalities:
ReportDesign
instance and its
handle, ReportDesignHandle
Note:
Field Summary | |
protected org.eclipse.birt.report.model.elements.ReportDesign |
design
the root element for this design. |
protected org.eclipse.birt.report.model.api.ReportDesignHandle |
designHandle
The report design handle. |
protected static java.lang.String |
GOLDEN_FOLDER
|
protected static java.lang.String |
INPUT_FOLDER
|
protected static java.lang.String |
OUTPUT_FOLDER
|
protected static java.lang.String |
PLUGIN_NAME
|
protected static java.lang.String |
PLUGIN_PATH
|
protected static java.lang.String |
PLUGINLOC
|
protected static java.lang.String |
ROM_DEF_NAME
The file name of metadata file. |
protected org.eclipse.birt.report.model.api.SessionHandle |
sessionHandle
The session handle. |
protected static java.lang.String |
TEST_FOLDER
|
protected static java.util.Locale |
TEST_LOCALE
|
Constructor Summary | |
BaseTestCase(java.lang.String name)
|
Method Summary | |
protected void |
compareErrors(java.lang.String filename)
Compares the error messages against the golden file. |
protected boolean |
compareTextFile(java.lang.String goldenFileName,
java.lang.String outputFileName)
Compares two text file. |
protected boolean |
compareTextFileAsResource(java.lang.Class theClass,
java.lang.String goldenFileName,
java.lang.String outputFileName)
Compares two text files. |
protected org.eclipse.birt.report.model.api.ReportDesignHandle |
createDesign()
Creates a new report. |
protected org.eclipse.birt.report.model.api.ReportDesignHandle |
createDesign(java.util.Locale locale)
Creates a new report with given locale. |
protected void |
dumpErrors(java.lang.String filename)
Dumps the parsing errors into a text file. |
protected java.lang.String |
getClassFolder()
Locates the folder where the unit test java source file is saved. |
protected java.lang.String |
getFullQualifiedClassName()
Returns the full qualified class name. |
protected void |
openDesign(java.lang.String fileName)
Opens design file with default locale. |
protected void |
openDesign(java.lang.String fileName,
java.io.InputStream is)
Reads design file as InputStream. |
protected void |
openDesign(java.lang.String fileName,
java.io.InputStream is,
java.util.Locale locale)
Opens a design file. |
protected void |
openDesign(java.lang.String fileName,
java.util.Locale locale)
Opens design file providing the file name and the locale. |
protected void |
openDesignAsResource(java.lang.Class theClass,
java.lang.String fileName)
Opens design file as resource with default locale. |
protected void |
openDesignAsResource(java.lang.Class theClass,
java.lang.String fileName,
java.util.Locale locale)
Opens design file as resource with the given locale. |
protected void |
printSemanticError(org.eclipse.birt.report.model.elements.ReportDesign design)
Prints out all semantic errors stored in the error list during parsing the design file. |
protected void |
printSemanticErrors()
Prints out all semantic errors stored in the error list during parsing the design file. |
protected void |
printSyntaxError(org.eclipse.birt.report.model.api.DesignFileException e)
Prints out all syntax errors stored in the error list during parsing the design file. |
protected void |
saveAs(java.lang.String filename)
Eventually, this method will call ReportDesignHandle.saveAs(String) to save the output file of some
unit test. |
protected void |
saveAsInTempDir(java.lang.String filename)
Saves the design file to temp directory. |
protected void |
setUp()
|
protected void |
tearDown()
|
Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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 |
protected org.eclipse.birt.report.model.api.ReportDesignHandle designHandle
protected org.eclipse.birt.report.model.api.SessionHandle sessionHandle
protected org.eclipse.birt.report.model.elements.ReportDesign design
protected static final java.lang.String ROM_DEF_NAME
protected static final java.lang.String PLUGIN_NAME
protected static final java.lang.String PLUGINLOC
protected static final java.lang.String PLUGIN_PATH
protected static final java.lang.String TEST_FOLDER
protected static final java.lang.String OUTPUT_FOLDER
protected static final java.lang.String INPUT_FOLDER
protected static final java.lang.String GOLDEN_FOLDER
protected static final java.util.Locale TEST_LOCALE
Constructor Detail |
public BaseTestCase(java.lang.String name)
Method Detail |
protected void setUp() throws java.lang.Exception
java.lang.Exception
protected void tearDown() throws java.lang.Exception
java.lang.Exception
protected org.eclipse.birt.report.model.api.ReportDesignHandle createDesign()
protected org.eclipse.birt.report.model.api.ReportDesignHandle createDesign(java.util.Locale locale)
locale
- the user locale
protected void openDesign(java.lang.String fileName) throws org.eclipse.birt.report.model.api.DesignFileException
fileName
- design file name
org.eclipse.birt.report.model.api.DesignFileException
- if any exceptionprotected void openDesign(java.lang.String fileName, java.util.Locale locale) throws org.eclipse.birt.report.model.api.DesignFileException
fileName
- the design file to be openedlocale
- the user locale
org.eclipse.birt.report.model.api.DesignFileException
- if any exception.protected void openDesignAsResource(java.lang.Class theClass, java.lang.String fileName) throws org.eclipse.birt.report.model.api.DesignFileException
fileName
- the file name without path
org.eclipse.birt.report.model.api.DesignFileException
- if any exception.protected void openDesignAsResource(java.lang.Class theClass, java.lang.String fileName, java.util.Locale locale) throws org.eclipse.birt.report.model.api.DesignFileException
fileName
- the file name without pathlocale
- the given locale
org.eclipse.birt.report.model.api.DesignFileException
- if any exception.protected void openDesign(java.lang.String fileName, java.io.InputStream is) throws org.eclipse.birt.report.model.api.DesignFileException
fileName
- Design file nameis
- InputStream of this design file
org.eclipse.birt.report.model.api.DesignFileException
- if any exception.protected void openDesign(java.lang.String fileName, java.io.InputStream is, java.util.Locale locale) throws org.eclipse.birt.report.model.api.DesignFileException
fileName
- the design file nameis
- the input stream of the design file.locale
- the user locale.
org.eclipse.birt.report.model.api.DesignFileException
- if any exception.protected boolean compareTextFile(java.lang.String goldenFileName, java.lang.String outputFileName) throws java.lang.Exception
goldenFileName
- the 1st file name to be compared.outputFileName
- the 2nd file name to be compared.
java.lang.Exception
- if any exception.protected boolean compareTextFileAsResource(java.lang.Class theClass, java.lang.String goldenFileName, java.lang.String outputFileName) throws java.lang.Exception
goldenFileName
- the golden file name. The golden file should be located with
class loader.outputFileName
- the output file name. The output file should be in temperary
directory of Java VM.
java.lang.Exception
- if any exception.protected void printSemanticErrors()
protected void printSemanticError(org.eclipse.birt.report.model.elements.ReportDesign design)
design
- report designprotected void printSyntaxError(org.eclipse.birt.report.model.api.DesignFileException e)
e
- DesignFileException
containing syntax error
list.protected void dumpErrors(java.lang.String filename) throws java.lang.Exception
filename
- the file name into which the error will be dumped.
java.lang.Exception
- if any exception.protected void saveAs(java.lang.String filename) throws java.io.IOException
ReportDesignHandle.saveAs(String)
to save the output file of some
unit test. The output test file will be saved in the folder of 'output'
under the folder where the unit test java source file locates, so before
calling ReportDesignHandle.saveAs(String)
, the file name will be
modified to include the path information. For example, in a unit test
class, it can call saveAs( "PropertyCommandTest.out" ).
filename
- the test output file to be saved.
java.io.IOException
- if error occurs while saving the file.protected void saveAsInTempDir(java.lang.String filename) throws java.io.IOException
filename
- the new file name to save
java.io.IOException
- if any exceptionprotected java.lang.String getClassFolder()
protected java.lang.String getFullQualifiedClassName()
protected void compareErrors(java.lang.String filename) throws java.lang.Exception
filename
- the golden file name which contains the error messages.
java.lang.Exception
- if any exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |