@Test public void testStartDoesNotFailWithOneInvalidUri() throws Exception { FeaturesServiceImpl impl = createStrictMock(FeaturesServiceImpl.class); impl.addRepository(URI.create(INEXISTANT_REPO)); expectLastCall().andThrow(new IllegalArgumentException("Part of the test. Can be ignored.")); impl.bootDone(); expectLastCall(); replay(impl); String[] repositories = new String[] { INEXISTANT_REPO }; BootFeaturesInstaller bootFeatures = new BootFeaturesInstaller(null, impl, repositories, "", false); Logger logger = Logger.getLogger(BootFeaturesInstaller.class.getName()); logger.setLevel(Level.OFF); bootFeatures.installBootFeatures(); logger.setLevel(Level.INFO); verify(impl); }
protected void installBootFeatures() { try { addRepositories(); List<Set<String>> stagedFeatures = parseBootFeatures(features); for (Set<String> features : stagedFeatures) { featuresService.installFeatures(features, EnumSet.of(FeaturesService.Option.NoFailOnFeatureNotFound)); } featuresService.bootDone(); publishBootFinished(); } catch (Throwable e) { if (e instanceof IllegalStateException) { try { bundleContext.getBundle(); } catch (IllegalStateException ies) { return; } } LOGGER.error("Error installing boot features", e); } }
BootFeaturesInstaller { protected void installBootFeatures() { try { addRepositories(); List<Set<String>> stagedFeatures = parseBootFeatures(features); for (Set<String> features : stagedFeatures) { featuresService.installFeatures(features, EnumSet.of(FeaturesService.Option.NoFailOnFeatureNotFound)); } featuresService.bootDone(); publishBootFinished(); } catch (Throwable e) { if (e instanceof IllegalStateException) { try { bundleContext.getBundle(); } catch (IllegalStateException ies) { return; } } LOGGER.error("Error installing boot features", e); } } }
BootFeaturesInstaller { protected void installBootFeatures() { try { addRepositories(); List<Set<String>> stagedFeatures = parseBootFeatures(features); for (Set<String> features : stagedFeatures) { featuresService.installFeatures(features, EnumSet.of(FeaturesService.Option.NoFailOnFeatureNotFound)); } featuresService.bootDone(); publishBootFinished(); } catch (Throwable e) { if (e instanceof IllegalStateException) { try { bundleContext.getBundle(); } catch (IllegalStateException ies) { return; } } LOGGER.error("Error installing boot features", e); } } BootFeaturesInstaller(BundleContext bundleContext,
                                 FeaturesServiceImpl featuresService,
                                 String[] repositories,
                                 String features,
                                 boolean asynchronous); }
BootFeaturesInstaller { protected void installBootFeatures() { try { addRepositories(); List<Set<String>> stagedFeatures = parseBootFeatures(features); for (Set<String> features : stagedFeatures) { featuresService.installFeatures(features, EnumSet.of(FeaturesService.Option.NoFailOnFeatureNotFound)); } featuresService.bootDone(); publishBootFinished(); } catch (Throwable e) { if (e instanceof IllegalStateException) { try { bundleContext.getBundle(); } catch (IllegalStateException ies) { return; } } LOGGER.error("Error installing boot features", e); } } BootFeaturesInstaller(BundleContext bundleContext,
                                 FeaturesServiceImpl featuresService,
                                 String[] repositories,
                                 String features,
                                 boolean asynchronous); void start(); }
BootFeaturesInstaller { protected void installBootFeatures() { try { addRepositories(); List<Set<String>> stagedFeatures = parseBootFeatures(features); for (Set<String> features : stagedFeatures) { featuresService.installFeatures(features, EnumSet.of(FeaturesService.Option.NoFailOnFeatureNotFound)); } featuresService.bootDone(); publishBootFinished(); } catch (Throwable e) { if (e instanceof IllegalStateException) { try { bundleContext.getBundle(); } catch (IllegalStateException ies) { return; } } LOGGER.error("Error installing boot features", e); } } BootFeaturesInstaller(BundleContext bundleContext,
                                 FeaturesServiceImpl featuresService,
                                 String[] repositories,
                                 String features,
                                 boolean asynchronous); void start();  }