net.sourceforge.jtds.jdbc
Class DefaultPropertiesTestLibrary

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bynet.sourceforge.jtds.jdbc.DefaultPropertiesTestLibrary
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
ConnectionJDBC2UnitTest.Test_ConnectionJDBC2_unpackProperties, DriverUnitTest.Test_Driver_getPropertyInfo, DriverUnitTest.Test_Driver_setupConnectProperties

public abstract class DefaultPropertiesTestLibrary
extends junit.framework.TestCase

Library for testing default properties.

Uses a DefaultPropertiesTester object to test different methods in different classes.

To extend this class, the programmer must implement the following items:

  1. Set the #tester field in a public default constructor that takes no arguments.
  2. A public static Test suite() method that takes one or more arguments. (The suite() method in this class should not be overridden.)

Version:
$Id: DefaultPropertiesTestLibrary.java,v 1.26.2.1 2009-08-07 14:02:11 ickzon Exp $
Author:
David D. Kilzer

Field Summary
private  boolean onlySqlServerTests
          If true, only run tests for SQL Server, not Sybase.
private  boolean onlyTds70Tests
          If true, only run tests for TDS 7.0.
private  DefaultPropertiesTester tester
          Object used to run all of the tests.
private static java.lang.String URL_SQLSERVER
          Test JDBC URL for SQL Server.
private static java.lang.String URL_SYBASE
          Test JDBC URL for Sybase.
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
DefaultPropertiesTestLibrary()
          Default constructor.
 
Method Summary
private  void assertDefaultPropertyByServerType(java.lang.String url, java.lang.String key, java.lang.String fieldName, java.lang.String expected)
          Assert that the expected property value is set using a given url.
private  void assertDefaultPropertyByTdsVersion(java.lang.String url, java.lang.String tdsVersion, java.lang.String key, java.lang.String fieldName, java.lang.String expected)
          Assert that the expected property value is set using a given url and tdsVersion property.
protected  DefaultPropertiesTester getTester()
          Getter for tester.
 boolean isOnlySqlServerTests()
          Getter for #onlySqlServerTests.
 boolean isOnlyTds70Tests()
          Getter for #onlyTds70Tests.
protected  void setOnlySqlServerTests(boolean onlySqlServerTests)
          Setter for onlySqlServerTests.
protected  void setOnlyTds70Tests(boolean onlyTds70Tests)
          Setter for onlyTds70Tests.
 void setTester(DefaultPropertiesTester tester)
          Setter for #tester.
static junit.framework.Test suite()
          Provides a null test suite so that JUnit will not try to instantiate this class directly.
 void test_appName()
          Test the appName property.
 void test_batchSize()
          Test the batchSize property.
 void test_bindAddress()
          Test the bindAddress property.
 void test_bufferDir()
          Test the bufferDir property.
 void test_bufferMaxMemory()
          Test the bufferMaxMemory property.
 void test_bufferMinPackets()
          Test the bufferMinPackets property.
 void test_cacheMetaData()
          Test the cacheMetaData property.
 void test_databaseName()
          Test the databaseName property.
 void test_lastUpdateCount()
          Test the lastUpdateCount property.
 void test_lobBuffer()
          Test the lobBuffer property.
 void test_loginTimeout()
          Test the loginTimeout property.
 void test_macAddress()
          Test the macAddress property.
 void test_namedPipe()
          Test the namedPipe property.
 void test_packetSize()
          Test the packetSize property.
 void test_portNumber()
          Test the portNumber property.
 void test_prepareSql()
          Test the prepareSql property.
 void test_processId()
          Test the processId property.
 void test_progName()
          Test the progName property.
 void test_sendStringParametersAsUnicode()
          Test the sendStringParametersAsUnicode property.
 void test_serverType()
          Test the serverType property.
 void test_socketKeepAlive()
          Test the socketKeepAlive property.
 void test_socketTimeout()
          Test the socketTimeout property.
 void test_tcpNoDelay()
          Test the tcpNoDelay property.
 void test_tds()
          Test the tds (version) property.
 void test_useCursors()
          Test the useCursors property.
 void test_useJCIFS()
          Test the useJCIFS property.
 void test_useLOBs()
          Test the useLOBs property.
 void test_wsid()
          Test the wsid property.
 
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
 

Field Detail

URL_SQLSERVER

private static final java.lang.String URL_SQLSERVER
Test JDBC URL for SQL Server.

See Also:
Constant Field Values

URL_SYBASE

private static final java.lang.String URL_SYBASE
Test JDBC URL for Sybase.

See Also:
Constant Field Values

tester

private DefaultPropertiesTester tester
Object used to run all of the tests.


onlySqlServerTests

