protected BundleContext startFramework(File bundleInfo, File[] additionalBundle) { try { File simpleConfiguratorBundle = getLocation("org.eclipse.equinox.simpleconfigurator"); File osgiBundleLoc = getLocation("org.eclipse.osgi"); // for test purposes create an install.area and configuration.area located in the local bundle // data area. File installarea = TestActivator.context.getDataFile(getName() + "/eclipse"); File configarea = new File(installarea, "configuration"); URL osgiBundle = osgiBundleLoc.toURI().toURL(); Map frameworkProperties = new HashMap(); // note that any properties you do not want to be inherited from the hosting Equinox will need // to be nulled out. Otherwise you will pick them up from the hosting env. frameworkProperties.put("osgi.framework", null); frameworkProperties.put("osgi.install.area", installarea.toURL().toExternalForm()); frameworkProperties.put("osgi.configuration.area", configarea.toURL().toExternalForm()); StringBuffer osgiBundles = new StringBuffer(); for (int i = 0; additionalBundle != null && i < additionalBundle.length; i++) { osgiBundles .append("reference:") .append(additionalBundle[i].toURL().toExternalForm()) .append(","); } osgiBundles .append("reference:") .append(simpleConfiguratorBundle.toURL().toExternalForm()) .append("@1:start"); frameworkProperties.put("osgi.bundles", osgiBundles.toString()); frameworkProperties.put( "org.eclipse.equinox.simpleconfigurator.configUrl", bundleInfo.toURL().toExternalForm()); frameworkProperties.put("osgi.dev", "bin/"); equinox = new EmbeddedEquinox(frameworkProperties, new String[] {}, new URL[] {osgiBundle}); return equinox.startFramework(); } catch (MalformedURLException e) { return null; } }
protected void tearDown() throws Exception { super.tearDown(); if (equinox != null) equinox.shutdown(); }