RE: [Sling Testing] Mocking a Resource Resolver w/ URL Mappings

2017-06-27 Thread Stefan Seifert
i've added a test case for your use case, seems to work:
https://github.com/apache/sling/commit/9cfb76c717abdab409af4db552f245a8a63a9e72

the problem in your test harness ist he usage of RESOURCERESOLVER_MOCK - this 
is only a very simplified of resource resolver implementation and has nothing 
to do with the real impl or any properties you provide for the activator - the 
map implementation is also simplified [1].

if you switch to ResourceResolverType.JCR_MOCK you have the real resource 
resolver implementation.

stefan


[1] 
https://github.com/apache/sling/blob/trunk/testing/mocks/resourceresolver-mock/src/main/java/org/apache/sling/testing/resourceresolver/MockResourceResolver.java#L113


>-Original Message-
>From: David G. [mailto:davidjgonza...@gmail.com]
>Sent: Friday, June 23, 2017 11:06 PM
>To: users@sling.apache.org
>Subject: Re: [Sling Testing] Mocking a Resource Resolver w/ URL Mappings
>
>Thanks Stefan,
>
>I tried it out to no avail; here is a quick harness [1]
>I poke around the code, and dont see where these properties are used in the
>code? Am I missing something?
>
>Im on the latest sling mock bundle (2.2.12) and also played around w the
>param format; String[] vs "[/:/,/content/,<]", as well as the order, but it
>didnt work,
>
>[1] https://gist.github.com/davidjgonzalez/38550e36e66be3c234c6944fabf67d8f
>[2]
>https://github.com/apache/sling/blob/trunk/testing/mocks/resourceresolver-
>mock/src/main/java/org/apache/sling/testing/resourceresolver/MockResourceRe
>solver.java#L118
>
>
>On Fri, Jun 23, 2017 at 9:41 AM, Stefan Seifert 
>wrote:
>
>> yes, you can set a different value for the resource.resolver.mapping
>> property.
>>
>> when you create the SlingContext object for the junit rule using the
>> SlingContextBuilder, you have method resourceResolverFactoryActivat
>> orProps.
>> pass in a hashmap for this method with property resource.resolver.mapping
>> set to your mapping string array.
>>
>> stefan
>>
>> >-Original Message-
>> >From: David G. [mailto:davidjgonza...@gmail.com]
>> >Sent: Thursday, June 22, 2017 3:40 PM
>> >To: users@sling.apache.org
>> >Subject: [Sling Testing] Mocking a Resource Resolver w/ URL Mappings
>> >
>> >Hi all,
>> >
>> >I would like to mock a Resource Resolver but provide various URL
>Mappings
>> >for my unit testing (ie. what is set via Apache Sling Resource Resolver
>> >Factory > URL Mapping)
>> >
>> >Is there a way to achieve this with the new (and great) Sling Mocks?
>> >
>> >Thanks
>>


Can ACL's be applied on resources provided by ResourceProviders

2017-06-27 Thread Bart Wulteputte
Hi,

I've been using the JcrContentLoader json format in combination with an
FsResourceProvider of type INITIAL_CONTENT. I was wondering if ACL's can be
applied to resource provided by ResourceProviders. According to the docs of
JcrContentLoader, it should be possible, however, SLING-6960
 seems to remove this
feature? So it's somewhat unclear to me if ACL's are/remain a supported
feature. Could someone provide some clarity on this please?

Best regards

Bart