ch.elca.el4j.tests.util.metadata.annotations
Class GenericAttributesTest

java.lang.Object
  extended by ch.elca.el4j.tests.util.metadata.annotations.GenericAttributesTest

public class GenericAttributesTest
extends Object

JUnit test for the GenericMetaDataAdvisor class in combination with Java 5 Annotations. Please be sure to compile the Commons Attributes before launching this test.

Author:
Raphael Boog (RBO)
File-location:
GenericAttributesTest
Last check-in date:
2009-08-04 14:35:53 +0200 (Di, 04. Aug 2009) by swismer for revision 3875

Field Summary
static String SPRING_BEAN_CONFIG_LOCATION
          Is the spring bean config location prefix for this test.
 
Constructor Summary
GenericAttributesTest()
           
 
Method Summary
 void testAdvisorWithNoInterceptingAttributes()
          This test loads an application context with an AutoProxy, one GenericAttributeAdvisor, a class with declared attributes, but no intercepting Attributes are defined.
 void testAdvisorWithNoInterceptor()
          This test loads an application context with an AutoProxy, one GenericAttributeAdvisor, a class with declared attributes, but no interceptor are defined.
 void testConfiguredAttributeSource()
          This test loads an application context with an AutoProxy, a GenericAttributeAdvisor and a class with declared attributes.
 void testInterceptorInjectedViaConstructor()
          This test loads an application context with an AutoProxy, a GenericAttributeAdvisor and a class with declared attributes.
 void testInterceptorInjectedViaConstructorInnerClassAsParameter()
          This test does the same as method testInterceptorInjectedViaConstructor but it invokes the method with an inner class parameter.
 void testInterceptorInjectedViaSetter()
          This test loads an application context with an AutoProxy, a GenericAttributeAdvisor and a class with declared attributes.
 void testTwoAdvisors()
          This test loads an application context with a class having declared attributes, an AutoProxy and two GenericAttributeAdvisor with each defined a different ExampleAttribute and a different Interceptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPRING_BEAN_CONFIG_LOCATION

public static final String SPRING_BEAN_CONFIG_LOCATION
Is the spring bean config location prefix for this test.

See Also:
Constant Field Values
Constructor Detail

GenericAttributesTest

public GenericAttributesTest()
Method Detail

testInterceptorInjectedViaConstructor

public void testInterceptorInjectedViaConstructor()
This test loads an application context with an AutoProxy, a GenericAttributeAdvisor and a class with declared attributes. The interceptor will be injected via contructor argument to the advisor. It calculates the result of a calculation which is only correct if the interception worked correctly.


testInterceptorInjectedViaSetter

public void testInterceptorInjectedViaSetter()
This test loads an application context with an AutoProxy, a GenericAttributeAdvisor and a class with declared attributes. The interceptor will be injected via setter method to the advisor. It calculates the result of a calculation which is only correct if the interception worked correctly.


testConfiguredAttributeSource

public void testConfiguredAttributeSource()
This test loads an application context with an AutoProxy, a GenericAttributeAdvisor and a class with declared attributes. Additionally, the AttributeSource and the Attributes implementation are injected via configuration file and not set automatically like in the other tests. It calculates the result of a calculation which is only correct if the interception worked correctly.


testTwoAdvisors

public void testTwoAdvisors()
This test loads an application context with a class having declared attributes, an AutoProxy and two GenericAttributeAdvisor with each defined a different ExampleAttribute and a different Interceptor. The order of the advisors can be adjusted by setting the property "order" in the configuration file. The advisor with the lower number will be invoked first. Therefore, in our case, "exampleInterceptorTwo" has to be the real interceptor for the target method.


testAdvisorWithNoInterceptor

public void testAdvisorWithNoInterceptor()
This test loads an application context with an AutoProxy, one GenericAttributeAdvisor, a class with declared attributes, but no interceptor are defined. This test checks whether an exception is thrown.


testAdvisorWithNoInterceptingAttributes

public void testAdvisorWithNoInterceptingAttributes()
This test loads an application context with an AutoProxy, one GenericAttributeAdvisor, a class with declared attributes, but no intercepting Attributes are defined. This test checks whether an exception is thrown.


testInterceptorInjectedViaConstructorInnerClassAsParameter

public void testInterceptorInjectedViaConstructorInnerClassAsParameter()
This test does the same as method testInterceptorInjectedViaConstructor but it invokes the method with an inner class parameter. This should test if methods which has inner classes as parameter as also intercepted.



Copyright © 2005-2011 ELCA. All Rights Reserved.