public void testURLHandlersWithClassLoaderIsolation() throws Exception
{
DelegatingClassLoader cl1 = new DelegatingClassLoader(this.getClass().getClassLoader());
DelegatingClassLoader cl2 = new DelegatingClassLoader(this.getClass().getClassLoader());
Framework f = createFramework();
f.init();
f.start();
String mf = "Bundle-SymbolicName: url.test\n"
+ "Bundle-Version: 1.0.0\n"
+ "Bundle-ManifestVersion: 2\n"
+ "Import-Package: org.osgi.framework\n"
+ "Manifest-Version: 1.0\n"
+ Constants.BUNDLE_ACTIVATOR + ": " + TestURLHandlersActivator.class.getName();
File bundleFile = createBundle(mf, TestURLHandlersActivator.class);
final Bundle bundle = f.getBundleContext().installBundle(bundleFile.toURI().toString());
bundle.start();
Class clazz1 = cl1.loadClass(URLHandlersTest.class.getName());
clazz1.getMethod("testURLHandlers").invoke(clazz1.newInstance());
bundle.stop();
bundle.start();
Class clazz2 = cl2.loadClass(URLHandlersTest.class.getName());
clazz2.getMethod("testURLHandlers").invoke(clazz2.newInstance());
bundle.stop();
bundle.start();
f.stop();
}