-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Introduce PreInterruptCallback extension point #3431
Conversation
I am currently not happy with the change in |
da26892
to
0c2a0ed
Compare
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.
I am currently not happy with the change in
MutableExtensionRegistry
. Is there another way to get the current activeExtensionRegistry
from a currentExtensionContext
?
I think we should consider adding a <E extends Extension> List<E> getExtensions(Class<E> extensionType)
method to ExtensionContext
and storing an ExtensionRegistry
as an instance field in the implementations of ExtensionContext
. Could you please give that a try?
junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java
Outdated
Show resolved
Hide resolved
junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java
Show resolved
Hide resolved
...ter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultPreInterruptCallback.java
Outdated
Show resolved
Hide resolved
@marcphilipp Thanks for the review. And your proposal regarding the |
junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java
Outdated
Show resolved
Hide resolved
...piter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java
Outdated
Show resolved
Hide resolved
...ter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java
Outdated
Show resolved
Hide resolved
...piter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java
Outdated
Show resolved
Hide resolved
...upiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineDescriptor.java
Outdated
Show resolved
Hide resolved
...piter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java
Outdated
Show resolved
Hide resolved
...piter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java
Outdated
Show resolved
Hide resolved
junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java
Outdated
Show resolved
Hide resolved
junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java
Outdated
Show resolved
Hide resolved
...upiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java
Outdated
Show resolved
Hide resolved
...upiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactory.java
Show resolved
Hide resolved
junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java
Outdated
Show resolved
Hide resolved
...upiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactory.java
Show resolved
Hide resolved
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.
Thanks for making the requested changes! I've requested one additional change and I'd like to discuss the introduction of ExtensionContext.getExtensions
(that I suggested) with the team before we merge this.
junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java
Outdated
Show resolved
Hide resolved
junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptContext.java
Outdated
Show resolved
Hide resolved
junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java
Show resolved
Hide resolved
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.
One more thing came out of our team discussion.
junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java
Outdated
Show resolved
Hide resolved
Added PreInterruptCallback extension to allow to hook into the @timeout extension before the executing Thread is interrupted. The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.out. It is disabled by default and must be enabled with: junit.jupiter.execution.timeout.threaddump.enabled = true Issue: junit-team#2938 Co-authored-by: Marc Philipp <[email protected]>
...upiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionContextInternal.java
Outdated
Show resolved
Hide resolved
@AndreasTu Thank you for your contribution! 👍 |
Overview
Added PreInterruptCallback extension to allow to hook into the
@Timeout
extension before the executing Thread is interrupted.The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.out.
It is disabled by default and must be enabled with: junit.jupiter.execution.timeout.threaddump.enabled = true
Issue: #2938
I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@API
annotations