コード例 #1
0
        public void Success_AlreadyOnIt()
        {
            // Setup
            var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath;

            MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath);
            MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, LcmCache.ModelVersion);
            MercurialTestHelper.CreateFlexRepo(lDProjectFolderPath);

            // Execute
            _EnsureCloneAction.Run(_lfProject);

            // Verify
            Assert.That(_env.Logger.GetErrors(), Is.Empty);
            Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.CLONED));
            Assert.That(ModelVersion, Is.EqualTo(LcmCache.ModelVersion));
            Assert.That(Directory.Exists(_lfProject.ProjectDir), Is.True);
        }
コード例 #2
0
        public void Error_NoCommitsInRepository()
        {
            // Setup
            // Create a hg repo that doesn't contain a branch for the current model version
            var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath;

            MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath);
            MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, LcmCache.ModelVersion);

            // Execute
            _EnsureCloneAction.Run(_lfProject);

            // Verify
            Assert.That(_env.Logger.GetErrors(), Does.Contain("new repository with no commits"));
            Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.ERROR));
            Assert.That(ModelVersion, Is.EqualTo(0));
            Assert.That(Directory.Exists(_lfProject.ProjectDir), Is.False);
        }
コード例 #3
0
        public void Error_NoCommitsInRepository()
        {
            // Setup
            // Create a empty hg repo
            var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath;

            MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath);
            MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, LcmCache.ModelVersion);
            MercurialTestHelper.CloneRepo(lDProjectFolderPath, _lfProject.ProjectDir);
            LanguageDepotMock.Server.Start();

            // Execute
            _synchronizeAction.Run(_lfProject);

            // Verify
            Assert.That(_env.Logger.GetErrors(),
                        Does.Contain("Cannot do first commit."));
            Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.HOLD));
        }
コード例 #4
0
        public void Error_NoBranch_OlderSupportedBranch()
        {
            // Setup
            // Create a hg repo that doesn't contain a branch for the current model version
            var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath;

            MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath);
            MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, 7000065);             // simulate a too old version
            MercurialTestHelper.CreateFlexRepo(lDProjectFolderPath);
            MagicStrings.SetMinimalModelVersion(7000065);

            // Execute
            _EnsureCloneAction.Run(_lfProject);

            // Verify
            Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.CLONING));
            Assert.That(ModelVersion, Is.EqualTo(7000065));
            Assert.That(Directory.Exists(_lfProject.ProjectDir), Is.True);
        }
コード例 #5
0
        public void Error_CloneHasHigherModelVersion()
        {
            // Setup
            var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath;

            MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath);
            MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, LcmCache.ModelVersion);
            MercurialTestHelper.CreateFlexRepo(lDProjectFolderPath);
            MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, 7600000);
            MercurialTestHelper.HgCommit(lDProjectFolderPath, "on branch");

            // Execute
            _EnsureCloneAction.Run(_lfProject);

            // Verify
            Assert.That(_env.Logger.GetErrors(), Does.Contain("clone has higher model"));
            Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.ERROR));
            Assert.That(ModelVersion, Is.EqualTo(0));
            Assert.That(Directory.Exists(_lfProject.ProjectDir), Is.False);
        }
コード例 #6
0
        public void Error_NotAFlexProject()
        {
            // Setup
            // Create a non-FLEx hg repo (in this case an empty repo)
            var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath;

            MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath);
            File.WriteAllText(Path.Combine(lDProjectFolderPath, "some.file"),
                              "just a test file");
            MercurialTestHelper.HgCommit(lDProjectFolderPath, "Initial commit");

            // Execute
            _EnsureCloneAction.Run(_lfProject);

            // Verify
            Assert.That(_env.Logger.GetErrors(), Does.Contain("clone is not a FLEx project"));
            Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.ERROR));
            Assert.That(ModelVersion, Is.EqualTo(0));
            Assert.That(Directory.Exists(_lfProject.ProjectDir), Is.False);
        }
コード例 #7
0
        public void Error_NewerBranch()
        {
            // Setup
            var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath;

            MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath);
            MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, LcmCache.ModelVersion);
            MercurialTestHelper.CreateFlexRepo(lDProjectFolderPath);
            MercurialTestHelper.CloneRepo(lDProjectFolderPath, _lfProject.ProjectDir);
            // Simulate a user with a newer FLEx version doing a S/R
            MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, 7600000);
            MercurialTestHelper.HgCommit(lDProjectFolderPath, "Commit with newer FLEx version");
            LanguageDepotMock.Server.Start();

            // Execute
            _synchronizeAction.Run(_lfProject);

            // Verify
            Assert.That(_env.Logger.GetMessages(), Does.Contain("Allow data migration for project"));
            Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.SYNCING));
        }
コード例 #8
0
        public void Error_DifferentBranch()
        {
            // Setup
            // Create a hg repo that doesn't contain a branch for the current model version
            const int modelVersion = 7000067;

            MagicStrings.SetMinimalModelVersion(modelVersion);
            var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath;

            MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath);
            MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, modelVersion);
            MercurialTestHelper.CreateFlexRepo(lDProjectFolderPath, modelVersion);
            MercurialTestHelper.CloneRepo(lDProjectFolderPath, _lfProject.ProjectDir);
            LanguageDepotMock.Server.Start();

            // Execute
            _synchronizeAction.Run(_lfProject);

            // Verify
            Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.SYNCING));
            Assert.That(ModelVersion, Is.EqualTo(modelVersion));
        }
コード例 #9
0
        public void Error_NoBranch_UnsupportedBranch()
        {
            // Setup
            // Create a hg repo that doesn't contain a branch for the current model version
            var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath;

            MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath);
            MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, 7000060);             // simulate a too old version
            MercurialTestHelper.CreateFlexRepo(lDProjectFolderPath);
            MagicStrings.SetMinimalModelVersion(7000068);

            // Execute
            _EnsureCloneAction.Run(_lfProject);

            // Verify
            Assert.That(_env.Logger.GetErrors(), Does.Contain("no such branch"));
            Assert.That(_env.Logger.GetErrors(), Does.Contain(
                            "clone model version '7000060' less than minimal supported model version '7000068'."));
            Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.ERROR));
            Assert.That(ModelVersion, Is.EqualTo(0));
            Assert.That(Directory.Exists(_lfProject.ProjectDir), Is.False);
        }