you have the possibility to set your custom config via ConfigAdmin in the 
mock-osgi context. i've added and example to the documentation:
http://sling.apache.org/documentation/development/osgi-mock.html#provide-your-own-configuration-via-configadmin

you can wrap the code for this in an implementation of 
org.apache.sling.testing.mock.sling.junit.SlingContextCallback and call it in 
the SlingContextBuilder before calling the caconfig context plugin.

stefan

>-----Original Message-----
>From: Nicolas Peltier [mailto:npelt...@adobe.com]
>Sent: Wednesday, January 4, 2017 2:31 PM
>To: users@sling.apache.org
>Subject: Re: [caconfig][mock] configuration resolver mock?
>
>Thanks Stefan!
>
>one thing that is not clear to me: how should i configure CA services in my
>unit tests.
>I know we have different views for
>DefaultConfigurationResourceResolvingStrategy’s configPath property, but
>e.g. setting DefaultContextPathStrategy’s configRefResourceNames to
>“[jcr:content]” so it looks in those children is not trivial: activate
>method is private as well as most of the members. Any indication (but going
>away from the content model i have)?
>
>Nicolas
>
>
>On Dec 10, 2016, at 9:38 AM, Stefan Seifert <sseifert@pro-
>vision.de<mailto:sseif...@pro-vision.de>> wrote:
>
>it's easier now - the recent sling-mock releases got a plugin interface,
>and there is a plugin for context-aware configuration (soon to be release,
>use 1.0.0-SNAPSHOT vor trying it out).
>
>see http://sling.apache.org/documentation/bundles/context-aware-
>configuration/context-aware-configuration.html#unit-tests-with-context-
>aware-configuration
>
>stefan
>
>
>-----Original Message-----
>From: Stefan Seifert [mailto:sseif...@pro-vision.de]
>Sent: Thursday, December 1, 2016 9:30 PM
>To: users@sling.apache.org<mailto:users@sling.apache.org>
>Subject: RE: [caconfig][mock] configuration resolver mock?
>
>not yet - but it's definitly planned.
>i think we do not need a mock of caconfig, we can just use it directly. it
>only needs a couple of osgi services registered in the mock context, and we
>can make this a bit easier.
>
>until then have a look at [1] and [2] how to do it manually.
>
>stefan
>
>[1]
>https://github.com/apache/sling/blob/trunk/contrib/extensions/contextaware-
>config/impl/src/test/java/org/apache/sling/caconfig/resource/impl/Configura
>tionResourceTestUtils.java
>
>[2]
>https://github.com/apache/sling/blob/trunk/contrib/extensions/contextaware-
>config/impl/src/test/java/org/apache/sling/caconfig/impl/ConfigurationTestU
>tils.java
>
>
>-----Original Message-----
>From: Nicolas Peltier [mailto:npelt...@adobe.com]
>Sent: Thursday, December 1, 2016 2:13 PM
>To: users@sling.apache.org
>Subject: [caconfig][mock] configuration resolver mock?
>
>Hi
>
>is there a configuration resolver mock i can use, or is it planned ?
>
>Nicolas
>
>
>
>

Reply via email to