|
|||||||||
| 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.apache.derbyTesting.junit.BaseTestCase
org.apache.derbyTesting.junit.BaseJDBCTestCase
org.apache.derbyTesting.functionTests.tests.lang.TriggerTest
public class TriggerTest
Test triggers.
| Field Summary | |
|---|---|
private static java.lang.ThreadLocal |
TRIGGER_INFO
Thread local that a trigger can access to allow recording information about the firing. |
| Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase |
|---|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE |
| Constructor Summary | |
|---|---|
TriggerTest(java.lang.String name)
|
|
| Method Summary | |
|---|---|
private void |
actionTypesCompareMainToAction(int actionCount,
java.lang.String type)
Compare the contents of the main table to the action table. |
private void |
actionTypesCompareMainToActionForUpdate(java.lang.String type,
int id)
Compare the values for an update trigger. |
private void |
actionTypesDeleteTest(java.lang.String type)
Test deletes with the specified types in the action statement. |
private void |
actionTypesInsertTest(java.lang.String type)
Execute three insert statements. |
private void |
actionTypesSetup(java.lang.String type)
Setup the tables and triggers for a single type for actionTypeTest |
private void |
actionTypesUpdateTest(java.lang.String type)
Test updates of the specified types in the action statement. |
private void |
actionTypeTest(java.lang.String type)
Test that the action statement of a trigger can work with a specific datatype. |
private int |
assertFiringOrder(java.lang.String iud,
int modifiedRowCount)
Look at the ordered information in the thread local and ensure it reflects correct sequenceing of triggers created in testFiringOrder. |
private int |
assertFiringOrder(java.lang.String iud,
int modifiedRowCount,
boolean noAfter)
|
private void |
assertInputStreamContents(java.io.InputStream is,
int size,
byte expectedValue)
|
private void |
assertReaderContents(java.io.Reader r,
int size,
char expectedCharValue)
|
private int[] |
createRandomTriggers()
|
static java.lang.Object |
getRandomValue(java.util.Random r,
int jdbcType,
int precision)
Generate a random object (never null) for a given JDBC type. |
protected void |
initializeConnection(java.sql.Connection conn)
Allow a sub-class to initialize a connection to provide consistent connection state for its tests. |
static void |
logTriggerInfo(java.lang.String info)
Record the trigger information in the thread local. |
private byte[] |
makeArray(int size,
byte b)
|
private char[] |
makeArray(int size,
char c)
|
private java.io.CharArrayReader |
makeCharArrayReader(char c,
int size)
Make a CharArrayReader |
private static byte[] |
randomBinary(java.util.Random r,
int len)
|
private static java.lang.String |
randomString(java.util.Random r,
int len)
|
static void |
setRandomValue(java.util.Random r,
java.sql.PreparedStatement ps,
int column,
int jdbcType,
int precision)
|
protected void |
setUp()
|
static junit.framework.Test |
suite()
Run only in embedded as TRIGGERs are server side logic. |
protected void |
tearDown()
Tear down this fixture, sub-classes should call super.tearDown(). |
void |
testBlobInTriggerTable()
Test for DERBY-3238 trigger fails with IOException if triggering table has large lob. |
private void |
testBlobInTriggerTable(int blobSize)
Create a table with after update trigger on non-lob column. |
void |
testClobInTriggerTable()
Test for DERBY-3238 trigger fails with IOException if triggering table has large lob. |
private void |
testClobInTriggerTable(int clobSize)
Create a table with after update trigger on non-lob column. |
void |
testDerby4095NewTriggerRows()
Test that a nested loop join that accesses the TriggerNewTransitionRowsVTI can reopen the ResultSet properly when it re-executes. |
void |
testDerby4095OldTriggerRows()
Test that a nested loop join that accesses the TriggerOldTransitionRowsVTI can reopen the ResultSet properly when it re-executes. |
void |
testFiringConstraintOrder()
Test that a order of firing is before triggers, constraint checking and after triggers. |
void |
testFiringOrder()
Test the firing order of triggers. |
void |
testNPEinTriggerFire()
Test for DERBY-3718 NPE when a trigger is fired |
void |
testTypesInActionStatement()
Test that the action statement of a trigger can work with all datatypes. |
void |
testUpdateTriggerOnClobColumn()
|
| Methods inherited from class org.apache.derbyTesting.junit.BaseTestCase |
|---|
alarm, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertSecurityManager, assertThrowableEquals, execJavaCmd, fail, getFailureFolder, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeSystemProperty, runBare, setSystemProperty, traceit |
| Methods inherited from class junit.framework.TestCase |
|---|
countTestCases, createResult, getName, run, run, 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 |
|---|
private static java.lang.ThreadLocal TRIGGER_INFO
| Constructor Detail |
|---|
public TriggerTest(java.lang.String name)
| Method Detail |
|---|
public static junit.framework.Test suite()
protected void initializeConnection(java.sql.Connection conn)
throws java.sql.SQLException
BaseJDBCTestCase
initializeConnection in class BaseJDBCTestCaseconn - Connection to be intialized
java.sql.SQLException - Error setting the initial state.
protected void setUp()
throws java.lang.Exception
setUp in class junit.framework.TestCasejava.lang.Exception
protected void tearDown()
throws java.lang.Exception
BaseJDBCTestCase
tearDown in class BaseJDBCTestCasejava.lang.Exception
public void testFiringOrder()
throws java.sql.SQLException
java.sql.SQLException
private int[] createRandomTriggers()
throws java.sql.SQLException
java.sql.SQLException
public void testFiringConstraintOrder()
throws java.sql.SQLException
java.sql.SQLException
private int assertFiringOrder(java.lang.String iud,
int modifiedRowCount)
iud -
private int assertFiringOrder(java.lang.String iud,
int modifiedRowCount,
boolean noAfter)
public static void logTriggerInfo(java.lang.String info)
info - trigger information
public void testNPEinTriggerFire()
throws java.sql.SQLException
java.sql.SQLException
java.io.IOException
public void testClobInTriggerTable()
throws java.sql.SQLException,
java.io.IOException
java.sql.SQLException
java.io.IOException
private void testClobInTriggerTable(int clobSize)
throws java.sql.SQLException,
java.io.IOException
clobSize - size of clob to test
java.sql.SQLException
java.io.IOException
private char[] makeArray(int size,
char c)
private byte[] makeArray(int size,
byte b)
public void testBlobInTriggerTable()
throws java.sql.SQLException,
java.io.IOException
java.sql.SQLException
java.io.IOException
private void testBlobInTriggerTable(int blobSize)
throws java.sql.SQLException,
java.io.IOException
blobSize - size of blob to test.
java.sql.SQLException
java.io.IOException
private void assertInputStreamContents(java.io.InputStream is,
int size,
byte expectedValue)
throws java.io.IOException
java.io.IOException
public void testUpdateTriggerOnClobColumn()
throws java.sql.SQLException,
java.io.IOException
java.sql.SQLException
java.io.IOException
private void assertReaderContents(java.io.Reader r,
int size,
char expectedCharValue)
throws java.io.IOException
java.io.IOException
private java.io.CharArrayReader makeCharArrayReader(char c,
int size)
c - character to repeatsize - size of array
public void testTypesInActionStatement()
throws java.sql.SQLException,
java.io.IOException
java.sql.SQLException
java.io.IOException
private void actionTypeTest(java.lang.String type)
throws java.sql.SQLException,
java.io.IOException
type - SQL type to be tested
java.sql.SQLException
java.io.IOException
private void actionTypesSetup(java.lang.String type)
throws java.sql.SQLException
java.sql.SQLException
private void actionTypesInsertTest(java.lang.String type)
throws java.sql.SQLException,
java.io.IOException
type -
java.sql.SQLException
java.io.IOException
private void actionTypesUpdateTest(java.lang.String type)
throws java.sql.SQLException,
java.io.IOException
type -
java.sql.SQLException
java.io.IOException
private void actionTypesCompareMainToActionForUpdate(java.lang.String type,
int id)
throws java.sql.SQLException,
java.io.IOException
type - id -
java.sql.SQLException
java.io.IOException
private void actionTypesDeleteTest(java.lang.String type)
throws java.sql.SQLException,
java.io.IOException
type -
java.sql.SQLException
java.io.IOException
private void actionTypesCompareMainToAction(int actionCount,
java.lang.String type)
throws java.sql.SQLException,
java.io.IOException
actionCount - type -
java.sql.SQLException
java.io.IOException
public static void setRandomValue(java.util.Random r,
java.sql.PreparedStatement ps,
int column,
int jdbcType,
int precision)
throws java.sql.SQLException,
java.io.IOException
java.sql.SQLException
java.io.IOException
public static java.lang.Object getRandomValue(java.util.Random r,
int jdbcType,
int precision)
throws java.io.IOException
Caller should check the return type using instanceof and use setCharacterStream() for Reader objects and setBinaryStream for InputStreams. (work in progress)
java.io.IOException
private static byte[] randomBinary(java.util.Random r,
int len)
private static java.lang.String randomString(java.util.Random r,
int len)
public void testDerby4095OldTriggerRows()
throws java.sql.SQLException
java.sql.SQLException
public void testDerby4095NewTriggerRows()
throws java.sql.SQLException
java.sql.SQLException
|
Built on Sat 2009-11-28 18:44:18-0800, from revision 885187 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||