public class Derby2017LayerBTest extends BaseJDBCTestCase
IOException
don't
insert data into the database when they shouldn't.
The test uses various combinations of auto-commit and rollback.
Modifier and Type | Class and Description |
---|---|
private static class |
Derby2017LayerBTest.FailingInputStream
Simple and non-conforming input stream that will fail after a
specified number of bytes read.
|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
Derby2017LayerBTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
private void |
doInsertTest(byte[][] INSERT,
java.lang.String[][] MASTER,
boolean autoCommit,
boolean rollbackOnError)
Performs the base test cycle; insert 3 valid rows, try to insert 2
invalid rows, insert 2 valid rows.
|
private void |
doInsertTest(java.lang.String[] INSERT,
java.lang.String[][] MASTER,
boolean autoCommit,
boolean rollbackOnError)
Performs the base test cycle; insert 3 valid rows, try to insert 2
invalid rows, insert 2 valid rows.
|
static junit.framework.Test |
suite()
Returns a suite running the test with both the client driver and the
embedded driver.
|
void |
testFailedStreamInsertBinary() |
void |
testFailedStreamInsertBinaryAutoCommit() |
void |
testFailedStreamInsertBinaryAutoCommitRollbackOnError() |
void |
testFailedStreamInsertBinaryRollbackOnError() |
void |
testFailedStreamInsertChar() |
void |
testFailedStreamInsertCharAutoCommit() |
void |
testFailedStreamInsertCharAutoCommitRollbackOnError() |
void |
testFailedStreamInsertCharBufferBoundariesImpl()
Attempt to insert data with failing streams of various lengths.
|
void |
testFailedStreamInsertCharRollbackOnError() |
void |
testStreamInsertCharBufferBoundary() |
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, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, 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, setUp, toString
public static junit.framework.Test suite()
public void testStreamInsertCharBufferBoundary() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testFailedStreamInsertCharBufferBoundariesImpl() throws java.io.IOException, java.sql.SQLException
None of the inserts should be successful, as an IOException
is
thrown by all of the streams.
java.io.IOException
java.sql.SQLException
public void testFailedStreamInsertChar() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testFailedStreamInsertCharAutoCommit() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testFailedStreamInsertCharRollbackOnError() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testFailedStreamInsertCharAutoCommitRollbackOnError() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testFailedStreamInsertBinary() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testFailedStreamInsertBinaryAutoCommit() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testFailedStreamInsertBinaryRollbackOnError() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testFailedStreamInsertBinaryAutoCommitRollbackOnError() throws java.io.IOException, java.sql.SQLException
java.io.IOException
java.sql.SQLException
private void doInsertTest(java.lang.String[] INSERT, java.lang.String[][] MASTER, boolean autoCommit, boolean rollbackOnError) throws java.io.IOException, java.sql.SQLException
The outcome depends on whether auto-commit is on, and whether a rollback is issued when an insert fails.
INSERT
- the data to insertMASTER
- the expected outcomeautoCommit
- the auto-commit state to userollbackOnError
- whether or not to issue a rollback if an insert
failsjava.io.IOException
- if something goes wrongjava.sql.SQLException
- if something goes wrongprivate void doInsertTest(byte[][] INSERT, java.lang.String[][] MASTER, boolean autoCommit, boolean rollbackOnError) throws java.io.IOException, java.sql.SQLException
The outcome depends on whether auto-commit is on, and whether a rollback is issued when an insert fails.
INSERT
- the data to insertMASTER
- the expected outcomeautoCommit
- the auto-commit state to userollbackOnError
- whether or not to issue a rollback if an insert
failsjava.io.IOException
- if something goes wrongjava.sql.SQLException
- if something goes wrongApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.