On Thursday 13 September 2018 10:23:30 Christian Schneider wrote:
> In some cases I want to pull up a sling instances in pax exam but want to
> remove some lower level bundles and replace them with some custom bundle.
> This can not be handled by simply providing a different version.

Right, you have to remove the bundle.

> An example is:
> I want to load sling using SlingOptions.slingDistribution() but I want to
> remove the sling event bundle and install my own bundle instead.
> 
> As the methods in SlingOptions are all static I can not simply extend the
> class and and override the SlingOptions.slingEvent() method.
> 
> So currently I copy all features that I need from SlingOptions into my own
> class and change what I need to change there. This is of course not very
> manageable and also kind of hides the fact that most of the bundle will
> stay the same.
> 
> Any ideas how to tackle this problem?

Remove the unwanted options (bundles) from your Sling options – that is quite 
easy in fact.

I will add a remove(Option) to CompositeOption in Pax Exam and change the 
return types in SlingOptions from Option to CompositeOption. 

Until then do it yourself by casting to CompositeOption and recreating the 
CompositeOption, see ContentloaderTestSupport#configuration():Option[] where I 
remove the Content Loader bundle and use the build artifact.

https://github.com/apache/sling-org-apache-sling-jcr-contentloader/blob/master/src/test/java/org/apache/sling/jcr/contentloader/it/ContentloaderTestSupport.java#L100

Regards,
O.

> Christian

Reply via email to