SPT RWT Application API

com.sptci.rwt
Class ConnectionsTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.sptci.rwt.ConnectionsTest
All Implemented Interfaces:
Test

public class ConnectionsTest
extends TestCase

Unit test for the Connections object. Test initialising, adding and deleting saved connections.

Copyright 2007 Sans Pareil Technologies, Inc.

Version:
$Id: ConnectionsTest.java 4123 2008-05-25 21:49:01Z rakesh $
Author:
Rakesh Vidyadharan 2007-09-25

Field Summary
(package private) static String connectionName
           
(package private) static Connections connections
           
(package private) static String userName
           
 
Constructor Summary
ConnectionsTest()
           
 
Method Summary
protected  void connect(String databaseType, String name, Connections connections)
          Open a connection and close it to test.
protected  void connectFromParameters(Connections connections)
          Open a connection using ConnectionParameters and close it.
static Test suite()
           
 void testAdd()
          Test adding a new ConnectionParameters to the saved state using the Connections.add(java.lang.String, com.sptci.rwt.ConnectionParameters) method.
 void testConnection()
          Test fetching a Connection using the Connections.getConnection(java.lang.String, java.lang.String) method.
 void testConnectionFromParameters()
          Test fetching a Connection using the ConnectionFactory.open( ConnectionParameters ) method after fetching the parameters from Connections.getConnectionParameters(java.lang.String, java.lang.String).
 void testDelete()
          Test removing a database from the persistent state using the Connections.delete( String ) method.
 void testDeleteConnection()
          Test removing a saved connection from the persistent state using the Connections.delete( String, String ) method.
 void testDuplicateName()
          Test adding a duplicate connection with same saved name.
 void testInitialisation()
          Test initialisation of Connections from persistent state.
 void testNewInstantiation()
          Test instantiating a new instance through the Connections.getInstance(java.lang.String) method when no saved state is available.
 
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, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

connections

static Connections connections

userName

static final String userName

connectionName

static final String connectionName
Constructor Detail

ConnectionsTest

public ConnectionsTest()
Method Detail

suite

public static Test suite()

testNewInstantiation

public void testNewInstantiation()
                          throws Exception
Test instantiating a new instance through the Connections.getInstance(java.lang.String) method when no saved state is available.

Throws:
Exception

testAdd

public void testAdd()
Test adding a new ConnectionParameters to the saved state using the Connections.add(java.lang.String, com.sptci.rwt.ConnectionParameters) method.


testConnection

public void testConnection()
Test fetching a Connection using the Connections.getConnection(java.lang.String, java.lang.String) method.

See Also:
connect(java.lang.String, java.lang.String, com.sptci.rwt.Connections)

testConnectionFromParameters

public void testConnectionFromParameters()
Test fetching a Connection using the ConnectionFactory.open( ConnectionParameters ) method after fetching the parameters from Connections.getConnectionParameters(java.lang.String, java.lang.String).

See Also:
connectFromParameters(com.sptci.rwt.Connections)

testDuplicateName

public void testDuplicateName()
Test adding a duplicate connection with same saved name. Exception test case.


testInitialisation

public void testInitialisation()
Test initialisation of Connections from persistent state.

See Also:
connect(java.lang.String, java.lang.String, com.sptci.rwt.Connections), connectFromParameters(com.sptci.rwt.Connections)

testDeleteConnection

public void testDeleteConnection()
Test removing a saved connection from the persistent state using the Connections.delete( String, String ) method.


testDelete

public void testDelete()
Test removing a database from the persistent state using the Connections.delete( String ) method.


connect

protected void connect(String databaseType,
                       String name,
                       Connections connections)
Open a connection and close it to test.

Parameters:
databaseType - The database engine to connect to.
name - The name of the saved connection.
connections - The connections object to use.

connectFromParameters

protected void connectFromParameters(Connections connections)
Open a connection using ConnectionParameters and close it.

Parameters:
connections - The connections object to use.

SPT RWT Application API