@Test
  public void testClientBlueprintContainerOnlyStartsWhenServiceStarted() throws Exception {
    // Stop everything before we start
    Bundle bcli = getInstalledBundle("org.apache.aries.samples.blueprint.helloworld.client");
    assertNotNull(bcli);
    bcli.stop();

    Bundle bser = getInstalledBundle("org.apache.aries.samples.blueprint.helloworld.server");
    assertNotNull(bser);
    bser.stop();

    // Wait for everything to shut down
    Thread.sleep(1000);

    // When everything is stopped, there should be no blueprint container for either the client or
    // the server

    assertClientBlueprintContainerNull();
    assertServerBlueprintContainerNull();

    // If we start the client first, it shouldn't have a blueprint container
    bcli.start();

    // Wait for everything to get started
    Thread.sleep(1000);
    assertClientBlueprintContainerNull();

    // Then when we start the server both it and the client should have blueprint containers
    bser.start();
    // Wait for everything to get started
    Thread.sleep(1000);
    assertClientBlueprintContainerNotNull();
    assertServerBlueprintContainerNotNull();
  }
 @After
 public void tearDown() throws BundleException {
   if (warBundle != null) {
     warBundle.stop();
     warBundle.uninstall();
   }
   if (fragmentBundle != null) {
     fragmentBundle.stop();
     fragmentBundle.uninstall();
   }
 }
 @Test
 public void testDependentBundleLifecyclePermutation1Test() throws Exception {
   Bundle paxWebBundle = getBundleForSymbolicName("org.ops4j.pax.web.pax-web-jetty-bundle");
   Bundle restServiceProviderBundle =
       getBundleForSymbolicName("org.developers.blog.osgi.webservice.jaxrs-provider");
   paxWebBundle.stop();
   restServiceProviderBundle.stop();
   assertFalse(checkRestServiceRunning(false));
   paxWebBundle.start();
   assertTrue(waitForBundle(paxWebBundle));
   restServiceProviderBundle.start();
   assertTrue(waitForBundle(restServiceProviderBundle));
   assertTrue(checkRestServiceRunning(true));
 }
예제 #4
0
    NavigableMap<URI, Bundle> stopBundles(Set<URI> bundles) {
      NavigableMap<URI, Bundle> expect, update;
      do {
        expect = get();
        update =
            ImmutableSortedMap.<URI, Bundle>naturalOrder()
                .putAll(Maps.filterKeys(expect, not(in(bundles))))
                .build();
      } while (!compareAndSet(expect, update));

      List<URI> couldNotStop = new ArrayList<>();
      NavigableMap<URI, Bundle> stopped = Maps.filterKeys(expect, in(bundles));
      for (Map.Entry<URI, Bundle> e : stopped.entrySet()) {
        URI bundleURI = e.getKey();
        Bundle bundle = e.getValue();
        try {
          bundle.stop();
        } catch (BundleException exc) {
          LOG.error("Failed to stop bundle " + bundleURI, exc);
          couldNotStop.add(bundleURI);
        }
      }
      if (!couldNotStop.isEmpty()) {
        throw new ModularException("Failed to stop bundles %s", couldNotStop);
      }
      return stopped;
    }
예제 #5
0
 @Override
 public void undeployBundle(String bundleName) throws BundleException {
   if (bundleName == null) {
     // ignore
     return;
   }
   log.info(
       String.format(
           "Before undeploy bundle with name '%s'.\n" + "%s", bundleName, getRuntimeStatus()));
   BundleContext ctx = getBundleContext();
   ServiceReference ref = ctx.getServiceReference(PackageAdmin.class.getName());
   PackageAdmin srv = (PackageAdmin) ctx.getService(ref);
   try {
     for (Bundle b : srv.getBundles(bundleName, null)) {
       if (b != null && b.getState() == Bundle.ACTIVE) {
         Transaction tx = TransactionHelper.suspendTransaction();
         try {
           b.stop();
           b.uninstall();
         } finally {
           TransactionHelper.resumeTransaction(tx);
         }
       }
     }
   } finally {
     ctx.ungetService(ref);
   }
   log.info(String.format("Undeploy done.\n" + "%s", getRuntimeStatus()));
 }
  @Test
  public void testClientDeploymentAsArchive() throws Exception {

    String symbolicName = "archive-deployer-test-bundle";
    Archive<?> archive = provider.getClientDeployment(symbolicName);
    String depname = archiveDeployer.deploy(archive);
    Bundle bundle = null;
    try {
      for (Bundle aux : context.getBundles()) {
        if (symbolicName.equals(aux.getSymbolicName())) {
          bundle = aux;
          break;
        }
      }
      // Assert that the bundle is there
      assertNotNull("Bundle found", bundle);

      // Start the bundle
      bundle.start();
      OSGiTestHelper.assertBundleState(Bundle.ACTIVE, bundle.getState());

      // Stop the bundle
      bundle.stop();
      OSGiTestHelper.assertBundleState(Bundle.RESOLVED, bundle.getState());
    } finally {
      archiveDeployer.undeploy(depname);
      // FIXME JBAS-9359
      // OSGiTestHelper.assertBundleState(Bundle.UNINSTALLED, bundle.getState());
    }
  }
 @After
 public void tearDown() throws BundleException {
   if (installWarBundle != null) {
     installWarBundle.stop();
     installWarBundle.uninstall();
   }
 }
