|
|||||||||
| 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.jdbc4.BlobTest
public class BlobTest
| Field Summary | |
|---|---|
private java.sql.Blob |
blob
Default Blob object used by the tests. |
private static ExemptBlobMD[] |
emd
|
private java.util.HashMap<java.lang.reflect.Method,ExemptBlobMD> |
excludedMethodSet
|
private static java.lang.String |
LOCK_TIMEOUT
|
| Fields inherited from class org.apache.derbyTesting.junit.BaseTestCase |
|---|
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE |
| Constructor Summary | |
|---|---|
BlobTest(java.lang.String name)
Create the test with the given name. |
|
| Method Summary | |
|---|---|
(package private) void |
buildHashSet()
Builds the HashSet which will be used to test whether the given methods can be exempted or not |
(package private) void |
buildMethodList(java.lang.Object LOB)
|
(package private) boolean |
checkIfExempted(java.lang.reflect.Method m)
Checks if the method throws a SQLFeatureNotSupportedException |
(package private) boolean |
checkIfMethodThrowsSQLException(java.lang.Object LOB,
java.lang.reflect.Method method)
Checks if the invocation of the method throws a SQLExceptio as expected. |
private void |
executeParallelUpdate(int id,
boolean timeoutExpected)
Try to update the row with the given error. |
static int |
getLastByteInStream(java.io.InputStream is,
int expectedCount)
Drains the stream and returns the last byte read from the stream. |
(package private) java.lang.Object |
getNullValueForType(java.lang.Class type)
|
(package private) java.lang.Object[] |
getNullValues(java.lang.Class<?>[] params)
|
private int |
initializeLongBlob()
Insert a row with a large blob into the test table. |
void |
setUp()
|
static junit.framework.Test |
suite()
Create test suite for this test. |
protected void |
tearDown()
Tear down this fixture, sub-classes should call super.tearDown(). |
void |
testFreeandMethodsAfterCallingFree()
Tests the implementation for the free() method in the Blob interface. |
void |
testGetBinaryStreamBlobUpdates()
Tests that the data updated in a Blob is always reflected in the InputStream got. |
void |
testGetBinaryStreamCreateBlob()
Tests that the InputStream got from a empty Blob reflects new data in the underlying Blob. |
void |
testGetBinaryStreamLong()
Tests the implementation of the method getBinaryStream(long pos, long length). |
void |
testGetBinaryStreamLongDrain()
Tests that draining a "sub-stream" from the Blob works. |
void |
testGetBinaryStreamLongExceptionConditions()
Tests the exceptions thrown by the getBinaryStream (long pos, long length) for the following conditions a) pos <= 0 b) pos > (length of LOB) c) length < 0 d) pos + length > (length of LOB). |
void |
testGetBinaryStreamLongLastByte()
Obtains a binary stream and tries to drain it to read the last byte in the Blob. |
void |
testLockingAfterFree()
Test that a lock held on the corresponding row is released when free() is called on the Blob object. |
void |
testLockingAfterFreeWithDirtyReads()
Test that a lock held on the corresponding row is released when free() is called on the Blob object if the isolation level is Read Uncommitted |
void |
testLockingAfterFreeWithRR()
Test that a lock held on the corresponding row is NOT released when free() is called on the Blob object if the isolation level is Repeatable Read |
void |
testSetBytesReturnValueLarge()
Tests the return count on insertion when the Blob is represented as a temporary file on disk. |
void |
testSetBytesReturnValueLargeStateChange()
Tests the return count on insertion when the Blob is fetched from the database and then modified. |
void |
testSetBytesReturnValueSmall()
Tests the return count on insertion when the Blob is represented as a byte array in memory. |
static void |
transferAlphabetData(java.io.OutputStream writer,
long length)
Transfers the specified number of bytes generated from the modern latin alphabet (lowercase) to the destination stream. |
| 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 java.sql.Blob blob
private static final ExemptBlobMD[] emd
private java.util.HashMap<java.lang.reflect.Method,ExemptBlobMD> excludedMethodSet
private static final java.lang.String LOCK_TIMEOUT
| Constructor Detail |
|---|
public BlobTest(java.lang.String name)
name - name of the test.| Method Detail |
|---|
public void setUp()
throws java.sql.SQLException
setUp in class junit.framework.TestCasejava.sql.SQLException
protected void tearDown()
throws java.lang.Exception
BaseJDBCTestCase
tearDown in class BaseJDBCTestCasejava.lang.Exceptionvoid buildHashSet()
public void testFreeandMethodsAfterCallingFree()
throws java.sql.SQLException
java.sql.SQLException - if an error occurs during releasing
the Blob resourcesvoid buildMethodList(java.lang.Object LOB)
boolean checkIfExempted(java.lang.reflect.Method m)
m - The method object that needs to be verified to see if it
is exempted
boolean checkIfMethodThrowsSQLException(java.lang.Object LOB,
java.lang.reflect.Method method)
LOB - the Object that implements the Blob interfacemethod - the method that needs to be tested to ensure
that it throws the correct exception
java.lang.Object[] getNullValues(java.lang.Class<?>[] params)
java.lang.Object getNullValueForType(java.lang.Class type)
public void testGetBinaryStreamLong()
throws java.lang.Exception
java.lang.Exception
public void testGetBinaryStreamLongLastByte()
throws java.io.IOException,
java.sql.SQLException
See DERBY-4060.
java.io.IOException - if reading from a stream fails
java.sql.SQLException - if something goes wrong
public void testGetBinaryStreamLongExceptionConditions()
throws java.sql.SQLException
SQLException.
java.sql.SQLException
public void testGetBinaryStreamLongDrain()
throws java.io.IOException,
java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testGetBinaryStreamCreateBlob()
throws java.lang.Exception
java.lang.Exception
public void testGetBinaryStreamBlobUpdates()
throws java.lang.Exception
java.lang.Exception
public void testSetBytesReturnValueSmall()
throws java.sql.SQLException
java.sql.SQLException
public void testSetBytesReturnValueLarge()
throws java.io.IOException,
java.sql.SQLException
java.io.IOException
java.sql.SQLException
public void testSetBytesReturnValueLargeStateChange()
throws java.io.IOException,
java.sql.SQLException
The main point for this test is to provoke the transition from a
read-only internal representation to a writable representation.
For a Blob of "considerable" size, this involved going from a store
stream representation to a LOBStreamControl representation using
a temporary file.
java.io.IOException
java.sql.SQLException
public void testLockingAfterFree()
throws java.sql.SQLException
java.sql.SQLException
public void testLockingAfterFreeWithRR()
throws java.sql.SQLException
java.sql.SQLException
public void testLockingAfterFreeWithDirtyReads()
throws java.sql.SQLException
java.sql.SQLException
private int initializeLongBlob()
throws java.sql.SQLException
blob.
java.sql.SQLException
private void executeParallelUpdate(int id,
boolean timeoutExpected)
throws java.sql.SQLException
id - The id of the row to be updatedtimeoutExpected - true if it is expected that the update times out
java.sql.SQLException
public static void transferAlphabetData(java.io.OutputStream writer,
long length)
throws java.io.IOException
writer - the destinationlength - number of bytes to write
java.io.IOException - if writing to the destination stream fails
public static int getLastByteInStream(java.io.InputStream is,
int expectedCount)
throws java.io.IOException
is - stream to drainexpectedCount - expected number of bytes (remaining) in the stream
java.lang.AssertionError - if there are too many/few bytes in the stream
java.io.IOException - if reading from the stream failspublic static junit.framework.Test suite()
|
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 | ||||||||