Skip to content
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

Closed
wants to merge 5 commits into from
Closed

Accomplished Issue #3, #4, #5 #11

wants to merge 5 commits into from

Conversation

bbq2100
Copy link
Contributor

@bbq2100 bbq2100 commented Nov 7, 2014

Preamble

Due to the fact that the earlier pull #10 contained a broken commit (shame on me :trollface:), 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.

  • Implemented a approach based on the @InterceptorBinding mechanism. The solution replaces @interceptors() in processed beans with a global interceptor wrapper/proxy. The wrapper delegates the InvocationContext to the modified InterceptorBinding.
  • Implemented a cache optimization regarding the modification of Interceptor bindings of @ejb Interceptors.
  • Created Sample EJB together with a basic @AroundInvoke Interceptor to verify the NPE in EJB Interceptors proposed by @agori.
  • Fixed debug log in EntityManagerProducer
  • Processing @interceptors annotation and replacing with altered InterceptionBindings
  • Saving altered InterceptorBindings in GlobalInterceptorImpl (interceptor cache)

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.

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
@bbq2100
Copy link
Contributor Author

bbq2100 commented Dec 16, 2014

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.
The InterceptorChain object comprises all different level of interceptor bindings (class and method).

Technically the new algorithm looks like the following:

  1. Retrieve the InterceptorChain object from the InterceptorWrapperBinding.
  2. Create a new InterceptorInvocationContext via the DefaultInvocationContextFactory.
  3. The InterceptorInvocation object holds the origin intercepted class, method and parameters.

@bbq2100
Copy link
Contributor Author

bbq2100 commented Jan 14, 2015

After observing the long commit history in this PR, I will squash some of the 'refactoring'- and 'fix' commits.

Qaiser Abbasi added 4 commits January 14, 2015 17:01
…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'
@bbq2100
Copy link
Contributor Author

bbq2100 commented Mar 23, 2015

I will separate the different PRs here in a more reasonable form => leads to better overview regarding the committed changes ☀️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant