JSR-318: Interceptors Specification TCK Coverage

1.2

Contents

Chapter Summary
Section Summary
Coverage Detail
Unmatched Tests
Unversioned Tests
Test Group Summary

Coverage Distribution

 
 
 
 
 
 
 
 
 
 

Chapter Summary

Chapter Assertions Testable Total Tested Total Tests Tested
(problematic)
Tested
(working)
Coverage %
1 Overview000000
2 Interceptor Programming Contract92706810006897,14%
3 Associating Interceptors using Interceptor Bindings3932305603093,75%
4 Associating Interceptors using the Interceptors Annotation833003100,00%
5 Interceptor Ordering22101033010100,00%
Total161115111189011196,52%

Section Summary

SectionAssertionsTestableTotal TestedTested
(problematic)
Tested
(working)
Coverage %
1 Overview00000
2 Interceptor Programming Contract00000
2.1 Interceptor Definition95505100,00%
2.2 Interceptor Life Cycle13650583,33%
2.2.1 Interceptor Environment33303100,00%
2.3 InvocationContext19161501593,75%
2.4 Exceptions54404100,00%
2.5 Business Method Interceptors109909100,00%
2.6 Interceptors for Lifecycle Event Callbacks161313013100,00%
2.6.1 Exceptions33303100,00%
2.7 Timeout Method Interceptors86606100,00%
2.8 Constructor- and Method-level Interceptors65505100,00%
3 Associating Interceptors using Interceptor Bindings10000
3.1 Interceptor Binding Types22202100,00%
3.1.1 Interceptor binding types with additional interceptor bindings32202100,00%
3.1.2 Other sources of interceptor bindings11101100,00%
3.2 Declaring Interceptor Bindings of an Interceptor7530360,00%
3.3 Binding an Interceptor to a Component121010010100,00%
3.4 Interceptor Resolution87707100,00%
3.4.1 Interceptors with multiple bindings11101100,00%
3.4.2 Interceptor binding types with members44404100,00%
4 Associating Interceptors using the Interceptors Annotation63303100,00%
4.1 Default Interceptors20000
5 Interceptor Ordering00000
5.1 Defining Interceptor Order51101100,00%
5.2 Common Ordering Rules00000
5.2.1 Invocation Order of Interceptors Declared on the Target Class44404100,00%
5.2.2 Invocation Order of Interceptors with Superclasses11101100,00%
5.3 Ordering Interceptors using the Priority Annotation50000
5.4 Interceptor Priority00000
5.5 Invocation Order for Multiple Interceptors Defined Using the Interceptors Annotation74404100,00%

Coverage Detail

Colour Key
Assertion is covered
Assertion is not covered
Assertion test is unimplemented
Assertion is untestable

Section 2.1 - Interceptor Definition

An interceptor method may be defined on a target class or on an interceptor class associated with the target class.

aa)

Interceptor method may be defined on a target class.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke.bindings.ejb
Test archive name: 3286d95f67ebb1afb78fffa93ba2a8e9fd9b34
SessionBeanAroundInvokeInterceptorTest.testBusinessMethodIntercepted()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke.bindings
Test archive name: d8d5d346925eef1fc2a33cfa816a379a769b350
AroundInvokeInterceptorTest.testBusinessMethodIntercepted()github
ab)

Interceptor method may be defined on an interceptor class associated with the target class.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testPostConstructInterceptor()github
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testPreDestroyInterceptor()github
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testAroundInvokeAndLifeCycleCallbackInterceptorsCanBeDefinedOnTheSameClass()github
b)It's not possible to test all the combinations, we only test few basic scenarios.

Any number of interceptor classes may be associated with a target class.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct
Test archive name: 24532c5aefe78fa5ce54a325bc97ae0c48638
AroundConstructTest.testExceptions()github
c)INTERCEPTORS_SPEC-22

An interceptor class must not be abstract and must have a public no-arg constructor.

d)

An around-invoke interceptor method, an around-timeout interceptor method, and lifecycle callback interceptor methods for different lifecycle events may be defined on the same interceptor class.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testAroundInvokeAndLifeCycleCallbackInterceptorsCanBeDefinedOnTheSameClass()github
e)

An interceptor class may have superclasses.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct.bindings
Test archive name: 3b1268c6746335af3048425d34eb5e7c298d2c3c
AroundConstructTest.testReplacingParameters()github
f)Tested in several other sections

Interceptor methods and interceptor classes may be defined for a class by means of metadata annotations or, optionally, by means of a deployment descriptor.

g)Tested in sections 3.3 and 4

Interceptors classes may be associated with the target class using either interceptor binding or the Interceptors annotation. Typically only one interceptor association type is used for any component.

h)The ejb-jar.xml deployment descriptor is tested within the EJB TCK. The beans.xml deployment descriptor is tested within the CDI TCK, section 9.4 Interceptor enablement and ordering.

A deployment descriptor may be used to specify the invocation order of interceptors or to override the order specified in metadata annotations. A deployment descriptor can be optionally used to define default interceptors or to associate interceptors with the target class. The EJB specification requires support for the ejb-jar.xml deployment descriptor and the CDI specification requires supports for the beans.xml deployment descriptor.

Section 2.2 - Interceptor Life Cycle

a)Tested within 2.2 ba) and 2.2 bb).

The lifecycle of an interceptor instance is the same as that of the target class instance with which it is associated.

ba)

Except as noted below, when the target instance is created, a corresponding interceptor instance is created for each associated interceptor class.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.interceptorLifeCycle
Test archive name: 7529b9262a5d146684def534f61464a89587a77e
InterceptorLifeCycleTest.testInterceptorInstanceCreatedWhenTargetInstanceCreated()github
org.jboss.cdi.tck.interceptors.tests.contract.interceptorLifeCycle.aroundConstruct.withAroundInvoke
Test archive name: 4d34218e7fcb68badea652c18b6d70df602318
SingleInterceptorInstanceTest.testAroundConstructInvokedAfterDependencyInjectionOnInterceptorClasses()github
bb)Unable to test whether an instance is really destroyed.

These interceptor instances are destroyed if the target instance fails to be created or when it is removed.

c)Tested within 2.2.1 a).

An interceptor instance may be the target of dependency injection. Dependency injection is performed when the interceptor instance is created, using the naming context of the associated target class.

Coverage

No tests exist for this assertion

When a AroundConstruct lifecycle callback interceptor is used, the following rules apply:

da)

The AroundConstruct lifecycle callback is invoked after the dependency injection has been completed on instances of all interceptor classes associated with the target class.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.interceptorLifeCycle.aroundConstruct
Test archive name: 96a098218fb0918f99d4837d4894b88c1ceb116d
AroundConstructLifeCycleTest.testAroundConstructInvokedAfterDependencyInjectionOnInterceptorClasses()github
daz)

Injection of the target component into interceptor instances that are invoked during the AroundConstruct lifecycle callback is not supported.

db)

The target instance is created and its constructor injection is performed, if applicable, when the last interceptor method in the AroundConstruct interceptor chain invokes the InvocationContext.proceed method. If the InvocationContext.proceed method is not invoked by an interceptor method, the target instance will not be created.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.interceptorLifeCycle.aroundConstruct
Test archive name: 96a098218fb0918f99d4837d4894b88c1ceb116d
AroundConstructLifeCycleTest.testInstanceNotCreatedUnlessInvocationContextProceedCalled()github
dc)

The AroundConstruct interceptor method can access the constructed instance using the InvocationContext.getTarget method after the InvocationContext.proceed completes.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.interceptorLifeCycle.aroundConstruct
Test archive name: 96a098218fb0918f99d4837d4894b88c1ceb116d
AroundConstructLifeCycleTest.testInstanceNotCreatedUnlessInvocationContextProceedCalled()github
dd)INTERCEPTORS_SPEC-26

