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
Test CDI and FT interceptors ordering changing FT interceptor priority #378
Conversation
FT interceptor priority issue 313 eclipse#313 New tests added to validate the CDI interceptors against FT interceptor when the FT interceptor priority is changed and the CDI interceptors are injected to the context using xml or annotation base configuration. Signed-off-by: carlos de la rosa <kusanagi12002@gmail.com>
Can one of the admins verify this patch? |
If I'm reading this right, in both cases (beans.xml and Priority annotation) you're changing the priority of the Fault Tolerance interceptor(s) in a way where you expect the same behaviour as when you didn't change the priority of it? Could you change The other test is fine since when the interceptors are defined in the |
@genie-microprofile test this please |
Hello @Azquelt yes you are right I will make the change Thanks |
@carlosdlr can you please make the change as indicated so that we can merge this PR? thanks |
FT interceptor priority issue 313 eclipse#313 Fixes related to code review and use of the fault tolerance interceptor priority parameter. Signed-off-by: Carlos Andres De La Rosa <kusanagi12002@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good.
I have one request: can we change the interceptors so that the EarlyFtInterceptor
is called earlier than LateFtInterceptor
? Having the late interceptor called earlier than the early interceptor makes the test really confusing to read.
FT interceptor priority issue 313 eclipse#313 Fixes related to code review, order changed to make clear the test Signed-off-by: Carlos Andres De La Rosa <kusanagi12002@gmail.com>
} | ||
|
||
String [] expectedOrder = {"serviceRetryA","EarlyOrderFtInterceptor","LateOrderFtInterceptor", | ||
"serviceRetryA","EarlyOrderFtInterceptor","LateOrderFtInterceptor"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I missed something, I was expecting this to be `{"EarlyOrderFtInterceptor","LateOrderFtInterceptor", "serviceRetryA", "EarlyOrderFtInterceptor","LateOrderFtInterceptor", "serviceRetryA"};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Azquelt,
This is not the case because the idea of this the is to validate that if the FT priority is changed to be called at first must work in the order that is expected in the test. if you check the priority values for this test are for the Earlier(Interceptor.Priority.PLATFORM_AFTER - 200) = 3800, Later(Interceptor.Priority.PLATFORM_AFTER - 100) = 3900 and for the FT the value in this test is 3700, so according to the interceptors documentation the order to be called is ascending so must be called FT, Early and Later interceptor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but even if the FT interceptor is called first, the method body is still called at the end.
The difference I expect to with the FT interceptor being first is that the interceptors are called on each retry, rather than only once at the start.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so for no make sense this test because as a developer if I change the FT priority I expect some change in the order, I think is better wait after the implementation to add this test. What do you think?, because for me is not clear what is the purpose of this parameter (would you mind give me a brief explanation?). if you check the previous test related to this, the scenario that you mention "I expect to with the FT interceptor being first is that the interceptors are called on each retry, rather than only once at the start." is already tested and is working in the way that you mention without change the FT priority.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we have the following:
EarlyOrderFtInterceptor - priority 3800
LateOrderFtInterceptor - priority 3900
FT interceptor base - default priority 4010, but configured here to be 3700
If the FT interceptor is left at the default priority, I would expect the order to be "Early, Late, FT".
Therefore, in the order queue, I would expect to see {"EarlyOrderFtInterceptor","LateOrderFtInterceptor", "asyncGetString", "asyncGetString"}
If the FT interceptor is configured to priority 3700, I would then expect the order to be "FT, Early, Late".
Therefore, in the order queue, I would expect to see {"EarlyOrderFtInterceptor","LateOrderFtInterceptor", "asyncGetString", "EarlyOrderFtInterceptor","LateOrderFtInterceptor", "asyncGetString"}
The change is expected here because I now expect the interceptors to be called on each retry attempt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok @Azquelt Thanks for your clarification
public void testAsync() throws InterruptedException, ExecutionException { | ||
Future<String> result = testInterceptor.asyncGetString(); | ||
assertEquals(result.get(), "OK"); | ||
String [] expectedOrder = {"asyncGetString","EarlyOrderFtInterceptor","LateOrderFtInterceptor"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, should this not be {"EarlyOrderFtInterceptor","LateOrderFtInterceptor", "asyncGetString"}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Azquelt,
This is not the case because the idea of this the is to validate that if the FT priority is changed to be called at first must work in the order that is expected in the test. if you check the priority values for this test are for the Earlier(Interceptor.Priority.PLATFORM_AFTER - 200) = 3800, Later(Interceptor.Priority.PLATFORM_AFTER - 100) = 3900 and for the FT the value in this test is 3700, so according to the interceptors documentation the order to be called is ascending so must be called FT, Early and Later interceptor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Azquelt Changes done.
Thank you
FT interceptor priority issue 313 eclipse#313 Fixes related to code review, order changed to make clear the test Signed-off-by: Carlos Andres De La Rosa <kusanagi12002@gmail.com>
Thanks @carlosdlr :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks @carlosdlr !
FT interceptor priority issue 313
#313
New tests added to validate the CDI interceptors against FT interceptor
when the FT interceptor priority is changed and the CDI interceptors
are injected to the context using xml or annotation base configuration.
Signed-off-by: carlos de la rosa kusanagi12002@gmail.com