org.apache.derbyTesting.functionTests.tests.jdbc4
Class BlobClobTestSetup

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.extensions.TestDecorator
          extended by junit.extensions.TestSetup
              extended by org.apache.derbyTesting.junit.BaseTestSetup
                  extended by org.apache.derbyTesting.junit.BaseJDBCTestSetup
                      extended by org.apache.derbyTesting.functionTests.tests.jdbc4.BlobClobTestSetup
All Implemented Interfaces:
junit.framework.Test

public class BlobClobTestSetup
extends BaseJDBCTestSetup

Create a table with one column for a blob and one column for a clob. This is shared between tests that need a blob or a clob, and is required because the createBlob/-Clob methods are not yet implemented.


Field Summary
private static byte[] blobData
          Blob data.
private static java.lang.String clobData
          Clob data.
static int ID
          ID is used to store the latest unique value for the ID column Start from 3 since 1 is used for null values and 2 is used for sample values.
static int ID_NULLVALUES
          Constant for accessing the row with null values.
static int ID_SAMPLEVALUES
          Constant for accessing the row with sample values.
 
Fields inherited from class junit.extensions.TestDecorator
fTest
 
Constructor Summary
BlobClobTestSetup(junit.framework.Test test)
          Create a test setup for the specified blob or clob test.
 
Method Summary
static int getID()
          Returns new unique ID values that can be used in these tests.
static java.sql.Blob getSampleBlob(java.sql.Connection con)
          Fetch a sample Blob.
static java.sql.Clob getSampleClob(java.sql.Connection con)
          Fetch a sample Clob.
protected  void setUp()
          Create a table with BLOB and CLOB, so that such objects can be accessed/used from JDBC.
protected  void tearDown()
          Drop the table we created during setup.
 
Methods inherited from class org.apache.derbyTesting.junit.BaseJDBCTestSetup
getConnection, getTestConfiguration, println
 
Methods inherited from class org.apache.derbyTesting.junit.BaseTestSetup
run
 
Methods inherited from class junit.extensions.TestDecorator
basicRun, countTestCases, getTest, 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

ID_NULLVALUES

public static final int ID_NULLVALUES
Constant for accessing the row with null values.

See Also:
Constant Field Values

ID_SAMPLEVALUES

public static final int ID_SAMPLEVALUES
Constant for accessing the row with sample values.

See Also:
Constant Field Values

ID

public static int ID
ID is used to store the latest unique value for the ID column Start from 3 since 1 is used for null values and 2 is used for sample values.


blobData

private static final byte[] blobData
Blob data.


clobData

private static final java.lang.String clobData
Clob data.

See Also:
Constant Field Values
Constructor Detail

BlobClobTestSetup

public BlobClobTestSetup(junit.framework.Test test)
Create a test setup for the specified blob or clob test.

Parameters:
test - the test to provide setup for.
Method Detail

setUp

protected void setUp()
              throws java.io.IOException,
                     java.sql.SQLException
Create a table with BLOB and CLOB, so that such objects can be accessed/used from JDBC.

Overrides:
setUp in class junit.extensions.TestSetup
Throws:
java.io.IOException
java.sql.SQLException

tearDown

protected void tearDown()
                 throws java.lang.Exception
Drop the table we created during setup.

Overrides:
tearDown in class BaseJDBCTestSetup
Throws:
java.lang.Exception

getSampleBlob

public static java.sql.Blob getSampleBlob(java.sql.Connection con)
                                   throws java.sql.SQLException
Fetch a sample Blob. If this method fails, the test fails.

Parameters:
con - database connection to fetch data from.
Returns:
a sample Blob object.
Throws:
java.sql.SQLException

getSampleClob

public static java.sql.Clob getSampleClob(java.sql.Connection con)
                                   throws java.sql.SQLException
Fetch a sample Clob. If this method fails, the test fails.

Parameters:
con - database connection to fetch data from.
Returns:
a sample Clob object.
Throws:
java.sql.SQLException

getID

public static int getID()
Returns new unique ID values that can be used in these tests.

Returns:
an integer that represents an unique ID value.

Built on Sat 2009-11-28 18:44:18-0800, from revision 885187

Apache Derby V10.6 Internals - Copyright © 2004,2008 The Apache Software Foundation. All Rights Reserved.