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