diff options
author | Thomas Watson | 2011-07-08 21:20:07 +0000 |
---|---|---|
committer | Thomas Watson | 2011-07-08 21:20:07 +0000 |
commit | 9cff86cd95fd7d47383fea06157a0a2663b0c386 (patch) | |
tree | e23dee76011341731c701a217f321fe5efa7b63e /bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java | |
parent | 85308fbb7c4e7a87445e79221502e1cec97b62ff (diff) | |
download | rt.equinox.framework-9cff86cd95fd7d47383fea06157a0a2663b0c386.tar.gz rt.equinox.framework-9cff86cd95fd7d47383fea06157a0a2663b0c386.tar.xz rt.equinox.framework-9cff86cd95fd7d47383fea06157a0a2663b0c386.zip |
Bug 351083 - cannot install by reference WTP project to a osgi based web container.
Diffstat (limited to 'bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java')
-rw-r--r-- | bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java index 06fcfb686..baf50b409 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java @@ -1328,6 +1328,53 @@ public class SystemBundleTests extends AbstractBundleTests { assertEquals("Wrong state for SystemBundle", Bundle.RESOLVED, equinox.getState()); //$NON-NLS-1$ } + public void testBug351083DevClassPath() throws InvalidSyntaxException { + // create/start/stop/start/stop test + BundleInstaller testBundleInstaller = new BundleInstaller("test_files/devCPTests", OSGiTestsActivator.getContext()); + + try { + File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$ + Properties configuration = new Properties(); + configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath()); + configuration.put("osgi.dev", "../devCP"); + Equinox equinox = new Equinox(configuration); + try { + equinox.start(); + } catch (BundleException e) { + fail("Unexpected exception in init()", e); //$NON-NLS-1$ + } + BundleContext systemContext = equinox.getBundleContext(); + assertNotNull("System context is null", systemContext); //$NON-NLS-1$ + // try installing a bundle before starting + Bundle tb1 = null; + try { + tb1 = systemContext.installBundle(testBundleInstaller.getBundleLocation("tb1")); //$NON-NLS-1$ + } catch (BundleException e1) { + fail("failed to install a bundle", e1); //$NON-NLS-1$ + } + URL resource = tb1.getResource("tb1/resource.txt"); + assertNotNull("Resource is null", resource); + + try { + equinox.stop(); + } catch (BundleException e) { + fail("Unexpected erorr stopping framework", e); //$NON-NLS-1$ + } + try { + equinox.waitForStop(10000); + } catch (InterruptedException e) { + fail("Unexpected interrupted exception", e); //$NON-NLS-1$ + } + assertEquals("Wrong state for SystemBundle", Bundle.RESOLVED, equinox.getState()); //$NON-NLS-1$ + } finally { + try { + testBundleInstaller.shutdown(); + } catch (BundleException e) { + fail("Could not shutdown installer", e); + } + } + } + private static File[] createBundles(File outputDir, int bundleCount) throws IOException { outputDir.mkdirs(); |