Dependency injection on the target instance is not completed until after invocation of all interceptor methods in the AroundConstruct interceptor chain complete successfully.

de)Tested in 2.2 e).

The PostConstruct lifecycle callback chain for the target instance, if any, will be invoked after the dependency injection has been completed on the target instance.

df)

An AroundConstruct lifecycle callback interceptor method should exercise caution when invoking methods of the target instance since its dependency injection may not have been completed.

e)If the PostConstruct callback is defined on the interceptor class, it is not invoked when the interceptor instance itself is created.

With the exception of AroundConstruct lifecycle callback interceptors, all interceptor methods, including PostConstruct callbacks are invoked after dependency injection has been completed on both the interceptor instances and the target instance.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.interceptorLifeCycle
Test archive name: 7529b9262a5d146684def534f61464a89587a77e
InterceptorLifeCycleTest.testInterceptorMethodsCalledAfterDependencyInjection()github
f)If the PreDestroy callback is defined on the interceptor class, it is not invoked when the interceptor instance itself is destroyed.

PreDestroy callbacks, if any, are invoked before the target instance and all interceptor instances associated with it are destroyed.

Section 2.2.1 - Interceptor Environment

a)

An interceptor class shares the enterprise naming context of its associated target class. Annotations and/or XML deployment descriptor elements for dependency injection or for direct JNDI lookup refer to this shared naming context.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.interceptorLifeCycle.environment.jndi.ejb
Test archive name: a574934159b3d2ae87d2d24b32afa4b1f790eb42
InterceptorEnvironmentJNDISessionBeanTest.testInterceptorEnvironment()github
org.jboss.cdi.tck.interceptors.tests.contract.interceptorLifeCycle.environment.jndi
Test archive name: ccd8b964247a8e3ed6974c533a5ae0c3979a2627
InterceptorEnvironmentJNDITest.testInterceptorEnvironment()github
b)

Around-invoke and around-timeout interceptor methods run in the same Java thread as the associated target method.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.interceptorLifeCycle.environment
Test archive name: b6c0464847fc61fbe77fbc0411dadb39cea1728
InterceptorEnvironmentTest.testSameThread()github
c)

It is possible to carry state across multiple interceptor method invocations for a single method invocation or lifecycle callback event in the context data of the InvocationContext object. The InvocationContext object also provides metadata that enables interceptor methods to control the behavior of the interceptor invocation chain, including whether the next method in the chain is invoked and the values of its parameters and result.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.interceptorLifeCycle.environment
Test archive name: b6c0464847fc61fbe77fbc0411dadb39cea1728
InterceptorEnvironmentTest.testInvocationContext()github

Section 2.3 - InvocationContext

a)Statement of intent

The InvocationContext object provides metadata that enables interceptor methods to control the behavior of the invocation chain.

ba)

The same InvocationContext instance will be passed to each interceptor method for a given target class method or lifecycle event interception. This allows an interceptor to save information in the context data property of the InvocationContext that can be subsequently retrieved in other interceptors as a means to pass contextual data between interceptors. The contextual data is not sharable across separate target class method invocations or lifecycle callback events.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testContextData()github
bb)

If interceptors are invoked as a result of the invocation on a web service endpoint, the map returned by getContextData() will be the JAX-WS MessageContext.

Coverage

No tests exist for this assertion

c)

The getTarget method returns the associated target instance. For the AroundConstruct lifecycle callback interceptor method, getTarget returns null if called before the proceed method returns.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct
Test archive name: 24532c5aefe78fa5ce54a325bc97ae0c48638
AroundConstructTest.testInterceptorInvocation()github
org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testGetTargetMethod()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct.bindings
Test archive name: 3b1268c6746335af3048425d34eb5e7c298d2c3c
AroundConstructTest.testInterceptorInvocation()github
da)Duplicate of 2.7 f)

The getTimer method returns the timer object associated with a timeout method invocation.

db)

The getTimer method returns null for around-invoke methods and lifecycle callback interceptor methods.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testGetTimerMethod()github
ea)

The getMethod method returns the method of the target class for which the interceptor was invoked.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testGetMethodForAroundInvokeInterceptorMethod()github
eb)

In a lifecycle callback interceptor for which there is no corresponding lifecycle callback method on the target class or in the AroundConstruct lifecycle callback interceptor method, getMethod returns null.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct
Test archive name: 24532c5aefe78fa5ce54a325bc97ae0c48638
AroundConstructTest.testInterceptorInvocation()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct.bindings
Test archive name: 3b1268c6746335af3048425d34eb5e7c298d2c3c
AroundConstructTest.testInterceptorInvocation()github
org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testGetMethodForLifecycleCallbackInterceptorMethod()github
f)

The getParameters method returns the parameters of the method or constructor invocation. If the setParameters method has been called, getParameters returns the values to which the parameters have been set.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct
Test archive name: 24532c5aefe78fa5ce54a325bc97ae0c48638
AroundConstructTest.testInterceptorInvocation()github
org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testMethodParameters()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct.bindings
Test archive name: 3b1268c6746335af3048425d34eb5e7c298d2c3c
AroundConstructTest.testInterceptorInvocation()github

The setParameters method modifies the parameters used for the target class method or constructor invocation. Modifying the parameter values does not affect the determination of the method or the constructor that is invoked on the target class. The parameter types must match the types for the target class method or constructor, and the number of parameters supplied must equal the number of parameters on the target class method or constructor, or the IllegalArgumentException is thrown.

ga)

Test setParameters method modifies the parameters used.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct
Test archive name: 24532c5aefe78fa5ce54a325bc97ae0c48638
AroundConstructTest.testReplacingParameters()github
org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testMethodParameters()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct.bindings
Test archive name: 3b1268c6746335af3048425d34eb5e7c298d2c3c
AroundConstructTest.testReplacingParameters()github
gb)

Test invalid number of parameters.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testIllegalNumberOfParameters()github
gc)

Test invalid parameter types.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testIllegalTypeOfParameters()github

The proceed method causes the invocation of the next interceptor method in the chain, or, when called from the last around-invoke or around-timeout interceptor method, the target class method.

ha)

Test around-invoke interceptor method.

Coverage

org.jboss.cdi.tck.interceptors.tests.order.aroundInvoke
Test archive name: 91fcb6b275046f4beae3fcdf9aa58c885b5656
AroundInvokeOrderTest.testInvocationOrder()github
hb)

Test around-timeout interceptor method.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundTimeout.bindings
Test archive name: 1625c9bac7406e431be63a53bf90f1ce52e74c9
AroundTimeoutOrderInterceptorTest.testTimeoutMethodIntercepted()github
i)

For AroundConstruct lifecycle callback interceptor methods, the invocation of the last interceptor method in the chain causes the target instance to be created.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct
Test archive name: 6eda4b5a1dc5e2735766f3dee3ed7e9feebc29
ConstructorInterceptionTest.testTypeLevelAndConstructorLevelBinding()github
j)

Interceptor methods must always call the InvocationContext.proceed method or no subsequent interceptor methods, target class method, or lifecycle callback methods will be invoked, or the target instance will not be created.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testBusinessMethodNotCalledWithoutProceedInvocation()github
k)

If a method is of type void, the invocation of the proceed method returns null.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testProceedReturnsNullForVoidMethod()github
l)

For all other lifecycle callback interceptor methods, if there is no callback method defined on the target class, the invocation of proceed in the last interceptor method in the chain is a no-op, and null is returned.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testCtxProceedForLifecycleCallbackInterceptorMethod()github
m)Unclear meaning of validation.

