public void GetRepositories( string canonical_name, string localPath, string remoteFolderPath, string url, string user, string password, string repositoryId, string binding) { ServerCredentials credentials = new ServerCredentials() { Address = new Uri(url), Binding = binding, UserName = user, Password = password }; var repos = credentials.GetRepositories(); Assert.That(repos, Is.Not.Null.Or.Empty); foreach (var repo in repos) { Assert.That(string.IsNullOrEmpty(repo.Id), Is.False); Assert.That(string.IsNullOrEmpty(repo.Name), Is.False); Console.WriteLine(repo.ToString()); } }
public void GetRepositoriesTroughProxy( string cmisServerUrl, string cmisUser, string cmisPassword, string proxyUrl, string proxyUser, string proxyPassword) { if (string.IsNullOrEmpty(proxyUrl)) { Assert.Ignore(); } ServerCredentials credentials = new ServerCredentials { Address = new Uri(cmisServerUrl), UserName = cmisUser, Password = cmisPassword }; ProxySettings proxySettings = new ProxySettings(); proxySettings.Selection = string.IsNullOrEmpty(cmisServerUrl) ? ProxySelection.NOPROXY : ProxySelection.CUSTOM; proxySettings.Server = new Uri(proxyUrl); proxySettings.LoginRequired = !string.IsNullOrEmpty(proxyUser); if (proxySettings.LoginRequired) { proxySettings.Username = proxyUser; proxySettings.ObfuscatedPassword = Crypto.Obfuscate(proxyPassword); } HttpProxyUtils.SetDefaultProxy(proxySettings, true); Assert.That(credentials.GetRepositories(), Is.Not.Empty); }
partial void OnPasswordChanged(NSObject sender) { this.LoginStatusLabel.StringValue = "logging in..."; this.LoginStatusLabel.Hidden = false; // monomac bug: animation GUI effect will cause GUI to hang, when backend thread is busy // this.LoginStatusProgress.StartAnimation(this); ServerCredentials cred = new ServerCredentials() { Address = Credentials.Address, Binding = Credentials.Binding, UserName = Credentials.UserName, Password = PasswordText.StringValue }; PasswordText.Enabled = false; new TaskFactory().StartNew(() => { try{ cred.GetRepositories(); InvokeOnMainThread(() => { lock (loginLock) { if (!isClosed) { this.LoginStatusLabel.StringValue = "login successful"; } } }); }catch (Exception e) { InvokeOnMainThread(() => { lock (loginLock) { if (!isClosed) { this.LoginStatusLabel.StringValue = "login failed: " + e.Message; } } }); } InvokeOnMainThread(() => { lock (loginLock) { PasswordText.Enabled = true; if (!isClosed) { this.LoginStatusProgress.StopAnimation(this); } } }); }); }
public void GetRepositoriesReturnsListOfReposInOrder() { var underTest = new ServerCredentials { Address = new Uri("https://demo.deutsche-wolke.de/cmis/browser"), Binding = DotCMIS.BindingType.Browser, UserName = "******", Password = "******" }; var name = "Name"; var id = Guid.NewGuid().ToString(); var sessionFactory = new Mock <ISessionFactory>(); sessionFactory.SetupRepositories(Mock.Of <IRepository>(r => r.Id == id && r.Name == name), Mock.Of <IRepository>(r => r.Id == Guid.NewGuid().ToString() && r.Name == "other")); var repos = underTest.GetRepositories(sessionFactory.Object); Assert.That(repos.Count, Is.EqualTo(2)); Assert.That(repos.First().Id, Is.EqualTo(id)); Assert.That(repos.First().Name, Is.EqualTo(name)); }
private void CheckPassword(object sender, DoWorkEventArgs args) { if (!passwordChanged) { return; } Dispatcher.BeginInvoke((Action) delegate { passwordHelp.Text = Properties_Resources.LoginCheck; passwordBox.IsEnabled = false; passwordProgress.Visibility = Visibility.Visible; }); ServerCredentials cred = new ServerCredentials() { Address = Credentials.Address, Binding = Credentials.Binding, UserName = Credentials.UserName, Password = passwordBox.Password }; cred.GetRepositories(); }