Ejemplo n.º 1
0
        public void StartsWithMappingsTest()
        {
            MigrationItemStrings fileOutSideMapping = new MigrationItemStrings("source-integration/file.txt", null, TestEnvironment, true);
            MigrationItemStrings fileUnderMapping   = new MigrationItemStrings("source/file.txt", null, TestEnvironment, true);

            TestUtils.CreateRandomFile(fileOutSideMapping.LocalPath, 10);
            TestUtils.CreateRandomFile(fileUnderMapping.LocalPath, 10);

            string mergeComment = "Migration test merge";

            SourceWorkspace.PendAdd(fileOutSideMapping.LocalPath);
            SourceWorkspace.PendAdd(fileUnderMapping.LocalPath);

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), mergeComment);

            MappingPair mapping = new MappingPair(TestEnvironment.FirstSourceServerPath + SrcPathSeparator + "source",
                                                  TestEnvironment.FirstTargetServerPath + TarPathSeparator + "source",
                                                  false);
            MappingPair mapping2 = new MappingPair(TestEnvironment.FirstSourceServerPath + SrcPathSeparator + "source-integration",
                                                   TestEnvironment.FirstTargetServerPath + TarPathSeparator + "source-integration",
                                                   false);

            TestEnvironment.Mappings.Clear();

            TestEnvironment.AddMapping(mapping);
            TestEnvironment.AddMapping(mapping2);
            RunAndValidate();
        }
Ejemplo n.º 2
0
        public void AddSourceRename()
        {
            MigrationItemStrings file = new MigrationItemStrings("file.txt", "file-renamed.txt", TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);
            SourceWorkspace.Get();
            SourceWorkspace.PendRename(file.ServerPath, file.NewServerPath);
            TestUtils.CreateRandomFile(file.LocalPath, 10);
            SourceWorkspace.PendAdd(file.LocalPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "AddSourceRename");
            RunAndValidate();
        }
Ejemplo n.º 3
0
        public void RenameAddNamespaceReuseTest()
        {
            MigrationItemStrings file = new MigrationItemStrings("a.txt", "b.txt", TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);

            SourceWorkspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            SourceWorkspace.PendRename(file.ServerPath, file.NewServerPath);

            TestUtils.CreateRandomFile(file.LocalPath, 10);

            SourceWorkspace.PendAdd(file.LocalPath);
            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "Rename a.txt to b.txt and add a.txt in the same changeset.");

            RunAndValidate();
        }
Ejemplo n.º 4
0
        public void RenameParentAddSubFolderTest()
        {
            MigrationItemStrings parentFolder = new MigrationItemStrings("parent", "new-parent", TestEnvironment, true);
            MigrationItemStrings file         = new MigrationItemStrings("filea.txt", null, TestEnvironment, true);
            MigrationItemStrings subFolder    = new MigrationItemStrings("new-parent/subdir", null, TestEnvironment, true);

            SourceAdapter.AddFolder(parentFolder.LocalPath);
            SourceAdapter.AddFile(Path.Combine(parentFolder.LocalPath, file.Name));

            SourceWorkspace.PendRename(parentFolder.ServerPath, parentFolder.NewServerPath);
            Directory.CreateDirectory(subFolder.LocalPath);
            SourceWorkspace.PendAdd(subFolder.LocalPath);
            SourceWorkspace.PendRename(Path.Combine(parentFolder.NewServerPath, file.Name), Path.Combine(subFolder.ServerPath, file.Name));

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "added a new sub folder. moved an item to the sub folder. rename parent folder");

            RunAndValidate();
        }
Ejemplo n.º 5
0
        public void RenameFolderUnderItselfTest()
        {
            MigrationItemStrings file         = new MigrationItemStrings("folder/file.txt", null, TestEnvironment, true);
            MigrationItemStrings movedFolder  = new MigrationItemStrings("folder", "temp-folder", TestEnvironment, true);
            MigrationItemStrings tempFolder   = new MigrationItemStrings("temp-folder", "folder/folder", TestEnvironment, true);
            MigrationItemStrings parentFolder = new MigrationItemStrings("folder", null, TestEnvironment, true);

            SourceAdapter.AddFile(file.LocalPath);

            SourceWorkspace.PendRename(movedFolder.ServerPath, movedFolder.NewServerPath);

            Directory.CreateDirectory(parentFolder.LocalPath);
            SourceWorkspace.PendAdd(parentFolder.LocalPath);

            SourceWorkspace.PendRename(tempFolder.ServerPath, tempFolder.NewServerPath);

            SourceWorkspace.CheckIn(SourceWorkspace.GetPendingChanges(), "Move a folder below itsself");

            RunAndValidate();
        }
Ejemplo n.º 6
0
 private void pendAdd(string localFile)
 {
     TestUtils.CreateRandomFile(localFile, 10);
     SourceWorkspace.PendAdd(localFile);
 }