In case of the PostConstruct interceptor, if there is no callback method defined on the target class, the invocation of InvocationContext.proceed method in the last interceptor method in the chain validates the target instance.

Section 2.4 - Exceptions

a)

Interceptor methods are allowed to throw runtime exceptions or any checked exceptions that the associated target method allows within its throws clause.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.exceptions.aroundInvoke
Test archive name: d574c30483d77dadd5f54c1781db32e5b8f56a
ExceptionTest.testExceptions1()github
Test archive name: d574c30483d77dadd5f54c1781db32e5b8f56a
ExceptionTest.testExceptions2()github

Interceptor methods are allowed to catch and suppress exceptions and to recover by calling the InvocationContext.proceed method.

ba)

Interceptor method is allowed to catch and suppress exceptions.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.exceptions.aroundInvoke
Test archive name: d574c30483d77dadd5f54c1781db32e5b8f56a
ExceptionTest.testExceptions1()github
Test archive name: d574c30483d77dadd5f54c1781db32e5b8f56a
ExceptionTest.testExceptions2()github
bb)

Interceptor method is allowed to recover by calling the InvocationContext.proceed method.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.exceptions.aroundInvoke
Test archive name: d574c30483d77dadd5f54c1781db32e5b8f56a
ExceptionTest.testExceptions2()github
c)

The invocation of the InvocationContext.proceed method will throw the same exception as any thrown by the associated target method unless an interceptor further down the Java call stack has caught it and thrown a different exception.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.exceptions.aroundInvoke
Test archive name: d574c30483d77dadd5f54c1781db32e5b8f56a
ExceptionTest.testExceptions1()github
d)

Exceptions and initialization and/or cleanup operations should typically be handled in try/catch/finally blocks around the proceed method.

Section 2.5 - Business Method Interceptors

a)

Interceptor methods that interpose on business method invocations are denoted by the AroundInvoke annotation.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke.bindings.ejb
Test archive name: 3286d95f67ebb1afb78fffa93ba2a8e9fd9b34
SessionBeanAroundInvokeInterceptorTest.testBusinessMethodIntercepted()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke.bindings
Test archive name: d8d5d346925eef1fc2a33cfa816a379a769b350
AroundInvokeInterceptorTest.testBusinessMethodIntercepted()github
b)

Around-invoke methods may be defined on interceptor classes and/or the target class and/or superclasses of the target class or the interceptor classes. However, only one around-invoke method may be defined on a given class.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke.bindings.ejb
Test archive name: 3286d95f67ebb1afb78fffa93ba2a8e9fd9b34
SessionBeanAroundInvokeInterceptorTest.testBusinessMethodIntercepted()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke.bindings
Test archive name: d8d5d346925eef1fc2a33cfa816a379a769b350
AroundInvokeInterceptorTest.testBusinessMethodIntercepted()github

Around-invoke methods can have public, private, protected, or package level access.

ca)

Test public level access.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke.bindings.ejb
Test archive name: 3286d95f67ebb1afb78fffa93ba2a8e9fd9b34
SessionBeanAroundInvokeInterceptorTest.testBusinessMethodIntercepted()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke.bindings
Test archive name: d8d5d346925eef1fc2a33cfa816a379a769b350
AroundInvokeInterceptorTest.testBusinessMethodIntercepted()github
cb)

Test private level access.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke
Test archive name: df742f6f32126099ef54ff2e15b84f7bb9142823
AroundInvokeAccessInterceptorTest.testPrivateAroundInvokeInterceptor()github
cc)

Test protected level access.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke
Test archive name: df742f6f32126099ef54ff2e15b84f7bb9142823
AroundInvokeAccessInterceptorTest.testProtectedAroundInvokeInterceptor()github
cd)

Test package level access.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke
Test archive name: df742f6f32126099ef54ff2e15b84f7bb9142823
AroundInvokeAccessInterceptorTest.testPackagePrivateAroundInvokeInterceptor()github
d)INTERCEPTORS_SPEC-22

An around-invoke method must not be declared as abstract, final or static.

e)

An around-invoke method can invoke any component or resource that the method it is intercepting can invoke.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke
Test archive name: df742f6f32126099ef54ff2e15b84f7bb9142823
AroundInvokeAccessInterceptorTest.testSecurityContext()github

In general, an around-invoke method invocation occurs within the same transaction and security context as the method on which it is interposing. However, note that the transaction context may be changed by transactional interceptors in the invocation chain.

fa)

Test transaction context.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke
Test archive name: df742f6f32126099ef54ff2e15b84f7bb9142823
AroundInvokeAccessInterceptorTest.testTransactionContext()github
fb)

Test security context.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke
Test archive name: df742f6f32126099ef54ff2e15b84f7bb9142823
AroundInvokeAccessInterceptorTest.testSecurityContext()github

Section 2.6 - Interceptors for Lifecycle Event Callbacks

a)

The AroundConstruct annotation denotes lifecycle callback interceptor methods that interpose on invocation of the target instance’s constructor.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct
Test archive name: 24532c5aefe78fa5ce54a325bc97ae0c48638
AroundConstructTest.testInterceptorInvocation()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct.bindings
Test archive name: 3b1268c6746335af3048425d34eb5e7c298d2c3c
AroundConstructTest.testInterceptorInvocation()github
b)

The PostConstruct annotation denotes lifecycle callback interceptor methods that are invoked after the target instance has been constructed and dependency injection on that instance has been completed, but before any business method or other event can be invoked on the target instance.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testPostConstructInterceptor()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.wrapped
Test archive name: ea4e4fe8e6f85c41f7c47709d87a5b56b17
LifecycleCallbackInterceptorTest.testLifecycleCallbackInterception()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings
Test archive name: 98edddd6df426bf718e878b626f3e5de621f32
LifecycleInterceptorDefinitionTest.testLifecycleInterception()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings.ejb
Test archive name: e61cd8ccbea56e929ef7a42b8190c625a702b28
SessionBeanLifecycleInterceptorDefinitionTest.testLifecycleInterception()github
c)

The PreDestroy annotation denotes lifecycle callback interceptor methods that interpose on the target instance’s removal.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testPreDestroyInterceptor()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.wrapped
Test archive name: ea4e4fe8e6f85c41f7c47709d87a5b56b17
LifecycleCallbackInterceptorTest.testLifecycleCallbackInterception()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings
Test archive name: 98edddd6df426bf718e878b626f3e5de621f32
LifecycleInterceptorDefinitionTest.testLifecycleInterception()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings.ejb
Test archive name: e61cd8ccbea56e929ef7a42b8190c625a702b28
SessionBeanLifecycleInterceptorDefinitionTest.testLifecycleInterception()github
d)INTERCEPTORS_SPEC-22

The AroundConstruct interceptor methods may be only defined on interceptor classes and/or superclasses of interceptor classes. The AroundConstruct callback should not be defined on the target class.

All other interceptor methods that interpose on the target instance lifecycle event callbacks can be defined on an interceptor class and/or directly on the target class.

ea)

Test PostConstruct interceptor method.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings
Test archive name: 98edddd6df426bf718e878b626f3e5de621f32
LifecycleInterceptorDefinitionTest.testMultipleLifecycleInterceptors()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings.ejb
Test archive name: e61cd8ccbea56e929ef7a42b8190c625a702b28
SessionBeanLifecycleInterceptorDefinitionTest.testMultipleLifecycleInterceptors()github
eb)

