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, usingEmbedded
alarm, 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, vmAtLeast
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, toString
private 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.TestCase
java.lang.Exception
public void tearDown() throws java.lang.Exception
BaseJDBCTestCase
tearDown
in class BaseJDBCTestCase
java.lang.Exception
public void testDefault() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testFile() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testWrongFile() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testMethod() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testWrongMethod() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testField() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testWrongField() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testFileOverMethod() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testFileOverField() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testFileOverMethodAndField() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testMethodOverField() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testStyleRollingFile() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testWrongStyle() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testDefaultRollingDefaultConfig() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testDefaultRollingUserConfig() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testRollingFileStyleOverFile() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testRollingFileStyleOverMethod() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testRollingFileStyleOverField() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public static java.io.OutputStream getStream()
private static java.lang.String makeStreamFilename(java.lang.String type)
private void openStreams() throws java.io.IOException
java.io.IOException
private void closeStreams() throws java.io.IOException
java.io.IOException
private static void assertNotDirectory(java.io.File f) throws java.io.IOException
java.io.IOException
private static void assertIsEmpty(java.io.File f) throws java.io.IOException
java.io.IOException
private static void assertNotEmpty(java.io.File f) throws java.io.IOException
java.io.IOException
private static void assertFileSize(java.io.File f, int size) throws java.io.IOException
java.io.IOException
private static void assertIsExisting(java.io.File f) throws java.io.IOException
java.io.IOException
private static void assertNotExisting(java.io.File f) throws java.io.IOException
java.io.IOException
private static boolean deleteFile(java.io.File f)
private static java.lang.String getCanonicalPath(java.io.File f) throws java.io.IOException
java.io.IOException
private static void makeDirIfNotExisting(java.lang.String filename)
private static java.io.FileOutputStream newFileOutputStream(java.io.File f) throws java.io.FileNotFoundException
java.io.FileNotFoundException
private static void resetProps()
private void deleteStreamFiles()
private void nullFields()
private void bootDerby() throws java.sql.SQLException
java.sql.SQLException
public 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 BaseJDBCTestCase
java.lang.Throwable
private void copyFileToFail(java.lang.String origFileName) throws java.io.IOException
java.io.IOException
private void deleteFile(java.lang.String origFileName) throws java.io.IOException
java.io.IOException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.