com.ail.coretest
Class TestConfigurationServices

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

public class TestConfigurationServices
extends CoreUserTestCase

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

Constructor Summary
TestConfigurationServices(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 testCarServiceAvailability()
          The core offers twp services to package and deploy car files (Configuration Archives).
 void testDeployCarServicePreconditions()
          The DeployCar service takes a car file and deploys a specified list of the configurations it contains.
 void testGetNamespaces()
          The GetNamespaces service collects and returns information about all the currently defined configuration namespaces.
 void testPackageAndDeployCarHappyPath()
          The PackageCar service returns a configuration archive containing a set of configurations specified.
 void testPackageCarServicePreconditions()
          The PackageCar service returns a configuration archive containing a set of configurations specified.
 void testScriptLoadService()
          Test the script fetching command (GetCommandScript).
 void testScriptSaveService()
          Test the script save command.
 
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

TestConfigurationServices

public TestConfigurationServices(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)

testScriptLoadService

public void testScriptLoadService()
                           throws java.lang.Exception
Test the script fetching command (GetCommandScript). Some commands in the system are defined interally as scripts held in strings - rules and highly configurable logic are typically handled this way. This test checks that the service responsible for fetching such scripts for edit or display is working correctly.
  1. Get and instance of the GetCommandScript command
  2. Populate the command's arguments such that it will fetch the TestBeanShellService script
  3. Invoke the command
  4. Fail if a command object is not returned
  5. Fail if the object's Type property isn't set to BeanShell
  6. Fail if the object's Script property doesn't look like a script
  7. Fail if the object's namespace property isn't set correctly (=TestNamespace)
  8. Fail if the object's service name property isn't set to TertBeanShellService
  9. Fail if any exceptions are thrown

Throws:
java.lang.Exception

testScriptSaveService

public void testScriptSaveService()
                           throws java.lang.Exception
Test the script save command. Scriptable commands can be modified using the SetCommandScript command. This test ensures that this service is working correctly.
  1. Create an instance of a scriptable test command - one that adds two numbers (TestBeanShellService)
  2. Polulate the command with arguments (21 and 3)
  3. Invoke the command
  4. Fail if the result isn't 24
  5. Create an instance of the SetCommandScript command
  6. Populate the command with arguments to modify the TestBeanShellService script such that it always returns the value 5
  7. Invoke the setCommandScript command.
  8. Clear the config cache. Note: this is not really necessary, but we're not testing caching here.
  9. Set the version effective date to now - this should ensure that we use the new test command rather than the old one.
  10. Run through steps 1-3 again.
  11. Fail if the result isn't 5.
  12. Fail if any exceptions are thrown
    1. Throws:
      java.lang.Exception

testGetNamespaces

public void testGetNamespaces()
                       throws java.lang.Exception
The GetNamespaces service collects and returns information about all the currently defined configuration namespaces. This test checks that the service is operating correctly.

Throws:
java.lang.Exception

testCarServiceAvailability

public void testCarServiceAvailability()
                                throws java.lang.Exception
The core offers twp services to package and deploy car files (Configuration Archives). This text checks that the services can be instantiated - it doesn't attempt to invoke them.

Throws:
java.lang.Exception

testPackageCarServicePreconditions

public void testPackageCarServicePreconditions()
                                        throws java.lang.Exception
The PackageCar service returns a configuration archive containing a set of configurations specified. Configurations are specified by namespace. This test checks that sending a empty or null collection of namespaces throws the appropriate exception.

Throws:
java.lang.Exception

testPackageAndDeployCarHappyPath

public void testPackageAndDeployCarHappyPath()
                                      throws java.lang.Exception
The PackageCar service returns a configuration archive containing a set of configurations specified. Configurations are specified by namespace. This test checks that sending one or more valid namespaces does return a Car.

Throws:
java.lang.Exception

testDeployCarServicePreconditions

public void testDeployCarServicePreconditions()
                                       throws java.lang.Exception
The DeployCar service takes a car file and deploys a specified list of the configurations it contains. This test checks the service's preconditions.

Throws:
java.lang.Exception