Hi Stefan,

Sure. I think most of it is in the newest or a very recent version.

Sling-mock 2.2.6
ResourceResolver-mock 1.1.16
sling-mock-oak 2.0.2
jcr-mock 1.2.0
org.apache.sling.jcr.resource 2.9.2

The problem, I think is that sling mocks uses the loginAdministrative when 
using JCR_MOCK and that doesn't work anymore since it requires to be 
whitelisted. Im not sure if this is a bug or I have to whitelist it somehow.

Greetings.

Santiago García Pimentel| Sr Software Engineer
Netcentric Ibérica SLU
M: +34687915463
santiago.pimen...@netcentric.biz <mailto:santiago.pimen...@netcentric.biz>  | 
www.netcentric.biz <http://www.netcentric.biz/>
> On Apr 28, 2017, at 12:35 PM, Stefan Seifert <sseif...@pro-vision.de> wrote:
> 
> can you provide more details with version of sling mock you are using?
> and if you are overrding some of it's dependencies (e.g. 
> org.apache.sling.resourceresolver or org.apache.sling.jcr.resource) with 
> other versions?
> 
> you might also try to move sling-mock test dependency to the top in your 
> project POM to avoid conflicting transitive dependency.
> 
> stefan
> 
>> -----Original Message-----
>> From: Santiago Garcia Pimentel [mailto:santiago.pimen...@netcentric.biz]
>> Sent: Friday, April 28, 2017 12:33 PM
>> To: users@sling.apache.org
>> Subject: sling mocks "Creating resource resolver failed"
>> 
>> Hello,
>> 
>> Im trying to use sling mocks and Im having problems when creating content
>> when using the JCR_MOCK.
>> 
>> When trying to create a resource with :
>> 
>>   @Rule
>>   public final SlingContext context = new
>> SlingContext(ResourceResolverType.JCR_MOCK);
>> 
>> and
>> 
>> context.create().resource("/content/web", ImmutableMap.of("jcr:title",
>> "web"));
>> 
>> I get java.lang.RuntimeException: Creating resource resolver failed.
>>      at
>> org.apache.sling.testing.mock.sling.context.SlingContextImpl.resourceResolv
>> er(SlingContextImpl.java:250)
>>      at
>> org.apache.sling.testing.mock.sling.context.SlingContextImpl.create(SlingCo
>> ntextImpl.java:335)
>> 
>>      …..
>> Caused by: org.apache.sling.api.resource.LoginException: Calling bundle
>> missing in authentication info
>>      at
>> org.apache.sling.jcr.resource.internal.helper.jcr.JcrProviderStateFactory.c
>> reateProviderState(JcrProviderStateFactory.java:129)
>>      at
>> org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.authe
>> nticate(JcrResourceProvider.java:284)
>>      at
>> org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.authe
>> nticate(JcrResourceProvider.java:75)
>>      at
>> org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.a
>> uthenticate(ProviderManager.java:161)
>>      at
>> org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.g
>> etOrCreateProvider(ProviderManager.java:87)
>>      at
>> org.apache.sling.resourceresolver.impl.providers.stateful.ProviderManager.a
>> uthenticateAll(ProviderManager.java:129)
>>      at
>> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.createControl(R
>> esourceResolverImpl.java:154)
>>      at
>> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.<init>(Resource
>> ResolverImpl.java:116)
>>      at
>> org.apache.sling.resourceresolver.impl.ResourceResolverImpl.<init>(Resource
>> ResolverImpl.java:110)
>>      at
>> org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.ge
>> tResourceResolverInternal(CommonResourceResolverFactoryImpl.java:257)
>>      at
>> org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl.ge
>> tAdministrativeResourceResolver(CommonResourceResolverFactoryImpl.java:140)
>>      at
>> org.apache.sling.resourceresolver.impl.ResourceResolverFactoryImpl.getAdmin
>> istrativeResourceResolver(ResourceResolverFactoryImpl.java:107)
>>      at
>> org.apache.sling.testing.mock.sling.context.SlingContextImpl.resourceResolv
>> er(SlingContextImpl.java:248)
>>      ... 27 more
>> 
>> 
>> 
>> It seems to be caused by the recent changes in the use of administrative
>> resource resolver, and Im not sure how to make it work. Anyone has a tip on
>> this?
>> 
>> Santiago García Pimentel| Sr Software Engineer
>> Netcentric Ibérica SLU
>> M: +34687915463
>> santiago.pimen...@netcentric.biz  | www.netcentric.biz
> 

Reply via email to