Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-11-14 20:54:32 +0000
committerJean Michel-Lemieux2003-11-14 20:54:32 +0000
commitfb692d44d9269b46856bd2ade32a2bf72bf34cdb (patch)
treecfa3da11b5cf6637dc3b5028c42eece3f5527394 /tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team
parentb71773e8cbc34fe6d0691438c3cdd505cd99fecf (diff)
downloadeclipse.platform.team-fb692d44d9269b46856bd2ade32a2bf72bf34cdb.tar.gz
eclipse.platform.team-fb692d44d9269b46856bd2ade32a2bf72bf34cdb.tar.xz
eclipse.platform.team-fb692d44d9269b46856bd2ade32a2bf72bf34cdb.zip
Updated for new event handlers.
Diffstat (limited to 'tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team')
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java34
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java9
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java27
4 files changed, 29 insertions, 43 deletions
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
index 0609b1abf..f152795ab 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
@@ -15,8 +15,9 @@ import java.util.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.*;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.tests.harness.EclipseWorkspaceTest;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.*;
@@ -30,6 +31,7 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.SyncFileChangeListener;
import org.eclipse.team.internal.ccvs.ui.operations.*;
+import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
import org.eclipse.team.tests.ccvs.ui.HeadlessCVSRunnableContext;
public class EclipseTest extends EclipseWorkspaceTest {
@@ -707,21 +709,29 @@ public class EclipseTest extends EclipseWorkspaceTest {
}
}
- public void waitForIgnoreHandlerCompletion() {
- Job job = SyncFileChangeListener.getDeferredHandler().getEventHandlerJob();
- int count = 0;
- while (job.getState() != Job.NONE) {
+ public static void waitForJobCompletion(Job job) {
+ // process UI events first, give the main thread a chance
+ // to handle any syncExecs or asyncExecs posted as a result
+ // of the event processing thread.
+ while (Display.getCurrent().readAndDispatch()) {};
+
+ // wait for the event handler to process changes.
+ while(job.getState() != Job.NONE) {
+ while (Display.getCurrent().readAndDispatch()) {};
try {
- Thread.sleep(100);
- count++;
+ Thread.sleep(10);
} catch (InterruptedException e) {
- // ignore and keep going;
- }
- // Only wait 10 seconds at most
- if (count == 100) {
- fail("Ignore handling job does not seem to be finishing");
}
}
+ while (Display.getCurrent().readAndDispatch()) {};
+ }
+
+ public static void waitForIgnoreFileHandling() {
+ waitForJobCompletion(SyncFileChangeListener.getDeferredHandler().getEventHandlerJob());
+ }
+
+ public static void waitForSubscriberInputHandling(SubscriberInput input) {
+ waitForJobCompletion(input.getEventHandler().getEventHandlerJob());
}
protected static void executeHeadless(CVSOperation op) throws CVSException {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java
index 3f97a794e..69afa2934 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java
@@ -299,7 +299,7 @@ public class EclipseSynchronizerTest extends EclipseTest {
// ignore list
IResource cvsIgnore = project.getFile(".cvsignore");
cvsIgnore.delete(true, null);
- waitForIgnoreHandlerCompletion();
+ waitForIgnoreFileHandling();
assertIsIgnored(project.getFile("a.txt"), false);
assertIsIgnored(project.getFile("c.java"), false);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java
index 1ae463ede..fc73b503a 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java
@@ -171,7 +171,7 @@ public class IsModifiedTests extends EclipseTest {
resourceList.add(new Path(string));
}
}
- waitForIgnoreHandlerCompletion();
+ waitForIgnoreFileHandling();
rootFolder.accept(new ICVSResourceVisitor() {
public void visitFile(ICVSFile file) throws CVSException {
assertModificationState(file);
@@ -298,7 +298,6 @@ public class IsModifiedTests extends EclipseTest {
addedResources = buildResources(project, new String[] {"ignored.txt"}, false);
assertModificationState(project, new String[] {".", "ignored.txt"}, true);
project.getFile(".cvsignore").create(new ByteArrayInputStream("ignored.txt".getBytes()), false, DEFAULT_MONITOR);
- waitForIgnoreHandlerCompletion();
assertModificationState(project, new String[] {".", ".cvsignore"}, true);
getProvider(project).add(new IResource[] {project.getFile(".cvsignore")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
assertModificationState(project, new String[] {".", ".cvsignore"}, true);
@@ -306,13 +305,11 @@ public class IsModifiedTests extends EclipseTest {
assertModificationState(project, null, true);
// delete the .cvsignore to see the modification come back
project.getFile(".cvsignore").delete(false, DEFAULT_MONITOR);
- waitForIgnoreHandlerCompletion();
assertModificationState(project, new String[] {".", "ignored.txt", ".cvsignore"}, true);
commitResources(project, new String[] {".cvsignore"});
assertModificationState(project, new String[] {".", "ignored.txt"}, true);
// re-add the ignore and then delete the ignored
project.getFile(".cvsignore").create(new ByteArrayInputStream("ignored.txt".getBytes()), false, DEFAULT_MONITOR);
- waitForIgnoreHandlerCompletion();
getProvider(project).add(new IResource[] {project.getFile(".cvsignore")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
assertModificationState(project, new String[] {".", ".cvsignore"}, true);
commitResources(project, new String[] {".cvsignore"});
@@ -402,7 +399,6 @@ public class IsModifiedTests extends EclipseTest {
assertModificationState(project, new String[] {".", "folder1/", "folder1/ignored/", "folder1/ignored/file.txt"}, true);
// ignore the folder
project.getFile("folder1/.cvsignore").create(new ByteArrayInputStream("ignored".getBytes()), false, DEFAULT_MONITOR);
- waitForIgnoreHandlerCompletion();
assertModificationState(project, new String[] {".", "folder1/", "folder1/.cvsignore"}, true);
getProvider(project).add(new IResource[] {project.getFile("folder1/.cvsignore")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
assertModificationState(project, new String[] {".", "folder1/", "folder1/.cvsignore"}, true);
@@ -415,7 +411,6 @@ public class IsModifiedTests extends EclipseTest {
assertModificationState(project, new String[] {".", "folder1/", "folder1/ignored/", "folder1/ignored/file.txt"}, true);
// re-add the .cvsignore and then delete the ignored
project.getFile("folder1/.cvsignore").create(new ByteArrayInputStream("ignored".getBytes()), false, DEFAULT_MONITOR);
- waitForIgnoreHandlerCompletion();
assertModificationState(project, new String[] {".", "folder1/", "folder1/.cvsignore"}, true);
getProvider(project).add(new IResource[] {project.getFile("folder1/.cvsignore")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
commitResources(project, new String[] {"folder1/.cvsignore"});
@@ -550,13 +545,13 @@ public class IsModifiedTests extends EclipseTest {
project.getFile(".cvsignore").create(new ByteArrayInputStream("ignored".getBytes()), false, DEFAULT_MONITOR);
getProvider(project).add(new IResource[] {project.getFile(".cvsignore")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
commitProject(project);
+ assertModificationState(project, null, true);
project.getFolder("ignored").create(false, true, DEFAULT_MONITOR);
assertModificationState(project, null, true);
// Checkout a copy and add the file to ensure it is ignored
// Check the project out under a different name
IProject copy = checkoutCopy(project, "-copy");
- waitForIgnoreHandlerCompletion();
assertModificationState(copy, null, true);
copy.getFolder("ignored").create(false, true, DEFAULT_MONITOR);
assertModificationState(copy, null, true);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java
index cf8112e9e..d1c9006af 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java
@@ -14,7 +14,6 @@ import junit.framework.AssertionFailedError;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.SyncInfo;
@@ -24,6 +23,7 @@ import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant;
import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
import org.eclipse.team.internal.ui.synchronize.sets.SyncSet;
+import org.eclipse.team.tests.ccvs.core.EclipseTest;
import org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
@@ -37,25 +37,6 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage(null);
}
- public void waitForEventNotification(SubscriberInput input) {
- // process UI events first, give the main thread a chance
- // to handle any syncExecs or asyncExecs posted as a result
- // of the event processing thread.
- while (Display.getCurrent().readAndDispatch()) {};
-
- // wait for the event handler to process changes.
- Job job = input.getEventHandler().getEventHandlerJob();
- while(job.getState() != Job.NONE) {
- while (Display.getCurrent().readAndDispatch()) {};
- try {
- Thread.sleep(50);
- } catch (InterruptedException e) {
- }
- }
- }
-
-
-
public SyncInfo getSyncInfo(TeamSubscriber subscriber, IResource resource) throws TeamException {
SubscriberInput input = getInput(subscriber);
SyncSet set = input.getWorkingSetSyncSet();
@@ -78,7 +59,7 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
SubscriberInput input = ((TeamSubscriberParticipant)participant).getInput();
TeamSubscriber s = input.getSubscriber();
if(s == subscriber) {
- waitForEventNotification(input);
+ EclipseTest.waitForSubscriberInputHandling(input);
return input;
}
}
@@ -133,8 +114,9 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
*/
public void refresh(TeamSubscriber subscriber, IResource resource) throws TeamException {
super.refresh(subscriber, resource);
- waitForEventNotification(getInput(subscriber));
+ EclipseTest.waitForSubscriberInputHandling(getInput(subscriber));
}
+
/* (non-Javadoc)
* @see org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource#reset()
*/
@@ -142,5 +124,4 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
super.reset(subscriber);
getInput(subscriber).reset();
}
-
}

Back to the top