コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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));
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 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);
 }
コード例 #7
0
 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);
 }
コード例 #8
0
 public static void AreEqualGlobalPathInfo(GlobalPathInfo expected, GlobalPathInfo actual)
 {
     AreEqualGlobalPathInfo(expected.AzureSdkDirectory, expected.GlobalSettings, expected.PublishSettings, actual);
 }
コード例 #9
0
 public GlobalComponents(string publishSettingsPath, string azureSdkPath)
 {
     GlobalPaths = new GlobalPathInfo(azureSdkPath);
     New(publishSettingsPath, GlobalPaths);
     Save(GlobalPaths, azureSdkPath);
 }
コード例 #10
0
 public GlobalComponents(string azureSdkPath)
 {
     GlobalPaths = new GlobalPathInfo(azureSdkPath);
     Load(GlobalPaths);
 }
コード例 #11
0
        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);
        }
コード例 #12
0
 public GlobalComponents(string publishSettingsPath, string azureSdkPath)
 {
     GlobalPaths = new GlobalPathInfo(azureSdkPath);
     New(publishSettingsPath, GlobalPaths);
     Save(GlobalPaths, azureSdkPath);
 }
コード例 #13
0
 public GlobalComponents(string azureSdkPath)
 {
     GlobalPaths = new GlobalPathInfo(azureSdkPath);
     Load(GlobalPaths);
 }
コード例 #14
0
        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);
        }
コード例 #15
0
 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);
 }