@Test public void testInactiveBundle() { when(bundle1.getState()).thenReturn(Bundle.INSTALLED); Result result = healthCheck.execute(); assertEquals("Status should be WARN", Result.Status.WARN, result.getStatus()); String msg = "Bundle Bundle 1 is not active. It is in state 2."; assertTrue("Message should say bundle is not active", result.iterator().next().getMessage().contains(msg)); }
@Override public Result execute() { FormattingResultLog resultLog = new FormattingResultLog(); int inactiveBundles = 0; Bundle[] bundles = bundleContext.getBundles(); for (Bundle bundle : bundles) { if ((!isActiveBundle(bundle)) && !isIgnoredBundle(bundle)) { inactiveBundles++; resultLog.warn("Bundle {} is not active. It is in state {}.", bundle.getSymbolicName(), bundle.getState()); } } if (ignoredBundles != null) { resultLog.debug("The following bundles will be ignored: {}", Arrays.toString(ignoredBundles)); } if (inactiveBundles > 0) { resultLog.warn("There are {} inactive Bundles", inactiveBundles); } else { resultLog.info("All bundles are considered active"); } return new Result(resultLog); }
ActiveBundleHealthCheck implements HealthCheck { @Override public Result execute() { FormattingResultLog resultLog = new FormattingResultLog(); int inactiveBundles = 0; Bundle[] bundles = bundleContext.getBundles(); for (Bundle bundle : bundles) { if ((!isActiveBundle(bundle)) && !isIgnoredBundle(bundle)) { inactiveBundles++; resultLog.warn("Bundle {} is not active. It is in state {}.", bundle.getSymbolicName(), bundle.getState()); } } if (ignoredBundles != null) { resultLog.debug("The following bundles will be ignored: {}", Arrays.toString(ignoredBundles)); } if (inactiveBundles > 0) { resultLog.warn("There are {} inactive Bundles", inactiveBundles); } else { resultLog.info("All bundles are considered active"); } return new Result(resultLog); } }
ActiveBundleHealthCheck implements HealthCheck { @Override public Result execute() { FormattingResultLog resultLog = new FormattingResultLog(); int inactiveBundles = 0; Bundle[] bundles = bundleContext.getBundles(); for (Bundle bundle : bundles) { if ((!isActiveBundle(bundle)) && !isIgnoredBundle(bundle)) { inactiveBundles++; resultLog.warn("Bundle {} is not active. It is in state {}.", bundle.getSymbolicName(), bundle.getState()); } } if (ignoredBundles != null) { resultLog.debug("The following bundles will be ignored: {}", Arrays.toString(ignoredBundles)); } if (inactiveBundles > 0) { resultLog.warn("There are {} inactive Bundles", inactiveBundles); } else { resultLog.info("All bundles are considered active"); } return new Result(resultLog); }  }
ActiveBundleHealthCheck implements HealthCheck { @Override public Result execute() { FormattingResultLog resultLog = new FormattingResultLog(); int inactiveBundles = 0; Bundle[] bundles = bundleContext.getBundles(); for (Bundle bundle : bundles) { if ((!isActiveBundle(bundle)) && !isIgnoredBundle(bundle)) { inactiveBundles++; resultLog.warn("Bundle {} is not active. It is in state {}.", bundle.getSymbolicName(), bundle.getState()); } } if (ignoredBundles != null) { resultLog.debug("The following bundles will be ignored: {}", Arrays.toString(ignoredBundles)); } if (inactiveBundles > 0) { resultLog.warn("There are {} inactive Bundles", inactiveBundles); } else { resultLog.info("All bundles are considered active"); } return new Result(resultLog); }  @Override Result execute(); }
ActiveBundleHealthCheck implements HealthCheck { @Override public Result execute() { FormattingResultLog resultLog = new FormattingResultLog(); int inactiveBundles = 0; Bundle[] bundles = bundleContext.getBundles(); for (Bundle bundle : bundles) { if ((!isActiveBundle(bundle)) && !isIgnoredBundle(bundle)) { inactiveBundles++; resultLog.warn("Bundle {} is not active. It is in state {}.", bundle.getSymbolicName(), bundle.getState()); } } if (ignoredBundles != null) { resultLog.debug("The following bundles will be ignored: {}", Arrays.toString(ignoredBundles)); } if (inactiveBundles > 0) { resultLog.warn("There are {} inactive Bundles", inactiveBundles); } else { resultLog.info("All bundles are considered active"); } return new Result(resultLog); }  @Override Result execute();  }