hi all,

I've added a new module org.apache.sling.testing.paxexam in trunk/testing 
recently. It provides Sling's Launchpad Karaf Features as Options for Pax 
Exam (without Karaf) to setup a Sling instance with less boilerplate code:

* allows to run ITs in the same module (with the build artifact under test)
* allows using different versions in build and tests
* allows overriding of versions
 
Setting up a Sling Launchpad with some additional "Features":

protected static Option launchpad(final String workingDirectory) {
    final int httpPort = findFreePort();
    final String slingHome = String.format("%s/sling", workingDirectory);
    final String repositoryHome = String.format("%s/repository", slingHome);
    final String localIndexDir = String.format("%s/index", repositoryHome);
    return composite(
        slingJcrOak(),
        slingLaunchpadOak(),
        slingExtensionI18n(),
        slingExtensionModels(),
        slingScriptingJsp(),
        newConfiguration("org.apache.felix.http")
            .put("org.osgi.service.http.port", httpPort)
            .asOption(),
        
newConfiguration("org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStoreService")
            .put("repository.home", repositoryHome)
            .put("name", "Default NodeStore")
            .asOption(),
        
newConfiguration("org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProviderService")
            .put("localIndexDir", localIndexDir)
            .asOption(),
        mavenBundle().groupId("org.apache.jackrabbit").artifactId("oak-
segment").version(SlingOptions.versionResolver)
    );
}

For a complete example see tests in Scripting Thymeleaf. I will cut a first 
release when Sling Oak Server 1.1 is available. Any feedback is welcome.

Regards,
O.

Reply via email to