net.sourceforge.jtds.jdbcx
Class JtdsDataSourceTest

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.UnitTestBase
                      extended bynet.sourceforge.jtds.jdbcx.JtdsDataSourceTest
All Implemented Interfaces:
junit.framework.Test

public class JtdsDataSourceTest
extends UnitTestBase

Unit tests for the JtdsDataSource class.

Author:
David D. Kilzer, Holger Rehn

Field Summary
 
Fields inherited from class net.sourceforge.jtds.jdbc.DatabaseTestCase
 
Fields inherited from class net.sourceforge.jtds.jdbc.TestBase
props
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
JtdsDataSourceTest(java.lang.String name)
          Constructor.
 
Method Summary
static junit.framework.Test suite()
          Construct a test suite for this class.
 void testAddNonNullProperties()
          ensure only non-null properties are added
 void testDefaultTdsVersion()
          Test connecting without specifying TDS version.
 void testNoHost()
          Test connecting without specifying a host.
 void testNormal()
          Test connecting with the settings in connection.properties.
 void testNoUser()
          Test connecting without specifying a user.
 void testPublicConstructor()
          Tests that the public constructor works.
 
Methods inherited from class net.sourceforge.jtds.jdbc.UnitTestBase
assertEquals, invokeConstructor, invokeGetInstanceField, invokeInstanceMethod, invokeSetInstanceField, invokeStaticMethod, ucFirst
 
Methods inherited from class net.sourceforge.jtds.jdbc.DatabaseTestCase
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
 

Constructor Detail

JtdsDataSourceTest

public JtdsDataSourceTest(java.lang.String name)
Constructor.

Parameters:
name - The name of the test.
Method Detail

suite

public static junit.framework.Test suite()
Construct a test suite for this class.


testPublicConstructor

public void testPublicConstructor()
Tests that the public constructor works.

Needed so that this class has at least one test.


testNoHost

public void testNoHost()
Test connecting without specifying a host. Should get an SQL state of 08001 (SQL client unable to establish SQL connection).


testNoUser

public void testNoUser()
Test connecting without specifying a user. Should get an SQL state of either 28000 (invalid authorization specification) or 08S01 (bad host name).


testNormal

public void testNormal()
Test connecting with the settings in connection.properties.

Should also test bug [1051595] jtdsDataSource connects only to localhost.


testDefaultTdsVersion

public void testDefaultTdsVersion()
Test connecting without specifying TDS version.

Test for bug [1113709] Connecting via DataSource. Issue was caused by JtdsDataSource setting the default values in the constructor, so the TDS version was always set to 8.0 unless explicitly modified.

The incorrect behavior ocured when connecting to Sybase (when the TDS version should have been 5.0 by default).


testAddNonNullProperties

public void testAddNonNullProperties()
                              throws java.lang.Exception
ensure only non-null properties are added

Throws:
java.lang.Exception


Generated on October 27 2012