Test PreDestroy interceptor method.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings
Test archive name: 98edddd6df426bf718e878b626f3e5de621f32
LifecycleInterceptorDefinitionTest.testMultipleLifecycleInterceptors()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings.ejb
Test archive name: e61cd8ccbea56e929ef7a42b8190c625a702b28
SessionBeanLifecycleInterceptorDefinitionTest.testMultipleLifecycleInterceptors()github
f)

A single lifecycle callback interceptor method may be used to interpose on multiple callback events.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testSingleMethodInterposingMultipleLifecycleCallbackEvents()github
g)

Lifecycle callback interceptor methods are invoked in an unspecified security context.

h)

Lifecycle callback interceptor methods are invoked in a transaction context determined by their target class and/or method.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testLifecycleCallbackInterceptorTransactionContext()github
i)

AroundConstruct lifecycle callback interceptor methods may be defined on superclasses of interceptor classes. All other lifecycle callback interceptor methods may be defined on superclasses of the target class or of interceptor classes. However, a given class may not have more than one lifecycle callback interceptor method for the same lifecycle event. Any subset or combination of lifecycle callback annotations may otherwise be specified on a target class or interceptor class.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings
Test archive name: 98edddd6df426bf718e878b626f3e5de621f32
LifecycleInterceptorDefinitionTest.testMultipleLifecycleInterceptors()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings.ejb
Test archive name: e61cd8ccbea56e929ef7a42b8190c625a702b28
SessionBeanLifecycleInterceptorDefinitionTest.testMultipleLifecycleInterceptors()github
ia)

If a lifecycle callback interceptor method returns a value, it is ignored by the container.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.interceptorLifeCycle.aroundConstruct.returnValueIgnored
Test archive name: 3f65bfc0992456e0de4f25ad1e9f3b3d8073c574
AroundConstructInterceptorReturnValueTest.testAroundConstructInvokedAfterDependencyInjectionOnInterceptorClasses()github

Lifecycle callback interceptor methods can have public, private, protected, or package level access.

ja)

Test public level access.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testPublicLifecycleInterceptorMethod()github
jb)

Test private level access.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testPrivateLifecycleInterceptorMethod()github
jc)

Test protected level access.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testProtectedLifecycleInterceptorMethod()github
jd)

Test package level access.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testPackagePrivateLifecycleInterceptorMethod()github
k)INTERCEPTORS_SPEC-22

A lifecycle callback interceptor method must not be declared as abstract, final or static.

Section 2.6.1 - Exceptions

a)

Lifecycle callback interceptor methods may throw runtime exceptions, but not checked exceptions.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct
Test archive name: 24532c5aefe78fa5ce54a325bc97ae0c48638
AroundConstructTest.testExceptions()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct.bindings
Test archive name: 3b1268c6746335af3048425d34eb5e7c298d2c3c
AroundConstructTest.testExceptions()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.exceptions
Test archive name: 2fb31b45c056ae42598d1d11e7a96b95a15bec6
LifecycleCallbackInterceptorExceptionTest.testPostConstructCanThrowRuntimeException()github
b)

A lifecycle callback interceptor method (other than a method on the target class or its superclasses) may catch an exception thrown by another lifecycle callback interceptor method in the invocation chain, and clean up before returning.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.exceptions
Test archive name: 2fb31b45c056ae42598d1d11e7a96b95a15bec6
LifecycleCallbackInterceptorExceptionTest.testLifecycleCallbackInterceptorCanCatchException()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct
Test archive name: 24532c5aefe78fa5ce54a325bc97ae0c48638
AroundConstructTest.testExceptions()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct.bindings
Test archive name: 3b1268c6746335af3048425d34eb5e7c298d2c3c
AroundConstructTest.testExceptions()github
c)

The PreDestroy callbacks are not invoked when the target instance and the interceptors are discarded as a result of such exceptions: the lifecycle callback interceptor methods in the chain should perform any necessary clean-up operations as the interceptor chain unwinds.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.exceptions
Test archive name: 2fb31b45c056ae42598d1d11e7a96b95a15bec6
LifecycleCallbackInterceptorExceptionTest.testPreDestroyNotInvokedWhenInstanceDiscarded()github

Section 2.7 - Timeout Method Interceptors

a)Tested within the CDI TCK, 7.2 Container invocations and interception.

Interceptor methods that interpose on timeout methods are denoted by the AroundTimeout annotation.

Around-timeout methods may be defined on interceptor classes and/or the target class and/or superclasses of the target class or interceptor classes. However, only one around-timeout method may be defined on a given class.

ba)Partially tested within the CDI TCK, 7.2 Container invocations and interception.

Test interceptor classes and/or superclasses.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundTimeout.bindings
Test archive name: 1625c9bac7406e431be63a53bf90f1ce52e74c9
AroundTimeoutOrderInterceptorTest.testTimeoutMethodIntercepted()github
bb)

Test target class and/or superclasses.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundTimeout.bindings
Test archive name: 1625c9bac7406e431be63a53bf90f1ce52e74c9
AroundTimeoutOrderInterceptorTest.testTimeoutMethodIntercepted()github
c)INTERCEPTORS_SPEC-22

Around-timeout methods can have public, private, protected, or package level access. An around-timeout method must not be declared as abstract, final or static.

d)

An around-timeout method can invoke any component or resource that its corresponding timeout method can invoke.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundTimeout
Test archive name: 88617be40e944f3b93f2b1d9aec41c8ac137a1
AroundTimeoutInterceptorTest.testSecurityContext()github

An around-timeout method invocation occurs within the same transaction and security context as the timeout method on which it is interposing.

ea)

Test transaction context.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundTimeout
Test archive name: 88617be40e944f3b93f2b1d9aec41c8ac137a1
AroundTimeoutInterceptorTest.testInvocationContextGetTimer()github
eb)

Test security context.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundTimeout
Test archive name: 88617be40e944f3b93f2b1d9aec41c8ac137a1
AroundTimeoutInterceptorTest.testSecurityContext()github
f)

The InvocationContext.getTimer method allows an around-timeout method to retrieve the timer object associated with the timeout.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundTimeout
Test archive name: 88617be40e944f3b93f2b1d9aec41c8ac137a1
AroundTimeoutInterceptorTest.testInvocationContextGetTimer()github

Section 2.8 - Constructor- and Method-level Interceptors

aa)

Method-level interceptors are interceptor classes associated with a specific business or timeout method of the target class.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.invocationContext
Test archive name: 85c5dac72f6d1e22c965beea0f4e3cf13815e6e
InvocationContextTest.testGetTargetMethod()github
ab)

Constructor-level interceptors are interceptor classes associated with a constructor of the target class.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct
Test archive name: 24532c5aefe78fa5ce54a325bc97ae0c48638
AroundConstructTest.testInterceptorInvocation()github
b)

Only the interceptor methods of the interceptor class that are relevant for the context in which the interceptor is bound are invoked. For example, if the interceptor is bound only to a business method, any AroundConstruct, AroundTimeout, PostConstruct, or PreDestroy methods on the interceptor are not called.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback
Test archive name: ab33c9d248be6e8255fb61fb1a1dd89a17c4a4
LifecycleCallbackInterceptorTest.testLifeCycleCallbackInterceptorNotInvokedForMethodLevelInterceptor()github
c)INTERCEPTORS_SPEC-22

Method-level interceptors may not be associated with a lifecycle callback method of the target class.

d)

The same interceptor may be applied to more than one business or timeout method of the target class.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.method
Test archive name: 5b66c7e9a0977b7ca642aabad0725a7bb5f286ac
MethodLevelInterceptorTest.testInterceptorCanBeAppliedToMoreThanOneMethod()github
e)

