Esempio n. 1
0
        public async Task TestPublishThenFetchDeploymentConfig()
        {
            string           data             = File.ReadAllText(_deploymentConfigFilePath);
            DeploymentConfig deploymentConfig = new DeploymentConfig(data);
            await _deploymentRepository.PublishDeploymentConfig(deploymentConfig);

            DeploymentConfig newDeploymentConfig = await _deploymentRepository.FetchDeploymentConfig();

            Assert.Equal(deploymentConfig.RawData(), newDeploymentConfig.RawData());
        }
Esempio n. 2
0
        private async Task <DeploymentConfig> FetchDeploymentConfig(StorageAccountConnectionInfo connectionInfo)
        {
            string path = GetDeploymentConfigLocalPath(connectionInfo.AccountName);

            if (File.Exists(path))
            {
                return(new DeploymentConfig(File.ReadAllText(path)));
            }
            IDeploymentRepository connection       = _deploymentRepositoryManager.GetRepository(connectionInfo);
            DeploymentConfig      deploymentConfig = await connection.FetchDeploymentConfig();

            SaveLocalDeploymentConfig(connectionInfo, deploymentConfig.RawData());
            return(deploymentConfig);
        }
Esempio n. 3
0
        private async void OnSyncFromBlob(object sender, RoutedEventArgs e)
        {
            MessageBoxResult res = MessageBox.Show("This will ovewrite any local changes\n\n Are you sure you want to continue?",
                                                   "Sync From Blob", MessageBoxButton.YesNo);

            if (res == MessageBoxResult.Yes)
            {
                StorageAccountConnectionInfo connectionInfo   = GetCurrentConnection();
                IDeploymentRepository        connection       = _deploymentRepositoryManager.GetRepository(connectionInfo);
                DeploymentConfig             deploymentConfig = await connection.FetchDeploymentConfig();

                SaveLocalDeploymentConfig(connectionInfo, deploymentConfig.RawData());
            }
        }
Esempio n. 4
0
 public void TestToJson()
 {
     Assert.Equal(JObject.Parse(_deplymentConfigJson).ToString(), JObject.Parse(_deploymentConfig.RawData()).ToString());
 }
Esempio n. 5
0
        private void SaveLocalDeploymentConfig(StorageAccountConnectionInfo connectionInfo)
        {
            string json = _deploymentConfig.RawData();

            SaveLocalDeploymentConfig(connectionInfo, json);
        }
        public Task PublishDeploymentConfig(DeploymentConfig deploymentConfig)
        {
            CloudBlockBlob blob = _blobContainer.GetBlockBlobReference(Constants.DeploymentConfigFileName);

            return(blob.UploadTextAsync(deploymentConfig.RawData()));
        }
Esempio n. 7
0
 public Task PublishDeploymentConfig(DeploymentConfig deploymentConfig)
 {
     File.WriteAllText(_deploymentConfigPath, deploymentConfig.RawData());
     return(Task.CompletedTask);
 }