public void RenameMergeTest() { MigrationItemStrings file1 = new MigrationItemStrings(source.Name + "file1.txt", source.Name + "renamed-file1.txt", TestEnvironment, true); SourceAdapter.AddFile(file1.LocalPath); MigrationItemStrings file2 = new MigrationItemStrings(source.Name + "file2.txt", source.Name + "renamed-file2.txt", TestEnvironment, true); SourceAdapter.AddFile(file2.LocalPath); int changesetId = AddBranch(); SourceAdapter.RenameItem(file.ServerPath, file.NewServerPath, AddComment); SourceAdapter.RenameItem(file1.ServerPath, file1.NewServerPath, AddComment); SourceAdapter.RenameItem(file2.ServerPath, file2.NewServerPath, AddComment); SourceWorkspace.Merge(source.LocalPath, target.LocalPath, VersionSpec.ParseSingleSpec(changesetId.ToString(), Environment.UserName), VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.ForceMerge); Conflict[] conflicts = SourceWorkspace.QueryConflicts(new string[] { "$/" }, true); foreach (Conflict conflict in conflicts) { conflict.Resolution = Resolution.AcceptTheirs; SourceWorkspace.ResolveConflict(conflict); } RunAndValidate(); }
public void RenameWithSourceNotMappedTest() { MigrationItemStrings folder = new MigrationItemStrings("rename-from", "rename-to", TestEnvironment, true); MigrationItemStrings file = new MigrationItemStrings("rename-from/fld/file.txt", "rename-to/fld/file.txt", TestEnvironment, true); // Add the child item SourceAdapter.AddFile(file.LocalPath); MappingPair mapping = new MappingPair(TestEnvironment.FirstSourceServerPath + SrcPathSeparator + "rename-from", TestEnvironment.FirstTargetServerPath + TarPathSeparator + "rename-from", true); // cloaked TestEnvironment.AddMapping(mapping); SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite); SourceWorkspace.PendRename(folder.ServerPath, folder.NewServerPath); SourceAdapter.EditFile(file.NewLocalPath); Run(); VerifyHistory(3, 0); // Resolve "Branch source path not found conflict" using "$/" scope. ConflictResolver conflictManager = new ConflictResolver(Configuration); List <RTConflict> conflicts = conflictManager.GetConflicts(); Assert.AreEqual(1, conflicts.Count, "There should be only 1 conflict"); conflictManager.TryResolveConflict(conflicts[0], new VCChangeToAddOnBranchSourceNotMappedAction(), "$/"); // Add on branch source not found RunAndValidate(true, true); }
private void RenameMergeRenameScenario(bool includeEdit) { // Add a file MigrationItemStrings sourceFolder = new MigrationItemStrings(m_source.Name + "folder/", null, TestEnvironment, true); m_file = new MigrationItemStrings(sourceFolder.Name + "file1.txt", null, TestEnvironment, true); SourceAdapter.AddFile(m_file.LocalPath); // Branch the containing folder int changesetId = SourceAdapter.BranchItem(m_source, m_target); // Rename the file and check it in MigrationItemStrings rename1 = new MigrationItemStrings(sourceFolder.Name + "file1.txt", sourceFolder.Name + "file2.txt", TestEnvironment, true); SourceWorkspace.PendRename(rename1.LocalPath, rename1.NewLocalPath); // Checkin the rename & pend a merge CheckinMergeResolve(changesetId); MigrationItemStrings targetFolder = new MigrationItemStrings(m_target.Name + "folder/", null, TestEnvironment, true); MigrationItemStrings rename2 = new MigrationItemStrings(targetFolder.Name + "file2.txt", targetFolder.Name + "file3.txt", TestEnvironment, true); SourceWorkspace.PendRename(rename2.LocalPath, rename2.NewLocalPath); if (includeEdit) { SourceAdapter.EditFile(rename2.NewLocalPath); } RunAndValidate(); VerifyNoExtraMergeCandidates(); }
private int AddBranch() { m_file = new MigrationItemStrings(m_source.Name + "file.txt", m_source.Name + "renamed-file.txt", TestEnvironment, true); SourceAdapter.AddFile(m_file.LocalPath); return(SourceAdapter.BranchItem(m_source, m_target)); }
public void RenameDeleteMergeTest2() { MigrationItemStrings sourceFolder = new MigrationItemStrings(m_source.Name + "folder/", m_source.Name + "renamed-folder/", TestEnvironment, true); m_file = new MigrationItemStrings(sourceFolder.Name + "file.txt", sourceFolder.NewName + "file.txt", TestEnvironment, true); MigrationItemStrings file2 = new MigrationItemStrings(sourceFolder.Name + "file2.txt", sourceFolder.NewName + "file2.txt", TestEnvironment, true); MigrationItemStrings sourceFolder2 = new MigrationItemStrings(m_source.Name + "folder2/", m_source.Name + "renamed-folder2/", TestEnvironment, true); int changesetId = SourceAdapter.AddFile(m_file.LocalPath); SourceAdapter.AddFile(file2.LocalPath); SourceAdapter.AddFolder(sourceFolder2.LocalPath); SourceAdapter.BranchItem(m_source, m_target); PendRenameDelete(sourceFolder, m_file); SourceWorkspace.PendRename(sourceFolder2.LocalPath, sourceFolder2.NewLocalPath); CheckinMergeResolve(changesetId); if (TestEnvironment.SourceEndPoint.IsTfsAdapter && TestEnvironment.SourceEndPoint.AdapterType >= AdapterType.TFS2010VC) { Run(); Assert.IsTrue(VerifyContents()); } else { RunAndValidate(); } }
public void RenameDeleteMergeTest2() { MigrationItemStrings sourceFolder = new MigrationItemStrings(source.Name + "folder/", source.Name + "renamed-folder/", TestEnvironment, true); file = new MigrationItemStrings(sourceFolder.Name + "file.txt", sourceFolder.NewName + "file.txt", TestEnvironment, true); MigrationItemStrings file2 = new MigrationItemStrings(sourceFolder.Name + "file2.txt", sourceFolder.NewName + "file2.txt", TestEnvironment, true); MigrationItemStrings sourceFolder2 = new MigrationItemStrings(source.Name + "folder2/", source.Name + "renamed-folder2/", TestEnvironment, true); int changesetId = SourceAdapter.AddFile(file.LocalPath); SourceAdapter.AddFile(file2.LocalPath); SourceAdapter.AddFolder(sourceFolder2.LocalPath); SourceAdapter.BranchItem(source.ServerPath, target.ServerPath); PendRenameDelete(sourceFolder, file); SourceWorkspace.PendRename(sourceFolder2.LocalPath, sourceFolder2.NewLocalPath); CheckinMergeResolve(changesetId); if (TestEnvironment.SourceTFSVersion == TFSVersionEnum.TFS2010) { Run(); Assert.IsTrue(VerifyContents()); } else { RunAndValidate(); } }
public void ThreeWayCyclicRenameTest() { MigrationItemStrings folder1 = new MigrationItemStrings("folder1/", null, TestEnvironment, true); MigrationItemStrings folder2 = new MigrationItemStrings("folder2/", null, TestEnvironment, true); MigrationItemStrings folder3 = new MigrationItemStrings("folder3/", null, TestEnvironment, true); MigrationItemStrings temp = new MigrationItemStrings("temp/", null, TestEnvironment, true); MigrationItemStrings file1 = new MigrationItemStrings("folder1/file1.txt", null, TestEnvironment, true); MigrationItemStrings file2 = new MigrationItemStrings("folder2/file2.txt", null, TestEnvironment, true); MigrationItemStrings file3 = new MigrationItemStrings("folder3/file3.txt", null, TestEnvironment, true); SourceAdapter.AddFolder(folder1.LocalPath); SourceAdapter.AddFolder(folder2.LocalPath); SourceAdapter.AddFolder(folder3.LocalPath); SourceAdapter.AddFile(file1.LocalPath); SourceAdapter.AddFile(file2.LocalPath); SourceAdapter.AddFile(file3.LocalPath); // Create a cyclic rename of the three folders SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite); SourceWorkspace.PendRename(folder3.ServerPath, temp.ServerPath); SourceWorkspace.PendRename(folder2.ServerPath, folder3.ServerPath); SourceWorkspace.PendRename(folder1.ServerPath, folder2.ServerPath); SourceWorkspace.PendRename(temp.ServerPath, folder1.ServerPath); SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), RenameComment); RunAndValidate(); }
public override void Initialize() { m_currentDirectory = Directory.GetCurrentDirectory(); base.Initialize(); TCAdapterEnvironment sourceTCAdapterEnv = TestEnvironment.SourceTCAdapterEnvironment; TCAdapterEnvironment targetTCAdapterEnv = TestEnvironment.TargetTCAdapterEnvironment; m_sourceAdapter = (IVCTestCaseAdapter)TestAdapterManager.LoadAdapter(new Guid(TestEnvironment.SourceTCAdapterEnvironment.AdapterRefName)); m_targetAdapter = (IVCTestCaseAdapter)TestAdapterManager.LoadAdapter(new Guid(TestEnvironment.TargetTCAdapterEnvironment.AdapterRefName)); m_sourceAdapter.Initialize(sourceTCAdapterEnv); m_targetAdapter.Initialize(targetTCAdapterEnv); MappingPair mapping = new MappingPair(m_sourceAdapter.FilterString, m_targetAdapter.FilterString); TestEnvironment.AddMapping(mapping); TestEnvironment.SourceWorkspaceLocalPath = m_sourceAdapter.WorkspaceLocalPath; TestEnvironment.TargetWorkspaceLocalPath = m_targetAdapter.WorkspaceLocalPath; // an extra file is usefull to make sure that the toolkit was not left in a bad state after migrating the scenario under test m_extraFile = new MigrationItemStrings("extraFile.txt", null, TestEnvironment, true); Trace.TraceInformation("Adding an extra file {0} -> {1}", m_extraFile.LocalPath, m_extraFile.ServerPath); SourceAdapter.AddFile(m_extraFile.LocalPath); InitializeTestCase(); Trace.TraceInformation("Loaded VC test environment successfully"); }
public void BasicSnapshotTest() { MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true); MigrationItemStrings[] addFiles = new MigrationItemStrings[20]; // Add files // Create a tree structure so that we can test path compression logic. int snapshotChangesetId = 0; for (int i = 0; i < 20; i++) { addFiles[i] = new MigrationItemStrings(string.Format("source/addFile{0}.txt", i), null, TestEnvironment, true); if (i == 15) { snapshotChangesetId = SourceAdapter.AddFile(addFiles[i].LocalPath); } else { SourceAdapter.AddFile(addFiles[i].LocalPath); } } TestEnvironment.SnapshotStartPoints = new Dictionary <string, string>(); TestEnvironment.SnapshotStartPoints.Add(TestEnvironment.SourceTeamProject, snapshotChangesetId.ToString()); TestEnvironment.SnapshotBatchSize = 3; Run(); VerifySnapshotMigration(snapshotChangesetId); Assert.IsTrue(VerifyContents()); }
public void TwoWay_EditEditConflictTakeOtherTest() { // continuous manual, bi-directional sync TestEnvironment.WorkFlowType = new WorkFlowType(); TestEnvironment.WorkFlowType.DirectionOfFlow = DirectionOfFlow.Bidirectional; TestEnvironment.WorkFlowType.Frequency = Frequency.ContinuousManual; TestEnvironment.WorkFlowType.SyncContext = SyncContext.Disabled; // 1. migrate a.txt -> a.txt string fileName = "a.txt"; MigrationItemStrings sourceFile = new MigrationItemStrings(fileName, null, TestEnvironment, true); MigrationItemStrings targetFile = new MigrationItemStrings(fileName, null, TestEnvironment, false); SourceAdapter.AddFile(sourceFile.LocalPath); RunAndValidate(); // 2. source system: a.txt -> edit SourceAdapter.EditFile(sourceFile.LocalPath); // 3. target system: a.txt -> edit TargetAdapter.EditFile(targetFile.LocalPath); // 4. Migration will detect a conflict Run(); // 5. resolve conflicts ConflictResolver conflictResolver = new ConflictResolver(Configuration); List <RTConflict> conflicts = conflictResolver.GetConflicts(); Assert.AreEqual(1, conflicts.Count, "There should be 1 conflict"); VCContentConflictType contentConflict = new VCContentConflictType(); Assert.IsTrue(contentConflict.ReferenceName.Equals(conflicts[0].ConflictTypeReference.Value.ReferenceName), "It should be vc content conflict"); conflictResolver.TryResolveConflict(conflicts[0], new VCContentConflictTakeOtherChangesAction(), conflicts[0].ScopeHint); // sync Run(true, true); // validation // no remaining conflicts conflicts = conflictResolver.GetConflicts(); Assert.AreEqual(0, conflicts.Count, "There should be NO conflict"); // content should match Assert.IsTrue(VerifyContents(), "The latest content should match."); // 6. edit a.txt on source system SourceAdapter.EditFile(sourceFile.LocalPath); // 7. sync Run(true, true); // validation // no remaining conflicts conflicts = conflictResolver.GetConflicts(); Assert.AreEqual(0, conflicts.Count, "There should be NO conflict"); // content should match Assert.IsTrue(VerifyContents(), "The latest content should match."); }
public void TFSHistoryNotFoundConflict() { MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true); MigrationItemStrings file1 = new MigrationItemStrings("source/file1.txt", null, TestEnvironment, true); MigrationItemStrings file2 = new MigrationItemStrings("source/file2.txt", null, TestEnvironment, true); int firstChangeset = SourceAdapter.AddFile(file1.LocalPath); int editBeforeSnapShot = SourceAdapter.EditFile(file1.LocalPath); int snapshotChangesetId = SourceAdapter.AddFile(file2.LocalPath); SourceAdapter.BranchItem(branch); TestEnvironment.SnapshotBatchSize = 10; TestEnvironment.SnapshotStartPoints = new Dictionary <string, string>(); TestEnvironment.SnapshotStartPoints.Add(TestEnvironment.SourceEndPoint.TeamProject, snapshotChangesetId.ToString()); Run(); // Resolve "Branch source path not found conflict" using "$/" scope. ConflictResolver conflictManager = new ConflictResolver(Configuration); List <RTConflict> conflicts = conflictManager.GetConflicts(); Assert.AreEqual(1, conflicts.Count, "There should be only 1 conflict"); conflictManager.TryResolveConflict(conflicts[0], ConflictConstant.TFSHistoryNotFoundSkipAction, string.Format("{0}-{1}", firstChangeset, snapshotChangesetId)); // Add on branch source not found Run(); Assert.IsTrue(VerifyContents()); }
public void MergeMovesTest() { MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true); MigrationItemStrings file = new MigrationItemStrings("source/file.txt", "source/sub/file.txt", TestEnvironment, true); MigrationItemStrings file2 = new MigrationItemStrings("source/file2.txt", "source/sub/file2.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); SourceAdapter.AddFile(file2.LocalPath); int branchChangeset = SourceAdapter.BranchItem(branch.ServerPath, branch.NewServerPath); SourceAdapter.EditFile(file.LocalPath); SourceAdapter.EditFile(file.LocalPath); SourceAdapter.EditFile(m_extraFile.LocalPath); SourceAdapter.RenameItem(file.ServerPath, file.NewServerPath); SourceAdapter.RenameItem(file2.ServerPath, file2.NewServerPath); SourceWorkspace.Merge(branch.ServerPath, branch.NewServerPath, VersionSpec.ParseSingleSpec(branchChangeset.ToString(), Environment.UserName), VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.None); ResolveConflicts(Resolution.AcceptTheirs); SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MergeComment); RunAndValidate(); }
protected void BranchCyclicalRenameTest() { MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true); MigrationItemStrings folder1 = new MigrationItemStrings("source/folder1/", null, TestEnvironment, true); MigrationItemStrings folder2 = new MigrationItemStrings("source/folder2/", null, TestEnvironment, true); MigrationItemStrings temp = new MigrationItemStrings("source/temp/", null, TestEnvironment, true); MigrationItemStrings file1 = new MigrationItemStrings("source/folder1/file1.txt", null, TestEnvironment, true); MigrationItemStrings file2 = new MigrationItemStrings("source/folder2/file2.txt", null, TestEnvironment, true); SourceAdapter.AddFolder(folder1.LocalPath); SourceAdapter.AddFolder(folder2.LocalPath); SourceAdapter.AddFile(file1.LocalPath); SourceAdapter.AddFile(file2.LocalPath); SourceAdapter.EditFile(m_extraFile.LocalPath); SourceWorkspace.PendRename(folder1.ServerPath, temp.ServerPath); SourceWorkspace.PendRename(folder2.ServerPath, folder1.ServerPath); SourceWorkspace.PendRename(temp.ServerPath, folder2.ServerPath); SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), RenameComment); SourceAdapter.BranchItem(branch.ServerPath, branch.NewServerPath); RunAndValidate(); }
private void EditUndelete(MigrationItemStrings file) { SourceAdapter.AddFile(file.LocalPath); PendUndelete(file); TestUtils.EditRandomFile(file.LocalPath); SourceWorkspace.PendEdit(file.LocalPath); }
public void RenameCaseTest() { MigrationItemStrings folder; MigrationItemStrings file; if ((SourceAdapter.AdapterType == AdapterType.TFS2008VC) || (SourceAdapter.AdapterType == AdapterType.TFS2010VC)) { // change case only folder = new MigrationItemStrings("FOLDER", "folder", TestEnvironment, true); file = new MigrationItemStrings("file.txt", "FILE.txt", TestEnvironment, true); } else { // non-TFS adapters don't support case-only rename folder = new MigrationItemStrings("FOLDER1", "folder2", TestEnvironment, true); file = new MigrationItemStrings("file1.txt", "FILE2.txt", TestEnvironment, true); } SourceAdapter.AddFolder(folder.LocalPath); SourceAdapter.AddFile(file.LocalPath); SourceAdapter.RenameItem(folder.LocalPath, folder.NewLocalPath); SourceAdapter.RenameItem(file.LocalPath, file.NewLocalPath); RunAndValidate(); }
public void MapBranchRootTest() { MigrationItemStrings branch = new MigrationItemStrings("source" + SourceAdapter.PathSeparator, "target" + SourceAdapter.PathSeparator, TestEnvironment, true); MigrationItemStrings file = new MigrationItemStrings(branch.Name + SourceAdapter.PathSeparator + "file.txt", branch.NewName + SourceAdapter.PathSeparator + "file.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); //Remap the migration string source = TestEnvironment.FirstSourceServerPath; string target = TestEnvironment.FirstTargetServerPath; TestEnvironment.Mappings.Clear(); TestEnvironment.AddMapping(new MappingPair(source + SrcPathSeparator + branch.Name, target + TarPathSeparator + branch.Name, false)); TestEnvironment.AddMapping(new MappingPair(source + SrcPathSeparator + branch.NewName, target + TarPathSeparator + branch.NewName, false)); TestEnvironment.AddMapping(new MappingPair(source + SrcPathSeparator + m_extraFile.Name, target + TarPathSeparator + m_extraFile.Name, false)); int branchChangeset = SourceAdapter.BranchItem(branch.ServerPath, branch.NewServerPath); SourceAdapter.EditFile(file.LocalPath); SourceAdapter.MergeItem(branch, branchChangeset); SourceAdapter.EditFile(m_extraFile.LocalPath); RunAndValidate(); }
public void PartialMergeTest() { MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true); MigrationItemStrings file = new MigrationItemStrings("source/file.txt", "target/file.txt", TestEnvironment, true); MigrationItemStrings file2 = new MigrationItemStrings("file2.txt", "target/file2.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); SourceAdapter.AddFile(file2.LocalPath); int branchChangeset = SourceAdapter.BranchItem(branch.ServerPath, branch.NewServerPath); SourceAdapter.EditFile(file.LocalPath); SourceAdapter.EditFile(file.LocalPath); SourceAdapter.EditFile(m_extraFile.LocalPath); int mergeOne = SourceAdapter.EditFile(file2.LocalPath); SourceAdapter.EditFile(file.LocalPath); SourceAdapter.EditFile(m_extraFile.LocalPath); SourceAdapter.EditFile(file.LocalPath); int mergeTwo = SourceAdapter.EditFile(file2.LocalPath); SourceAdapter.EditFile(file.LocalPath); SourceAdapter.EditFile(file2.LocalPath); SourceAdapter.EditFile(m_extraFile.LocalPath); SourceAdapter.MergeItem(branch, branchChangeset, mergeOne); SourceAdapter.MergeItem(branch, branchChangeset, mergeTwo); SourceAdapter.MergeItem(branch, branchChangeset, SourceTfsClient.GetLatestChangesetId()); RunAndValidate(); }
private int AddBranch() { file = new MigrationItemStrings(source.Name + "file.txt", source.Name + "renamed-file.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); return(SourceAdapter.BranchItem(source.ServerPath, target.ServerPath)); }
public void AddTest() { MigrationItemStrings file = new MigrationItemStrings("file.txt", "FILE.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); RunAndValidate(); }
protected void BranchFileScenario() { MigrationItemStrings file = new MigrationItemStrings("source/file.txt", "target/file.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); SourceAdapter.BranchItem(file.ServerPath, file.NewServerPath); RunAndValidate(); }
public void BranchFileTest() { MigrationItemStrings file = new MigrationItemStrings("source/file.txt", "target/file.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); SourceAdapter.BranchItem(file); RunAndValidate(); }
public void RenameUndeleteTest() { file = new MigrationItemStrings("file.txt", "newFile.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); PendUndeleteRename(file); RunAndValidate(); }
public void SnapshotUndeleteTest() { /* * Descripton from the bug: * Item is undeleted *after* snapshot. * Then it is merged from version after snapshot. * After merge, we pend another edit. * This is on the source system. * On the target, since undelete is before snapshot, we change it to add. * But merge is valid because it is after snapshot, * so we pend merge and that becomes branch, merge. * Finally, when we pend edit, it will say that item can not be found or * that you do not have permission to access it - basically, item cannot be found. */ // 0. setup MigrationItemStrings branch = new MigrationItemStrings("main", "main-branch", TestEnvironment, true); MigrationItemStrings filea1 = new MigrationItemStrings("main/a1.txt", null, TestEnvironment, true); MigrationItemStrings filea2 = new MigrationItemStrings("main/a2.txt", null, TestEnvironment, true); MigrationItemStrings fileb1 = new MigrationItemStrings("main-branch/a1.txt", null, TestEnvironment, true); MigrationItemStrings fileb2 = new MigrationItemStrings("main-branch/a2.txt", null, TestEnvironment, true); SourceAdapter.AddFolder(branch.LocalPath); SourceAdapter.AddFile(filea1.LocalPath); SourceAdapter.AddFile(filea2.LocalPath); SourceAdapter.BranchItem(branch.ServerPath, branch.NewServerPath); // delete b1.txt int deleteChangesetId = SourceAdapter.DeleteItem(fileb1.ServerPath); // snapshot changeset id int snapshotChangesetId = SourceAdapter.EditFile(fileb2.LocalPath); // undelete b1.txt SourceAdapter.UndeleteFile(fileb1.ServerPath, deleteChangesetId); // merge from version after snapshot changeset id int mergeAfterSnapshotId = SourceAdapter.EditFile(filea1.LocalPath); SourceAdapter.MergeItem(branch, mergeAfterSnapshotId); // edit the item SourceAdapter.EditFile(fileb1.LocalPath); // migration TestEnvironment.SnapshotStartPoints = new Dictionary <string, string>(); TestEnvironment.SnapshotStartPoints.Add(TestEnvironment.SourceTeamProject, snapshotChangesetId.ToString()); TestEnvironment.SnapshotBatchSize = 100; Run(); // ToDo, ideally, we should compare content at snapshot changeset and compare history after snapshot changeset. //verifyChangesetAfterSnapshot(tfsDiff, snapshotChangesetId); Assert.IsTrue(VerifyContents()); }
public void BranchMergeTest() { file = new MigrationItemStrings(source.Name + "file.txt", target.Name + "file.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); SourceWorkspace.Merge(file.ServerPath, file.NewServerPath, VersionSpec.Latest, VersionSpec.Latest); RunAndValidate(); }
public void RenameEditTest() { m_file = new MigrationItemStrings("file.txt", "newName.txt", TestEnvironment, true); SourceAdapter.AddFile(m_file.LocalPath); PendRenameEdit(m_file); RunAndValidate(); }
public void BranchMergeDeleteTest() { file = new MigrationItemStrings(source.Name + "file.txt", target.Name + "file.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); SourceWorkspace.Merge(source.ServerPath, target.ServerPath, VersionSpec.Latest, VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.None); int mergeChangeset = SourceAdapter.DeleteItem(file.NewLocalPath); RunAndValidate(); }
public void RecursiveBranchDeleteTest() { file = new MigrationItemStrings(source.Name + "file.txt", target.Name + "file.txt", TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); SourceWorkspace.PendBranch(source.ServerPath, target.ServerPath, VersionSpec.Latest); SourceAdapter.DeleteItem(target.ServerPath); RunAndValidate(); }
public void RecursiveDeletesTest() { file = new MigrationItemStrings("folder/subfolder/file.txt", null, TestEnvironment, true); MigrationItemStrings folder = new MigrationItemStrings("folder", null, TestEnvironment, true); SourceAdapter.AddFile(file.LocalPath); SourceAdapter.DeleteItem(folder.ServerPath); RunAndValidate(); }
public void MergeTwoCyclicRenamesTest() { MigrationItemStrings branch = new MigrationItemStrings("source/", "target/", TestEnvironment, true); MigrationItemStrings folder1 = new MigrationItemStrings("source/folder1/", null, TestEnvironment, true); MigrationItemStrings folder2 = new MigrationItemStrings("source/folder2/", null, TestEnvironment, true); MigrationItemStrings folder3 = new MigrationItemStrings("source/folder3/", null, TestEnvironment, true); MigrationItemStrings temp = new MigrationItemStrings("source/temp/", null, TestEnvironment, true); MigrationItemStrings file1 = new MigrationItemStrings("source/folder1/file1.txt", null, TestEnvironment, true); MigrationItemStrings file2 = new MigrationItemStrings("source/folder1/file2.txt", null, TestEnvironment, true); MigrationItemStrings tempFile = new MigrationItemStrings("source/folder1/tempFile.txt", null, TestEnvironment, true); SourceAdapter.AddFolder(folder1.LocalPath); SourceAdapter.AddFolder(folder2.LocalPath); SourceAdapter.AddFolder(folder3.LocalPath); SourceAdapter.AddFile(file1.LocalPath); SourceAdapter.AddFile(file2.LocalPath); int branchChangeset = SourceAdapter.BranchItem(branch); // Create a cyclic rename of two files SourceWorkspace.PendRename(file1.ServerPath, tempFile.ServerPath); SourceWorkspace.PendRename(file2.ServerPath, file1.ServerPath); SourceWorkspace.PendRename(tempFile.ServerPath, file2.ServerPath); // Create a three-way cyclic rename of the parent folder with two other folders SourceWorkspace.PendRename(folder1.ServerPath, temp.ServerPath); SourceWorkspace.PendRename(folder2.ServerPath, folder1.ServerPath); SourceWorkspace.PendRename(folder3.ServerPath, folder2.ServerPath); SourceWorkspace.PendRename(temp.ServerPath, folder3.ServerPath); SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), RenameComment); SourceWorkspace.Merge(branch.ServerPath, branch.NewServerPath, VersionSpec.ParseSingleSpec(branchChangeset.ToString(), Environment.UserName), VersionSpec.Latest, LockLevel.None, RecursionType.Full, MergeOptions.AlwaysAcceptMine); SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), MergeComment); Run(); if (TestEnvironment.SourceEndPoint.AdapterType == AdapterType.TFS2008VC) { VerifyHistory(0, 0); // For orcas, there should be no difference. } else { VerifyHistory(1, 1); // Need more comparison here. // On dev 10 server, rename becomes sourceDelete+targetbranch. So the rename-from-name will exist in the original place as a deleted item. // The merge will then merge the item as a Merge|Delete. We will skip the change in this case. } }
public void RollbackAddTest() { MigrationItemStrings sourceFile = new MigrationItemStrings("a.txt", null, TestEnvironment, true); int AddChangesetId = SourceAdapter.AddFile(sourceFile.LocalPath); // 2. Rollback the Add SourceAdapter.Rollback(AddChangesetId, AddChangesetId); RunAndValidate(); }