You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by "hungphan227 (via GitHub)" <gi...@apache.org> on 2024/03/05 04:25:10 UTC
[PR] Update JamesServerExtension [james-project]
hungphan227 opened a new pull request, #2086:
URL: https://github.com/apache/james-project/pull/2086
This PR is used to test effect of changes in postgresql branch (https://github.com/apache/james-project/pull/2072) on master branch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
Re: [PR] Update JamesServerExtension [james-project]
Posted by "Arsnael (via GitHub)" <gi...@apache.org>.
Arsnael merged PR #2086:
URL: https://github.com/apache/james-project/pull/2086
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org
Re: [PR] Update JamesServerExtension [james-project]
Posted by "hungphan227 (via GitHub)" <gi...@apache.org>.
hungphan227 commented on PR #2086:
URL: https://github.com/apache/james-project/pull/2086#issuecomment-1978354019
> Can you please better explain why this change is needed?
The old code of JamesServerExtension:
```
PER_ENCLOSING_CLASS(
(extension, context) -> {
if (!isNested(context)) {
extension.start(context);
}
},
(extension, context) -> { },
(extension, context) -> { },
(extension, context) -> {
if (!isNested(context)) {
extension.stop(context);
}
}),
```
With the old code, when running test class that have nested classes, the beforeAll and afterAll method of all registrableExtensions run several times (corresponding to number of nested classes) during the test class execution while beforeEach and afterEach method of registrableExtensions only run once at the beginning and the end -----> wrong order
With the new code:
```
PER_ENCLOSING_CLASS(
(extension, context) -> {
if (!isNested(context)) {
extension.setup(context);
extension.start(context);
}
},
(extension, context) -> { },
(extension, context) -> { },
(extension, context) -> {
if (!isNested(context)) {
extension.stop(context);
extension.tearDown(context);
}
}),
```
when running test class that have nested classes, beforeAll, afterAll, beforeEach and afterEach methods of all registrableExtensions only run once with the right order beforeAll -> beforeEach -> afterEach -> afterAll
In addition, I believe the new code is easier to understand than the old code. The old code really confused me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org