The applicability of a method-level interceptor to more than one method of an associated target class does not affect the relationship between the interceptor instance and the target class - only a single instance of the interceptor class is created per target class instance.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.method
Test archive name: 5b66c7e9a0977b7ca642aabad0725a7bb5f286ac
MethodLevelInterceptorTest.testInterceptorCanBeAppliedToMoreThanOneMethod()github

Section 3 - Associating Interceptors using Interceptor Bindings

a)Statement of intent

Interceptor bindings are intermediate annotations that may be used to associate interceptors with any component that is not itself an interceptor.

Section 3.1 - Interceptor Binding Types

a)

An interceptor binding type is a Java annotation defined as Retention(RUNTIME). Typically an interceptor binding is defined as Target({TYPE, METHOD, CONSTRUCTOR}) or any subset of valid target types.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct.ejb
Test archive name: 4463a57f4d4c975957afd5d199e83aae24dc8f1
SessionBeanConstructorInterceptionTest.testConstructorLevelBinding()github
Test archive name: 4463a57f4d4c975957afd5d199e83aae24dc8f1
SessionBeanConstructorInterceptionTest.testTypeLevelBinding()github
org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct
Test archive name: 6eda4b5a1dc5e2735766f3dee3ed7e9feebc29
ConstructorInterceptionTest.testConstructorLevelBinding()github
Test archive name: 6eda4b5a1dc5e2735766f3dee3ed7e9feebc29
ConstructorInterceptionTest.testTypeLevelBinding()github
b)

An interceptor binding type may be declared by specifying the InterceptorBinding meta-annotation.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct.ejb
Test archive name: 4463a57f4d4c975957afd5d199e83aae24dc8f1
SessionBeanConstructorInterceptionTest.testConstructorLevelBinding()github
Test archive name: 4463a57f4d4c975957afd5d199e83aae24dc8f1
SessionBeanConstructorInterceptionTest.testTypeLevelBinding()github
org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct
Test archive name: 6eda4b5a1dc5e2735766f3dee3ed7e9feebc29
ConstructorInterceptionTest.testConstructorLevelBinding()github
Test archive name: 6eda4b5a1dc5e2735766f3dee3ed7e9feebc29
ConstructorInterceptionTest.testTypeLevelBinding()github

Section 3.1.1 - Interceptor binding types with additional interceptor bindings

a)

An interceptor binding type may declare other interceptor bindings.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.resolution
Test archive name: 1e66bdf133ea7e5e1b2312a263b42370f9889524
InterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github
b)

Interceptor bindings are transitive - an interceptor binding declared by an interceptor binding type is inherited by all components and other interceptor binding types that declare that interceptor binding type.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.resolution
Test archive name: 1e66bdf133ea7e5e1b2312a263b42370f9889524
InterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github
c)INTERCEPTORS_SPEC-21

An interceptor binding type can only be applied to an interceptor binding type defining a superset of it's target types. For example interceptor binding types declared Target(TYPE) may not be applied to interceptor binding types declared Target({TYPE, METHOD}).

Section 3.1.2 - Other sources of interceptor bindings

a)

An extension specification may define other sources of interceptor bindings, such as via a CDI stereotype.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.resolution
Test archive name: 1e66bdf133ea7e5e1b2312a263b42370f9889524
InterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github

Section 3.2 - Declaring Interceptor Bindings of an Interceptor

a)

The interceptor bindings of an interceptor are specified by annotating the interceptor class with the binding types and the Interceptor annotation and are called the set of interceptor bindings for the interceptor.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.multiple
Test archive name: c1e51317779a2b34d5543887e4b9d5f0ad54f8be
MultipleInterceptorBindingsTest.testInterceptorAppliedToBeanWithAllBindings()github
Test archive name: c1e51317779a2b34d5543887e4b9d5f0ad54f8be
MultipleInterceptorBindingsTest.testInterceptorNotAppliedToBeanWithSomeBindings()github
b)

An interceptor class may declare multiple interceptor bindings.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.multiple
Test archive name: c1e51317779a2b34d5543887e4b9d5f0ad54f8be
MultipleInterceptorBindingsTest.testInterceptorAppliedToBeanWithAllBindings()github
Test archive name: c1e51317779a2b34d5543887e4b9d5f0ad54f8be
MultipleInterceptorBindingsTest.testInterceptorNotAppliedToBeanWithSomeBindings()github
c)

Multiple interceptors may declare the same interceptor bindings.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.multiple
Test archive name: c1e51317779a2b34d5543887e4b9d5f0ad54f8be
MultipleInterceptorBindingsTest.testInterceptorAppliedToBeanWithAllBindings()github
Test archive name: c1e51317779a2b34d5543887e4b9d5f0ad54f8be
MultipleInterceptorBindingsTest.testInterceptorNotAppliedToBeanWithSomeBindings()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct.bindings
Test archive name: 3b1268c6746335af3048425d34eb5e7c298d2c3c
AroundConstructTest.testExceptions()github
d)

An extension specification may define other ways of declaring an interceptor.

Coverage

No tests exist for this assertion

e)

If an interceptor does not declare an Interceptor annotation, it could be bound to components using Interceptors annotation or a deployment descriptor file.

Coverage

No tests exist for this assertion

f)Non-portable mode

All interceptors declared using the Interceptor annotation should specify at least one interceptor binding. If an interceptor declared using the Interceptor annotation does not declare any interceptor binding, non-portable behavior results.

g)INTERCEPTORS_SPEC-22

With the exception of AroundConstruct lifecycle callback interceptors, an interceptor for lifecycle callbacks may only declare interceptor binding types that are defined as Target(TYPE).

Section 3.3 - Binding an Interceptor to a Component

An interceptor may be bound to a component by annotating the component class, a method, or constructor of the component class, with the interceptor binding type.

aa)

Test a component class.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.multiple
Test archive name: c1e51317779a2b34d5543887e4b9d5f0ad54f8be
MultipleInterceptorBindingsTest.testInterceptorAppliedToBeanWithAllBindings()github
Test archive name: c1e51317779a2b34d5543887e4b9d5f0ad54f8be
MultipleInterceptorBindingsTest.testInterceptorNotAppliedToBeanWithSomeBindings()github
ab)

Test a method.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.multiple
Test archive name: c1e51317779a2b34d5543887e4b9d5f0ad54f8be
MultipleInterceptorBindingsTest.testMultipleInterceptorsOnMethod()github
ac)

Test a constructor.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct
Test archive name: 6eda4b5a1dc5e2735766f3dee3ed7e9feebc29
ConstructorInterceptionTest.testConstructorLevelBinding()github

A component class, method, or constructor of a component class may declare multiple interceptor bindings.

ba)

Test a component class.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.multiple
Test archive name: c1e51317779a2b34d5543887e4b9d5f0ad54f8be
MultipleInterceptorBindingsTest.testInterceptorAppliedToBeanWithAllBindings()github
Test archive name: c1e51317779a2b34d5543887e4b9d5f0ad54f8be
MultipleInterceptorBindingsTest.testInterceptorNotAppliedToBeanWithSomeBindings()github
bb)

Test a method.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.multiple
Test archive name: c1e51317779a2b34d5543887e4b9d5f0ad54f8be
MultipleInterceptorBindingsTest.testMultipleInterceptorsOnMethod()github
bc)

Test a constructor.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct
Test archive name: 6eda4b5a1dc5e2735766f3dee3ed7e9feebc29
ConstructorInterceptionTest.testMultipleConstructorLevelBinding()github
c)

