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 2022/08/19 12:19:00 UTC

[jira] [Created] (SLING-11548) sling-mock: Introduce RESOURCEPROVIDER_MOCK resource resolver type

Stefan Seifert created SLING-11548:
--------------------------------------

             Summary: sling-mock: Introduce RESOURCEPROVIDER_MOCK resource resolver type
                 Key: SLING-11548
                 URL: https://issues.apache.org/jira/browse/SLING-11548
             Project: Sling
          Issue Type: New Feature
          Components: Testing
            Reporter: Stefan Seifert
            Assignee: Stefan Seifert
             Fix For: Testing Sling Mock 3.4.0


based on the new MockResourceProvider implemention in resourceresolver-mock (SLING-11455) we introduce a new resource resolver type {{RESOURCEPROVIDER_MOCK}} that's uses the ResourceProvider implementation instead of the MockResourceResolver.

with this change we remove the additional wrapper layers for MockResourceResolverFactory and MockResourceResolver in sling-mock there were introduced for SLING-5922/SLING-10753 and caused various trouble because the wrapper layer was too simplicisty (examples for problems: SLING-10937, SLING-11252, [WTES-74|https://wcm-io.atlassian.net/browse/WTES-74])

benefits of {{RESOURCEPROVIDER_MOCK}} compared to {{{}RESOURCERESOLVER_MOCK{}}}:
 * it used the "real" sling resource resolver implementation with full support for combinding multiple ResourceProvider
 * fully supports loading folders of JSON or FileVault XML content as described in SLING-5922/SLING-10753.
this feature is no longer supported with {{RESOURCERESOLVER_MOCK}} and the error message indicated to switch to {{RESOURCEPROVIDER_MOCK}} for those tests that make use of this feature.
 * overall the resourceresolver behaves "closer" to the real resourceresolver than using MockResourceResolver alone

drawbacks:
 * the test execution has more overhead initializing the sling resourceresolver implementation with a lot of magic happening behinde the scenes
that's why we introduced a new resource resolver type, and did not just change the implementation of {{{}RESOURCERESOLVER_MOCK{}}}, and {{RESOURCERESOLVER_MOCK}} is still the default mode as it still serves well for the majority of typical use cases



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