On Wednesday 02 December 2015 09:51:41 Thierry Yge wrote:
> Dear dev team,

hi Thierry,

> As reported on SLING-5330 <https://issues.apache.org/jira/browse/SLING-5330>
> it would be nice to have a solution to include content which could be
> installed / uninstalled along with the test running via TeleporterRule
> mechanism.
> 
> The reason to import content could be multiple, it would simplify the the
> setup for the tests mainly avoiding to recreate content with API which may
> not be the best solution, one can implement it's own solution, but since
> there are already some existing tool in Sling that does it (like
> Sling-Initial-Content), it would be worth to leverage the existing.
> 
> For example one need following content for testing:
> 
> .
> 
> └── jcr_root
> 
>     ├── apps
> 
>     │   ├── myapp
> 
>     │   │   └── components
> 
>     │   │       └── resource
> 
>     │   │           ├── models.js
> 
>     │   │           └── text.html
> 
>     │   └── myapp.json
> 
>     └── content
> 
>         ├── myapp
> 
>         │   └── resource
> 
>         └── myapp.json
> 
> With current available API in Sling, you can already import the .json file
> with the ContentImporter, but you would need to re-implement the solution
> to traverse the resources in the installed bundle, to also install the
> plain text files (models.js and text.html).
> 
> I have suggested different solutions in SLING-5330 which may have pros and
> cons.
> 
> 1. using Sling-Initial-Content via manifest headers
>    - pros : it's quick to implement as it only need to allow to pass custom
> manifest entry.
>    - cons : test need to wait until the content is ready based on the
> property set by Sling-Initial-Content (ContentLoader) upon completion (easy
> to implement but not nice). Uninstall is not perfect as it may leave some
> garbages.
> 
> 2. enhancing ContentLoaderService / BundleHelper interface to allow the
> uses of the installFromPath method
>    - pros : It delegate the use of it to the test code executed on server
> side. It is in sync with the test so that it will be available as soon as
> the test execute, the cleanup is not much different than with solution 1.
> So it still may leave garbages, but a bit less than with
> Sling-Initial-Content which also create some nodes in
> /var/sling/bundle-content/....
>    - cons : it's a change request in the contentloader, it's a bit more
> changes than in the solution 1.
> 
> Can you discuss it and define if that make sense or not, at least it would
> help so that if that is not going to be part of Sling we can find
> alternative solutions for our own project needs.

+1 for enhancing the Content Loader. It needs some streamlining and care 
anyway (see open issues) and patches are very welcome.

However check the very good work done by Stefan in the testing area. Maybe 
it's already possible to import content the way you want with the tools 
developed by him.

Regards,
O.

> Regards,
> -Thierry

Reply via email to