You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Radu Cotescu (Jira)" <ji...@apache.org> on 2023/04/28 14:09:00 UTC
[jira] [Resolved] (SLING-11852) Make the ThreadsafeMockAdapterManagerWrapper use an InheritableThreadLocal
[ https://issues.apache.org/jira/browse/SLING-11852?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Radu Cotescu resolved SLING-11852.
----------------------------------
Resolution: Fixed
> Make the ThreadsafeMockAdapterManagerWrapper use an InheritableThreadLocal
> --------------------------------------------------------------------------
>
> Key: SLING-11852
> URL: https://issues.apache.org/jira/browse/SLING-11852
> Project: Sling
> Issue Type: Improvement
> Components: Testing
> Reporter: Radu Cotescu
> Assignee: Radu Cotescu
> Priority: Major
> Fix For: Testing Sling Mock 3.4.8
>
>
> For scenarios where the mocked OSGi framework executes calls in other threads than the test thread (e.g. servlets under test in Jetty), the only way to pass the test's {{AdapterManager}} is to directly call {{{}SlingAdaptable#setAdapterManager{}}}. However, this will affect tests starting after this initial call.
> A better solution would be to make the {{org.apache.sling.testing.mock.sling.ThreadsafeMockAdapterManagerWrapper#THREAD_LOCAL}} an {{{}InheritableThreadLocal{}}}. This would allow the tests to still be executable in parallel, but threads started from a test thread (e.g. the servlets under test in Jetty) could inherit the thread local context.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)