-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accomplished Issue #3, #4, #5 #11
Conversation
This commit provides altogether with small code clean-ups the requested deployment validation in #5 by @carlosbarragan. Details * Validating correct dependency configuration in the deployment process. * Refactored observed methodes in BeanTestExtension * Disabled TestInvalidInjectionPointConfiguration. The test case contains the reason. * Updated snapshot version * various cleanups
The former proposal regarding the InterceptorWrapper invocation mechanism was wrong! Instead of manually calling the wrapped interceptors with the origin InvocationContext, one should replace the origin InvocationContext with a modified version containing an altered InterceptorChain object. Technically the new algorithm looks like the following:
|
After observing the long commit history in this PR, I will squash some of the 'refactoring'- and 'fix' commits. |
…solution of issue #4 This commit fixes the injection failure in @ejb Interceptors. Also this commit approves that with the help of InterceptorWrapper (global interceptor) BeanTesting already supports correct transaction propagation in EJB interceptors. The transaction will be shared among invoked interceptor instances. Further this commit contains various design improvements. Details * Implemented an approach based on @InterceptorBindings. The solution replaces @interceptors in processed beans with a global interceptor wrapper. The wrapper delegates the InvocationContext to modified InterceptorBindings. * Implemented a cache optimization regarding the modification of Interceptor bindings in @ejb Interceptors. * Refactoring of BeanTestExtension: extracted the Interceptor/EJB functionality in seperate CDI Extensions. * Fixed debug log in EntityManagerProducer * Introduced Base class for CDI Extensions. Created distinct CDI Extensions and registered in the javax.enterprise.inject.spi.Extension file * Removed redundant type parameter from methods * Pulled up various common methods to BaseExtension * Updated Javadocs * Written new test case 'TestExcludedInterceptors'
* Processing Class- and Methodlevel InterceptorBindings * Updated javadocs * Created testcase 'TestEJBInterceptedMethodLevel.java' * Improved testcase 'EJBWithExludeClassInterception' * Implemented testcase 'TestEJBInterceptedMethodLevel'
* Separated testing components in distinct packages ('extension') * Introduces package 'utils' containing ['Entities', 'Exceptions', 'Mocks'] * Removed 'demo test package' * Introduced subpackage 'resources' holding sample bean definitions
The new approach is based on the creation of custom InterceptorInvocationContext objects. This commit also includes a larger refactoring of the 'InterceptorExtension'. Details * Introduced new 'EjbInterceptor' design model: implemented 'InterceptorWrapperBinding' and 'InterceptorWrapperRepository'. * Implemented creation of custom InterceptorInvocationContext objects containing the modified Interceptors. * Renamed 'InterceptorWrapper' to 'EjbInterceptorWrapper' (leads to better understanding of the IDEA) * Implemented new testcase 'Method and class level interception' * Added setup methods to reset 'isInvoked' flag in DummyInterceptor * Removed redundant resource 'ExcludeInterceptor' * Improved test case 'TestInterceptedBean': Now asserting actual Interceptor invocation during test execution * Implemented new testcase 'TestEjbInterceptionSequence'
I will separate the different PRs here in a more reasonable form => leads to better overview regarding the committed changes ☀️ |
Preamble
Due to the fact that the earlier pull #10 contained a broken commit (shame on me ), I edited the broken commit. As a consequence of this the commit history has changed. That´s why this pull requests looks larger than usual. Lessons learned: never commit broken code 👊
Issue #5
This commit provides altogether with small code clean-ups the requested deployment validation in #5 by @carlosbarragan. BeanTestExtension is now ensuring that a processed bean holds valid dependency injection points for its member i.e. the processed bean may hold exclusively field injection points or setter injection points for a particular bean member.
Issue #3
This commit fixes the injection failure in @ejb Interceptors. See issue #3.
Issue #4
This commit comprise a resolution for issue #4. The created test case (TestEJBInterceptedByMultipleInterceptors) demonstrates that EJB interceptors (Interceptor1SharingTransaction and Interceptor2SharingTransaction) are using an active (the same!) transaction.