private boolean onlySqlServerTests
If true, only run tests for SQL Server, not Sybase.


onlyTds70Tests

private boolean onlyTds70Tests
If true, only run tests for TDS 7.0.

Constructor Detail

DefaultPropertiesTestLibrary

public DefaultPropertiesTestLibrary()
Default constructor.

The extender of this class is required to set the #tester field in a public default constructor.

Method Detail

suite

public static final junit.framework.Test suite()
Provides a null test suite so that JUnit will not try to instantiate this class directly.

Returns:
The test suite (always null).

test_serverType

public void test_serverType()
Test the serverType property.

Different values are set depending on whether SQL Server or Sybase is used.


test_tds

public void test_tds()
Test the tds (version) property.


test_portNumber

public void test_portNumber()
Test the portNumber property.

Different values are set depending on whether SQL Server or Sybase is used.


test_databaseName

public void test_databaseName()
Test the databaseName property.


test_appName

public void test_appName()
Test the appName property.


test_bindAddress

public void test_bindAddress()
Test the bindAddress property.


test_lastUpdateCount

public void test_lastUpdateCount()
Test the lastUpdateCount property.


test_lobBuffer

public void test_lobBuffer()
Test the lobBuffer property.


test_loginTimeout

public void test_loginTimeout()
Test the loginTimeout property.


test_socketTimeout

public void test_socketTimeout()
Test the socketTimeout property.


test_socketKeepAlive

public void test_socketKeepAlive()
Test the socketKeepAlive property.


test_processId

public void test_processId()
Test the processId property.


test_macAddress

public void test_macAddress()
Test the macAddress property.


test_namedPipe

public void test_namedPipe()
Test the namedPipe property.


test_packetSize

public void test_packetSize()
Test the packetSize property.


test_prepareSql

public void test_prepareSql()
Test the prepareSql property.


test_progName

public void test_progName()
Test the progName property.


test_sendStringParametersAsUnicode

public void test_sendStringParametersAsUnicode()
Test the sendStringParametersAsUnicode property.


test_batchSize

public void test_batchSize()
Test the batchSize property.


test_bufferDir

public void test_bufferDir()
Test the bufferDir property.


test_bufferMaxMemory

public void test_bufferMaxMemory()
Test the bufferMaxMemory property.


test_bufferMinPackets

public void test_bufferMinPackets()
Test the bufferMinPackets property.


test_cacheMetaData

public void test_cacheMetaData()
Test the cacheMetaData property.


test_tcpNoDelay

public void test_tcpNoDelay()
Test the tcpNoDelay property.


test_useCursors

public void test_useCursors()
Test the useCursors property.


test_useJCIFS

public void test_useJCIFS()
Test the useJCIFS property.


test_useLOBs

public void test_useLOBs()
Test the useLOBs property.


test_wsid

public void test_wsid()
Test the wsid property.


assertDefaultPropertyByTdsVersion

private void assertDefaultPropertyByTdsVersion(java.lang.String url,
                                               java.lang.String tdsVersion,
                                               java.lang.String key,
                                               java.lang.String fieldName,
                                               java.lang.String expected)
Assert that the expected property value is set using a given url and tdsVersion property.

Parameters:
url - The JDBC URL.
tdsVersion - The TDS version.
key - The message key.
fieldName - The field name used in the class.
expected - The expected value of the property.

assertDefaultPropertyByServerType

private void assertDefaultPropertyByServerType(java.lang.String url,
                                               java.lang.String key,
                                               java.lang.String fieldName,
                                               java.lang.String expected)
Assert that the expected property value is set using a given url.

Parameters:
url - The JDBC URL.
key - The message key.
fieldName - The field name used in the class.
expected - The expected value of the property.

getTester

protected DefaultPropertiesTester getTester()
Getter for tester.

Returns:
Value of tester.

setTester

public void setTester(DefaultPropertiesTester tester)
Setter for #tester.

Parameters:
tester - The value to set #tester to.

isOnlySqlServerTests

public boolean isOnlySqlServerTests()
Getter for #onlySqlServerTests.

Returns:
Value of #onlySqlServerTests.

setOnlySqlServerTests

protected void setOnlySqlServerTests(boolean onlySqlServerTests)
Setter for onlySqlServerTests.

Parameters:
onlySqlServerTests - The value to set onlySqlServerTests to.

isOnlyTds70Tests

public boolean isOnlyTds70Tests()
Getter for #onlyTds70Tests.

Returns:
Value of #onlyTds70Tests.

setOnlyTds70Tests

protected void setOnlyTds70Tests(boolean onlyTds70Tests)
Setter for onlyTds70Tests.

Parameters:
onlyTds70Tests - The value to set onlyTds70Tests to.


Generated on October 27 2012