ConnectionJDBC2UnitTest (jTDS API)
Keywords: net.sourceforge.jtds.test.ConnectionJDBC2UnitTest class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sourceforge.jtds.test
Class ConnectionJDBC2UnitTest

    java.lang.Object
      junit.framework.Assert
          junit.framework.TestCase
              net.sourceforge.jtds.test.UnitTestBase
                  net.sourceforge.jtds.test.ConnectionJDBC2UnitTest

All Implemented Interfaces:
  junit.framework.Test

public class ConnectionJDBC2UnitTest
extends UnitTestBase

Unit test for the `ConnectionJDBC2` class.

Version:
  $Id: ConnectionJDBC2UnitTest.java,v 1.11 2007/07/08 18:08:54 bheineman Exp $
Author:
  David Kilzer, Alin Sinpalean

Nested Class Summary
`static class` | `ConnectionJDBC2UnitTest.Test_ConnectionJDBC2_unpackProperties` Class used to test `net.sourceforge.jtds.jdbc.ConnectionJDBC2.unpackProperties(Properties)`.

Field Summary

Fields inherited from class junit.framework.TestCase
``

Constructor Summary
`ConnectionJDBC2UnitTest(java.lang.String name)` Constructor.

Method Summary
`private void` | `assertSQLExceptionForBadWholeNumberProperty(java.lang.String key)` Assert that an SQLException is thrown when `ConnectionJDBC2.unpackProperties(Properties)` is called with an invalid integer (or long) string set on a property.
`private java.sql.Connection` | `getConnectionOverrideProperties(java.util.Properties override)` Creates a `Connection`, overriding the default properties with the ones provided.
`static junit.framework.Test` | `suite()` Construct a test suite for this class.
`void` | `test_unpackProperties_invalidIntegerProperty()` Test that an `SQLException` is thrown when parsing invalid integer (and long) properties.
`void` | `testAutoCommit()` Test for bug [1296482] setAutoCommit() behaviour.
`void` | `testForceCharset1()` Test correct behavior of the `charset` property.
`void` | `testForceCharset2()` Test correct behavior of the `charset` property.

Methods inherited from class net.sourceforge.jtds.test.UnitTestBase
`assertEquals, invokeConstructor, invokeGetInstanceField, invokeInstanceMethod, invokeSetInstanceField, invokeStaticMethod, ucFirst`

Methods inherited from class junit.framework.TestCase
`countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, 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

### ConnectionJDBC2UnitTest

    public ConnectionJDBC2UnitTest(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.

  The test suite includes the tests in this class, and adds tests from `DefaultPropertiesTestLibrary` after creating an anonymous `DefaultPropertiesTester` object.

  Returns:
    The test suite to run.

### test_unpackProperties_invalidIntegerProperty

    public void test_unpackProperties_invalidIntegerProperty()

  Test that an `SQLException` is thrown when parsing invalid integer (and long) properties.

### assertSQLExceptionForBadWholeNumberProperty

    private void assertSQLExceptionForBadWholeNumberProperty(java.lang.String key)

  Assert that an SQLException is thrown when `ConnectionJDBC2.unpackProperties(Properties)` is called with an invalid integer (or long) string set on a property.

  Note that because Java 1.3 is still supported, the `RuntimeException` that is caught may not contain the original `Throwable` cause, only the original message.

  Parameters:
    `key` - The message key used to retrieve the property name.

### getConnectionOverrideProperties

    private java.sql.Connection getConnectionOverrideProperties(java.util.Properties override)
                                                         throws java.lang.Exception

  Creates a `Connection`, overriding the default properties with the ones provided.

  Parameters:
    `override` - the overriding properties
  Returns:
    a `Connection` object
  Throws:
    `java.lang.Exception`

### testForceCharset1

    public void testForceCharset1()
                           throws java.lang.Exception

  Test correct behavior of the `charset` property. Values should be stored and retrieved using the requested charset rather than the server's as long as Unicode is not used.

  Throws:
    `java.lang.Exception`

### testForceCharset2

    public void testForceCharset2()
                           throws java.lang.Exception

  Test correct behavior of the `charset` property. Stored procedure output parameters should be decoded using the specified charset rather than the server's as long as they are non-Unicode.

  Throws:
    `java.lang.Exception`

### testAutoCommit

    public void testAutoCommit()
                        throws java.lang.Exception

  Test for bug [1296482] setAutoCommit() behaviour.

  The behaviour of setAutoCommit() on ConnectionJDBC2 is inconsistent with the Sun JDBC 3.0 Specification. JDBC 3.0 Specification, section 10.1.1:

  > "If the value of auto-commit is changed in the middle of a transaction, the current transaction is committed."

  Throws:
    `java.lang.Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Generated on December 30 2009