com.ail.coretest
Class TestFinderService

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.ail.coretest.CoreUserTestCase
              extended by com.ail.coretest.TestFinderService
All Implemented Interfaces:
ConfigurationOwner, CoreUser, java.io.Serializable, junit.framework.Test

public class TestFinderService
extends CoreUserTestCase

Version:
$Revision: 1.2 $
See Also:
Serialized Form

Constructor Summary
TestFinderService(java.lang.String name)
          Constructs a test case with the given name.
 
Method Summary
static void main(java.lang.String[] args)
           
static junit.framework.Test suite()
           
 void testClassFinderForMissingClass()
          The class finder service should always return a list - even if it is empty.
 void testForClassesOutsideComAil()
          By default the class finder service searches under the com.ail package tree.
 void testForClassesOutsideSpecifiedPackage()
          The class finder service can searches under any specified package tree.
 void testSimpleClassFinder()
          The GetClassList service searches for class that implement specific interfaces (or extend a base class).
 
Methods inherited from class com.ail.coretest.CoreUserTestCase
getConfiguration, getConfigurationNamespace, getCore, getSecurityPrincipal, getVersionEffectiveDate, resetConfiguration, setConfiguration, setCore, setupSystemProperties, setVersionEffectiveDate
 
Methods inherited from class junit.framework.TestCase
countTestCases, getName, run, run, runBare, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestFinderService

public TestFinderService(java.lang.String name)
Constructs a test case with the given name.

Method Detail

suite

public static junit.framework.Test suite()

main

public static void main(java.lang.String[] args)

testSimpleClassFinder

public void testSimpleClassFinder()
                           throws java.lang.Exception
The GetClassList service searches for class that implement specific interfaces (or extend a base class). Given the class to search for and a portion of the package structure to search under, it will return a list of all the class it finds that implement of extend the class. This test performs a search under com.ail.core and checks that a number of known classes are returned.
  1. Create an instance of the GetClassList command object.
  2. Set the command to search for instances of Type.class.
  3. Set the command to search under com.ail.core in the package structure.
  4. Invoke the command.
  5. Check that the returned list includes:
    • com.ail.core.Version
    • com.ail.core.History
    • com.ail.core.configure.Builder
  6. Fail if any exceptions are thrown, or if any of the above are not returned.

Throws:
java.lang.Exception

testClassFinderForMissingClass

public void testClassFinderForMissingClass()
                                    throws java.lang.Exception
The class finder service should always return a list - even if it is empty. This test asks the finder to find implementors of a class that doesn't exist.
  1. Create an instance of the GetClassList command object
  2. Set the command to search for an instance of "com.ail.ClassThatDoesNotExist"
  3. Invoke the command
  4. Fail if any exceptions are thrown
  5. Fail if the class list returned is null, or not empty

Throws:
java.lang.Exception

testForClassesOutsideComAil

public void testForClassesOutsideComAil()
                                 throws java.lang.Exception
By default the class finder service searches under the com.ail package tree. This test checks that class outside of this tree are ignored.
  1. Create an instance of the GetClassList command object
  2. Set the command to search for an instance of "java.io.Serializable"
  3. Invoke the command
  4. Fail if any exceptions are thrown
  5. Fail if the class list returned is null, or empty
  6. Fail if the class list returned includes any class outside of com.ail

Throws:
java.lang.Exception

testForClassesOutsideSpecifiedPackage

public void testForClassesOutsideSpecifiedPackage()
                                           throws java.lang.Exception
The class finder service can searches under any specified package tree. This test checks that class outside of a selected tree are ignored.
  1. Create an instance of the GetClassList command object
  2. Set the command to search for an instance of "java.lang.Exception"
  3. Set the search package to "java.io"
  4. Invoke the command
  5. Fail if any exceptions are thrown
  6. Fail if the class list returned is null, or empty
  7. Fail if the classes list returned includes any class outside of java.io

Throws:
java.lang.Exception