X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.osgi.boot%2Fext%2Ftest%2Forg%2Fargeo%2Fosgi%2Fboot%2FOsgiBootRuntimeTest.java;h=b396c451a200e604e8c4dadc8df494c53e7399a6;hb=86e5f79860a8b3013b40a36c1f06c828d52f5249;hp=7596c56a3f87f006ab828258cbfd48d232cf9d6c;hpb=807ccba419e96a18f7af67a66f986ae4c91c03d9;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.osgi.boot/ext/test/org/argeo/osgi/boot/OsgiBootRuntimeTest.java b/org.argeo.osgi.boot/ext/test/org/argeo/osgi/boot/OsgiBootRuntimeTest.java index 7596c56a3..b396c451a 100644 --- a/org.argeo.osgi.boot/ext/test/org/argeo/osgi/boot/OsgiBootRuntimeTest.java +++ b/org.argeo.osgi.boot/ext/test/org/argeo/osgi/boot/OsgiBootRuntimeTest.java @@ -26,7 +26,6 @@ import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; /** Starts an Equinox runtime and provision it with OSGi boot. */ -@SuppressWarnings({ "unchecked", "rawtypes", "deprecation", "restriction" }) public class OsgiBootRuntimeTest extends TestCase { protected OsgiBoot osgiBoot = null; private boolean osgiRuntimeAlreadyRunning = false; @@ -39,25 +38,26 @@ public class OsgiBootRuntimeTest extends TestCase { } osgiBoot.installUrls(osgiBoot.getBundlesUrls(OsgiBoot.DEFAULT_BASE_URL, OsgiBootNoRuntimeTest.BUNDLES)); - Map map = new TreeMap(osgiBoot.getBundlesBySymbolicName()); - for (Iterator keys = map.keySet().iterator(); keys.hasNext();) { - Object key = keys.next(); - Bundle bundle = (Bundle) map.get(key); + Map map = new TreeMap( + osgiBoot.getBundlesBySymbolicName()); + for (Iterator keys = map.keySet().iterator(); keys.hasNext();) { + String key = keys.next(); + Bundle bundle = map.get(key); System.out.println(key + " : " + bundle.getLocation()); } assertEquals(4, map.size()); - Iterator keys = map.keySet().iterator(); + Iterator keys = map.keySet().iterator(); assertEquals("org.argeo.osgi.boot.test.bundle1", keys.next()); assertEquals("org.argeo.osgi.boot.test.bundle2", keys.next()); assertEquals("org.argeo.osgi.boot.test.bundle3", keys.next()); assertEquals("org.eclipse.osgi", keys.next()); - osgiBoot.startBundles("org.argeo.osgi.boot.test.bundle2"); + // osgiBoot.startBundles("org.argeo.osgi.boot.test.bundle2"); long begin = System.currentTimeMillis(); while (System.currentTimeMillis() - begin < 10000) { - Map mapBundles = osgiBoot.getBundlesBySymbolicName(); - Bundle bundle = (Bundle) mapBundles - .get("org.argeo.osgi.boot.test.bundle2"); + Map mapBundles = osgiBoot + .getBundlesBySymbolicName(); + Bundle bundle = mapBundles.get("org.argeo.osgi.boot.test.bundle2"); if (bundle.getState() == Bundle.ACTIVE) { System.out.println("Bundle " + bundle + " started."); return; @@ -69,6 +69,11 @@ public class OsgiBootRuntimeTest extends TestCase { protected BundleContext startRuntime() throws Exception { String[] args = { "-console", "-clean" }; BundleContext bundleContext = EclipseStarter.startup(args, null); + +// ServiceLoader ff = ServiceLoader.load(FrameworkFactory.class); +// Map config = new HashMap(); +// Framework fwk = ff.iterator().next().newFramework(config); +// fwk.start(); return bundleContext; }