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 2018/07/31 11:53:00 UTC

[jira] [Resolved] (SLING-7712) sling-mock: make register Sling Models from classpath optional

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

Stefan Seifert resolved SLING-7712.
-----------------------------------
       Resolution: Fixed
    Fix Version/s: Testing Sling Mock 2.2.20

i've added a new flag to the SlingContextBuilder which allows to disable automatic registration of sling models from the classpath - example:
{code:java}
    @Rule
    public SlingContext context = new SlingContextBuilder()
            .registerSlingModelsFromClassPath(false)
            .build();
{code}

implemented in
https://github.com/apache/sling-org-apache-sling-testing-sling-mock/commit/8415c24609e6c40b59d2227038b9a8e5766f7a21

> sling-mock: make register Sling Models from classpath optional
> --------------------------------------------------------------
>
>                 Key: SLING-7712
>                 URL: https://issues.apache.org/jira/browse/SLING-7712
>             Project: Sling
>          Issue Type: Improvement
>          Components: Testing
>    Affects Versions: Testing Sling Mock 1.9.12, Testing Sling Mock 2.2.18
>            Reporter: Andrey Bardashevsky
>            Assignee: Stefan Seifert
>            Priority: Major
>             Fix For: Testing Sling Mock 2.2.20
>
>
> Registering all sling models from classpath leads to slow down tests dramatically.
> Steps to reproduce:
>  # Register several models.
>  # In context.afterSetup() register several custom injetors that implements StaticInjectAnnotationProcessorFactory
> Each injector registration leads to update every model (ModelAdapterFactory) that slow downs test dramatically, when you have 300+ models and 5-6 injectors that register in setup method before each test.
> Workaround is to register injectors before models.
> Please implement optional registration all sling models from classpath.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)