Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2003-12-03 19:51:06 +0000
committerMichael Valenta2003-12-03 19:51:06 +0000
commit5c409f63fad13e45b8aaf6aad5725d9e3ff2b0e9 (patch)
tree9b6b550a4a4cc8e8e486acd4d152e9397237b21a /tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team
parent2c9457975b3cf366eb60ec4752f3dfcc472adc2b (diff)
downloadeclipse.platform.team-5c409f63fad13e45b8aaf6aad5725d9e3ff2b0e9.tar.gz
eclipse.platform.team-5c409f63fad13e45b8aaf6aad5725d9e3ff2b0e9.tar.xz
eclipse.platform.team-5c409f63fad13e45b8aaf6aad5725d9e3ff2b0e9.zip
46730: CVS (Replace With.. --> Latest from HEAD)
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/provider/CVSProviderTest.java66
1 files changed, 44 insertions, 22 deletions
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java
index efe702dbc..31c55b716 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java
@@ -9,34 +9,19 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.team.tests.ccvs.core.provider;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import java.util.HashMap;
import java.util.Map;
import junit.framework.Test;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.team.core.IFileTypeInfo;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.client.Command;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.team.core.*;
+import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.client.*;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
+import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
@@ -525,5 +510,42 @@ public class CVSProviderTest extends EclipseTest {
IProject copy = checkoutCopy(project, tag);
assertEquals(project, copy);
}
+
+ public void testUpdateWithOverwrite() throws TeamException, CoreException {
+ // Create a project and ad an unmanaged resource
+ IProject project = createProject(new String[] { "a.txt", "b.txt" });
+ buildResources(project, new String[] { "new.txt" }, false);
+ // Checkout a copy and commit the same resource
+ IProject copy = checkoutCopy(project, "-copy");
+ addResources(copy, new String[] { "new.txt" }, true);
+ IStatus status;
+ try {
+ // Use the regular update and ensure that it fails
+ status = executeCommand(project, Command.UPDATE, Command.NO_LOCAL_OPTIONS);
+ fail();
+ } catch (CVSException e) {
+ // This is expected as the creation of the file failed;
+ }
+ // Use the update and overwrite and ensure that it works
+ status = executeCommand(project, Command.REPLACE, Command.NO_LOCAL_OPTIONS);
+ assertTrue(status.isOK());
+ }
+
+ private IStatus executeCommand(IProject project, Update update, LocalOption[] options) throws CVSException {
+ Session session = new Session(getRepository(), CVSWorkspaceRoot.getCVSFolderFor(project));
+ session.open(DEFAULT_MONITOR);
+ try {
+ return update.execute(
+ session,
+ Command.NO_GLOBAL_OPTIONS,
+ options,
+ new String[] { "." },
+ null,
+ DEFAULT_MONITOR);
+ } finally {
+ session.close();
+ }
+
+ }
}

Back to the top