예제 #8
0
 public void stopBundle(String bundleSymbolicName) throws BundleException {
   for (Bundle bundle : bundleCtx.getBundles()) {
     if (bundleSymbolicName.equals(bundle.getSymbolicName())) {
       bundle.stop();
     }
   }
 }
예제 #9
0
  @Override
  public boolean uninstall(OTEStatusCallback<ConfigurationStatus> statusCallback) {
    boolean result = true;
    for (Bundle bundle : installedBundles) {
      try {
        bundle.uninstall();
      } catch (BundleException ex) {
        result = false;
        statusCallback.error("Failed to uninstall " + bundle.getSymbolicName(), ex);
      }
    }
    installedBundles.clear();

    for (Bundle bundle : runningBundles) {
      try {
        String entry = bundle.getHeaders().get("Fragment-Host");
        if (entry == null) {
          bundle.stop();
        }
        bundle.uninstall();
      } catch (BundleException ex) {
        result = false;
        statusCallback.error("Failed to stop and uninstall " + bundle.getSymbolicName(), ex);
      }
    }
    runningBundles.clear();

    return result;
  }
 @Test
 public void simpleRestProviderWhitboardTest() throws Exception {
   Bundle bundle = getBundleForSymbolicName("RestProviderTestBundle");
   assertEquals(Bundle.ACTIVE, bundle.getState());
   bundle.stop();
   bundle.start();
 }
  @Test
  public void testSetPropertiesAfterStop() throws Exception {
    Bundle bundle = installBundle(getBundleArchiveA());
    try {
      bundle.start();
      BundleContext bundleContext = bundle.getBundleContext();
      assertNotNull(bundleContext);

      ServiceRegistration registration =
          bundleContext.registerService(BundleContext.class.getName(), bundleContext, null);
      assertNotNull(registration);

      bundle.stop();

      try {
        registration.setProperties(new Hashtable<String, Object>());
        fail("Should not be here!");
      } catch (IllegalStateException t) {
        // expected
      }
      assertNoServiceEvent();
    } finally {
      bundle.uninstall();
    }
  }
  @Test
  public void testProperties() throws Exception {
    Bundle bundle = installBundle(getBundleArchiveA());
    try {
      bundle.start();
      BundleContext bundleContext = bundle.getBundleContext();
      assertNotNull(bundleContext);
      assertEquals("1.5", bundleContext.getProperty(Constants.FRAMEWORK_VERSION));
      assertEquals("jboss.org", bundleContext.getProperty(Constants.FRAMEWORK_VENDOR));
      assertEquals(
          Locale.getDefault().getLanguage(),
          bundleContext.getProperty(Constants.FRAMEWORK_LANGUAGE));
      assertSystemProperty(bundleContext, "os.name", Constants.FRAMEWORK_OS_NAME);
      String fwOSVersion = bundleContext.getProperty(Constants.FRAMEWORK_OS_VERSION);
      assertTrue(fwOSVersion.length() > 0);
      assertTrue(System.getProperty("os.version").startsWith(fwOSVersion));
      assertSystemProperty(bundleContext, "os.arch", Constants.FRAMEWORK_PROCESSOR);

      assertNull(bundleContext.getProperty(getClass().getName()));
      System.setProperty(getClass().getName(), "test");
      assertEquals("test", bundleContext.getProperty(getClass().getName()));

      bundle.stop();
      try {
        bundleContext.getProperty(getClass().getName());
        fail("Should not be here!");
      } catch (IllegalStateException t) {
        // expected
      }
    } finally {
      bundle.uninstall();
    }
  }
  @Test
  public void testSynchronousBundleListener() throws Exception {
    final List<BundleEvent> events = new ArrayList<BundleEvent>();
    BundleListener listener =
        new SynchronousBundleListener() {
          @Override
          public void bundleChanged(BundleEvent event) {
            events.add(event);
          }
        };
    BundleContext context = getSystemContext();
    context.addBundleListener(listener);

    Bundle bundle = installBundle(getBundleArchiveA());
    try {
      bundle.start();
      bundle.stop();
      bundle.update();
    } finally {
      bundle.uninstall();
    }

    assertEquals("Event count in: " + events, 10, events.size());
    assertEquals(BundleEvent.INSTALLED, events.get(0).getType());
    assertEquals(BundleEvent.RESOLVED, events.get(1).getType());
    assertEquals(BundleEvent.STARTING, events.get(2).getType());
    assertEquals(BundleEvent.STARTED, events.get(3).getType());
    assertEquals(BundleEvent.STOPPING, events.get(4).getType());
    assertEquals(BundleEvent.STOPPED, events.get(5).getType());
    assertEquals(BundleEvent.UNRESOLVED, events.get(6).getType());
    assertEquals(BundleEvent.UPDATED, events.get(7).getType());
    assertEquals(BundleEvent.UNRESOLVED, events.get(8).getType());
    assertEquals(BundleEvent.UNINSTALLED, events.get(9).getType());
  }
  @Test
  public void testStopedBundleContext() throws Exception {
    Bundle bundle = installBundle(getBundleArchiveA());
    try {
      bundle.start();
      BundleContext bundleContext = bundle.getBundleContext();
      assertNotNull(bundleContext);

      // The context should be illegal to use.
      bundle.stop();
      try {
        bundleContext.getProperty(getClass().getName());
        fail("Should not be here!");
      } catch (IllegalStateException t) {
        // expected
      }

      // The context should not become reusable after we restart the bundle
      bundle.start();
      try {
        bundleContext.getProperty(getClass().getName());
        fail("Should not be here!");
      } catch (IllegalStateException t) {
        // expected
      }
    } finally {
      bundle.uninstall();
    }
  }
 @Override
 public BundleInformation restartBundle(long bundleId) throws BundleException {
   Bundle bundle = getBundle(bundleId);
   bundle.stop();
   bundle.start();
   return new BundleInformation(bundle);
 }
  @Before
  public void setUp() throws BundleException, InterruptedException {
    String bundlePath =
        "mvn:org.ops4j.pax.web.samples/authentication/" + VersionUtil.getProjectVersion();
    installWarBundle = bundleContext.installBundle(bundlePath);

    installWarBundle.start();

    new WaitCondition("authentication - resolved bundle") {
      @Override
      protected boolean isFulfilled() throws Exception {
        return installWarBundle.getState() == Bundle.ACTIVE;
      }
    }.waitForCondition(); // CHECKSTYLE:SKIP

    installWarBundle.stop();

    new WaitCondition("authentication - resolved bundle") {
      @Override
      protected boolean isFulfilled() throws Exception {
        return installWarBundle.getState() == Bundle.RESOLVED;
      }
    }.waitForCondition(); // CHECKSTYLE:SKIP

    waitForServer("http://127.0.0.1:8282/");
  }
  @Test
  public void testServletDeRegistration()
      throws BundleException, ServletException, NamespaceException {

    if (installWarBundle != null) {
      installWarBundle.stop();
    }
  }
  @Test
  public void testServletDeRegistration()
      throws BundleException, ServletException, NamespaceException {

    if (installWarBundle != null) {
      installWarBundle.stop();
    }
    // TODO check that deregistration worked
  }
 @Test
 public void testDependentBundleLifecyclePermutation3Test() throws Exception {
   Bundle restServiceProviderBundle =
       getBundleForSymbolicName("org.developers.blog.osgi.webservice.jaxrs-provider");
   restServiceProviderBundle.stop();
   assertFalse(checkRestServiceRunning(false));
   restServiceProviderBundle.start();
   assertTrue(checkRestServiceRunning(true));
 }
 @Test
 public void testDependentBundleLifecyclePermutation2Test() throws Exception {
   Bundle paxWebBundle = getBundleForSymbolicName("org.ops4j.pax.web.pax-web-jetty-bundle");
   paxWebBundle.stop();
   assertFalse(checkRestServiceRunning(false));
   paxWebBundle.start();
   assertTrue(waitForBundle(paxWebBundle));
   assertTrue(checkRestServiceRunning(true));
 }
  @Test
  public void testDataSourceInjection() throws Exception {

    bundle.start();
    Assert.assertEquals("H2", ResourceInjectionActivator.productName);

    bundle.stop();
    Assert.assertNull(ResourceInjectionActivator.productName);
  }
예제 #22
0
  @Test
  public void test_dynamic_binding_and_unbinding() throws BundleException {
    final String pid = "test_dynamic_binding_and_unbinding";

    // create and statically bind the configuration
    configure(pid);
    final Configuration config = getConfiguration(pid);
    TestCase.assertEquals(pid, config.getPid());
    TestCase.assertNull(config.getBundleLocation());

    // dynamically bind the configuration
    bundle = installBundle(pid);
    final String location = bundle.getLocation();
    bundle.start();
    delay();
    TestCase.assertEquals(location, config.getBundleLocation());

    // restart CM bundle
    final Bundle cmBundle = getCmBundle();
    cmBundle.stop();
    delay();
    cmBundle.start();

    // assert configuration still bound
    final Configuration configAfterRestart = getConfiguration(pid);
    TestCase.assertEquals(pid, configAfterRestart.getPid());
    TestCase.assertEquals(location, configAfterRestart.getBundleLocation());

    // stop bundle (configuration remains bound !!)
    bundle.stop();
    delay();
    TestCase.assertEquals(location, configAfterRestart.getBundleLocation());

    // restart CM bundle
    cmBundle.stop();
    delay();
    cmBundle.start();

    // assert configuration still bound
    final Configuration configBoundAfterRestart = getConfiguration(pid);
    TestCase.assertEquals(pid, configBoundAfterRestart.getPid());
    TestCase.assertEquals(location, configBoundAfterRestart.getBundleLocation());
  }
  /**
   * Retrieves a reference to the Gibberish bundle, stops it and uninstalls it and then reinstalls
   * it in order to make sure that accounts are not reloaded once removed.
   *
   * @throws java.lang.Exception if something goes wrong while manipulating the bundles.
   */
  public void testAccountUninstallationPersistence() throws Exception {
    Bundle providerBundle = GibberishSlickFixture.providerBundle;

    providerBundle.stop();

    assertTrue(
        "Couldn't stop the protocol provider bundle. State was " + providerBundle.getState(),
        Bundle.ACTIVE != providerBundle.getState() && Bundle.STOPPING != providerBundle.getState());

    providerBundle.uninstall();

    assertEquals(
        "Couldn't stop the protocol provider bundle.",
        Bundle.UNINSTALLED,
        providerBundle.getState());

    // Now reinstall the bundle and restart the provider
    providerBundle = GibberishSlickFixture.bc.installBundle(providerBundle.getLocation());

    assertEquals(
        "Couldn't re-install protocol provider bundle.",
        Bundle.INSTALLED,
        providerBundle.getState());

    AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(
        GibberishSlickFixture.bc, providerBundle, "Gibberish");
    assertEquals(
        "Couldn't re-start protocol provider bundle.", Bundle.ACTIVE, providerBundle.getState());

    // verify that the provider is not reinstalled
    ServiceReference[] gibberishProviderRefs = null;
    try {
      gibberishProviderRefs =
          GibberishSlickFixture.bc.getServiceReferences(
              ProtocolProviderService.class.getName(),
              "(" + ProtocolProviderFactory.PROTOCOL + "=Gibberish)");
    } catch (InvalidSyntaxException ex) {
      fail("We apparently got our filter wrong " + ex.getMessage());
    }

    // make sure we didn't retrieve a service
    assertTrue(
        "A Gibberish Protocol Provider Service was still regged "
            + "as an osgi service after it was explicitly uninstalled",
        gibberishProviderRefs == null || gibberishProviderRefs.length == 0);

    // and a nasty hack at the end - delete the configuration file so that
    // we get a fresh start on next run.
    ServiceReference confReference =
        GibberishSlickFixture.bc.getServiceReference(ConfigurationService.class.getName());
    ConfigurationService configurationService =
        (ConfigurationService) GibberishSlickFixture.bc.getService(confReference);

    configurationService.purgeStoredConfiguration();
  }
예제 #24
0
 private void applyChanges(Map<Bundle, String> toUpdate) throws BundleException, IOException {
   List<Bundle> toStop = new ArrayList<Bundle>();
   toStop.addAll(toUpdate.keySet());
   while (!toStop.isEmpty()) {
     List<Bundle> bs = getBundlesToDestroy(toStop);
     for (Bundle bundle : bs) {
       String hostHeader = (String) bundle.getHeaders().get(Constants.FRAGMENT_HOST);
       if (hostHeader == null
           && (bundle.getState() == Bundle.ACTIVE || bundle.getState() == Bundle.STARTING)) {
         bundle.stop();
       }
       toStop.remove(bundle);
     }
   }
   Set<Bundle> toRefresh = new HashSet<Bundle>();
   Set<Bundle> toStart = new HashSet<Bundle>();
   for (Map.Entry<Bundle, String> e : toUpdate.entrySet()) {
     InputStream is = new URL(e.getValue()).openStream();
     try {
       Bundle bundle = e.getKey();
       bundle.update(is);
       toRefresh.add(bundle);
       toStart.add(bundle);
     } finally {
       is.close();
     }
   }
   findBundlesWithOptionalPackagesToRefresh(toRefresh);
   findBundlesWithFramentsToRefresh(toRefresh);
   if (!toRefresh.isEmpty()) {
     final CountDownLatch l = new CountDownLatch(1);
     FrameworkListener listener =
         new FrameworkListener() {
           @Override
           public void frameworkEvent(FrameworkEvent event) {
             l.countDown();
           }
         };
     FrameworkWiring wiring =
         (FrameworkWiring) bundleContext.getBundle(0).adapt(FrameworkWiring.class);
     wiring.refreshBundles((Collection<Bundle>) toRefresh, new FrameworkListener[] {listener});
     try {
       l.await();
     } catch (InterruptedException e) {
       throw new PatchException("Bundle refresh interrupted", e);
     }
   }
   for (Bundle bundle : toStart) {
     String hostHeader = (String) bundle.getHeaders().get(Constants.FRAGMENT_HOST);
     if (hostHeader == null) {
       bundle.start();
     }
   }
 }
예제 #25
0
 /**
  * Locally stop a bundle.
  *
  * @param symbolicName the bundle symbolic name.
  * @param version the bundle version.
  * @throws BundleException in case of stop failure.
  */
 public void stopBundle(String symbolicName, String version) throws BundleException {
   Bundle[] bundles = getBundleContext().getBundles();
   if (bundles != null) {
     for (Bundle bundle : bundles) {
       if (bundle.getSymbolicName().equals(symbolicName)
           && bundle.getVersion().toString().equals(version)) {
         bundle.stop();
       }
     }
   }
 }
예제 #26
0
  @MsgbusMethod
  public void stopBundle(Request req, Response resp) {
    int bundleId = req.getInteger("bundle_id");
    Bundle bundle = bc.getBundle(bundleId);
    if (bundle == null) throw new IllegalArgumentException("bundle not found: " + bundleId);

    try {
      bundle.stop();
    } catch (BundleException e) {
      throw new IllegalStateException(e.getMessage());
    }
  }
  @Test
  public void testGetReference() throws Exception {
    Bundle bundle = installBundle(getBundleArchiveA());
    try {
      bundle.start();
      BundleContext bundleContext = bundle.getBundleContext();
      assertNotNull(bundleContext);

      ServiceRegistration registration =
          bundleContext.registerService(BundleContext.class.getName(), bundleContext, null);
      assertNotNull(registration);

      ServiceReference reference = registration.getReference();
      assertNotNull(reference);

      ServiceReference reference2 =
          bundleContext.getServiceReference(BundleContext.class.getName());
      assertEquals(reference, reference2);

      Object object = bundleContext.getService(reference);
      assertEquals(bundleContext, object);

      reference2 = registration.getReference();
      assertEquals(reference, reference2);

      registration.unregister();
      try {
        registration.getReference();
        fail("Should not be here!");
      } catch (IllegalStateException t) {
        // expected
      }

      ServiceRegistration registration2 =
          bundleContext.registerService(BundleContext.class.getName(), bundleContext, null);
      assertNotNull(registration);
      assertNotSame(registration, registration2);

      reference2 = registration2.getReference();
      assertNotNull(reference2);
      assertNotSame(reference, reference2);

      bundle.stop();
      try {
        registration2.getReference();
        fail("Should not be here!");
      } catch (IllegalStateException t) {
        // expected
      }
    } finally {
      bundle.uninstall();
    }
  }
