protected void installAdditionalBundles()

in src/main/java/org/apache/sling/testing/serversetup/instance/SlingTestBase.java [205:239]


    protected void installAdditionalBundles() {
        if (slingTestState.isInstallBundlesFailed()) {
            fail("Bundles could not be installed, cannot run tests");
        } else if(!slingTestState.isExtraBundlesInstalled()) {
            final List<File> toInstall = getBundlesToInstall();
            if (!toInstall.isEmpty()) {
                try {
                    // Install bundles, check that they are installed and start them all
                    bundlesInstaller.installBundles(toInstall, false);
                    final List<String> symbolicNames = new LinkedList<String>();
                    for (File f : toInstall) {
                        symbolicNames.add(OsgiConsoleClient.getBundleSymbolicName(f));
                    }
                    bundlesInstaller.waitForBundlesInstalled(symbolicNames,
                            TimeoutsProvider.getInstance().getTimeout(BUNDLE_INSTALL_TIMEOUT_SECONDS, 10) * 1000);
                    bundlesInstaller.startAllBundles(symbolicNames,
                            TimeoutsProvider.getInstance().getTimeout(START_BUNDLES_TIMEOUT_SECONDS, 30) * 1000);
                } catch(AssertionError ae) {
                    log.info("Exception while installing additional bundles", ae);
                    slingTestState.setInstallBundlesFailed(true);
                } catch(Exception e) {
                    log.info("Exception while installing additional bundles", e);
                    slingTestState.setInstallBundlesFailed(true);
                }
                if(slingTestState.isInstallBundlesFailed()) {
                    fail("Could not start all installed bundles:" + toInstall);
                }
            } else {
                log.info("Not installing additional bundles, probably System property {} not set",
                        ADDITONAL_BUNDLES_PATH);
            }
        }

        slingTestState.setExtraBundlesInstalled(!slingTestState.isInstallBundlesFailed());
    }