[ 
https://issues.apache.org/jira/browse/SLING-5330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15031834#comment-15031834
 ] 

Thierry Ygé commented on SLING-5330:
------------------------------------

[~bdelacretaz] I think that can work ( at least it worked in my tests), if the 
async need to wait, that can be done easily then on the serverside with a rule 
(for example it can wait for the /var/sling/bundle-content node to have the 
property related to installed bundle set to true (content-loaded property I 
think). the interest of the sling-initial-content , is that is already support 
complete structure (so not only .json file etc.. ), while the 
ContentImporter.importContent(...)  only support a specific stream to be 
imported.

As alternative, then we need a method in the content importer api to import 
based on a bundle / jar , so basically having the same method "installContent" 
from BundleContentLoader available in the ContentImporter , thus the all 
existing logic would not need to be rewritten.

http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoader.java


> add a method to include sling initial content rule in the generated manifest
> ----------------------------------------------------------------------------
>
>                 Key: SLING-5330
>                 URL: https://issues.apache.org/jira/browse/SLING-5330
>             Project: Sling
>          Issue Type: Improvement
>          Components: Testing
>    Affects Versions: JUnit Tests Teleporter 1.0.4
>            Reporter: Thierry Ygé
>         Attachments: teleporter_patch.txt
>
>
> As now with the latest improvement to include any resources in the generated 
> bundle that is sent over with the ClientSideTeleporter (SLING-5294), we see 
> that it could be also nice to include a method to define some 
> Sling-Initial-Content value.
> I have tried to implement a simple solution, it works fine in my prototype, 
> which I have based on the documentation 
> (https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#loading-initial-content-from-bundles)
> Attached is a sample patch, with a junit test for the added class.
> It can then get used in a custom TeleporterRule.Customizer implemented in my 
> test framework
> {code}
>     public void customize(TeleporterRule teleporterRule, String s) {
>        final ClientSideTeleporter cst = (ClientSideTeleporter) teleporterRule;
>       CustomizerParameter params = new CustomizerParameter(s);
>         for (PathImportOptions options : params.getWithContent()) {
>             cst.addImportOption(options);
>         }
> {code}
> In that example my customizer receive some parameter value, which it can 
> extract the import options. Eventually if could be done at TeleportRule level 
> it would be possible to include those with something like:
> {code}
> @Rule
> TeleporterRule teleporter = TeleporterRule.forClass(classUnderTest, 
> "Launchpad").withResources("/my_resources/").withContent(myPathImportOptions);
> {code}
> Since I am not sure if this is something that is "generic" enough to be part 
> of the TeleporterRule , I have only added it to the ClientSideTeleporter in 
> my sample patch.
> Actually it could also be part of a custom implementation if SLING-5329 would 
> be available. So that would reduce the required changes to resolve this 
> requirement.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to