ch.elca.el4j.tests.services.exceptionhandler
Class SafetyFacadeTest

java.lang.Object
  extended by ch.elca.el4j.tests.services.exceptionhandler.SafetyFacadeTest

public class SafetyFacadeTest
extends Object

This class tests the security facade.

Author:
Andreas Bur (ABU)
File-location:
SafetyFacadeTest
Last check-in date:
2009-08-04 15:35:01 +0200 (Di, 04. Aug 2009) by swismer for revision 3883

Field Summary
private  A m_a
          The bean that is guarded by the security facade.
private  ApplicationContext m_appContext
          The application context.
private  A m_unsafeA
          The bare bean.
 
Constructor Summary
SafetyFacadeTest()
          Default constructor.
 
Method Summary
 void testA()
          Checks on the guarded bean that no exception is thrown and that the result is converted correctly.
 void testForwardInterfaceExceptions()
          Tests whether the checked application exception is forwarded correctly.
 void testReconfigurationExceptionHandler()
          Tests the reconfiguration of a bean.
 void testRetry()
          Tests the retry exception handler.
 void testRoundRobinExceptonHandler()
          Tests the round robin exception handler.
 void testRTException()
          Checks that an runtime exception is consumed by the security facade.
 void testUnsafeA()
          Checks that the bare bean is still available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_appContext

private ApplicationContext m_appContext
The application context.


m_a

private A m_a
The bean that is guarded by the security facade.


m_unsafeA

private A m_unsafeA
The bare bean.

Constructor Detail

SafetyFacadeTest

public SafetyFacadeTest()
Default constructor.

Method Detail

testA

public void testA()
Checks on the guarded bean that no exception is thrown and that the result is converted correctly.


testUnsafeA

public void testUnsafeA()
Checks that the bare bean is still available.


testRTException

public void testRTException()
Checks that an runtime exception is consumed by the security facade.


testForwardInterfaceExceptions

public void testForwardInterfaceExceptions()
Tests whether the checked application exception is forwarded correctly.


testReconfigurationExceptionHandler

public void testReconfigurationExceptionHandler()
Tests the reconfiguration of a bean. A delegates add invocations to bean B, which throws an unsupported operation exception. After that, A is reconfigured to use C.

First, we check that B and C are called exactly once. From now on, A is configured to use C. A subsequent call does not touch B at all, which is tested after the counters are reset.


testRoundRobinExceptonHandler

public void testRoundRobinExceptonHandler()
Tests the round robin exception handler. First, the call on A fails letting the system switch to B. Then, B will be called directly (the proxy's target has been changed). In the third test it's assured that the round robin really cycles back to A and in the last round we just make sure that A is again referenced by the proxy as its target.


testRetry

public void testRetry()
Tests the retry exception handler. First we check that it retries several times without exceeding the specified number of maximum retries. Then the number of retries is increased and the invocation is expected to fail, as tested in the second part.



Copyright © 2005-2011 ELCA. All Rights Reserved.