Note I had a look at the contentImporter.importContent(...) it currently create the node with the name of the file, it would be possible to do what you suggested with a ZIP file only if contentloader 2.1.12 is released officially as it provide a new method : void importContent(Node parent, String name, String contentType, InputStream contentStream, ImportOptions importOptions, ContentImportListener importListener)
I have already tested a solution what would pack the resources needed into a zip and pass it to above method, but I am blocked because 2.1.12 is not officially available. Any idea when that one will be available ? Regards, -Thierry 2015-12-02 11:54 GMT+01:00 Thierry Yge <[email protected]>: > Hi Oliver, > > It could work, but that would mean we would need to recreate a ZIP/JAR out > of the content embedded in the bundle as resources and then pass it as > argument to the content loader (ContentImporter API here), which at the end > is most likely the same as re-implementing ourself in the test module the > logic to traverse a bundle. So indeed we can do that, but then I wouldn't > need to request an enhancement in Sling. > > I could also use then the VLT Packages format solution which also provide > a better method to uninstall that is even better (it create snapshots of > the modified content for example), the only bad about the VLT Package is > that the format used is not "user" friendly as it require .xml which I > don't think our developers will want to use. > > So I am not sure anymore what to use / do in that case. > > Let me know if you have any other suggestions. > Regards, > -Thierry > > > > On Wed, Dec 2, 2015 at 10:54 AM Oliver Lietz <[email protected]> > wrote: > >> On Wednesday 02 December 2015 09:39:49 Thierry Yge wrote: >> > Thanks Oliver, this ContentLoader mechanism come from the Sling Mocks >> > <https://sling.apache.org/documentation/development/sling-mock.html> I >> > believe, it's simply works if your test is not depending on the full >> setup >> > which is the reason to have TeleporterRule here. I doubt that the Sling >> > Mocks are available on the server side usually as that is against the >> idea >> > of mocking Sling then. >> > >> > Of course Sling Mocks / AEM Context extensions are useful and powerful >> > tools already but it's not in the scope of Teleporter use cases I think. >> >> Not sure if that is what my co-workers used, as they imported into a real >> repository. >> >> > If we can enhance the existing ContentLoader bundle code that would >> > certainly resolve the above use cases. Especially if we could simply >> import >> > a predefined structure as described above, instead of listing one by one >> > each resources which we indeed already know how to do. >> >> The Content Loader can already import ZIPs and JARs (and of course JCR >> XML), >> so there is no need to list each and every resource. Doesn't that work for >> you? >> >> O. >> >> > Regards, >> > -Thierry >> > >> > On Wed, Dec 2, 2015 at 10:29 AM Oliver Lietz <[email protected]> >> wrote: >> > > On Wednesday 02 December 2015 10:10:26 Bertrand Delacretaz wrote: >> > > > Hi Oliver, >> > > >> > > Hi Bertrand, >> > > >> > > > On Wed, Dec 2, 2015 at 10:03 AM, Oliver Lietz < >> [email protected]> >> > > >> > > wrote: >> > > > > ...+1 for enhancing the Content Loader. It needs some >> streamlining and >> > > > > care >> > > > > anyway (see open issues) and patches are very welcome.... >> > > > >> > > > +1 to that, testing looks like a good use case for improving it. >> > > > >> > > > Teleported tests shouldn't need anything special for this compared >> to >> > > > other OSGi code, as they are running in bundles. And thanks to >> > > > Thierry's recent contribution resources can also be teleported, we >> > > > might just need to improve the content loader and/or JUnit rules, >> > > > distinct from the TeleporterRule to avoid mixing concerns. >> > > > >> > > > I'm busy with other things at the moment, hoping to have a look at >> > > > this early next week. >> > > > >> > > > > ...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.... >> > > > >> > > > Which tools do you mean? >> > > >> > > my co-workers used something from wcm.io to import content, not sure >> if >> > > that >> > > tools already live in the Sling repo and how capable they are - >> better ask >> > > Stefan himself. >> > > >> > > O. >> > > >> > > > -Bertrand >> >>
