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