com.ail.coretest
Class TestServiceInvocation

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

public class TestServiceInvocation
extends CoreUserTestCase

Test that basic service invocation works as specified. Note: These tests assume that the JDBCConfigurationLoader is being used.

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

Constructor Summary
TestServiceInvocation(java.lang.String name)
          Constructs a test case with the given name.
 
Method Summary
 void DONTtestSimpleWebServiceClient()
          Invoke the configure server via its web service interface.
 void DONTtestWebServiceWithUrlViaAccessor()
          THIS TEST SKIPPED UNTIL WE NEED WEB SERVICE SUPPORT
 VersionEffectiveDate getVersionEffectiveDate()
          Always select the latest configuration.
static void main(java.lang.String[] args)
           
static junit.framework.Test suite()
           
 void testBeanShellInheritance()
          Test that the BeanShell accessor's inheritance support is working.
 void testBeanShellService()
          Test that services writen in BeanShell work correctly.
 void testBeanshellUrlLoader()
          The Beanshell accessor supports the loading of scripts from URLs.
 void testDroolsAccessorCache()
           
 void testDroolsDecisionTable()
          The DroolsDecisionTableAccessor provides access to drools decision table based services.
 void testDroolsDecisionTableInheritance()
          The DroolsDecisionTableAccessor provides support for "inheritance" which allows the rules defined in one rule spreadsheet to inherit rules from another.
 void testDroolsInheritance()
          The DroolsDecisionTableAccessor provides access to drools decision table based services.
 void testDroolsMemoryLeak()
           
 void testDroolsService()
           
 void testDroolsServiceUrlScript()
           
 void testJaninoInheritance()
          The Janino Accessor supports inheritance by allowing Janino services to be 'chained'.
 void testJMSService()
           
 void testMultiLineInvoke()
          Test the "normal" multi line service invocation.
 void testServiceLogging()
           
 void testSimpleJaninoService()
          The Janino Accessor provides access to services whose logic is defined in a java like syntax.
 void testSingleLineInvoke()
          Test the single line service invocation facility.
 void testXSLT()
           
 void testXSLTPerformance()
           
 
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

TestServiceInvocation

public TestServiceInvocation(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)
                 throws java.lang.Exception
Throws:
java.lang.Exception

getVersionEffectiveDate

public VersionEffectiveDate getVersionEffectiveDate()
Always select the latest configuration.

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

testBeanShellService

public void testBeanShellService()
                          throws java.lang.Exception
Test that services writen in BeanShell work correctly. BeanShell services allow a service's logic to be defined as a script in the services configuration. This is similar to using rules in a lot of ways as the logic can be changed without the need to recompile anything. This test The TestBeanShellService simply adds two numbers (X & Y) together to get R, if X>100 it is multiplied by 2 before being added to Y.
  1. Create an instance of the TestBeanShellService.
  2. Invoke the service with X=21 and Y=3
  3. Fail if the result (R) doesn't equal 24
  4. Invoke the service again with X=101 and Y=10
  5. Fail if the result (R) doesn't equal 212
  6. Fail if any exceptions are thrown.

Throws:
java.lang.Exception

testXSLT

public void testXSLT()
              throws java.lang.Exception
Throws:
java.lang.Exception

testXSLTPerformance

public void testXSLTPerformance()
                         throws java.lang.Exception
Throws:
java.lang.Exception

testDroolsDecisionTable

public void testDroolsDecisionTable()
                             throws java.lang.Exception
The DroolsDecisionTableAccessor provides access to drools decision table based services. This test ensures that 'happy path' access to this type of service works okay.

Throws:
java.lang.Exception

testDroolsDecisionTableInheritance

public void testDroolsDecisionTableInheritance()
                                        throws java.lang.Exception
The DroolsDecisionTableAccessor provides support for "inheritance" which allows the rules defined in one rule spreadsheet to inherit rules from another. This test checks that this feature is working.

Throws:
java.lang.Exception

testDroolsInheritance

public void testDroolsInheritance()
                           throws java.lang.Exception
The DroolsDecisionTableAccessor provides access to drools decision table based services. This test ensures that 'happy path' access to this type of service works okay.

Throws:
java.lang.Exception

DONTtestSimpleWebServiceClient

public void DONTtestSimpleWebServiceClient()
                                    throws java.lang.Exception
Invoke the configure server via its web service interface. This test uses the web service directly (i.e. not via any accessor). THIS TEST SKIPPED UNTIL WE NEED WEB SERVICE SUPPORT

Throws:
java.lang.Exception

testDroolsService

public void testDroolsService()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testDroolsServiceUrlScript

public void testDroolsServiceUrlScript()
                                throws java.lang.Exception
Throws:
java.lang.Exception

testMultiLineInvoke

public void testMultiLineInvoke()
                         throws java.lang.Exception
Test the "normal" multi line service invocation.
  1. Get the TestService (which adds two ints together)
  2. Set the first int to 1 using the setter.
  3. Set the second int to 1 using the setter.
  4. invoke the service.
  5. Fail if the result returned isn't 2.
  6. Fail if any exceptions are thrown.

Throws:
java.lang.Exception

DONTtestWebServiceWithUrlViaAccessor

public void DONTtestWebServiceWithUrlViaAccessor()
                                          throws java.lang.Exception
THIS TEST SKIPPED UNTIL WE NEED WEB SERVICE SUPPORT

Throws:
java.lang.Exception

testSingleLineInvoke

public void testSingleLineInvoke()
                          throws java.lang.Exception
Test the single line service invocation facility.
  1. Invoke the TestService passing it arguments of 1 and 1.
  2. Fail if the result isn't 2.
  3. Fail if any exceptions are thrown.
    1. Throws:
      java.lang.Exception

testServiceLogging

public void testServiceLogging()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testJMSService

public void testJMSService()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testDroolsAccessorCache

public void testDroolsAccessorCache()
                             throws java.lang.Exception
Throws:
java.lang.Exception

testBeanShellInheritance

public void testBeanShellInheritance()
                              throws java.lang.Exception
Test that the BeanShell accessor's inheritance support is working. The BeanShell acceessor's implementation of inheritance (using the "extends" parameter) is really more akin to chaining two or more accessors together. The command named in the extends property is executed, and the results of that execution are passed into the extending script for it to do with as it pleases. The extended command need not be another BeanShell based command, it could be any type of command.

The test configuration (TestServiceInvocationDefaultConfig.xml) defines the BeanShell command "TestBeanshellInheritanceService" which extends "TestBeanShellService". "TestBeanShellService" applys a simple rule: if x<100 r=x+y; else r=2*x+y;). The inheriting service adds it's own rule: if (x>1000) r=x-(2*y);

Throws:
java.lang.Exception

testBeanshellUrlLoader

public void testBeanshellUrlLoader()
                            throws java.lang.Exception
The Beanshell accessor supports the loading of scripts from URLs. This test executes a command configured that way.

Throws:
java.lang.Exception

testDroolsMemoryLeak

public void testDroolsMemoryLeak()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testSimpleJaninoService

public void testSimpleJaninoService()
                             throws java.lang.Exception
The Janino Accessor provides access to services whose logic is defined in a java like syntax. This tests ensures that the accessor works in its simplest form and performs some rudimentary performance tests.

Throws:
java.lang.Exception

testJaninoInheritance

public void testJaninoInheritance()
                           throws java.lang.Exception
The Janino Accessor supports inheritance by allowing Janino services to be 'chained'. If one janino service may "extends" another, the logic of the extended service is executed before the logic of the extending service. This test checks that this extension mechanism is working.

Throws:
java.lang.Exception