Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
        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));
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 8
0
 public static void AreEqualGlobalPathInfo(GlobalPathInfo expected, GlobalPathInfo actual)
 {
     AreEqualGlobalPathInfo(expected.AzureSdkDirectory, expected.GlobalSettings, expected.PublishSettings, actual);
 }
Exemplo n.º 9
0
 public GlobalComponents(string publishSettingsPath, string azureSdkPath)
 {
     GlobalPaths = new GlobalPathInfo(azureSdkPath);
     New(publishSettingsPath, GlobalPaths);
     Save(GlobalPaths, azureSdkPath);
 }
Exemplo n.º 10
0
 public GlobalComponents(string azureSdkPath)
 {
     GlobalPaths = new GlobalPathInfo(azureSdkPath);
     Load(GlobalPaths);
 }
Exemplo n.º 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);
        }
Exemplo n.º 12
0
 public GlobalComponents(string publishSettingsPath, string azureSdkPath)
 {
     GlobalPaths = new GlobalPathInfo(azureSdkPath);
     New(publishSettingsPath, GlobalPaths);
     Save(GlobalPaths, azureSdkPath);
 }
Exemplo n.º 13
0
 public GlobalComponents(string azureSdkPath)
 {
     GlobalPaths = new GlobalPathInfo(azureSdkPath);
     Load(GlobalPaths);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }