net.sourceforge.jtds.jdbc
Class BatchTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bynet.sourceforge.jtds.jdbc.TestBase
              extended bynet.sourceforge.jtds.jdbc.DatabaseTestCase
                  extended bynet.sourceforge.jtds.jdbc.BatchTest
All Implemented Interfaces:
junit.framework.Test

public class BatchTest
extends DatabaseTestCase

Simple test suite to exercise batch execution.

Version:
$Id: BatchTest.java,v 1.11.2.6 2009-12-30 13:33:24 ickzon Exp $

Nested Class Summary
private  class BatchTest.ConcurrentBatchingHelper
          Helper thread used by testConcurrentBatching() to execute a batch within a transaction that is then rolled back.
 
Field Summary
private static int EXECUTE_FAILED
           
private static int SUCCESS_NO_INFO
           
 
Fields inherited from class net.sourceforge.jtds.jdbc.DatabaseTestCase
 
Fields inherited from class net.sourceforge.jtds.jdbc.TestBase
con, props
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
BatchTest(java.lang.String name)
           
 
Method Summary
private static java.lang.String array2String(int[] a)
           
static void main(java.lang.String[] args)
           
 void testBatch()
          Test batched statements.
 void testBatchDupKey()
          Test for bug [1371295] SQL Server continues after duplicate key error.
 void testBatchEsc()
          Test for bug [1180169] JDBC escapes not allowed with Sybase addBatch.
 void testBatchUpdateCounts()
          test for bug [2827931] that implicitly also tests for bug [1811383] example for statement that produces multiple update counts unexpectedly: IF sessionproperty('ARITHABORT') = 0 SET ARITHABORT ON
 void testCallStmtBatch()
          Test batched callable statements.
 void testCallStmtBatch2()
          Test batched callable statements where the call includes literal parameters which prevent the use of RPC calls.
 void testCallStmtNoParams()
          Test batched callable statements where the call has no parameters.
 void testConcurrentBatching()
          Test batched prepared statement concurrency.
 void testDataTruncation()
          this is a test for the data truncation problem described in bug [2731952]
 void testLargeBatch()
          Test large batch behavior.
 void testNoCount()
          The first statement in this batch does not return an update count.
 void testPrepStmtBatch()
          Test batched prepared statements.
 void testPrepStmtBatchDupKey()
          Test for bug [1371295] SQL Server continues after duplicate key error.
 void testPrepStmtNoParams()
          Test for PreparedStatement batch with no parameters.
 void testPrepStmtVariableParams()
          Test for PreparedStatement batch with variable parameter types.
 void testResultSetError()
          This test should generate an error as the second statement in the batch returns a result set.
 
Methods inherited from class net.sourceforge.jtds.jdbc.DatabaseTestCase
compareBytes, getLongString, getLongString, getType, getTypemap
 
Methods inherited from class net.sourceforge.jtds.jdbc.TestBase
compareInputStreams, compareReaders, connect, dropDatabase, dropFunction, dropProcedure, dropTable, dropTrigger, dropType, dropView, dump, dump, dumpAll, dumpKeys, dumpRow, dumpRow, getConnection, getConnection, makeObjects, makeTestTables, setUp, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SUCCESS_NO_INFO

private static int SUCCESS_NO_INFO

EXECUTE_FAILED

private static int EXECUTE_FAILED
Constructor Detail

BatchTest

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

testResultSetError

public void testResultSetError()
                        throws java.lang.Exception
This test should generate an error as the second statement in the batch returns a result set.

Throws:
java.lang.Exception

testNoCount

public void testNoCount()
                 throws java.lang.Exception
The first statement in this batch does not return an update count. SUCCESS_NO_INFO is expected instead.

Throws:
java.lang.Exception

testBatch

public void testBatch()
               throws java.lang.Exception
Test batched statements.

Throws:
java.lang.Exception

testPrepStmtBatch

public void testPrepStmtBatch()
                       throws java.lang.Exception
Test batched prepared statements.

Throws:
java.lang.Exception

testCallStmtBatch

public void testCallStmtBatch()
                       throws java.lang.Exception
Test batched callable statements.

Throws:
java.lang.Exception

testCallStmtBatch2

public void testCallStmtBatch2()
                        throws java.lang.Exception
Test batched callable statements where the call includes literal parameters which prevent the use of RPC calls.

Throws:
java.lang.Exception

testLargeBatch

public void testLargeBatch()
                    throws java.lang.Exception
Test large batch behavior.

Throws:
java.lang.Exception

testBatchEsc

public void testBatchEsc()
                  throws java.lang.Exception
Test for bug [1180169] JDBC escapes not allowed with Sybase addBatch.

Throws:
java.lang.Exception

testPrepStmtBatchDupKey

public void testPrepStmtBatchDupKey()
                             throws java.lang.Exception
Test for bug [1371295] SQL Server continues after duplicate key error.

Throws:
java.lang.Exception

testBatchDupKey

public void testBatchDupKey()
                     throws java.lang.Exception
Test for bug [1371295] SQL Server continues after duplicate key error.

Throws:
java.lang.Exception

testPrepStmtNoParams

public void testPrepStmtNoParams()
                          throws java.lang.Exception
Test for PreparedStatement batch with no parameters.

Throws:
java.lang.Exception

testPrepStmtVariableParams

public void testPrepStmtVariableParams()
                                throws java.lang.Exception
Test for PreparedStatement batch with variable parameter types.

Throws:
java.lang.Exception

testCallStmtNoParams

public void testCallStmtNoParams()
                          throws java.lang.Exception
Test batched callable statements where the call has no parameters.

Throws:
java.lang.Exception

testConcurrentBatching

public void testConcurrentBatching()
                            throws java.lang.Exception
Test batched prepared statement concurrency. Batch prepares must not disappear between the moment when they were created and when they are executed.

Throws:
java.lang.Exception

testDataTruncation

public void testDataTruncation()
                        throws java.sql.SQLException
this is a test for the data truncation problem described in bug [2731952]

Throws:
java.sql.SQLException

testBatchUpdateCounts

public void testBatchUpdateCounts()
                           throws java.sql.SQLException
test for bug [2827931] that implicitly also tests for bug [1811383] example for statement that produces multiple update counts unexpectedly: IF sessionproperty('ARITHABORT') = 0 SET ARITHABORT ON

Throws:
java.sql.SQLException

array2String

private static java.lang.String array2String(int[] a)

main

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


Generated on October 27 2012