JtdsDataSourceTest (jTDS API)
Date: 2013-06-08

net.sourceforge.jtds.jdbcx

## Class JtdsDataSourceTest

- java.lang.Object
- - TestCase
  - - net.sourceforge.jtds.jdbc.TestBase
    - - net.sourceforge.jtds.jdbc.DatabaseTestCase
      - - net.sourceforge.jtds.jdbc.UnitTestBase
        - - net.sourceforge.jtds.jdbcx.JtdsDataSourceTest

-     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.TestBase

      `props`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JtdsDataSourceTest(java.lang.String name)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static 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 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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 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 June 8 2013