public class ErrorStreamTest extends BaseJDBCTestCase
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
DERBY_0_LOG |
private static java.lang.String |
DERBYLANGUAGELOG_QUERY_PLAN |
private java.io.OutputStream |
errStream
Field errStream used as redirection for System.err to be able
to checks its (non-)use in the scenarios.
|
private java.io.File |
errStreamFile |
private static java.lang.String |
FIELD_PROP |
static java.io.OutputStream |
fieldStream
Field fieldStream used by Derby when FIELD_PROP is set,
so it needs to be public and static.
|
private java.io.File |
fieldStreamFile |
private static java.lang.String |
FILE_PROP |
private java.io.File |
fileStreamFile
File used when FILE_PROP is set, it maps to file
|
private static java.lang.String |
LOGFILESDIR |
private static java.lang.String |
METHOD_PROP |
private static java.io.OutputStream |
methodStream
See doc for getStream() below.
|
private java.io.File |
methodStreamFile |
private static java.lang.String |
ROLLING_FILE_COUNT_PROP |
private static java.lang.String |
ROLLING_FILE_LIMIT_PROP |
private static java.lang.String |
ROLLING_FILE_PATTERN_PROP |
private static java.lang.String |
ROLLING_FILE_STYLE |
private static int |
runNo
runNo keeps track of which run we are in to generate unique (within a
JUnit run) names for files that are used in the test.
|
private static java.lang.String |
STYLE_PROP |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE| Constructor and Description |
|---|
ErrorStreamTest(java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
private static void |
assertFileSize(java.io.File f,
int size) |
private static void |
assertIsEmpty(java.io.File f) |
private static void |
assertIsExisting(java.io.File f) |
private static void |
assertNotDirectory(java.io.File f) |
private static void |
assertNotEmpty(java.io.File f) |
private static void |
assertNotExisting(java.io.File f) |
private void |
bootDerby() |
private void |
closeStreams() |
private void |
copyFileToFail(java.lang.String origFileName) |
private static boolean |
deleteFile(java.io.File f) |
private void |
deleteFile(java.lang.String origFileName) |
private void |
deleteStreamFiles() |
private static java.lang.String |
getCanonicalPath(java.io.File f) |
static java.io.OutputStream |
getStream()
Method getStream used by Derby when derby.stream.error.method
is set.
|
private static void |
makeDirIfNotExisting(java.lang.String filename) |
private static java.lang.String |
makeStreamFilename(java.lang.String type) |
private static java.io.FileOutputStream |
newFileOutputStream(java.io.File f) |
private void |
nullFields() |
private void |
openStreams() |
private static void |
resetProps() |
void |
runBareOverridable()
Run the bare test, including
setUp() and tearDown(). |
void |
setUp() |
static junit.framework.Test |
suite() |
void |
tearDown()
Tear down this fixture, sub-classes should call
super.tearDown().
|
void |
testDefault()
Test that the error stream file (derby.log) is created at database boot
and not deleted when the database is shut down, but can be deleted
afterwards.
|
void |
testDefaultRollingDefaultConfig()
Test the derby.stream.error.style=rollingFile property with default config
|
void |
testDefaultRollingUserConfig()
Test the derby.stream.error.style=rollingFile property with user configuration.
|
void |
testField()
Test the derby.stream.error.field property.
|
void |
testFile()
Test the derby.stream.error.file property.
|
void |
testFileOverField()
Test that the derby.stream.error.file property overrides the
derby.stream.error.field property.
|
void |
testFileOverMethod()
Test that the derby.stream.error.file property overrides the
derby.stream.error.method property.
|
void |
testFileOverMethodAndField()
Test that the derby.stream.error.file property overrides the
derby.stream.error.method and the derby.stream.error.field property.
|
void |
testMethod()
Test the derby.stream.error.method property.
|
void |
testMethodOverField()
Test that the derby.stream.error.field property overrides the
derby.stream.error.method property.
|
void |
testRollingFileStyleOverField()
Test that the derby.stream.error.style property overrides the
derby.stream.error.field property.
|
void |
testRollingFileStyleOverFile()
Test that the derby.stream.error.style property overrides the
derby.stream.error.file property.
|
void |
testRollingFileStyleOverMethod()
Test that the derby.stream.error.style property overrides the
derby.stream.error.method property.
|
void |
testStyleRollingFile()
Test the derby.stream.error.style=rollingFile property.
|
void |
testWrongField()
Test the derby.stream.error.field property with wrong input.
|
void |
testWrongFile()
Test the derby.stream.error.file property with wrong input.
|
void |
testWrongMethod()
Test the derby.stream.error.method property with wrong input.
|
void |
testWrongStyle()
Test the derby.stream.error.style property with wrong style.
|
assertCallError, assertCheckTable, assertCommitError, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertResults, assertResults, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, chattyPrepare, chattyPrepareCall, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, dumpRs, dumpRs, emptyStatementCache, executeQuery, expectCompilationError, expectCompilationError, expectExecutionError, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, goodStatement, goodUpdate, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runScript, runScript, runSQLCommands, setAutoCommit, usingDB2Client, usingDerbyNetClient, usingEmbeddedalarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSameNullness, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit, vmAtLeastassertEquals, 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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, toStringprivate static final java.lang.String FILE_PROP
private static final java.lang.String METHOD_PROP
private static final java.lang.String FIELD_PROP
private static final java.lang.String STYLE_PROP
private static final java.lang.String ROLLING_FILE_STYLE
private static final java.lang.String ROLLING_FILE_COUNT_PROP
private static final java.lang.String ROLLING_FILE_LIMIT_PROP
private static final java.lang.String ROLLING_FILE_PATTERN_PROP
private static final java.lang.String DERBY_0_LOG
private static final java.lang.String DERBYLANGUAGELOG_QUERY_PLAN
private static final java.lang.String LOGFILESDIR
private static int runNo
private java.io.File fileStreamFile
private static java.io.OutputStream methodStream
private java.io.File methodStreamFile
public static java.io.OutputStream fieldStream
private java.io.File fieldStreamFile
private java.io.OutputStream errStream
private java.io.File errStreamFile
public static junit.framework.Test suite()
public void setUp()
throws java.lang.Exception
setUp in class junit.framework.TestCasejava.lang.Exceptionpublic void tearDown()
throws java.lang.Exception
BaseJDBCTestCasetearDown in class BaseJDBCTestCasejava.lang.Exceptionpublic void testDefault()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testFile()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testWrongFile()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testMethod()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testWrongMethod()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testField()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testWrongField()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testFileOverMethod()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testFileOverField()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testFileOverMethodAndField()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testMethodOverField()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testStyleRollingFile()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testWrongStyle()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testDefaultRollingDefaultConfig()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testDefaultRollingUserConfig()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testRollingFileStyleOverFile()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testRollingFileStyleOverMethod()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void testRollingFileStyleOverField()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic static java.io.OutputStream getStream()
private static java.lang.String makeStreamFilename(java.lang.String type)
private void openStreams()
throws java.io.IOException
java.io.IOExceptionprivate void closeStreams()
throws java.io.IOException
java.io.IOExceptionprivate static void assertNotDirectory(java.io.File f)
throws java.io.IOException
java.io.IOExceptionprivate static void assertIsEmpty(java.io.File f)
throws java.io.IOException
java.io.IOExceptionprivate static void assertNotEmpty(java.io.File f)
throws java.io.IOException
java.io.IOExceptionprivate static void assertFileSize(java.io.File f,
int size)
throws java.io.IOException
java.io.IOExceptionprivate static void assertIsExisting(java.io.File f)
throws java.io.IOException
java.io.IOExceptionprivate static void assertNotExisting(java.io.File f)
throws java.io.IOException
java.io.IOExceptionprivate static boolean deleteFile(java.io.File f)
private static java.lang.String getCanonicalPath(java.io.File f)
throws java.io.IOException
java.io.IOExceptionprivate static void makeDirIfNotExisting(java.lang.String filename)
private static java.io.FileOutputStream newFileOutputStream(java.io.File f)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionprivate static void resetProps()
private void deleteStreamFiles()
private void nullFields()
private void bootDerby()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void runBareOverridable()
throws java.lang.Throwable
Run the bare test, including setUp() and tearDown().
This is overriding BaseJDBCTestCase.runBareOverridable and thereby BaseJDBCTestCase.runBare(), so we can copy any log files created by this test if any of the fixtures fail.
runBareOverridable in class BaseJDBCTestCasejava.lang.Throwableprivate void copyFileToFail(java.lang.String origFileName)
throws java.io.IOException
java.io.IOExceptionprivate void deleteFile(java.lang.String origFileName)
throws java.io.IOException
java.io.IOExceptionApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.