Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-09-29 19:28:00 +0000
committerJean Michel-Lemieux2003-09-29 19:28:00 +0000
commit75af860c583ef561a4ded7ed9f6e27372d37946d (patch)
tree4325b07a8be08687c61669828461e8c590c2db5b
parent976e6f28b0597d71e8cb152904f8d82d6ea2b37c (diff)
downloadeclipse.platform.team-75af860c583ef561a4ded7ed9f6e27372d37946d.tar.gz
eclipse.platform.team-75af860c583ef561a4ded7ed9f6e27372d37946d.tar.xz
eclipse.platform.team-75af860c583ef561a4ded7ed9f6e27372d37946d.zip
Added tests and methods for sync view action tests.
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java193
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java13
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java47
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java35
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java)20
5 files changed, 216 insertions, 92 deletions
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
index 6f59d853c..68a3bc072 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
@@ -41,6 +41,7 @@ import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.team.ui.sync.SyncInfoSet;
@@ -174,9 +175,6 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
}
}
- /**
- *
- */
private void registerSubscriberListener() throws TeamException {
registerSubscriberListener(getSubscriber());
}
@@ -201,9 +199,6 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
}
}
- /**
- * @return
- */
private TeamDelta[] deregisterSubscriberListener() throws TeamException {
return deregisterSubscriberListener(getSubscriber());
}
@@ -250,59 +245,54 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
}
}
- /**
- * Update the resources from an existing container with the changes from the CVS repository.
- * This update uses the SubscriberUpdateAction to perform the update so that all special
- * cases should be handled properly
- */
- public IResource[] update(IContainer container, String[] hierarchy, boolean allowOverwrite) throws CoreException, TeamException, InvocationTargetException, InterruptedException {
- IResource[] resources = getResources(container, hierarchy);
- SyncInfo[] syncResources = createSyncInfos(resources);
- update(syncResources,allowOverwrite);
- return resources;
- }
-
- /**
- * @param resources
- * @return
- */
+ /******************************************************************
+ * Subscriber Actions: commit/update and overide and commit/update
+ * These actions are those contributed to the Synchronize View by
+ * the CVS plugin.
+ ******************************************************************/
private SyncInfo[] createSyncInfos(IResource[] resources) throws TeamException {
return createSyncInfos(getSubscriber(), resources);
}
+
+ public IResource[] update(IContainer container, String[] hierarchy) throws CoreException, TeamException, InvocationTargetException, InterruptedException {
+ return runSubscriberAction(new TestUpdateAction(), container, hierarchy);
+ }
+
+ public IResource[] commit(IContainer container, String[] hierarchy) throws CoreException, TeamException {
+ return runSubscriberAction(new TestCommitAction(), container, hierarchy);
+ }
- /**
- * Commit the resources from an existing container to the CVS repository.
- * This commit uses the SubscriberCommitAction to perform the commit so that all special
- * cases should be handled properly
- */
- public IResource[] commitResources(IContainer container, String[] hierarchy) throws CoreException, TeamException {
- IResource[] resources = getResources(container, hierarchy);
- SyncInfo[] syncResources = createSyncInfos(resources);
- commitResources(syncResources);
+ public IResource[] overrideAndUpdate(IContainer container, String[] hierarchy, boolean shouldPrompt) throws CoreException, TeamException {
+ TestOverrideAndUpdate action = new TestOverrideAndUpdate();
+ IResource[] resources = runSubscriberAction(action, container, hierarchy);
+ assertTrue(shouldPrompt == action.isPrompted());
return resources;
}
-
- private void update(SyncInfo[] infos, final boolean allowOverwrite) throws TeamException {
- TestWorkspaceUpdateAction action = new TestWorkspaceUpdateAction(allowOverwrite);
- try {
- action.getRunnable(new SyncInfoSet(infos)).run(DEFAULT_MONITOR);
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- fail("Operation was interupted");
- }
+
+ public IResource[] overrideAndCommit(IContainer container, String[] hierarchy, boolean shouldPrompt) throws CoreException, TeamException {
+ TestOverrideAndCommit action = new TestOverrideAndCommit();
+ IResource[] resources = runSubscriberAction(action, container, hierarchy);
+ assertTrue(shouldPrompt == action.isPrompted());
+ return resources;
}
-
- private void commitResources(SyncInfo[] syncResources) throws TeamException {
- TestCommitAction action = new TestCommitAction();
+
+ private IResource[] runSubscriberAction(CVSSubscriberAction action, IContainer container, String[] hierarchy) throws CoreException {
+ IResource[] resources = getResources(container, hierarchy);
+ SyncInfo[] syncResources = createSyncInfos(resources);
try {
- action.getRunnable(new SyncInfoSet(syncResources)).run(DEFAULT_MONITOR);
+ action.getRunnable(new SyncInfoSet(syncResources)).run(DEFAULT_MONITOR);
+ return resources;
} catch (InvocationTargetException e) {
throw CVSException.wrapException(e);
} catch (InterruptedException e) {
fail("Operation was interupted");
- }
+ }
+ return new IResource[0];
}
+
+ /******************************************************************
+ * Tests
+ ******************************************************************/
/*
* Perform a simple test that checks for the different types of incoming changes
@@ -338,8 +328,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
"folder1/b.txt",
"folder2/",
"folder2/folder3/",
- "folder2/folder3/add.txt"},
- false /* allow overwrite */);
+ "folder2/folder3/add.txt"});
// Verify that we are in sync (except for "folder1/b.txt", which was deleted)
assertSyncEquals("testIncomingChanges", project,
@@ -384,7 +373,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.OUTGOING | SyncInfo.ADDITION});
// Commit the changes
- commitResources(project, new String[] {"folder1/a.txt", "folder1/b.txt", "folder2/folder3/add.txt"});
+ commit(project, new String[] {"folder1/a.txt", "folder1/b.txt", "folder2/folder3/add.txt"});
// Ensure we're in sync
assertSyncEquals("testOutgoingChanges", project,
@@ -401,6 +390,72 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
assertDeleted("testOutgoingChanges", project, new String[] {"folder1/b.txt"});
}
+ public void testOverideAndUpdateSimple() throws CVSException, CoreException, IOException {
+ IProject project = createProject("testOutgoingChangesOverideAndUpdate", new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt"});
+
+ // Make some modifications
+ setContentsAndEnsureModified(project.getFile("folder1/a.txt"));
+ addResources(project, new String[] { "folder2/folder3/add.txt" }, false);
+ deleteResources(project, new String[] {"folder1/b.txt"}, false);
+
+ // Get the sync tree for the project
+ assertSyncEquals("testOutgoingChangesOverwrite", project,
+ new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt"},
+ true, new int[] {
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC,
+ SyncInfo.OUTGOING | SyncInfo.CHANGE,
+ SyncInfo.OUTGOING | SyncInfo.DELETION,
+ SyncInfo.IN_SYNC, /* adding a folder creates it remotely */
+ SyncInfo.IN_SYNC, /* adding a folder creates it remotely */
+ SyncInfo.OUTGOING | SyncInfo.ADDITION});
+
+ // Revert the changes
+ overrideAndUpdate(project, new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt"}, true /* should prompt */);
+
+ // Ensure we're in sync
+ assertSyncEquals("testOutgoingChangesOverwrite", project,
+ new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt"},
+ true, new int[] {
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC});
+
+ // Ensure deleted resource is re-created
+ assertExistsInWorkspace("testOutgoingChangesOverwrite", project.getFile(new Path("folder1/b.txt")));
+
+ // Test conflicting changes
+ IProject copy = checkoutCopy(project, "-copy");
+ appendText(copy.getFile("file1.txt"), "prefix" + eol, true);
+ setContentsAndEnsureModified(copy.getFile("folder1/a.txt"), "Use a custom string to avoid intermitant errors!");
+ commitProject(copy);
+
+ // Make the same modifications to the original (We need to test both M and C!!!)
+ appendText(project.getFile("file1.txt"), eol + "postfix", false); // This will test merges (M)
+ setContentsAndEnsureModified(project.getFile("folder1/a.txt"));
+
+ // Get the sync tree for the project
+ assertSyncEquals("testFileConflict", project,
+ new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
+ true, new int[] {
+ SyncInfo.CONFLICTING | SyncInfo.CHANGE,
+ SyncInfo.IN_SYNC,
+ SyncInfo.CONFLICTING | SyncInfo.CHANGE });
+
+ // Revert the changes
+ overrideAndUpdate(project, new String[] { "file1.txt", "folder1/", "folder1/a.txt"}, true /* should prompt */);
+
+ assertSyncEquals("testFileConflict", project,
+ new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
+ true, new int[] {
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC});
+ }
+
/*
* Perform a simple test that checks for the different types of outgoing changes
*/
@@ -428,13 +483,13 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.OUTGOING | SyncInfo.ADDITION});
// Override the changes
- update(
+ overrideAndUpdate(
project,
new String[] {
"folder1/a.txt",
"folder1/b.txt",
"folder2/folder3/add.txt"},
- true /* allow overwrite */);
+ true /* should prompt */);
// Ensure added resources no longer exist
assertDeleted("testOverrideOutgoingChanges", project, new String[] {"folder2/", "folder2/folder3/","folder2/folder3/add.txt"});
@@ -480,7 +535,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.OUTGOING | SyncInfo.ADDITION,
SyncInfo.OUTGOING | SyncInfo.ADDITION});
- commitResources(project, new String[] {"folder1/b.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt"});
+ commit(project, new String[] {"folder1/b.txt", "folder2/", "folder2/folder3/", "folder2/folder3/add.txt"});
// Ensure we are in sync
assertSyncEquals("testOutgoingQuestionables", project,
@@ -501,9 +556,6 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
* Test simple file conflicts
*/
public void testFileConflict() throws IOException, TeamException, CoreException, InvocationTargetException, InterruptedException {
- String eol = System.getProperty("line.separator");
- if (eol == null) eol = "\n";
-
// Create a test project (which commits it as well)
IProject project = createProject("testFileConflict", new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt"});
@@ -532,8 +584,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
// Catch up to the file1.txt conflict using UPDATE
update(
project,
- new String[] {"file1.txt"},
- false /* allow overwrite */);
+ new String[] {"file1.txt"});
assertSyncEquals("testFileConflict", project,
new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
@@ -543,7 +594,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.CONFLICTING | SyncInfo.CHANGE });
// Release the folder1/a.txt conflict by merging and then committing
- commitResources(project, new String[] {"file1.txt", "folder1/a.txt"});
+ commit(project, new String[] {"file1.txt", "folder1/a.txt"});
assertSyncEquals("testFileConflict", project,
new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
@@ -591,7 +642,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.OUTGOING | SyncInfo.ADDITION });
// Commit conflicting add1b.txt and add2b.txt and outgoing add3.txt
- commitResources(project, new String[]{"add1b.txt", "add2b.txt", "add3.txt"});
+ commit(project, new String[]{"add1b.txt", "add2b.txt", "add3.txt"});
assertSyncEquals("testAdditionConflicts", project,
new String[] { "file.txt", "add1b.txt", "add2b.txt", "add3.txt"},
@@ -602,10 +653,10 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.IN_SYNC });
// Catch-up to conflicting cases using UPDATE
- update(
+ overrideAndUpdate(
project,
new String[] {"add1a.txt", "add2a.txt"},
- true /* allow overwrite */);
+ true /* should prompt */);
assertSyncEquals("testAdditionConflicts", project,
@@ -666,7 +717,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.IN_SYNC });
// Catch up to remote changes.
- update(
+ overrideAndUpdate(
project,
new String[] {
"delete1.txt",
@@ -674,7 +725,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
"delete3.txt",
"delete4.txt",
"delete5.txt"},
- true /* allow overwrite */);
+ true /* should be prompted */);
assertSyncEquals("testDeletionConflictsA", project,
new String[] { "delete1.txt", "delete2.txt"},
@@ -714,7 +765,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.IN_SYNC });
// Release the resources
- commitResources(project, new String[] { "delete1.txt", "delete2.txt", "delete3.txt", "delete4.txt", "delete5.txt"});
+ commit(project, new String[] { "delete1.txt", "delete2.txt", "delete3.txt", "delete4.txt", "delete5.txt"});
assertSyncEquals("testDeletionConflictsB", project,
new String[] { "delete3.txt"},
@@ -775,8 +826,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
update(
project,
- new String[] {"folder1/"},
- false /* allow overwrite */);
+ new String[] {"folder1/"});
assertSyncEquals("testFolderConflict", project,
new String[] { "file.txt", "folder1/", "folder1/file.txt", "folder2/", "folder2/file.txt"},
@@ -810,7 +860,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.OUTGOING | SyncInfo.DELETION});
// Commit the deletion
- commitResources(project , new String[] {"folder1/b.txt"});
+ commit(project , new String[] {"folder1/b.txt"});
// Get the sync tree again for the project and ensure others aren't effected
assertSyncEquals("testOutgoingDeletion", project,
@@ -847,8 +897,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
// Catch up to the addition by updating
update(
project,
- new String[] {"folder1/add.txt"},
- false /* allow overwrite */);
+ new String[] {"folder1/add.txt"});
// Get the sync tree again for the project and ensure the added resource is in sync
assertSyncEquals("testIncomingAddition", project,
@@ -1012,7 +1061,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.OUTGOING | SyncInfo.DELETION});
// commit folder1/a.txt
- commitResources(project, new String[] { "folder1/a.txt" });
+ commit(project, new String[] { "folder1/a.txt" });
// Resync and verify that above file is gone and others remain the same
assertSyncEquals("testFolderDeletion sync check", project,
@@ -1023,7 +1072,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
assertDeleted("testFolderDeletion", project, new String[] {"folder1/a.txt"});
// Commit folder1/folder2/file.txt
- commitResources(project, new String[] { "folder1/folder2/file.txt" });
+ commit(project, new String[] { "folder1/folder2/file.txt" });
// Resync and verify that all are deleted
assertDeleted("testFolderDeletion", project, new String[] {"folder1/", "folder1/folder2/", "folder1/folder2/file.txt"});
@@ -1104,7 +1153,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
true, new int[] {
SyncInfo.OUTGOING | SyncInfo.ADDITION});
- commitResources(project, new String[] { "folder2" });
+ commit(project, new String[] { "folder2" });
assertSyncEquals("testOutgoingEmptyFolder", project,
new String[] { "folder2/" },
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
index b1f43d911..5660bba30 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
@@ -10,11 +10,13 @@
*******************************************************************************/
package org.eclipse.team.tests.ccvs.core.subscriber;
+import org.eclipse.core.resources.IResource;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.internal.ccvs.ui.subscriber.OverrideAndCommitAction;
+import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
+import org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction;
import org.eclipse.team.ui.sync.SyncInfoSet;
-class TestCommitAction extends OverrideAndCommitAction {
+class TestCommitAction extends SubscriberCommitAction {
public IRunnableWithProgress getRunnable(SyncInfoSet syncSet) {
return super.getRunnable(syncSet);
@@ -23,4 +25,11 @@ class TestCommitAction extends OverrideAndCommitAction {
protected boolean canRunAsJob() {
return false;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction#promptForComment(org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager, org.eclipse.core.resources.IResource[])
+ */
+ protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
+ return "dummy comment";
+ }
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java
new file mode 100644
index 000000000..48481da81
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ccvs.core.subscriber;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
+import org.eclipse.team.internal.ccvs.ui.subscriber.OverrideAndCommitAction;
+import org.eclipse.team.ui.sync.SyncInfoSet;
+
+public class TestOverrideAndCommit extends OverrideAndCommitAction {
+
+ private boolean prompted = false;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction#promptForComment(org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager, org.eclipse.core.resources.IResource[])
+ */
+ protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
+ return "test comments";
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction#promptForConflicts(org.eclipse.team.ui.sync.SyncInfoSet)
+ */
+ protected int promptForConflicts(SyncInfoSet syncSet) {
+ this.prompted = true;
+ return 0; // ok to commit all conflicts
+ }
+
+ public boolean isPrompted() {
+ return this.prompted;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#canRunAsJob()
+ */
+ protected boolean canRunAsJob() {
+ return false;
+ }
+}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java
new file mode 100644
index 000000000..391cc5443
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java
@@ -0,0 +1,35 @@
+package org.eclipse.team.tests.ccvs.core.subscriber;
+
+import org.eclipse.team.internal.ccvs.ui.subscriber.OverrideAndUpdateAction;
+import org.eclipse.team.ui.sync.SyncInfoSet;
+
+public class TestOverrideAndUpdate extends OverrideAndUpdateAction {
+
+ private boolean prompted = false;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateAction#promptForOverwrite(org.eclipse.team.ui.sync.SyncInfoSet)
+ */
+ protected boolean promptForOverwrite(SyncInfoSet syncSet) {
+ this.prompted = true;
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateAction#warnAboutFailedResources(org.eclipse.team.ui.sync.SyncInfoSet)
+ */
+ protected void warnAboutFailedResources(SyncInfoSet syncSet) {
+ return;
+ }
+
+ public boolean isPrompted() {
+ return this.prompted;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#canRunAsJob()
+ */
+ protected boolean canRunAsJob() {
+ return false;
+ }
+}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java
index b5fba68e0..726e38153 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java
@@ -10,14 +10,12 @@
*******************************************************************************/
package org.eclipse.team.tests.ccvs.core.subscriber;
-import org.eclipse.core.resources.IResource;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceUpdateAction;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
import org.eclipse.team.ui.sync.SyncInfoSet;
-class TestWorkspaceUpdateAction extends WorkspaceUpdateAction {
- boolean allowOverwrite = false;
+class TestUpdateAction extends WorkspaceUpdateAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateAction#warnAboutFailedResources(org.eclipse.team.ui.sync.SyncInfoSet)
@@ -26,22 +24,8 @@ class TestWorkspaceUpdateAction extends WorkspaceUpdateAction {
return;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateAction#getOverwriteLocalChanges()
- */
- protected boolean getOverwriteLocalChanges() {
- return allowOverwrite;
- }
-
- public TestWorkspaceUpdateAction(boolean allowOverwrite) {
- this.allowOverwrite = allowOverwrite;
- }
-
protected boolean promptForOverwrite(SyncInfoSet syncSet) {
- if (allowOverwrite) return true;
- if (syncSet.isEmpty()) return true;
- IResource[] resources = syncSet.getResources();
- EclipseTest.fail(resources[0].getFullPath().toString() + " failed to update properly");
+ EclipseTest.fail("Should never prompt on update, simply update nodes that are valid.");
return false;
}

Back to the top