|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase org.eigenbase.test.DiffTestCase net.sf.farrago.test.ResultSetTestCase net.sf.farrago.test.FarragoTestCase
public abstract class FarragoTestCase
FarragoTestCase is a common base for Farrago JUnit tests. Subclasses must implement the suite() method in order to get a database connection correctly initialized. See FarragoQueryTest for an example.
For SQL tests, FarragoTestCase writes the output from sqlline to a file
called <testname>.log
, and compares that output
with a reference log file <testname>.ref
.
It is also possible to have additional logfiles, for tests which generate output to files. FarragoTestCase scans the input .sql file for lines of the form
##COMPARE <file>.log
and for each such command, it compares file.log with file.ref.
Nested Class Summary | |
---|---|
static class |
FarragoTestCase.Cleanup
Helper for staticSetUp. |
static class |
FarragoTestCase.CleanupFactory
CleanupFactory is a factory for Cleanup objects. |
private static class |
FarragoTestCase.ReplacingOutputStream
Stream which applies regular expression replacement to its contents. |
private static class |
FarragoTestCase.ShutdownThread
|
Field Summary | |
---|---|
protected FarragoCompoundAllocation |
allocOwner
An owner for any heavyweight allocations. |
private static int |
connCounter
Connection counter for distinguishing connections during debug. |
protected static Connection |
connection
JDBC connection to Farrago database. |
private static boolean |
individualTest
Flag used to allow individual test methods to be called from IntelliJ. |
protected PreparedStatement |
preparedStmt
PreparedStatement for processing queries. |
protected static FarragoRepos |
repos
Repos for test object definitions. |
private static SortedMap<String,Object> |
savedFarragoConfig
Saved copy of Farrago configuration parameters. |
private static SortedMap<String,Object> |
savedFennelConfig
Saved copy of Fennel configuration parameters. |
private static Thread |
shutdownHook
|
protected Statement |
stmt
Statement for processing queries. |
protected static Logger |
tracer
Logger to use for test tracing. |
Fields inherited from class net.sf.farrago.test.ResultSetTestCase |
---|
resultSet |
Fields inherited from class org.eigenbase.test.DiffTestCase |
---|
logFile, logOutputStream, refFile |
Constructor Summary | |
---|---|
protected |
FarragoTestCase(String testName)
Creates a new FarragoTestCase object. |
Method Summary | |
---|---|
static void |
forceShutdown()
|
protected static String |
getJdbcUri(FarragoAbstractJdbcDriver driver)
|
protected static FarragoSession |
getSession()
|
protected File |
getTestlogRoot()
|
static File |
getTestlogRootStatic()
Implementation for { @link DiffTestCase#getTestlogRoot } which uses 'testlog' directory under Farrago home. |
protected static Connection |
newConnection()
|
protected static FarragoAbstractJdbcDriver |
newJdbcEngineDriver()
Retrieves a new instance of the FarragoJdbcEngineDriver configured for this test. |
protected static void |
restoreParameters()
Restores system parameters to state saved by saveParameters(). |
protected static void |
restoreParameters(FarragoRepos repos)
|
private static void |
rollbackIfSupported()
|
protected static void |
runCleanup()
|
protected void |
runSqlLineTest(String sqlFile)
|
protected void |
runSqlLineTest(String sqlFile,
boolean shouldDiff)
|
protected static void |
saveParameters()
Saves system parameters. |
protected static void |
saveParameters(FarragoRepos repos)
|
protected void |
setRefFileDiffMasks()
Sets the diff masks that are common to .REF files |
protected void |
setUp()
|
protected boolean |
shouldDiff()
|
static void |
staticSetUp()
One-time setup routine. |
static void |
staticTearDown()
One-time tear-down routine. |
protected void |
tearDown()
|
protected void |
tearDownImpl()
|
static Test |
wrappedSuite(Class<? extends TestCase> clazz)
Generic implementation of suite() to be called by subclasses. |
static Test |
wrappedSuite(TestSuite suite)
Generic implementation of suite() to be called by subclasses. |
Methods inherited from class net.sf.farrago.test.ResultSetTestCase |
---|
compareResultList, compareResultLists, compareResultSet, compareResultSetWithDelta, compareResultSetWithPattern, getResultSetCount |
Methods inherited from class org.eigenbase.test.DiffTestCase |
---|
addDiffMask, addIgnorePattern, diffFile, diffLines, diffTestLog, fileContents, openTestLog, openTestLogOutputStream, setGC, setVerbose |
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, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final Logger tracer
protected static Connection connection
protected static FarragoRepos repos
private static boolean individualTest
private static SortedMap<String,Object> savedFarragoConfig
private static SortedMap<String,Object> savedFennelConfig
private static Thread shutdownHook
private static int connCounter
newConnection()
protected PreparedStatement preparedStmt
protected Statement stmt
protected FarragoCompoundAllocation allocOwner
Constructor Detail |
---|
protected FarragoTestCase(String testName) throws Exception
testName
- .
Exception
- .Method Detail |
---|
protected File getTestlogRoot() throws Exception
getTestlogRoot
in class DiffTestCase
Exception
public static File getTestlogRootStatic()
public static void staticSetUp() throws Exception
Exception
- .protected static void runCleanup() throws Exception
Exception
public static void staticTearDown() throws Exception
Exception
- .protected static FarragoSession getSession()
private static void rollbackIfSupported() throws SQLException
SQLException
protected static Connection newConnection() throws Exception
Exception
public static void forceShutdown() throws Exception
Exception
protected static void saveParameters()
protected static void restoreParameters()
protected static void saveParameters(FarragoRepos repos)
protected static void restoreParameters(FarragoRepos repos)
public static Test wrappedSuite(Class<? extends TestCase> clazz)
clazz
- the subclass being wrapped
public static Test wrappedSuite(TestSuite suite)
If the SaffronProperties.testEverything
property is false, and
the SaffronProperties.testName
property is set, then returns a
suite containing only the tests whose names match.
suite
- the suite being wrapped
protected void setUp() throws Exception
setUp
in class DiffTestCase
Exception
protected void tearDown() throws Exception
tearDown
in class DiffTestCase
Exception
protected void tearDownImpl() throws Exception
Exception
protected static FarragoAbstractJdbcDriver newJdbcEngineDriver() throws Exception
Exception
protected static String getJdbcUri(FarragoAbstractJdbcDriver driver) throws Exception
Exception
protected void runSqlLineTest(String sqlFile) throws Exception
Exception
protected void runSqlLineTest(String sqlFile, boolean shouldDiff) throws Exception
Exception
protected boolean shouldDiff()
protected void setRefFileDiffMasks()
DiffTestCase
setRefFileDiffMasks
in class DiffTestCase
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |