internal void Load(GlobalPathInfo paths) { Validate.ValidateNullArgument(paths, string.Empty); Validate.ValidateDirectoryExists(paths.AzureSdkDirectory, Resources.GlobalComponents_Load_PublishSettingsNotFound); Validate.ValidateFileExists(paths.GlobalSettings, string.Format(Resources.PathDoesNotExistForElement, Resources.SettingsFileName, paths.GlobalSettings)); Validate.ValidateFileExists(paths.PublishSettings, string.Format(Resources.PathDoesNotExistForElement, Resources.PublishSettingsFileName, paths.PublishSettings)); PublishSettings = General.DeserializeXmlFile <PublishData>(paths.PublishSettings); Certificate = General.GetCertificateFromStore(PublishSettings.Items[0].ManagementCertificate); GlobalSettings = ServiceSettings.Load(paths.GlobalSettings); }
internal void Load(GlobalPathInfo paths) { Validate.ValidateNullArgument(paths, string.Empty); Validate.ValidateDirectoryExists(paths.AzureSdkDirectory, Resources.GlobalComponents_Load_PublishSettingsNotFound); Validate.ValidateFileExists(paths.GlobalSettings, string.Format(Resources.PathDoesNotExistForElement, Resources.SettingsFileName, paths.GlobalSettings)); Validate.ValidateFileExists(paths.PublishSettings, string.Format(Resources.PathDoesNotExistForElement, Resources.PublishSettingsFileName, paths.PublishSettings)); PublishSettings = General.DeserializeXmlFile<PublishData>(paths.PublishSettings); Certificate = General.GetCertificateFromStore(PublishSettings.Items[0].ManagementCertificate); GlobalSettings = ServiceSettings.Load(paths.GlobalSettings); }
public void ImportAzurePublishSettingsProcessTests() { GlobalPathInfo globalPathInfo = new GlobalPathInfo(Data.AzureSdkAppDir); foreach (string filePath in Data.ValidPublishSettings) { new ImportAzurePublishSettingsCommand().ImportAzurePublishSettingsProcess(filePath, Data.AzureSdkAppDir); PublishData expectedPublishSettings = General.DeserializeXmlFile<PublishData>(filePath); PublishData actualPublishSettings = General.DeserializeXmlFile<PublishData>(globalPathInfo.PublishSettings); string thmbprint = actualPublishSettings.Items[0].ManagementCertificate; AzureAssert.AreEqualGlobalComponents(thmbprint, globalPathInfo, new ServiceSettings(), actualPublishSettings, new GlobalComponents(Data.AzureSdkAppDir)); } }
internal void Save(GlobalPathInfo paths, string azureSdkPath) { // Create new AzureSDK directory if doesn't exist // Directory.CreateDirectory(azureSdkPath); // Save *.publishsettings // General.SerializeXmlFile <PublishData>(PublishSettings, paths.PublishSettings); // Save global settings // GlobalSettings.Save(paths.GlobalSettings); }
private void New(string publishSettingsPath, GlobalPathInfo paths) { Validate.ValidateNullArgument(paths, string.Empty); Validate.ValidateStringIsNullOrEmpty(paths.AzureSdkDirectory, Resources.AzureSdkDirectoryName); Validate.ValidateFileFull(publishSettingsPath, Resources.PublishSettings); Validate.ValidateFileExtention(publishSettingsPath, Resources.PublishSettingsFileExtention); PublishSettings = General.DeserializeXmlFile <PublishData>(publishSettingsPath, string.Format(Resources.InvalidPublishSettingsSchema, publishSettingsPath)); Certificate = new X509Certificate2(Convert.FromBase64String(PublishSettings.Items[0].ManagementCertificate), string.Empty); PublishSettings.Items[0].ManagementCertificate = Certificate.Thumbprint; GlobalSettings = new ServiceSettings(); General.AddCertificateToStore(Certificate); }
public static void AreEqualGlobalComponents(string thumbprint, GlobalPathInfo paths, ServiceSettings globalSettings, PublishData publishSettings, GlobalComponents actual) { AreEqualGlobalPathInfo(paths, actual.GlobalPaths); AreEqualServiceSettings(globalSettings, actual.GlobalSettings); AreEqualPublishSettings(thumbprint, publishSettings, actual); }
public static void AreEqualGlobalPathInfo(string azureSdkPath, string globalSettings, string publishSettings, GlobalPathInfo actual) { Assert.AreEqual<string>(globalSettings, actual.GlobalSettings); Assert.AreEqual<string>(publishSettings, actual.PublishSettings); Assert.AreEqual<string>(azureSdkPath, actual.AzureSdkDirectory); }
public static void AreEqualGlobalPathInfo(GlobalPathInfo expected, GlobalPathInfo actual) { AreEqualGlobalPathInfo(expected.AzureSdkDirectory, expected.GlobalSettings, expected.PublishSettings, actual); }
public GlobalComponents(string publishSettingsPath, string azureSdkPath) { GlobalPaths = new GlobalPathInfo(azureSdkPath); New(publishSettingsPath, GlobalPaths); Save(GlobalPaths, azureSdkPath); }
public GlobalComponents(string azureSdkPath) { GlobalPaths = new GlobalPathInfo(azureSdkPath); Load(GlobalPaths); }
internal void Save(GlobalPathInfo paths, string azureSdkPath) { // Create new AzureSDK directory if doesn't exist // Directory.CreateDirectory(azureSdkPath); // Save *.publishsettings // General.SerializeXmlFile<PublishData>(PublishSettings, paths.PublishSettings); // Save global settings // GlobalSettings.Save(paths.GlobalSettings); }
private void New(string publishSettingsPath, GlobalPathInfo paths) { Validate.ValidateNullArgument(paths, string.Empty); Validate.ValidateStringIsNullOrEmpty(paths.AzureSdkDirectory, Resources.AzureSdkDirectoryName); Validate.ValidateFileFull(publishSettingsPath, Resources.PublishSettings); Validate.ValidateFileExtention(publishSettingsPath, Resources.PublishSettingsFileExtention); PublishSettings = General.DeserializeXmlFile<PublishData>(publishSettingsPath, string.Format(Resources.InvalidPublishSettingsSchema, publishSettingsPath)); Certificate = new X509Certificate2(Convert.FromBase64String(PublishSettings.Items[0].ManagementCertificate), string.Empty); PublishSettings.Items[0].ManagementCertificate = Certificate.Thumbprint; GlobalSettings = new ServiceSettings(); General.AddCertificateToStore(Certificate); }
public void GlobalPathInfoTests() { GlobalPathInfo pathInfo = new GlobalPathInfo(Data.AzureSdkAppDir); string azureSdkPath = Data.AzureSdkAppDir; AzureAssert.AreEqualGlobalPathInfo(azureSdkPath, Path.Combine(azureSdkPath, Resources.SettingsFileName), Path.Combine(azureSdkPath, Resources.PublishSettingsFileName), pathInfo); }