The set of interceptor bindings for a method or constructor are those declared at class level combined with those declared at method or constructor level.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct.ejb
Test archive name: 4463a57f4d4c975957afd5d199e83aae24dc8f1
SessionBeanConstructorInterceptionTest.testTypeLevelAndConstructorLevelBinding()github
org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct
Test archive name: 6eda4b5a1dc5e2735766f3dee3ed7e9feebc29
ConstructorInterceptionTest.testTypeLevelAndConstructorLevelBinding()github

An interceptor binding declared on a method or constructor replaces an interceptor binding of the same type declared at class level or inherited from a superclass.

da)

Test a constructor.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct.ejb
Test archive name: 4463a57f4d4c975957afd5d199e83aae24dc8f1
SessionBeanConstructorInterceptionTest.testOverridingTypeLevelBinding()github
org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct
Test archive name: 6eda4b5a1dc5e2735766f3dee3ed7e9feebc29
ConstructorInterceptionTest.testOverridingTypeLevelBinding()github
db)

Test a method.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.overriding
Test archive name: 1da8a4f27490aa967d5d4665124c21bd7c5e03a
InterceptorBindingOverridingTest.testInterceptorBindingOverriden()github
e)

An extension specification may define additional rules for combining interceptor bindings, such as interceptors defined via a CDI stereotype.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.resolution.ejb
Test archive name: 16eb74f923d6b50d5eb857a749269f646ab6c6e
EnterpriseInterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github
org.jboss.cdi.tck.interceptors.tests.bindings.resolution
Test archive name: 1e66bdf133ea7e5e1b2312a263b42370f9889524
InterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github
f)Tested within the CDI TCK, 9.3 Binding an interceptor to a bean.

If the component class declares or inherits a class level interceptor binding, it must not be declared final, or have any non-static, non-private, final methods. If a component has a class-level interceptor binding and is declared final or has a non-static, non-private, final method, the container automatically detects the problem and treats it as a definition error.

g)Tested within the CDI TCK, 9.3 Binding an interceptor to a bean.

If a non-static, non-private method of a component class declares a method level interceptor binding, neither the method nor the component class may be declared final. If a non-static, non-private, final method of a component has a method level interceptor binding, the container automatically detects the problem and treats it as a definition error.

Section 3.4 - Interceptor Resolution

a)Statement of intent

The process of matching interceptors to a certain lifecycle callback method, timeout method, business method or a constructor of a certain component is called interceptor resolution.

b)

For a lifecycle callback, the interceptor bindings include the interceptor bindings declared or inherited by the component at the class level, including, recursively, interceptor bindings declared as meta-annotations of other interceptor bindings.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.resolution.ejb
Test archive name: 16eb74f923d6b50d5eb857a749269f646ab6c6e
EnterpriseInterceptorBindingResolutionTest.testLifecycleInterceptorBindings()github
org.jboss.cdi.tck.interceptors.tests.bindings.resolution
Test archive name: 1e66bdf133ea7e5e1b2312a263b42370f9889524
InterceptorBindingResolutionTest.testLifecycleInterceptorBindings()github
Test archive name: 1e66bdf133ea7e5e1b2312a263b42370f9889524
InterceptorBindingResolutionTest.testConstructorInterceptorBindings()github

For a business method, timeout method, or constructor the interceptor bindings include the interceptor bindings declared or inherited by the component at the class level, including, recursively, interceptor bindings declared as meta-annotations of other interceptor bindings, together with all interceptor bindings declared on the constructor or method, including, recursively, interceptor bindings declared as meta-annotations of other interceptor bindings.

ca)

Test a business method.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.resolution.ejb
Test archive name: 16eb74f923d6b50d5eb857a749269f646ab6c6e
EnterpriseInterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github
org.jboss.cdi.tck.interceptors.tests.bindings.resolution
Test archive name: 1e66bdf133ea7e5e1b2312a263b42370f9889524
InterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github
cb)

Test a timeout method.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.resolution.ejb
Test archive name: 16eb74f923d6b50d5eb857a749269f646ab6c6e
EnterpriseInterceptorBindingResolutionTest.testTimeoutMethodInterceptorBindings()github
cc)

Test a constructor.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.resolution
Test archive name: 1e66bdf133ea7e5e1b2312a263b42370f9889524
InterceptorBindingResolutionTest.testConstructorInterceptorBindings()github

An interceptor is bound to a method or constructor if:

da)

The method or constructor has all the interceptor bindings of the interceptor. A method or constructor has an interceptor binding of an interceptor if it has an interceptor binding with (a) the same type and (b) the same annotation member value for each member. An extension specification may further refine this rule. For example the CDI specification adds the javax.enterprise.util.Nonbinding annotation, causing member values to be ignored by the resolution process.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct
Test archive name: 6eda4b5a1dc5e2735766f3dee3ed7e9feebc29
ConstructorInterceptionTest.testMultipleConstructorLevelBinding()github
org.jboss.cdi.tck.interceptors.tests.bindings.resolution.ejb
Test archive name: 16eb74f923d6b50d5eb857a749269f646ab6c6e
EnterpriseInterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github
org.jboss.cdi.tck.interceptors.tests.bindings.resolution
Test archive name: 1e66bdf133ea7e5e1b2312a263b42370f9889524
InterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github
db)

The interceptor intercepts the given kind of lifecycle callback or business method.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct
Test archive name: 6eda4b5a1dc5e2735766f3dee3ed7e9feebc29
ConstructorInterceptionTest.testMultipleConstructorLevelBinding()github
org.jboss.cdi.tck.interceptors.tests.bindings.resolution.ejb
Test archive name: 16eb74f923d6b50d5eb857a749269f646ab6c6e
EnterpriseInterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github
org.jboss.cdi.tck.interceptors.tests.bindings.resolution
Test archive name: 1e66bdf133ea7e5e1b2312a263b42370f9889524
InterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github
dc)

The interceptor is enabled.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.aroundConstruct
Test archive name: 6eda4b5a1dc5e2735766f3dee3ed7e9feebc29
ConstructorInterceptionTest.testMultipleConstructorLevelBinding()github
org.jboss.cdi.tck.interceptors.tests.bindings.resolution.ejb
Test archive name: 16eb74f923d6b50d5eb857a749269f646ab6c6e
EnterpriseInterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github
org.jboss.cdi.tck.interceptors.tests.bindings.resolution
Test archive name: 1e66bdf133ea7e5e1b2312a263b42370f9889524
InterceptorBindingResolutionTest.testBusinessMethodInterceptorBindings()github

Section 3.4.1 - Interceptors with multiple bindings

a)

An interceptor class may specify multiple interceptor bindings.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.resolution
Test archive name: 1e66bdf133ea7e5e1b2312a263b42370f9889524
InterceptorBindingResolutionTest.testLifecycleInterceptorBindings()github

Section 3.4.2 - Interceptor binding types with members

a)

Interceptor binding types may have annotation members.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.overriding
Test archive name: 1da8a4f27490aa967d5d4665124c21bd7c5e03a
InterceptorBindingOverridingTest.testInterceptorBindingOverriden()github
org.jboss.cdi.tck.interceptors.tests.bindings.members
Test archive name: 4cd3271048ad32393f7d579846ff2a77f6e6
InterceptorBindingTypeWithMemberTest.testInterceptorBindingTypeWithMember()github
b)

Annotation member values are compared using the equals method.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.members
Test archive name: 4cd3271048ad32393f7d579846ff2a77f6e6
InterceptorBindingTypeWithMemberTest.testInterceptorBindingTypeMemberValuesComparedWithEquals()github
c)Testing |javax.enterprise.util.Nonbinding| annotation.

