com.ail.coretest
Class TestProductServices

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

public class TestProductServices
extends CoreUserTestCase

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

Constructor Summary
TestProductServices(java.lang.String name)
          Constructs a test case with the given name.
 
Method Summary
 VersionEffectiveDate getVersionEffectiveDate()
          Always select the latest configurations
static void main(java.lang.String[] args)
           
static junit.framework.Test suite()
           
 void testConfigurationSource()
          When Configurations are "reset" the URL of they are loaded from is put into their source property.
 void testDefaultTypeInstantiation()
          Each product definition must contain a "default" type.
 void testListProductsService()
          The ListProducts service returns a list of all the products knowm to the system.
 void testNonDefaultProductTypeInstantiation()
          Each product can define any number of named types.
 void testProductDefaultTypeInheritance()
          A product definition that extends another may base its types on its parent's types.
 void testProductResetService()
           
 void testRegisterUpdateRemoveHappyPath()
           
 void testServicesViaCore()
          The core class exposes the services offered by the core via easy to use interfaces.
 
Methods inherited from class com.ail.coretest.CoreUserTestCase
getConfiguration, getConfigurationNamespace, getCore, getSecurityPrincipal, 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

TestProductServices

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

getVersionEffectiveDate

public VersionEffectiveDate getVersionEffectiveDate()
Always select the latest configurations

Specified by:
getVersionEffectiveDate in interface CoreUser
Overrides:
getVersionEffectiveDate in class CoreUserTestCase
Returns:

testServicesViaCore

public void testServicesViaCore()
The core class exposes the services offered by the core via easy to use interfaces. This test checks that those interfaces are present and throw the appropriate exceptions when bad arguments are passed into the services.


testListProductsService

public void testListProductsService()
The ListProducts service returns a list of all the products knowm to the system. It returns a Collection of instances of String, each representing the name of a product. If no products are defined it returns an empty Collections. The Core defines two test products, only these should be returned by this service.

testProductResetService

public void testProductResetService()

testDefaultTypeInstantiation

public void testDefaultTypeInstantiation()
Each product definition must contain a "default" type. This test checks that each of the test products does, and that they can be instantiated.


testNonDefaultProductTypeInstantiation

public void testNonDefaultProductTypeInstantiation()
Each product can define any number of named types. This test checks that the defalut product's named types are available, and that requests to instantiate types that are not defined are handled correctly.


testProductDefaultTypeInheritance

public void testProductDefaultTypeInheritance()
A product definition that extends another may base its types on its parent's types. This extends to the product default type. This test checks that TestProduct3's default type does correctly inherit its parent's settings, and also that it overrides some of them.

TestProduct2 defines four attributes and values:

  1. name='TestProduct2'
  2. productname='TestProduct2'
  3. age='34'
  4. colour='purple'
TestProduct3 extends TestProduct2, and overrides the following:
  1. name='TestProduct3'
  2. productname='TestProduct3'
The 'age' and 'colour' attributes inherited from TestProduct2.


testRegisterUpdateRemoveHappyPath

public void testRegisterUpdateRemoveHappyPath()

testConfigurationSource

public void testConfigurationSource()
When Configurations are "reset" the URL of they are loaded from is put into their source property. This has to present in order for resources to be loaded using relative URLs - which is a common practice in products. This test checks that the URL has been added correctly.