/** * Copied from CamelBlueprintHelper since there it is also a protected method. * * @param name * @param version * @param descriptors * @return * @throws FileNotFoundException * @throws MalformedURLException */ protected static TinyBundle createTestBundle(String name, String version, String descriptors) throws FileNotFoundException, MalformedURLException { TinyBundle bundle = TinyBundles.newBundle(); for (URL url : getBlueprintDescriptors(descriptors)) { LOG.info("Using Blueprint XML file: " + url.getFile()); bundle.add("OSGI-INF/blueprint/blueprint-" + url.getFile().replace("/", "-"), url); } bundle .set("Manifest-Version", "2") .set("Bundle-ManifestVersion", "2") .set("Bundle-SymbolicName", name) .set("Bundle-Version", version); return bundle; }
protected Bundle installBundle( final String pid, final Class<?> activatorClass, final String location) throws BundleException { final String activatorClassName = activatorClass.getName(); final InputStream bundleStream = new MyTinyBundle() .prepare( TinyBundles.withBnd() .set(Constants.BUNDLE_SYMBOLICNAME, activatorClassName) .set(Constants.BUNDLE_VERSION, "0.0.11") .set(Constants.IMPORT_PACKAGE, "org.apache.felix.cm.integration.helper") .set(Constants.BUNDLE_ACTIVATOR, activatorClassName) .set(BaseTestActivator.HEADER_PID, pid)) .build(TinyBundles.asStream()); try { return bundleContext.installBundle(location, bundleStream); } finally { try { bundleStream.close(); } catch (IOException ioe) { } } }