You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (Jira)" <ji...@apache.org> on 2026/03/31 12:43:00 UTC

[jira] [Assigned] (SLING-13146) ThreadsafeMockAdapterManagerWrapper: Adapters from test class cannot be found

     [ https://issues.apache.org/jira/browse/SLING-13146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Seifert reassigned SLING-13146:
--------------------------------------

    Fix Version/s: Testing Sling Mock 3.6.2
                   Testing Sling Mock 4.0.6
         Assignee: Stefan Seifert
       Issue Type: Bug  (was: Improvement)

i think i have found a solution that fixed both problems - at least your test case did pass with it, and it also still solves the problem for the flaky unit tests initially fixed with SLNIG-13003.
 * PR for master branch: https://github.com/apache/sling-org-apache-sling-testing-sling-mock/pull/60
 * PR for 3.x branch: https://github.com/apache/sling-org-apache-sling-testing-sling-mock/pull/59

> ThreadsafeMockAdapterManagerWrapper: Adapters from test class cannot be found
> -----------------------------------------------------------------------------
>
>                 Key: SLING-13146
>                 URL: https://issues.apache.org/jira/browse/SLING-13146
>             Project: Sling
>          Issue Type: Bug
>          Components: Testing
>    Affects Versions: Testing Sling Mock 4.0.0, Testing Sling Mock 4.0.2, Testing Sling Mock 3.6.0, Testing Sling Mock 4.0.4
>            Reporter: Henry Kuijpers
>            Assignee: Stefan Seifert
>            Priority: Major
>             Fix For: Testing Sling Mock 3.6.2, Testing Sling Mock 4.0.6
>
>
> When testing an OSGi service with ResourceResolverType=JCR_OAK, that is (for example) a ResourceChangeListener, the following could occur:
>  # Test class registers an adapter
>  # onChange gets triggered on a different thread, which causes: [pool-6-thread-1] WARN org.apache.sling.testing.mock.sling.ThreadsafeMockAdapterManagerWrapper - Create new bundle context for adapter manager because it was null, bundleContext=null
>  # The adapterfactories are not there in this new AdapterManager
>  # The adaptTo-call returns null
>  # When manually triggering the onChange-method from the test, the adaptTo-call works, as it uses a different AdapterManager that *does* have the adapterfactory



--
This message was sent by Atlassian Jira
(v8.20.10#820010)