net.sourceforge.jtds.test
Class ResultSetTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--net.sourceforge.jtds.test.TestBase
                    |
                    +--net.sourceforge.jtds.test.ResultSetTest
All Implemented Interfaces:
junit.framework.Test

public class ResultSetTest
extends TestBase

Version:
1.0

Fields inherited from class net.sourceforge.jtds.test.TestBase
con, CONNECTION_PROPERTIES, props
 
Fields inherited from class junit.framework.TestCase
fName
 
Constructor Summary
ResultSetTest(java.lang.String name)
           
 
Method Summary
static void main(java.lang.String[] args)
           
 void testAbsoluteMinusOne()
          Test that absolute(-1) works the same as last().
 void testCursorFetch()
          Test the behavior of sp_cursorfetch with fetch sizes greater than 1.
 void testCursorMaxRows()
          Test that Statement.setMaxRows() works on cursor ResultSets.
 void testCursorPrevious()
          Test that ResultSet.previous() works correctly on cursor ResultSets.
 void testCursorWarning()
          Test for bug [1022445] Cursor downgrade warning not raised.
 void testDeleteRowMarksDeleted()
          Test that deleted rows are not removed but rather marked as deleted.
 void testEmptyInsertRow()
          Test that insertRow() works with no values set.
 void testGetByName()
          Test whether retrieval by name returns the first occurence (that's what the spec requires).
 void testGetObject1()
          Test BIT data type.
 void testGetObject2()
          Test TINYINT data type.
 void testGetObject3()
          Test SMALLINT data type.
 void testGetObject4()
          Test INT data type.
 void testGetObject5()
          Test BIGINT data type.
 void testInsertRowVisible()
          Test that inserted rows are visible in a scroll sensitive ResultSet and that they show up at the end.
 void testMoreThan255Columns()
          Test if COL_INFO packets are processed correctly for ResultSets with over 255 columns.
 void testOutOfMemory()
          Test the behavior of the ResultSet/Statement/Connection when the JVM runs out of memory (hopefully) in the middle of a packet.
 void testRelative()
          Test for bug [1182066] regression bug resultset: relative() not working as expected.
 void testResultSetColumnName1()
          Test for bug [1009233] ResultSet getColumnName, getColumnLabel return wrong values
 void testResultSetMetaData()
          Test for fixed bugs in ResultSetMetaData: isNullable() always returns columnNoNulls.
 void testResultSetScroll1()
          Test for bug [961594] ResultSet.
 void testResultSetScroll2()
          Test for bug [945462] getResultSet() return null if you use scrollable/updatable.
 void testResultSetScroll3()
          Test for bug [1028881] statement.execute() causes wrong ResultSet type.
 void testResultSetUpdate1()
          Test for bug [1008208] 0.9-rc1 updateNull doesn't work.
 void testSetObjectScale()
          Test for bug [1075977] setObject() causes SQLException.
 void testUnicodeStream()
          Test that read() works ok on the stream returned by ResultSet.getUnicodeStream() (i.e.
 void testUpdateRowDuplicatesRow()
          Test that updated rows are marked as deleted and the new values inserted at the end of the ResultSet if the primary key is updated.
 void testUpdateRowNoChanges()
          Test for bug [1170777] resultSet.updateRow() fails if no row has been changed.
 void testUpdateRowUpdatesRow()
          Test that updated rows are modified in place if the primary key is not updated.
 
Methods inherited from class net.sourceforge.jtds.test.TestBase
compareInputStreams, compareReaders, connect, disconnect, dump, dumpRow, getConnection, initLanguage, loadProperties, makeObjects, makeTestTables, setUp, showWarnings, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, 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, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Constructor Detail

ResultSetTest

public ResultSetTest(java.lang.String name)
Method Detail

testGetObject1

public void testGetObject1()
                    throws java.lang.Exception
Test BIT data type.

testGetObject2

public void testGetObject2()
                    throws java.lang.Exception
Test TINYINT data type.

testGetObject3

public void testGetObject3()
                    throws java.lang.Exception
Test SMALLINT data type.

testGetObject4

public void testGetObject4()
                    throws java.lang.Exception
Test INT data type.

testGetObject5

public void testGetObject5()
                    throws java.lang.Exception
Test BIGINT data type.

testResultSetScroll1

public void testResultSetScroll1()
                          throws java.lang.Exception
Test for bug [961594] ResultSet.

testResultSetScroll2

public void testResultSetScroll2()
                          throws java.lang.Exception
Test for bug [945462] getResultSet() return null if you use scrollable/updatable.

testResultSetScroll3

public void testResultSetScroll3()
                          throws java.lang.Exception
Test for bug [1028881] statement.execute() causes wrong ResultSet type.

testResultSetUpdate1

public void testResultSetUpdate1()
                          throws java.lang.Exception
Test for bug [1008208] 0.9-rc1 updateNull doesn't work.

testResultSetColumnName1

public void testResultSetColumnName1()
                              throws java.lang.Exception
Test for bug [1009233] ResultSet getColumnName, getColumnLabel return wrong values

testResultSetMetaData

public void testResultSetMetaData()
                           throws java.lang.Exception
Test for fixed bugs in ResultSetMetaData:
  1. isNullable() always returns columnNoNulls.
  2. isSigned returns true in error for TINYINT columns.
  3. Type names for numeric / decimal have (prec,scale) appended in error.
  4. Type names for auto increment columns do not have "identity" appended.
NB: This test assumes getColumnName has been fixed to work as per the suggestion in bug report [1009233].
Throws:
java.lang.Exception -  

testCursorWarning

public void testCursorWarning()
                       throws java.lang.Exception
Test for bug [1022445] Cursor downgrade warning not raised.

testGetByName

public void testGetByName()
                   throws java.lang.Exception
Test whether retrieval by name returns the first occurence (that's what the spec requires).

testMoreThan255Columns

public void testMoreThan255Columns()
                            throws java.lang.Exception
Test if COL_INFO packets are processed correctly for ResultSets with over 255 columns.

testEmptyInsertRow

public void testEmptyInsertRow()
                        throws java.lang.Exception
Test that insertRow() works with no values set.

testInsertRowVisible

public void testInsertRowVisible()
                          throws java.lang.Exception
Test that inserted rows are visible in a scroll sensitive ResultSet and that they show up at the end.

testUpdateRowDuplicatesRow

public void testUpdateRowDuplicatesRow()
                                throws java.lang.Exception
Test that updated rows are marked as deleted and the new values inserted at the end of the ResultSet if the primary key is updated.

testUpdateRowUpdatesRow

public void testUpdateRowUpdatesRow()
                             throws java.lang.Exception
Test that updated rows are modified in place if the primary key is not updated.

testDeleteRowMarksDeleted

public void testDeleteRowMarksDeleted()
                               throws java.lang.Exception
Test that deleted rows are not removed but rather marked as deleted.

testUpdateRowNoChanges

public void testUpdateRowNoChanges()
                            throws java.lang.Exception
Test for bug [1170777] resultSet.updateRow() fails if no row has been changed.

testCursorFetch

public void testCursorFetch()
                     throws java.lang.Exception
Test the behavior of sp_cursorfetch with fetch sizes greater than 1.

Assertions tested:


testAbsoluteMinusOne

public void testAbsoluteMinusOne()
                          throws java.lang.Exception
Test that absolute(-1) works the same as last().

testUnicodeStream

public void testUnicodeStream()
                       throws java.lang.Exception
Test that read() works ok on the stream returned by ResultSet.getUnicodeStream() (i.e. it doesn't always fill the buffer, regardless of whether there's available data or not).

testCursorMaxRows

public void testCursorMaxRows()
                       throws java.lang.Exception
Test that Statement.setMaxRows() works on cursor ResultSets.

testSetObjectScale

public void testSetObjectScale()
                        throws java.lang.Exception
Test for bug [1075977] setObject() causes SQLException.

Conversion of float values to String adds grouping to the value, which cannot then be parsed.


testCursorPrevious

public void testCursorPrevious()
                        throws java.lang.Exception
Test that ResultSet.previous() works correctly on cursor ResultSets.

testOutOfMemory

public void testOutOfMemory()
                     throws java.sql.SQLException
Test the behavior of the ResultSet/Statement/Connection when the JVM runs out of memory (hopefully) in the middle of a packet.

Previously jTDS was not able to close a ResultSet/Statement/Connection after an OutOfMemoryError because the input stream pointer usually remained inside a packet and further attempts to dump the rest of the response failed because of "protocol confusions".


testRelative

public void testRelative()
                  throws java.lang.Exception
Test for bug [1182066] regression bug resultset: relative() not working as expected.

main

public static void main(java.lang.String[] args)


Generated on April 15 2005