Java Doc for SAfeTest.java in  » Database-JDBC-Connection-Pool » jTDS » net » sourceforge » jtds » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » jTDS » net.sourceforge.jtds.test 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


net.sourceforge.jtds.test.TestBase
   net.sourceforge.jtds.test.DatabaseTestCase
      net.sourceforge.jtds.test.SAfeTest

SAfeTest
public class SAfeTest extends DatabaseTestCase (Code)

author:
   Alin Sinpalean
version:
   $Id: SAfeTest.java,v 1.62 2007/07/08 21:43:02 bheineman Exp $
since:
   0.4


Field Summary
volatile  booleanfailed
    
volatile  intstarteddone
    

Constructor Summary
public  SAfeTest(String name)
    

Method Summary
public static  voidmain(String args)
    
public  voidtestBatchUpdates0015()
     Test batch updates for both plain and prepared statements.
public  voidtestBigDecimal0007()
     Test BigDecimals created from double values (i.e with very large scales).
public  voidtestBigDecimal1()
    
public  voidtestBitFields0005()
     Check that values returned from bit fields are correct (not just 0) (bug #841670).
public  voidtestBytesToString()
     Test that getString() on a varbinary column returns a hex string.
public  voidtestCallableStatement0006()
     Test that CallableStatements with return values work correctly.
public  voidtestCallableStatementVarchar0010()
     Test VARCHAR output parameters returned by CallableStatements.

An issue existed, caused by the fact that the parameter was sent to SQL Server as a short VARCHAR (not XORed with 0x80) limiting its length to 255 characters.

public  voidtestCancel0001()
     Test cancelling.
public  voidtestCancel0002()
     Test cancelling.
public  voidtestCancel0003()
     Test for bug [1120442] Statement hangs in socket read after Statement.cancel().

In 1.0.1 and earlier versions network packets consisting of a single TDS_DONE packet with the CANCEL flag set were ignored and a new read() was attempted, essentially causing a deadlock.

Because it relies on a particular succession of events this test will not always work as expected, i.e.

public  voidtestCursorResultSetConcurrency0003()
     Test CursorResultSet concurrency.
public  voidtestCursorResultSetEmpty0004()
     Check that meta data information is fetched even for empty cursor-based result sets (bug #613199).
public  voidtestDataTruncException()
     Test DataTruncation exception.
public  voidtestDatetimeRounding1()
    
public  voidtestDeleteRow0009()
     Test ResultSet.deleteRow() on updateable result sets.
public  voidtestExecuteUpdateSelect()
     Tests that executeUpdate("SELECT ...") fails.
public  voidtestFloat1()
    
public  voidtestFnEscape()
     Test for bug related with [1368058] Calling StoredProcedure with functions ({fn} escape can't handle special characters, e.g.
public  voidtestFnEscapeNesting()
     Test for bug #1116046 {fn } escape can't handle nested functions.
public  voidtestGetMultiScrollRs()
     Test return of multiple scrollable result sets from one execute.
public  voidtestInsertRow0012()
     Test ResultSet.insertRow() on updateable result sets.
public  voidtestLongToVarchar0008()
     Test writing long values to VARCHAR fields.
public  voidtestMaxFieldSize()
     Test Statement.setMaxFieldSize().
public  voidtestNullLengthStrings0001()
     Test whether NULL values, 0-length strings and single space strings are treated right.
public  voidtestNullOutputParameters()
     Test that null output parameters are handled correctly.

It seems that if a non-nullable type is sent as input value and the output value is NULL, SQL Server (not Sybase) gets confused and returns the same type but a single 0 byte as value instead of the equivalent nullable type (e.g.

public  voidtestOldDates0016()
     Test that dates prior to 06/15/1940 0:00:00 are stored and retrieved correctly.
public  voidtestOutOfOrderClose0013()
     Test how an "out-of-order" close behaves (e.g close the Connection first, then the Statement anf finally the ResultSet).
public  voidtestPlainResultSetPosition0004()
     Check that the isBeforeFirst, isAfterLast, isFirst and isLast methods work for forward-only, read-only result sets (bug [1039876] MS SQL JtdsResultSet.isAfterLast() always returns false).
public  voidtestPreparedAndCallableCursors0014()
     Test cursor-based ResultSets obtained from PreparedStatements and CallableStatements.
public  voidtestQueryTimeout()
     Test for bug [1222199] Delayed exception thrown in statement close.
public  voidtestSocketConcurrency1()
    
public  voidtestSocketConcurrency2()
    
public  voidtestSocketConcurrency3()
    
public  voidtestSocketConcurrency4()
     Test running SELECT queries on one Statement at the same time as cancel() is called on a concurrent Statement.
public  voidtestTableParsing()
     Test that the SQL parser doesn't try to parse the table name unless necessary (or that it is able to parse function calls if it does).
public  voidtestThreadInterrupt()
    
public  voidtestUnterminatedCommentParsing()
     Test for bug [1187927] Driver Hangs on Statement.execute().
public  voidtestUpdateRow0011()
     Test ResultSet.updateRow() on updateable result sets.

Field Detail
failed
volatile boolean failed(Code)



starteddone
volatile int starteddone(Code)




Constructor Detail
SAfeTest
public SAfeTest(String name)(Code)




Method Detail
main
public static void main(String args)(Code)



testBatchUpdates0015
public void testBatchUpdates0015() throws Exception(Code)
Test batch updates for both plain and prepared statements.



testBigDecimal0007
public void testBigDecimal0007() throws Exception(Code)
Test BigDecimals created from double values (i.e with very large scales).



testBigDecimal1
public void testBigDecimal1() throws Exception(Code)
Test for bug [939206] TdsException: can't sent this BigDecimal



testBitFields0005
public void testBitFields0005() throws Exception(Code)
Check that values returned from bit fields are correct (not just 0) (bug #841670).
throws:
  Exception -



testBytesToString
public void testBytesToString() throws Exception(Code)
Test that getString() on a varbinary column returns a hex string.



testCallableStatement0006
public void testCallableStatement0006() throws Exception(Code)
Test that CallableStatements with return values work correctly.
throws:
  Exception -



testCallableStatementVarchar0010
public void testCallableStatementVarchar0010() throws Exception(Code)
Test VARCHAR output parameters returned by CallableStatements.

An issue existed, caused by the fact that the parameter was sent to SQL Server as a short VARCHAR (not XORed with 0x80) limiting its length to 255 characters. See bug [815348] for more details.




testCancel0001
public void testCancel0001() throws Exception(Code)
Test cancelling. Create 2 connections, lock some records on one of them and try to read them using the other one. Cancel the statement from the second connection, then try executing a simple query on it to make sure it's in a correct state.



testCancel0002
public void testCancel0002() throws Exception(Code)
Test cancelling. Create 2 connections, lock some records on one of them and try to read them using the other one with a timeout set. When the second connection times out try executing a simple query on it to make sure it's in a correct state.



testCancel0003
public void testCancel0003() throws Exception(Code)
Test for bug [1120442] Statement hangs in socket read after Statement.cancel().

In 1.0.1 and earlier versions network packets consisting of a single TDS_DONE packet with the CANCEL flag set were ignored and a new read() was attempted, essentially causing a deadlock.

Because it relies on a particular succession of events this test will not always work as expected, i.e. the cancel might be executed too early or too late, but it won't fail in this situation.




testCursorResultSetConcurrency0003
public void testCursorResultSetConcurrency0003() throws Exception(Code)
Test CursorResultSet concurrency. Create a number of threads that execute concurrent queries using scrollable result sets. All requests should be run on the same connection (Tds instance).



testCursorResultSetEmpty0004
public void testCursorResultSetEmpty0004() throws Exception(Code)
Check that meta data information is fetched even for empty cursor-based result sets (bug #613199).
throws:
  Exception -



testDataTruncException
public void testDataTruncException() throws Exception(Code)
Test DataTruncation exception.



testDatetimeRounding1
public void testDatetimeRounding1() throws Exception(Code)
Test for bug [983561] getDatetimeValue truncates fractional milliseconds



testDeleteRow0009
public void testDeleteRow0009() throws Exception(Code)
Test ResultSet.deleteRow() on updateable result sets.



testExecuteUpdateSelect
public void testExecuteUpdateSelect() throws Exception(Code)
Tests that executeUpdate("SELECT ...") fails.



testFloat1
public void testFloat1() throws Exception(Code)
Test for bug [963799] float values change when written to the database



testFnEscape
public void testFnEscape() throws Exception(Code)
Test for bug related with [1368058] Calling StoredProcedure with functions ({fn} escape can't handle special characters, e.g. underscore).



testFnEscapeNesting
public void testFnEscapeNesting() throws Exception(Code)
Test for bug #1116046 {fn } escape can't handle nested functions.



testGetMultiScrollRs
public void testGetMultiScrollRs() throws Exception(Code)
Test return of multiple scrollable result sets from one execute.



testInsertRow0012
public void testInsertRow0012() throws Exception(Code)
Test ResultSet.insertRow() on updateable result sets.



testLongToVarchar0008
public void testLongToVarchar0008() throws Exception(Code)
Test writing long values to VARCHAR fields. There was a regression introduced in release 0.6 that caused long fields to be sent with non-zero scale and appear with decimals when written into VARCHAR fields.



testMaxFieldSize
public void testMaxFieldSize() throws Exception(Code)
Test Statement.setMaxFieldSize().



testNullLengthStrings0001
public void testNullLengthStrings0001() throws Exception(Code)
Test whether NULL values, 0-length strings and single space strings are treated right.



testNullOutputParameters
public void testNullOutputParameters() throws SQLException(Code)
Test that null output parameters are handled correctly.

It seems that if a non-nullable type is sent as input value and the output value is NULL, SQL Server (not Sybase) gets confused and returns the same type but a single 0 byte as value instead of the equivalent nullable type (e.g. instead of returning an INTN with length 0, which means it's null, it returns an INT4 followed by a single 0 byte). The output parameter packet length is also incorrect, which indicates that SQL Server is confused.

Currently jTDS always sends RPC parameters as nullable types, but this test is necessary to ensure that it will always remain so.




testOldDates0016
public void testOldDates0016() throws Exception(Code)
Test that dates prior to 06/15/1940 0:00:00 are stored and retrieved correctly.



testOutOfOrderClose0013
public void testOutOfOrderClose0013() throws Exception(Code)
Test how an "out-of-order" close behaves (e.g close the Connection first, then the Statement anf finally the ResultSet).



testPlainResultSetPosition0004
public void testPlainResultSetPosition0004() throws Exception(Code)
Check that the isBeforeFirst, isAfterLast, isFirst and isLast methods work for forward-only, read-only result sets (bug [1039876] MS SQL JtdsResultSet.isAfterLast() always returns false).
throws:
  Exception - if an error condition occurs



testPreparedAndCallableCursors0014
public void testPreparedAndCallableCursors0014() throws Exception(Code)
Test cursor-based ResultSets obtained from PreparedStatements and CallableStatements.



testQueryTimeout
public void testQueryTimeout() throws Exception(Code)
Test for bug [1222199] Delayed exception thrown in statement close.



testSocketConcurrency1
public void testSocketConcurrency1()(Code)



testSocketConcurrency2
public void testSocketConcurrency2()(Code)



testSocketConcurrency3
public void testSocketConcurrency3()(Code)



testSocketConcurrency4
public void testSocketConcurrency4() throws Exception(Code)
Test running SELECT queries on one Statement at the same time as cancel() is called on a concurrent Statement.



testTableParsing
public void testTableParsing() throws SQLException(Code)
Test that the SQL parser doesn't try to parse the table name unless necessary (or that it is able to parse function calls if it does).



testThreadInterrupt
public void testThreadInterrupt() throws Exception(Code)
Test for bug [1596743] executeQuery absorbs thread interrupt status



testUnterminatedCommentParsing
public void testUnterminatedCommentParsing() throws Exception(Code)
Test for bug [1187927] Driver Hangs on Statement.execute().

Versions 1.0.3 and prior entered an infinite loop when parsing an unterminated multi-line comment.




testUpdateRow0011
public void testUpdateRow0011() throws Exception(Code)
Test ResultSet.updateRow() on updateable result sets.



Methods inherited from net.sourceforge.jtds.test.DatabaseTestCase
static int compareBytes(byte a1, byte a2)(Code)(Java Doc)
protected void dropFunction(String procname) throws SQLException(Code)(Java Doc)
protected void dropProcedure(String procname) throws SQLException(Code)(Java Doc)
protected void dropProcedure(Statement stmt, String procname) throws SQLException(Code)(Java Doc)
protected void dropTable(String tableName) throws SQLException(Code)(Java Doc)
protected String getLongString(int length)(Code)(Java Doc)
protected String getLongString(char ch)(Code)(Java Doc)
protected static int getType(Object o) throws SQLException(Code)(Java Doc)
protected static Map getTypemap()(Code)(Java Doc)

Fields inherited from net.sourceforge.jtds.test.TestBase
Connection con(Code)(Java Doc)
final public static Properties props(Code)(Java Doc)

Methods inherited from net.sourceforge.jtds.test.TestBase
public void compareInputStreams(InputStream is1, InputStream is2) throws IOException(Code)(Java Doc)
public void compareReaders(Reader r1, Reader r2) throws IOException(Code)(Java Doc)
protected void connect() throws Exception(Code)(Java Doc)
public void dump(ResultSet rs) throws SQLException(Code)(Java Doc)
public void dumpRow(ResultSet rs) throws SQLException(Code)(Java Doc)
public Connection getConnection() throws Exception(Code)(Java Doc)
public Connection getConnection(Properties override) throws Exception(Code)(Java Doc)
public void makeObjects(Statement stmt, int count) throws SQLException(Code)(Java Doc)
protected void makeTestTables(Statement stmt) throws SQLException(Code)(Java Doc)
public void setUp() throws Exception(Code)(Java Doc)
public void tearDown() throws Exception(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.