PlatformBundleLoader { public void useBundles(List<String> bundlePaths) { if (hasLoadedBundles) { log.fine(() -> "Platform bundles have already been installed." + "\nInstalled bundles: " + installedBundles + "\nGiven files: " + bundlePaths); return; } installedBundles = install(bundlePaths); BundleStarter.startBundles(installedBundles); hasLoadedBundles = true; } PlatformBundleLoader(Osgi osgi);   PlatformBundleLoader(Osgi osgi, DiskBundleInstaller installer); void useBundles(List<String> bundlePaths);  }
@Test public void bundles_are_installed_and_started() { bundleLoader.useBundles(List.of(BUNDLE_1_REF)); assertEquals(1, osgi.getInstalledBundles().size()); TestBundle installedBundle = (TestBundle)osgi.getInstalledBundles().get(0); assertEquals(BUNDLE_1.getSymbolicName(), installedBundle.getSymbolicName()); assertTrue(installedBundle.started); }
@Test public void bundles_cannot_be_added_by_later_calls() { bundleLoader.useBundles(List.of(BUNDLE_1_REF)); bundleLoader.useBundles(List.of(BUNDLE_2_REF)); assertEquals(1, osgi.getInstalledBundles().size()); assertEquals(BUNDLE_1.getSymbolicName(), osgi.getInstalledBundles().get(0).getSymbolicName()); }