Пример #1
0
        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.AddRepositoryToProfile(getDefaultProfile(), selectedUrl, checkBoxRelease.Checked, checkBoxSnapshot.Checked);
                selectedRepoUrl = 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();
            }
        }
Пример #2
0
        public void AddRepository_NoProfileTag__AddsRepoToModel()
        {
            _settings = ReadTestSettings("test-settings.xml");

            Profile profile = SettingsUtil.GetDefaultProfile(_settings, true);

            Assert.IsNotNull(profile);
            SettingsUtil.AddRepositoryToProfile(profile, _repoUrl1, true, false);

            Assert.AreEqual(1, _settings.profiles.Length, "Settings does not contain a profile");

            Repository repository = SettingsUtil.GetRepositoryFromProfile(profile, _repoUrl1);

            Assert.IsNotNull(repository, "Repository '" + _repoUrl1 + "' was not added to profile");

            Assert.AreEqual("npanday.repo.0", repository.id);
            Assert.AreEqual(_repoUrl1, repository.url);
        }