Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-11852

Make the ThreadsafeMockAdapterManagerWrapper use an InheritableThreadLocal

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • Testing Sling Mock 3.4.8
    • Testing
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              radu Radu Cotescu
              radu Radu Cotescu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: