/**
  * Undeploys a contribution from a given bundle.
  *
  * <p>The path will be relative to the bundle root. Example: <code>
  * undeployContrib("org.nuxeo.ecm.core", "OSGI-INF/CoreExtensions.xml")
  * </code>
  *
  * @param name the bundle
  * @param contrib the contribution
  */
 @Override
 public void undeployContrib(String name, String contrib) throws Exception {
   RuntimeContext context = runtime.getContext(name);
   if (context == null) {
     context = runtime.getContext();
   }
   context.undeploy(contrib);
 }
 /**
  * Deploys a whole OSGI bundle.
  *
  * <p>The lookup is first done on symbolic name, as set in <code>MANIFEST.MF</code> and then falls
  * back to the bundle url (e.g., <code>nuxeo-platform-search-api</code>) for backwards
  * compatibility.
  *
  * @param name the symbolic name
  */
 @Override
 public void deployBundle(String name) throws Exception {
   // install only if not yet installed
   BundleImpl bundle = bundleLoader.getOSGi().getRegistry().getBundle(name);
   if (bundle == null) {
     BundleFile bundleFile = lookupBundle(name);
     bundleLoader.loadBundle(bundleFile);
     bundleLoader.installBundle(bundleFile);
     bundle = bundleLoader.getOSGi().getRegistry().getBundle(name);
   }
   if (runtime.getContext(bundle) == null) {
     runtime.createContext(bundle);
   }
 }
 /**
  * Deploys a contribution from a given bundle.
  *
  * <p>The path will be relative to the bundle root. Example: <code>
  * deployContrib("org.nuxeo.ecm.core", "OSGI-INF/CoreExtensions.xml")
  * </code>
  *
  * <p>For compatibility reasons the name of the bundle may be a jar name, but this use is
  * discouraged and deprecated.
  *
  * @param name the name of the bundle to peek the contrib in
  * @param contrib the path to contrib in the bundle.
  */
 @Override
 public void deployContrib(String name, String contrib) throws Exception {
   RuntimeContext context = runtime.getContext(name);
   if (context == null) {
     context = runtime.getContext();
     BundleFile file = lookupBundle(name);
     URL location = file.getEntry(contrib);
     if (location == null) {
       throw new AssertionError("Cannot locate " + contrib + " in " + name);
     }
     context.deploy(location);
     return;
   }
   context.deploy(contrib);
 }
 protected void deployContrib(URL url) {
   assertEquals(runtime, Framework.getRuntime());
   log.info("Deploying contribution from " + url.toString());
   try {
     runtime.getContext().deploy(url);
   } catch (Exception e) {
     fail("Failed to deploy contrib " + url.toString());
   }
 }
 /** @deprecated use {@link #undeployContrib(String, String)} instead */
 @Override
 @Deprecated
 public void undeployContrib(String contrib) {
   URL url = getResource(contrib);
   assertNotNull("Test contribution not found: " + contrib, url);
   try {
     runtime.getContext().undeploy(url);
   } catch (Exception e) {
     fail("Failed to undeploy contrib " + url.toString());
   }
 }
 @Override
 public RuntimeContext getContext() {
   return runtime.getContext();
 }
 @Override
 public Properties getProperties() {
   return runtime.getProperties();
 }