Array-valued or annotation-valued members of an interceptor binding type are not supported. An extension specification may add support for these member types. For example the CDI specification adds the javax.enterprise.util.Nonbinding annotation, allowing array-valued or annotation-valued members to be used on the annotation type, but ignored by the resolution process.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.members
Test archive name: 4cd3271048ad32393f7d579846ff2a77f6e6
InterceptorBindingTypeWithMemberTest.testInterceptorBindingTypeWithNonBindingMember()github
d)

If the set of interceptor bindings of a component class or interceptor, including bindings inherited from stereotypes and other interceptor bindings, has two instances of a certain interceptor binding type and the instances have different values of some annotation member, the container automatically detects the problem and treats it as a definition error.

Coverage

org.jboss.cdi.tck.interceptors.tests.bindings.broken
Test archive name: 33bc232eb6fd82bdd4587c14bc8b74b7db81282f
InvalidStereotypeInterceptorBindingAnnotationsTest.testInterceptorBindingsWithConflictingAnnotationMembersNotOk()github
Test archive name: ca15895647fe8ec3785edaeb4fd0f5b07ad08a
InvalidTransitiveInterceptorBindingAnnotationsTest.testInterceptorBindingsWithConflictingAnnotationMembersNotOk()github

Section 4 - Associating Interceptors using the Interceptors Annotation

a)

The Interceptors annotation can be used to denote interceptor classes and associate one or more interceptor classes with a target class, and/or one or more of its methods, and/or a constructor of the target class.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.method
Test archive name: 5b66c7e9a0977b7ca642aabad0725a7bb5f286ac
MethodLevelInterceptorTest.testInterceptorCanBeAppliedToMoreThanOneMethod()github
org.jboss.cdi.tck.interceptors.tests.order.aroundInvoke
Test archive name: 91fcb6b275046f4beae3fcdf9aa58c885b5656
AroundInvokeOrderTest.testInvocationOrder()github
org.jboss.cdi.tck.tests.extensions.interceptors.annotation
Test archive name: f3d7236dd82070b48b2238c5ebfb4dddbf389b
InterceptorAnnotationExtensionTest.testInterceptorAddedByExtension()github
b)Tested in section 5.

If multiple interceptors are defined for the target class in the Interceptors annotation, they are invoked in the order in which they are specified. See Chapter 5 for the rules on interceptors ordering.

c)Should be tested in the EJB TCK.

If a deployment descriptor is supported, it can be used to associate interceptor classes with the target class, and/or methods, and/or a constructor of the target class and specify the order of interceptor invocation or override metadata specified by annotations.

d)

Method-level around-invoke and around-timeout interceptors can be defined by applying the Interceptors annotation to the method for which the interceptors are to be invoked.

Coverage

org.jboss.cdi.tck.interceptors.tests.order.aroundInvoke
Test archive name: 91fcb6b275046f4beae3fcdf9aa58c885b5656
AroundInvokeOrderTest.testInvocationOrder()github
e)

Constructor-level interceptors can be defined by applying the Interceptors annotation to the constructor for which the interceptors are to be invoked.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.aroundConstruct
Test archive name: 24532c5aefe78fa5ce54a325bc97ae0c48638
AroundConstructTest.testInterceptorInvocation()github
f)Tested in section 5.

If more than one constructor- or method-level interceptor is defined for a target class constructor or method, the interceptors are invoked in the order specified. Constructor- and method-level interceptors are invoked in addition to any default interceptors and interceptors defined for the target class (and its superclasses).

Section 4.1 - Default Interceptors

a)Should be tested in the EJB TCK.

Default interceptors are interceptors that apply to a set of target classes. If a deployment descriptor is supported, it may be used to define default interceptors and their relative ordering.

b)Should be tested in the EJB TCK.

The ExcludeDefaultInterceptors annotation is used to exclude the invocation of default interceptors for a target class, or when applied to a target class constructor or method, is used to exclude the invocation of default interceptors for that constructor or that method.

Section 5.1 - Defining Interceptor Order

a)

Associating interceptors with the target class or method of the target class using the Interceptors annotation enables them for the target class, a method, or a constructor of the target class. The order in which they are invoked is determined by the order in which they are specified in the annotation.

Coverage

org.jboss.cdi.tck.interceptors.tests.order.aroundConstruct
Test archive name: d2ef6323f5edd69dc6252e56d3aede84e5dfda
AroundConstructOrderTest.testInvocationOrder()github
org.jboss.cdi.tck.interceptors.tests.order.lifecycleCallback
Test archive name: 624ba35ffddb694f7aaa6bfe123c2eb34c7bcf4
PostConstructOrderTest.testInvocationOrder()github
org.jboss.cdi.tck.interceptors.tests.order.aroundInvoke
Test archive name: 91fcb6b275046f4beae3fcdf9aa58c885b5656
AroundInvokeOrderTest.testInvocationOrder()github
b)Tested within the CDI TCK, section 9.4 Interceptor enablement and ordering.

Interceptors declared using interceptor bindings are enabled and ordered using the Priority annotation or the beans.xml deployment descriptor.

c)

An extension specification may define alternative mechanisms to enable and order interceptors.

d)Tested within the CDI TCK, section 9.4 Interceptor enablement and ordering.

For the same interceptor method type, interceptors declared using interceptor bindings are called after interceptors declared using the Interceptors annotation (or using the corresponding element of a deployment descriptor) and before an interceptor method of the same interceptor type declared on the target class or any superclass of the target class.

)Tested in section 2.3

The InvocationContext object enables interceptor methods to control the behavior of the invocation chain, including whether the next method in the chain is invoked and the values of its parameters and result.

Section 5.2.1 - Invocation Order of Interceptors Declared on the Target Class

Interceptor methods declared on the target class or its superclasses are invoked in the following order:

aa)

If a target class has superclasses, any interceptor methods defined on those superclasses are invoked, most general superclass first.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings
Test archive name: 98edddd6df426bf718e878b626f3e5de621f32
LifecycleInterceptorDefinitionTest.testMultipleLifecycleInterceptors()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundTimeout.bindings
Test archive name: 1625c9bac7406e431be63a53bf90f1ce52e74c9
AroundTimeoutOrderInterceptorTest.testTimeoutMethodIntercepted()github
org.jboss.cdi.tck.interceptors.tests.order.lifecycleCallback
Test archive name: 624ba35ffddb694f7aaa6bfe123c2eb34c7bcf4
PostConstructOrderTest.testInvocationOrder()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings.ejb
Test archive name: e61cd8ccbea56e929ef7a42b8190c625a702b28
SessionBeanLifecycleInterceptorDefinitionTest.testMultipleLifecycleInterceptors()github
org.jboss.cdi.tck.interceptors.tests.order.aroundInvoke
Test archive name: 91fcb6b275046f4beae3fcdf9aa58c885b5656
AroundInvokeOrderTest.testInvocationOrder()github
ab)

The interceptor method, if any, on the target class itself is invoked.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings
Test archive name: 98edddd6df426bf718e878b626f3e5de621f32
LifecycleInterceptorDefinitionTest.testMultipleLifecycleInterceptors()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundTimeout.bindings
Test archive name: 1625c9bac7406e431be63a53bf90f1ce52e74c9
AroundTimeoutOrderInterceptorTest.testTimeoutMethodIntercepted()github
org.jboss.cdi.tck.interceptors.tests.order.lifecycleCallback
Test archive name: 624ba35ffddb694f7aaa6bfe123c2eb34c7bcf4
PostConstructOrderTest.testInvocationOrder()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings.ejb
Test archive name: e61cd8ccbea56e929ef7a42b8190c625a702b28
SessionBeanLifecycleInterceptorDefinitionTest.testMultipleLifecycleInterceptors()github
org.jboss.cdi.tck.interceptors.tests.order.aroundInvoke
Test archive name: 91fcb6b275046f4beae3fcdf9aa58c885b5656
AroundInvokeOrderTest.testInvocationOrder()github

