public void InstallSolution(string directory, string solutionName, string solutionVersion, string localization, uint?deployMode) { // Downloading solution manifest Console.WriteLine("Downloading solution manifest for release {0}", solutionVersion); var solutionFolder = String.Format("{0}/RADS/solutions/{1}/releases/{2}", directory, solutionName, solutionVersion); System.IO.Directory.CreateDirectory(solutionFolder); webClient.DownloadFile( String.Format("{0}/releases/{1}/solutions/{2}/releases/{3}/solutionmanifest", LeagueCDN, Platform, solutionName, solutionVersion), solutionFolder + "/solutionmanifest"); var solutionManifest = new SolutionManifest(File.ReadAllLines(solutionFolder + "/solutionmanifest")); LocalizedEntry localizedEntry = solutionManifest.LocalizedEntries.Find(x => x.Name.Equals(localization, StringComparison.InvariantCultureIgnoreCase)); if (localizedEntry != null) { // Creating configuration manifest var configurationManifest = new ConfigurationManifest(localizedEntry); configurationManifest.Write(solutionFolder + "/configurationmanifest"); // Downloading each project foreach (SolutionProject project in localizedEntry.Projects) { InstallProject(directory, project.Name, project.Version, deployMode, solutionName, solutionVersion); } File.Create(solutionFolder + "/S_OK").Close(); } }
public void Invalid_manifest_should_throw_error_if_solution_name_is_not_populated() { var manifest = new ConfigurationManifest(); var validator = new ConfigurationManifestValidator(); var result = validator.Validate(manifest); result.IsValid.Should().Be(false, "solution name is mandatory"); }
public void Valid_manifest_should_return_valid_result() { var manifest = new ConfigurationManifest() { SolutionName = "TestSolution1" }; var validator = new ConfigurationManifestValidator(); var result = validator.Validate(manifest); result.IsValid.Should().Be(true, "solution name is only mandatory field"); }
public string GetFileURI(ConfigurationManifest config, string path = null) { var FilePath = path != null ? path : config.ServerURL; if (IsLocalPath(FilePath)) { return(FilePath); } else { return(DownloadRemoteUpdate(config, path)); } }
private string DownloadRemoteUpdate(ConfigurationManifest config, string fpath) { var path = string.Empty; if (config.WorkingDir != null) { path = config.WorkingDir; } using (var client = new WebClient()){ if (config.ConnectionInfo.UserName != null && config.ConnectionInfo.Password != null) { client.Credentials = new NetworkCredential(config.ConnectionInfo.UserName, config.ConnectionInfo.Password); } client.DownloadFile(config.ServerURL, path); return(path); } }