Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusan Franklin2009-09-30 17:08:57 +0000
committerSusan Franklin2009-09-30 17:08:57 +0000
commitbea2c4cd5124488fddabec0d9aeb7fb14881bc48 (patch)
tree15f4267a0651b9bc3a3d2853cb382b5b23a10e3f
parent4b83c9a56d5ec55cda314029764b256ba8e13c12 (diff)
downloadrt.equinox.p2-bea2c4cd5124488fddabec0d9aeb7fb14881bc48.tar.gz
rt.equinox.p2-bea2c4cd5124488fddabec0d9aeb7fb14881bc48.tar.xz
rt.equinox.p2-bea2c4cd5124488fddabec0d9aeb7fb14881bc48.zip
Bug 290931 - [ui] InstallationHistoryPageTest fails in N20090929
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallationHistoryPageTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementContentProvider.java6
2 files changed, 13 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallationHistoryPageTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallationHistoryPageTest.java
index 10d356d8f..b4062b6e7 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallationHistoryPageTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallationHistoryPageTest.java
@@ -50,7 +50,7 @@ public class InstallationHistoryPageTest extends AbstractProvisioningUITest {
/**
* Tests the dialog
*/
- public void testDialog() {
+ public void testDialogBackgroundFetch() {
TestDialog dialog = new TestDialog();
dialog.setBlockOnOpen(false);
dialog.open();
@@ -62,6 +62,9 @@ public class InstallationHistoryPageTest extends AbstractProvisioningUITest {
Object input = viewer.getInput();
Field jobField = ProvElementContentProvider.class.getDeclaredField("fetchJob");
jobField.setAccessible(true);
+ Field jobFamily = ProvElementContentProvider.class.getDeclaredField("fetchFamily");
+ jobFamily.setAccessible(true);
+
jobs = 0;
done = 0;
// hammer the elements repetitively to start multiple fast running fetch jobs
@@ -80,10 +83,11 @@ public class InstallationHistoryPageTest extends AbstractProvisioningUITest {
}
}
});
- if (i == 4 && job != null)
- job.join();
}
}
+ // We need to wait for all the fetch jobs to finish and then verify that they did
+ Object family = jobFamily.get(provider);
+ Job.getJobManager().join(family, null);
assertTrue("No fetch occurred", jobs > 0);
assertEquals("Not all jobs finished as expected", jobs, done);
} catch (Exception e) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementContentProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementContentProvider.java
index df5eb2f31..9fe429748 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementContentProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementContentProvider.java
@@ -31,6 +31,8 @@ public class ProvElementContentProvider implements ITreeContentProvider {
private Viewer viewer;
private Job fetchJob;
+ // family is used by test cases
+ Object fetchFamily = new Object();
/**
*
@@ -85,6 +87,10 @@ public class ProvElementContentProvider implements ITreeContentProvider {
return Status.OK_STATUS;
}
+ public boolean belongsTo(Object family) {
+ return family == fetchFamily;
+ }
+
};
fetchJob.schedule();
return new Object[] {pending};

Back to the top