public void HelperUtils_SanitizePath_Empty_ReturnNothing() { var resourceName = "warewolf-Server.log"; var resCat = HelperUtils.SanitizePath("", resourceName); Assert.AreEqual("", resCat); }
public void HelperUtils_SanitizePath_Equals_Root() { var path = "root"; var resourceName = "warewolf-Server.log"; var resCat = HelperUtils.SanitizePath(path, resourceName); Assert.AreEqual("warewolf-Server.log", resCat); }
public void HelperUtils_SanitizePath_StartsWith_Backslash() { var path = "\\\\Warewolf\\Server Log"; var resourceName = "warewolf-Server.log"; var resCat = HelperUtils.SanitizePath(path, resourceName); Assert.AreEqual("\\Warewolf\\Server Log\\warewolf-Server.log", resCat); }
public void HelperUtils_SanitizePath() { var path = "C:\\\\ProgramData\\Warewolf\\Server Log"; var resourceName = "warewolf-Server.log"; var resCat = HelperUtils.SanitizePath(path, resourceName); Assert.AreEqual("C:\\ProgramData\\Warewolf\\Server Log\\warewolf-Server.log", resCat); }
protected override void Save(IEnvironmentModel environmentModel, dynamic jsonObj) { // ReSharper disable once MaximumChainedReferences string resName = jsonObj.resourceName; string resCat = HelperUtils.SanitizePath((string)jsonObj.resourcePath, resName); var dropBoxSource = new OauthSource { Key = Token, Secret = Secret, ResourceName = resName, ResourcePath = resCat, IsNewResource = true, ResourceID = Guid.NewGuid() }.ToStringBuilder(); environmentModel.ResourceRepository.SaveResource(environmentModel, dropBoxSource, GlobalConstants.ServerWorkspaceID); }
protected override void Save(IEnvironmentModel environmentModel, dynamic jsonObj) { // ReSharper disable once MaximumChainedReferences string resName = jsonObj.resourceName; string resCat = HelperUtils.SanitizePath((string)jsonObj.resourcePath, resName); var sharepointSource = new SharepointSource { Server = Server, UserName = _userName, Password = _password, AuthenticationType = _authenticationType, ResourceName = resName, ResourcePath = resCat, IsNewResource = true, ResourceID = Guid.NewGuid() }; var source = sharepointSource.ToStringBuilder(); environmentModel.ResourceRepository.SaveResource(environmentModel, source, GlobalConstants.ServerWorkspaceID); environmentModel.ResourceRepository.ReloadResource(sharepointSource.ResourceID, ResourceType.Source, ResourceModelEqualityComparer.Current, true); }
protected override void Save(IServer server, dynamic jsonObj) { try { string resName = jsonObj.resourceName; string resCat = HelperUtils.SanitizePath((string)jsonObj.resourcePath, resName); if (_resourceModel != null) { EventPublisher.Publish(new SaveUnsavedWorkflowMessage(_resourceModel, resName, resCat, AddToTabManager)); } Close(); } catch (Exception e) { Exception e1 = new Exception("There was a problem saving. Please try again.", e); Dev2Logger.Info(e.Message + Environment.NewLine + " Stacktrace : " + e.StackTrace + Environment.NewLine + " jsonObj: " + jsonObj.ToString()); throw e1; } }