예제 #28
0
  @Test
  public void test_static_binding_and_unbinding() throws BundleException {
    final String pid = "test_static_binding_and_unbinding";
    final String location = bundleContext.getBundle().getLocation();

    // create and statically bind the configuration
    configure(pid);
    final Configuration config = getConfiguration(pid);
    TestCase.assertEquals(pid, config.getPid());
    TestCase.assertNull(config.getBundleLocation());

    // bind the configuration
    config.setBundleLocation(location);
    TestCase.assertEquals(location, config.getBundleLocation());

    // restart CM bundle
    final Bundle cmBundle = getCmBundle();
    cmBundle.stop();
    delay();
    cmBundle.start();

    // assert configuration still bound
    final Configuration configAfterRestart = getConfiguration(pid);
    TestCase.assertEquals(pid, configAfterRestart.getPid());
    TestCase.assertEquals(location, configAfterRestart.getBundleLocation());

    // unbind the configuration
    configAfterRestart.setBundleLocation(null);
    TestCase.assertNull(configAfterRestart.getBundleLocation());

    // restart CM bundle
    cmBundle.stop();
    delay();
    cmBundle.start();

    // assert configuration unbound
    final Configuration configUnboundAfterRestart = getConfiguration(pid);
    TestCase.assertEquals(pid, configUnboundAfterRestart.getPid());
    TestCase.assertNull(configUnboundAfterRestart.getBundleLocation());
  }
  public IResponse handlePut(
      String[] queryPath, Properties params, Properties uploads, InputStream content) {
    IResponse response;

    if (queryPath.length == 0) {
      response =
          new DefaultResponse(
              IResponse.HTTP_BADREQUEST, IResponse.MIME_PLAINTEXT, "Invalid request");
    } else {
      try {
        Bundle bundle = findBundle(queryPath[0]);
        try {
          if (queryPath.length == 1 && content != null) {
            // Update from supplied content
            bundle.update(content);
            response = listBundles();
          } else if (queryPath.length == 2 && "update".equals(queryPath[1])) {
            // Update from persistent location
            bundle.update();
            response = listBundles();
          } else if (queryPath.length == 2 && "start".equals(queryPath[1])) {
            bundle.start();
            response = listBundles();
          } else if (queryPath.length == 2 && "stop".equals(queryPath[1])) {
            bundle.stop();
            response = listBundles();
          } else {
            response =
                new DefaultResponse(
                    IResponse.HTTP_BADREQUEST, IResponse.MIME_PLAINTEXT, "Invalid request");
          }
        } catch (BundleException e) {
          response = DefaultResponse.createInternalError(e);
          response =
              new DefaultResponse(
                  IResponse.HTTP_INTERNALERROR, IResponse.MIME_PLAINTEXT, e.getMessage());
        }
      } catch (NumberFormatException e) {
        response =
            new DefaultResponse(
                IResponse.HTTP_BADREQUEST, IResponse.MIME_PLAINTEXT, e.getMessage());
      } catch (IllegalArgumentException e) {
        response =
            new DefaultResponse(
                IResponse.HTTP_NOTFOUND,
                IResponse.MIME_PLAINTEXT,
                "No such bundle " + queryPath[0]);
      }
    }

    return response;
  }
 @Ignore
 @Test
 public void massiveDynamicReadLoadTest() throws Exception {
   for (int i = 0; i < 10; i++) {
     resourceReadTest();
     Bundle bundle = getBundleForSymbolicName("RestProviderTestBundle");
     assertEquals(Bundle.ACTIVE, waitForBundle(bundle));
     bundle.stop();
     assertFalse(checkRestServiceRunning(false));
     bundle.start();
     logger.info("Test " + i + ": finished");
   }
 }