Email Answering System
Version 1.0

test
Class ManagedConnectionFactoryUnitTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--test.ManagedConnectionFactoryUnitTest
All Implemented Interfaces:
junit.framework.Test

public class ManagedConnectionFactoryUnitTest
extends junit.framework.TestCase

Unit test for the email resource adapter managed connection factory.

Author:
Derrick Oswald

Constructor Summary
ManagedConnectionFactoryUnitTest(String testName)
          Construct a ManagedConnectionFactory test.
 
Method Summary
 Serializable deserialize(byte[] bytes)
          Deserialize an object.
static junit.framework.Test equalsSuite()
          Test the equals method.
static junit.framework.Test hashCodeSuite()
          Test the hashCode method.
static void main(String[] args)
          Mainline for the ManagedConnectionFactory.
 byte[] serialize(Serializable object)
          Serialize an object.
protected  void setUp()
           
protected  String showBytes(byte[] data)
          Create a string representation of an array of bytes.
static junit.framework.Test suite()
          Create the suite of tests for the ManagedConnectionFactory.
protected  void tearDown()
           
 void testCreateConnectionFactory()
          Test the create factory method.
 void testCreateConnectionFactoryWithConnectionManager()
          Test the create factory method with a manager argument.
 void testCreateManagedConnection()
          Test the create connection method.
 void testCreateManagedConnectionWithSubject()
          Test the create connection method with a non-null subject.
 void testLogWriter()
          Test the logWriter property.
 void testLogWriterPropagates()
          Test the logWriter property propagates to managed connections.
 void testMatchManagedConnections()
          Test the match connection method.
 void testMatchManagedConnectionsWithSubject()
          Test the match connection method with a non-null subject.
 void testSerialization()
          Test the serializability of the factory.
 
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

ManagedConnectionFactoryUnitTest

public ManagedConnectionFactoryUnitTest(String testName)
Construct a ManagedConnectionFactory test.

Parameters:
testName - the name of the test
Method Detail

suite

public static junit.framework.Test suite()
Create the suite of tests for the ManagedConnectionFactory.

Returns:
The suite of tests.

setUp

protected void setUp()
Overrides:
setUp in class junit.framework.TestCase

tearDown

protected void tearDown()
Overrides:
tearDown in class junit.framework.TestCase

showBytes

protected String showBytes(byte[] data)
Create a string representation of an array of bytes. Shows the first 16 bytes in an array as "[xx yy...]".

Parameters:
data - The data to display.
Returns:
The string representation of the bytes in the array

equalsSuite

public static junit.framework.Test equalsSuite()
Test the equals method. Create a suite of tests to test the equals() method.

Returns:
The suite of tests for equals().

hashCodeSuite

public static junit.framework.Test hashCodeSuite()
Test the hashCode method. Create a suite of tests to test the hashCode() method.

Returns:
The suite of tests for hashCode().

testCreateConnectionFactory

public void testCreateConnectionFactory()
Test the create factory method.


testCreateConnectionFactoryWithConnectionManager

public void testCreateConnectionFactoryWithConnectionManager()
Test the create factory method with a manager argument.


testCreateManagedConnection

public void testCreateManagedConnection()
Test the create connection method.


testCreateManagedConnectionWithSubject

public void testCreateManagedConnectionWithSubject()
Test the create connection method with a non-null subject.


testMatchManagedConnections

public void testMatchManagedConnections()
Test the match connection method.


testMatchManagedConnectionsWithSubject

public void testMatchManagedConnectionsWithSubject()
Test the match connection method with a non-null subject.


testLogWriter

public void testLogWriter()
Test the logWriter property.


testLogWriterPropagates

public void testLogWriterPropagates()
Test the logWriter property propagates to managed connections.


serialize

public byte[] serialize(Serializable object)
                 throws IOException
Serialize an object.

Parameters:
object - The object to be serialized.
Returns:
The bytes corresponding to the serialized object.
Throws:
IOException - If the serialization process has an error.

deserialize

public Serializable deserialize(byte[] bytes)
                         throws ClassNotFoundException,
                                IOException
Deserialize an object.

Parameters:
bytes - The bytes corresponding to the serialized object.
Returns:
The deserialized object.
Throws:
ClassNotFoundException - If the class of the serialized object cannot be found or loaded.
IOException - If the deserialization process has an error.

testSerialization

public void testSerialization()
Test the serializability of the factory.


main

public static void main(String[] args)
Mainline for the ManagedConnectionFactory. Invoke the JUnit mainline.

Parameters:
args - JUnit arguments, optionally prefixed by a JUnit test runner class name. The default is junit.swingui.TestRunner, but other possibilities include:

junit.textui.TestRunner

junit.awtui.TestRunner


Email Answering System
Version 1.0

Copyright © 2003 Derrick Oswald. All rights reserved.