public void CreateDefaultProfile_WithNsWithoutProfileTag_AddsProfileTagsWithNamespace() { string fullPath; _settings = ReadTestSettings("test-settings-with-namespace.xml", out fullPath); Assert.IsNotNull(_settings); SettingsUtil.GetDefaultProfile(_settings, true); SettingsUtil.MergeSettings(_settings, fullPath); _namespaceManager.AddNamespace("settings", SettingsUtil.MavenSettingsNamespace); XmlDocument afterXd = new XmlDocument(_nameTable); afterXd.Load(fullPath); assertNodeExists(afterXd, "/settings:settings"); assertNodeExists(afterXd, "/settings:settings/settings:profiles"); assertNodeExists(afterXd, "/settings:settings/settings:profiles/settings:profile[settings:id='" + SettingsUtil.defaultProfileID + "']"); assertNodeExists(afterXd, "/settings:settings/settings:activeProfiles"); assertNodeExists(afterXd, "/settings:settings/settings:activeProfiles/settings:activeProfile[text()='" + SettingsUtil.defaultProfileID + "']"); }
private void executeRepoUpdate() { if (string.IsNullOrEmpty(RepoCombo.Text)) { MessageBox.Show("Sorry, Repository cannot be blank.", "Repository Configuration", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { string selectedUrl = RepoCombo.Text; // verify if URL is accessible try { if (selectedUrl.Contains("file:///")) { verifyFileProtocol(selectedUrl); } else { verifyRemoteAccess(selectedUrl); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Repository Configuration", MessageBoxButtons.OK, MessageBoxIcon.Warning); artifactTabControl.SelectedIndex = 2; RepoCombo.Text = string.Empty; return; } // add repository to profile NPanday.Model.Settings.Repository repo = SettingsUtil.SetProfileRepository(getDefaultProfile(), selectedUrl, checkBoxRelease.Checked, checkBoxSnapshot.Checked); selectedRepoUrl = selectedUrl; // set the mirror too SettingsUtil.SetMirrorUrl(settings, selectedUrl); // make NPanday.id profile active SettingsUtil.AddActiveProfile(settings, SettingsUtil.defaultProfileID); // write to Settings.xml SettingsUtil.MergeSettings(settings, settingsPath); // do not specify SelectedUrl to suppress SelectedIndexChanged event repoCombo_Refresh(null); MessageBox.Show(this, "Successfully Changed Remote Repository.", "Repository Configuration"); //localListView_Refresh(); } }
public void CreateDefaultProfile_WithoutNsAndProfileTag_AddsProfileTagsWithoutNamespace() { string fullPath; _settings = ReadTestSettings("test-settings.xml", out fullPath); Assert.IsNotNull(_settings); SettingsUtil.GetDefaultProfile(_settings, true); SettingsUtil.MergeSettings(_settings, fullPath); XmlDocument afterXd = new XmlDocument(); afterXd.Load(fullPath); assertNodeExists(afterXd, "/settings/profiles"); assertNodeExists(afterXd, "/settings/profiles/profile[id='" + SettingsUtil.defaultProfileID + "']"); assertNodeExists(afterXd, "/settings/activeProfiles"); assertNodeExists(afterXd, "/settings/activeProfiles/activeProfile[text()='" + SettingsUtil.defaultProfileID + "']"); }
private void ReadWrite_LeavesContentUnchanged(string testSettingsXml) { string fullPath; _settings = ReadTestSettings(testSettingsXml, out fullPath); Console.WriteLine("file:///" + new Uri(fullPath).AbsolutePath); Assert.IsNotNull(_settings); XmlDocument beforeXd = new XmlDocument(); beforeXd.Load(fullPath); string before = beforeXd.OuterXml; SettingsUtil.MergeSettings(_settings, fullPath); XmlDocument afterXd = new XmlDocument(); afterXd.Load(fullPath); string after = afterXd.OuterXml; Assert.AreEqual(before, after); }