aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2013-08-12 14:35:11 (EDT)
committerJohn Ross2013-08-12 14:35:11 (EDT)
commit3a24f0d40bd23aba9df2016c39ea68d89d218725 (patch)
treea1530538e8647642d007e9bc9342bc5257ce08ec
parent1630d76cda1dba192565363cbcd8f05372184ed9 (diff)
downloadrt.equinox.framework-3a24f0d40bd23aba9df2016c39ea68d89d218725.zip
rt.equinox.framework-3a24f0d40bd23aba9df2016c39ea68d89d218725.tar.gz
rt.equinox.framework-3a24f0d40bd23aba9df2016c39ea68d89d218725.tar.bz2
Bug 413723 - testPeriodicPersistence is failing regularly on linux
Fixed issue where it was possible for equinox instances to be orphaned while still running. The test now simply waits for a reasonable period of time rather than using a retry loop.
-rwxr-xr-xbundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PersistedBundleTests.java26
1 files changed, 9 insertions, 17 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PersistedBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PersistedBundleTests.java
index 887b2ed..85e518d 100755
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PersistedBundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PersistedBundleTests.java
@@ -18,7 +18,8 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.osgi.launch.Equinox;
import org.eclipse.osgi.tests.OSGiTestsActivator;
-import org.osgi.framework.*;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
/*
* The framework must persist data according to the value of the
@@ -65,7 +66,7 @@ public class PersistedBundleTests extends AbstractBundleTests {
private static final String IMMEDIATE_PERSISTENCE = "0";
private static final String NO_PERSISTENCE = "-1";
- private static final String PERIODIC_PERSISTENCE = "5000";
+ private static final String PERIODIC_PERSISTENCE = "4000";
protected void setUp() throws Exception {
super.setUp();
@@ -163,23 +164,14 @@ public class PersistedBundleTests extends AbstractBundleTests {
// happen before the first period elapses.
assertNull("Bundle exists", equinox2.getBundleContext().getBundle(getName()));
stopQuietly(equinox2);
- // Ensure the first period elapses so the bundle has time to be
- // persisted.
- Thread.sleep(Long.valueOf(PERIODIC_PERSISTENCE));
- Bundle b = null;
- // Provide a buffer, if needed, after the first period elapses
- // to ensure the first instance has time to persist the bundle.
- for (int i = 0; i < 5; i++) {
- equinox2 = new Equinox(configuration);
- initAndStart(equinox2);
- b = equinox2.getBundleContext().getBundle(getName());
- if (b != null)
- break;
- Thread.sleep(1000);
- }
+ // Ensure the first instance is given a reasonable amount of
+ // time to persist the bundle.
+ Thread.sleep(Long.valueOf(PERIODIC_PERSISTENCE) + 2000);
+ equinox2 = new Equinox(configuration);
+ initAndStart(equinox2);
// The persisted bundle should now be visible to the second
// equinox instance.
- assertNotNull("Bundle does not exist", b);
+ assertNotNull("Bundle does not exist", equinox2.getBundleContext().getBundle(getName()));
} finally {
stopQuietly(equinox2);
}