public void StatusCache_PhysicalAdd_IsValid() { // Arrange var rootPath = SvnManager.GetRoot(UnitTestPath); // Act if (SvnManager.IsWorkingCopy(rootPath)) { SvnManager.LoadCurrentSvnItemsInLocalRepository(rootPath); } var mappingsBefore = SvnManager.GetMappings(); int countBefore = mappingsBefore.Count; var physicalAddFile = new FileInfo(Path.Combine(UnitTestPath, countBefore + "_PhysicalAdd.txt")); physicalAddFile.Create(); Thread.Sleep(2000); var mappingsAfter = SvnManager.GetMappings(); int countAfter = mappingsAfter.Count; // Assert foreach (var item in mappingsAfter) { if (physicalAddFile.ToString() == item.Key) { item.Value.Status.LocalNodeStatus.Should().Be(SvnStatus.NotVersioned); } } }
public void StatusCache_PhysicalDeleteNormal_IsValid() { // Arrange var rootPath = SvnManager.GetRoot(UnitTestPath); // Act if (SvnManager.IsWorkingCopy(rootPath)) { SvnManager.LoadCurrentSvnItemsInLocalRepository(rootPath); } var mappingsBefore = SvnManager.GetMappings(); int countBefore = mappingsBefore.Count; var physicalDeleteNormalFile = new FileInfo(Path.Combine(UnitTestPath, countBefore + "_PhysicalDeleteNormal.txt")); var myFile = File.Create(physicalDeleteNormalFile.ToString()); myFile.Close(); Thread.Sleep(500); physicalDeleteNormalFile.Delete(); Thread.Sleep(2000); var mappings = SvnManager.GetMappings(); // Assert foreach (var item in mappings) { if (physicalDeleteNormalFile.ToString() == item.Key) { item.Value.Status.LocalNodeStatus.Should().Be(SvnStatus.Missing); } } }
private List <string> GetTestsPackages(List <string> packeges, string testPackagesSetting, string testPackegeSuffix, string svnUrl) { var result = new List <string>(); var svnManager = new SvnManager(Context.Settings.SvnUserName, Context.Settings.SvnUserPassword); var directories = svnManager.GetDirectories(svnUrl); if (string.Equals(testPackagesSetting.Trim(), "*")) { foreach (var packege in packeges) { var testPackageName = packege + testPackegeSuffix; if (directories.Contains(testPackageName)) { result.Add(testPackageName); } } return(result); } else { var packages = SplitPackegesSetting(testPackagesSetting); foreach (var package in packages) { if (directories.Contains(package)) { result.Add(package); } } return(result); } }
private void ValidateSvn() { try { var svnManager = new SvnManager(Context.Settings.SvnUserName, Context.Settings.SvnUserPassword); svnManager.Ping(Context.Settings.CorePath); } catch (Exception ex) { throw new SoftCommonException($@"Can'not ping svn server. Check your credentials. '{ex.Message}'"); } }
protected override void InternalExecute(Context context) { Logger.WriteCommand("Checkout core"); var projectDirectoryPath = Path.Combine(Context.Settings.ProjectsPath, Context.ProjectDirectoryName); var svnManager = new SvnManager(context.Settings.SvnUserName, context.Settings.SvnUserPassword); svnManager.Checkout(Context.Settings.CorePath, Context.BuildCoreRevision, projectDirectoryPath); Logger.WriteCommandSuccess(); }
public void LoadRepository_WorkingCopy_IsValid() { // Arrange SvnManager.BuildUnitTestRepo(MainViewModel.LocalWorkingLocation, UnitTestFolder); // Act var isWorkingCopy = SvnManager.IsWorkingCopy(SvnManager.GetRoot(UnitTestPath)); // Assert isWorkingCopy.Should().BeTrue(); }
public void SvnStatus_SvnUnLock_IsValid() { // Arrange var rootPath = SvnManager.GetRoot(UnitTestPath); // Act if (SvnManager.IsWorkingCopy(rootPath)) { SvnManager.LoadCurrentSvnItemsInLocalRepository(rootPath); } var mappingsBefore = SvnManager.GetMappings(); int countBefore = mappingsBefore.Count; var svnUnLock = new FileInfo(Path.Combine(UnitTestPath, countBefore + "_SvnUnLock.txt")); var myFile = File.Create(svnUnLock.ToString()); myFile.Close(); Thread.Sleep(2000); SvnManager.Add(svnUnLock.ToString()); Thread.Sleep(500); SvnManager.Commit(svnUnLock.ToString(), "Unit Test lock"); Thread.Sleep(2000); SvnManager.Lock(svnUnLock.ToString(), "Locking Test"); Thread.Sleep(1000); var mappingsAfter = SvnManager.GetMappings(); int countAfter = mappingsAfter.Count; foreach (var item in mappingsAfter) { if (svnUnLock.ToString() == item.Key) { if (item.Value.Status.IsLockedLocal) { SvnManager.ReleaseLock(svnUnLock.ToString()); } } } Thread.Sleep(500); // Assert countBefore.Should().BeLessThan(countAfter); foreach (var item in mappingsAfter) { if (svnUnLock.ToString() == item.Key) { item.Value.Status.LocalNodeStatus.Should().Be(SvnStatus.Normal); item.Value.Status.IsLockedLocal.Should().BeFalse(); } } }
protected override void InternalExecute(Context context) { if (!context.Settings.ClearSvnAuthenticationCache) { return; } Logger.WriteCommand("Delete Svn authentication cached items"); var svnManager = new SvnManager(context.Settings.SvnUserName, context.Settings.SvnUserPassword); svnManager.DeletenAuthenticationCachedItems(); Logger.WriteCommandSuccess(); }
private List <string> GetInstallScripts() { var svnManager = new SvnManager(Context.Settings.SvnUserName, Context.Settings.SvnUserPassword); var fileManager = new FileManager(); var tempDirectoryPath = fileManager.CreateTempFolder(); svnManager.Checkout(Context.Settings.TSqltPath, tempDirectoryPath); List <string> contents = GetFilesContent(tempDirectoryPath); Directory.Delete(tempDirectoryPath, true); return(contents); }
private void ConnectToRepository(string storagePath) { if (string.IsNullOrEmpty(storagePath)) { // Unsaved project return; } _svnManager = new SvnManager(); if (_svnManager.IsWorkingCopy(Path.GetDirectoryName(storagePath))) { _svnManager.LoadCurrentSvnItemsInLocalRepository(Path.GetDirectoryName(storagePath)); } _svnManager.SvnStatusUpdatedEvent += SvnManagerOnSvnStatusUpdatedEvent; }
static string ComposeBuildPath() { string buildPath = buildTargetPath[(int)Version] + string.Format("_Build{0:yyMMddHHmm}", DateTime.Now); // string[] args = Environment.GetCommandLineArgs(); // int len = args.Length; // if(args[len-1].IndexOf("BuildVersion") != -1) { SvnManager manager = new SvnManager("Assets"); string revisionNumber = manager.RevisionNumber; buildPath += "_Ver0." + revisionNumber; } buildPath += "/"; return(buildPath); }
public SvnStatusCache(bool shell, SvnManager svnManager) { _client = new SvnClient(); Map = new Dictionary <string, SvnItem>(StringComparer.OrdinalIgnoreCase); DirectoryMap = new Dictionary <string, SvnDirectory>(StringComparer.OrdinalIgnoreCase); _usingShell = shell; if (_usingShell) { //InitializeShellMonitor(); } else { _statusFileSystemWatcher = new SvnStatusFileSystemWatcher(svnManager); } }
public void StatusCache_SvnRenameCommittedFile_IsValid() { // Arrange var rootPath = SvnManager.GetRoot(UnitTestPath); // Act if (SvnManager.IsWorkingCopy(rootPath)) { SvnManager.LoadCurrentSvnItemsInLocalRepository(rootPath); } var mappingsBefore = SvnManager.GetMappings(); int countBefore = mappingsBefore.Count; var svnRenameCommittedFile = new FileInfo(Path.Combine(UnitTestPath, countBefore + "_SvnRenameCommittedFile.txt")); var myFile = File.Create(svnRenameCommittedFile.ToString()); myFile.Close(); Thread.Sleep(2000); SvnManager.Add(svnRenameCommittedFile.ToString()); Thread.Sleep(500); SvnManager.Commit(svnRenameCommittedFile.ToString(), "Unit Test"); Thread.Sleep(2000); var mappingsAfter = SvnManager.GetMappings(); int countAfter = mappingsAfter.Count; var fiNew = new FileInfo(Path.Combine(UnitTestPath, countAfter + "SvnRename_SvnRenameCommittedFile.txt")); SvnManager.SvnRename(svnRenameCommittedFile.ToString(), fiNew.ToString()); Thread.Sleep(1000); // Assert foreach (var item in mappingsAfter) { if (svnRenameCommittedFile.ToString() == item.Key) { item.Value.Status.LocalNodeStatus.Should().Be(SvnStatus.Deleted); } if (fiNew.ToString() == item.Key) { item.Value.Status.LocalNodeStatus.Should().Be(SvnStatus.Added); } } }
private void CheckoutProjects(IEnumerable <string> packages) { var svnManager = new SvnManager(Context.Settings.SvnUserName, Context.Settings.SvnUserPassword); foreach (var package in packages) { var projectDirectoryPath = Path.Combine(Context.Settings.ProjectsPath, Context.ProjectDirectoryName); var testDirectoryPath = Path.Combine(projectDirectoryPath, BpmonlineConstants.ConfigurationCsUnitTestsPath, package); if (Directory.Exists(testDirectoryPath)) { Directory.Delete(testDirectoryPath, true); } Directory.CreateDirectory(testDirectoryPath); var projectUrl = Context.Settings.UnitTestsPath + "/" + package; svnManager.Checkout(projectUrl, testDirectoryPath); } }
private void ValidateInfrastructureConsole() { var infrastructureConsoleDirectoryPath = Path.Combine(Context.Settings.ProjectsPath, InfrastructureConsoleConstants.DirectoryName); if (Directory.Exists(infrastructureConsoleDirectoryPath)) { var consoleFilePath = Path.Combine(infrastructureConsoleDirectoryPath, InfrastructureConsoleConstants.ConsoleRelativePath); if (!File.Exists(consoleFilePath)) { Directory.Delete(infrastructureConsoleDirectoryPath, true); } } if (!Directory.Exists(infrastructureConsoleDirectoryPath)) { Directory.CreateDirectory(infrastructureConsoleDirectoryPath); Logger.WriteCommandAddition($"Directory '{infrastructureConsoleDirectoryPath}' has been created"); var svnManager = new SvnManager(Context.Settings.SvnUserName, Context.Settings.SvnUserPassword); svnManager.Checkout(Context.Settings.InfrastructureConsolePath, infrastructureConsoleDirectoryPath); } }
public void StatusCache_PhysicallyRenameNormal_isValid() { // Arrange var rootPath = SvnManager.GetRoot(UnitTestPath); // Act if (SvnManager.IsWorkingCopy(rootPath)) { SvnManager.LoadCurrentSvnItemsInLocalRepository(rootPath); } var mappingsBefore = SvnManager.GetMappings(); int countBefore = mappingsBefore.Count; var physicalRenameFile = new FileInfo(Path.Combine(UnitTestPath, countBefore + "_PhysicallyRenameNormal.txt")); var physicalRenameFileNew = new FileInfo(Path.Combine(UnitTestPath, (countBefore + 1) + "Renamed" + "_PhysicallyRenameNormalRenamed.txt")); var myFile = File.Create(physicalRenameFile.ToString()); myFile.Close(); Thread.Sleep(2000); SvnManager.Add(physicalRenameFile.ToString()); Thread.Sleep(500); SvnManager.Commit(physicalRenameFile.ToString(), "Unit Test"); Thread.Sleep(2000); System.IO.File.Move(physicalRenameFile.ToString(), physicalRenameFileNew.ToString()); Thread.Sleep(2000); var mappingsAfter = SvnManager.GetMappings(); int countAfter = mappingsAfter.Count; // Assert foreach (var item in mappingsAfter) { if (physicalRenameFile.ToString() == item.Key) { item.Value.Status.LocalNodeStatus.Should().Be(SvnStatus.Missing); } else if (physicalRenameFileNew.ToString() == item.Key) { item.Value.Status.LocalNodeStatus.Should().Be(SvnStatus.NotVersioned); } } }
public void LoadRepository_Load_IsValid() { // Arrange var rootPath = SvnManager.GetRoot(UnitTestPath); // Act var isWorkingCopy = SvnManager.IsWorkingCopy(rootPath); if (isWorkingCopy) { SvnManager.LoadCurrentSvnItemsInLocalRepository(rootPath); } var mappedItems = SvnManager.GetMappings(); // Assert isWorkingCopy.Should().BeTrue(); mappedItems.Count.Should().BeGreaterThan(0); }
public void SvnManagement_Checkout_IsValid() { // Arrange bool assertVal = false; SvnManager.BuildUnitTestRepo(MainViewModel.LocalWorkingLocation, UnitTestFolder); // Act if (SvnManager.CheckOut(UnitTestPath)) { SvnManager.LoadCurrentSvnItemsInLocalRepository(UnitTestPath); assertVal = true; } // Assert assertVal.Should().BeTrue(); }
public virtual void SetUp() { ClearAll(); MockDispatcher = new MockDispatcher(); Ioc.RegisterSingleton <IMvxViewDispatcher>(MockDispatcher); Ioc.RegisterSingleton <IMvxMainThreadDispatcher>(MockDispatcher); Ioc.RegisterSingleton <IMvxStringToTypeParser>(new MvxStringToTypeParser()); //var messenger = new MvxMessengerHub(); //Ioc.RegisterSingleton<IMvxMessenger>(messenger); SvnManager = new SvnManager(); Ioc.RegisterSingleton <SvnManager>(SvnManager); MainViewModel = new MainViewModel(); UnitTestPath = Path.Combine(MainViewModel.LocalWorkingLocation, UnitTestFolder); Ioc.RegisterSingleton <IMvxTrace>(new TestTrace()); Ioc.RegisterSingleton <IMvxSettings>(new MvxSettings()); Initialize(); CreateTestableObject(); }
private void CheckoutProjects(Dictionary <string, List <string> > repos) { var svnManager = new SvnManager(Context.Settings.SvnUserName, Context.Settings.SvnUserPassword); foreach (var repo in repos) { foreach (var package in repo.Value) { var projectDirectoryPath = Path.Combine(Context.Settings.ProjectsPath, Context.ProjectDirectoryName); var testDirectoryPath = Path.Combine(projectDirectoryPath, BpmonlineConstants.ConfigurationCsUnitTestsPath, package); if (Directory.Exists(testDirectoryPath)) { Directory.Delete(testDirectoryPath, true); } Directory.CreateDirectory(testDirectoryPath); var projectUrl = repo.Key + "/" + package; svnManager.Checkout(projectUrl, testDirectoryPath); } } }
public SvnStatusFileSystemWatcher(SvnManager svnManagerObjectSvnManager) { _svnManager = svnManagerObjectSvnManager; }