If an interceptor method is overridden by another method (regardless of whether that method is itself an interceptor method), it will not be invoked.

ba)

Test business method interceptor method.

Coverage

org.jboss.cdi.tck.interceptors.tests.order.aroundInvoke
Test archive name: 91fcb6b275046f4beae3fcdf9aa58c885b5656
AroundInvokeOrderTest.testInvocationOrder()github
bb)

Test lifecycle interceptor method.

Coverage

org.jboss.cdi.tck.interceptors.tests.order.overriden.lifecycleCallback.wrapped
Test archive name: 163c5880ac61a3f0505cb9e9bedcc64bfd59c
OverridenLifecycleCallbackInterceptorTest.testCallbackOverridenByCallback()github
Test archive name: 163c5880ac61a3f0505cb9e9bedcc64bfd59c
OverridenLifecycleCallbackInterceptorTest.testCallbackOverridenByNonCallback()github
org.jboss.cdi.tck.interceptors.tests.order.overriden.lifecycleCallback
Test archive name: 8159bc2537cc8cb74615fac94a4cd21cf30e4d9
OverridenLifecycleCallbackInterceptorTest.testCallbackOverridenByCallback()github
Test archive name: 8159bc2537cc8cb74615fac94a4cd21cf30e4d9
OverridenLifecycleCallbackInterceptorTest.testCallbackOverridenByNonCallback()github

Section 5.2.2 - Invocation Order of Interceptors with Superclasses

a)

If an interceptor class itself has superclasses, the interceptor methods defined by the interceptor class’s superclasses are invoked before the interceptor method defined by the interceptor class, most general superclass first.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings
Test archive name: 98edddd6df426bf718e878b626f3e5de621f32
LifecycleInterceptorDefinitionTest.testMultipleLifecycleInterceptors()github
org.jboss.cdi.tck.interceptors.tests.order.aroundConstruct
Test archive name: d2ef6323f5edd69dc6252e56d3aede84e5dfda
AroundConstructOrderTest.testInvocationOrder()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundTimeout.bindings
Test archive name: 1625c9bac7406e431be63a53bf90f1ce52e74c9
AroundTimeoutOrderInterceptorTest.testTimeoutMethodIntercepted()github
org.jboss.cdi.tck.interceptors.tests.order.lifecycleCallback
Test archive name: 624ba35ffddb694f7aaa6bfe123c2eb34c7bcf4
PostConstructOrderTest.testInvocationOrder()github
org.jboss.cdi.tck.interceptors.tests.contract.aroundInvoke.bindings
Test archive name: d8d5d346925eef1fc2a33cfa816a379a769b350
AroundInvokeInterceptorTest.testBusinessMethodIntercepted()github
org.jboss.cdi.tck.interceptors.tests.contract.lifecycleCallback.bindings.ejb
Test archive name: e61cd8ccbea56e929ef7a42b8190c625a702b28
SessionBeanLifecycleInterceptorDefinitionTest.testMultipleLifecycleInterceptors()github
org.jboss.cdi.tck.interceptors.tests.order.aroundInvoke
Test archive name: 91fcb6b275046f4beae3fcdf9aa58c885b5656
AroundInvokeOrderTest.testInvocationOrder()github

Section 5.3 - Ordering Interceptors using the Priority Annotation

a)Tested within the CDI TCK, section 9.4 Interceptor enablement and ordering.

An interceptor bound to a component, a component method, or constructor using interceptor binding may be enabled for the entire application by applying the Priority annotation, along with a priority value, on the interceptor class.

b)Tested within the CDI TCK, section 9.4 Interceptor enablement and ordering.

Interceptors with smaller priority values are called first.

c)Undefined behaviour.

If more than one interceptor has the same priority, the relative order of these interceptor is undefined.

d)INTERCEPTORS_SPEC-23

The Priority annotation is ignored on interceptors bound to a component using the Interceptors annotation.

e)CDI does not define other way of assigning priorities.

Extension specifications may define other ways of assigning priorities to an interceptor.

Section 5.5 - Invocation Order for Multiple Interceptors Defined Using the Interceptors Annotation

If multiple business or timeout method interceptor methods are defined for a target class or multiple callback interceptor methods are defined for a lifecycle event for a target class using the Interceptors annotation, the following rules govern their invocation order for each interceptor type. A deployment descriptor may be used to override the interceptor invocation order specified in annotations.

a)Should be tested in the EJB TCK.

Default interceptors, if any, are invoked first. Default interceptors can only be specified in a deployment descriptor. Default interceptors are invoked in the order of their specification in the deployment descriptor.

b)

If there are any interceptor classes associated with the target class using the Interceptors annotation, the interceptor methods defined by those interceptor classes are invoked before any interceptor methods defined on the target class itself.

Coverage

org.jboss.cdi.tck.interceptors.tests.order.lifecycleCallback
Test archive name: 624ba35ffddb694f7aaa6bfe123c2eb34c7bcf4
PostConstructOrderTest.testInvocationOrder()github
org.jboss.cdi.tck.interceptors.tests.order.aroundInvoke
Test archive name: 91fcb6b275046f4beae3fcdf9aa58c885b5656
AroundInvokeOrderTest.testInvocationOrder()github
c)

The interceptor methods defined on those interceptor classes are invoked in the same order as the specification of the interceptor classes in the Interceptors annotation.

Coverage

org.jboss.cdi.tck.interceptors.tests.order.aroundConstruct
Test archive name: d2ef6323f5edd69dc6252e56d3aede84e5dfda
AroundConstructOrderTest.testInvocationOrder()github
org.jboss.cdi.tck.interceptors.tests.order.lifecycleCallback
Test archive name: 624ba35ffddb694f7aaa6bfe123c2eb34c7bcf4
PostConstructOrderTest.testInvocationOrder()github
org.jboss.cdi.tck.interceptors.tests.order.aroundInvoke
Test archive name: 91fcb6b275046f4beae3fcdf9aa58c885b5656
AroundInvokeOrderTest.testInvocationOrder()github
d)Tested in 5.2.2

If an interceptor class itself has superclasses, the interceptor methods are invoked according to the rules described in the section 5.2.2.

e)

After the interceptor methods defined on interceptor classes have been invoked, then if any constructor- or around-invoke or around-timeout method-level interceptors are defined for the target class constructor or method that is to be invoked, the corresponding methods defined on those interceptor classes are invoked in the same order as the specification of those interceptor classes in the Interceptors annotation applied to that target class constructor or method.

Coverage

org.jboss.cdi.tck.interceptors.tests.order.aroundConstruct
Test archive name: d2ef6323f5edd69dc6252e56d3aede84e5dfda
AroundConstructOrderTest.testInvocationOrder()github
org.jboss.cdi.tck.interceptors.tests.order.aroundInvoke
Test archive name: 91fcb6b275046f4beae3fcdf9aa58c885b5656
AroundInvokeOrderTest.testInvocationOrder()github
f)Tested in 5.2.1

And then interceptors declared on the target class or its superclasses are invoked according to the rules described in the section 5.2.1.

g)

The ExcludeClassInterceptors annotation can be used to exclude the invocation of the class-level interceptors.

Coverage

org.jboss.cdi.tck.interceptors.tests.contract.method
Test archive name: 5b66c7e9a0977b7ca642aabad0725a7bb5f286ac
MethodLevelInterceptorTest.testExcludeClassInterceptors()github

Highlighted test groups

Test ClassTest method
rewrite (0)