示例#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());
        }
示例#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);
        }
示例#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());
            }
        }
示例#4
0
 public void TestToJson()
 {
     Assert.Equal(JObject.Parse(_deplymentConfigJson).ToString(), JObject.Parse(_deploymentConfig.RawData()).ToString());
 }
示例#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()));
        }
示例#7
0
 public Task PublishDeploymentConfig(DeploymentConfig deploymentConfig)
 {
     File.WriteAllText(_deploymentConfigPath, deploymentConfig.RawData());
     return(Task.CompletedTask);
 }