public void Initialize(TP2007ServerBasedDialogSerializationHelper helper)
        {
            if (helper.Servers == null)
            {
                return;
            }

            List <Trados2007ServerAccount> accounts = new List <Trados2007ServerAccount>(helper.Servers.Length);

            foreach (var serverString in helper.Servers)
            {
                Uri serverUri;
                try
                {
                    serverUri = new Uri(string.Format("{0}://{1}", "http", serverString));
                }
                catch (UriFormatException)
                {
                    continue;
                }

                TranslationProviderCredential credential = this.CredentialStore.GetCredential(serverUri);

                string username;
                string password;
                if (CredentialsUtility.TryParse(credential, out username, out password))
                {
                    Trados2007ServerAccount account = new Trados2007ServerAccount(serverString, username, password);
                    accounts.Add(account);
                }
            }

            this.Servers = accounts;
        }
Exemple #2
0
        private void UpdateCredentials(Trados2007ServerAccount account)
        {
            var credentials =
                CredentialsUtility.CreateTranslationProviderCredential(account.Login, account.Password);

            this.credentialStore.AddCredential(account.ConnectionPointUri, credentials);
        }
Exemple #3
0
        public AddEditServerDialog(Trados2007ServerAccount account = null)
        {
            InitializeComponent();

            this.Text = account == null ?
                        PluginResources.Trados2007_AddEditServerDialog_Add :
                        PluginResources.Trados2007_AddEditServerDialog_Edit;

            if (account != null)
            {
                this.addressTextBox.Text = account.TranslationServer;

                if (account.IsWindowsAuthentication)
                {
                    this.windowsAuthRadioButton.Checked = true;
                }
                else
                {
                    this.serverAuthRadioButton.Checked = true;

                    this.loginTextBox.Text = account.Login;
                }
            }
            else
            {
                this.serverAuthRadioButton.Checked = true;
            }

            InitEnabled();
        }
        public void Trados2007ServerAccount_Constructor_ArgNullPassword()
        {
            string translationServer       = "10.109.5.114";
            string login                   = "******";
            string password                = string.Empty;
            Trados2007ServerAccount target = new Trados2007ServerAccount(translationServer, login, password);

            Assert.Fail("Should not pass");
        }
        public void Trados2007ServerAccount_Constructor_ArgNullServer()
        {
            string translationServer       = null;
            string login                   = "******";
            string password                = "******";
            Trados2007ServerAccount target = new Trados2007ServerAccount(translationServer, login, password);

            Assert.Fail("Should not pass");
        }
        public void Trados2007ServerAccount_Constructor_OKForValidHostnameWithSuffixes()
        {
            string translationServer = @"VQ01EN-S3E-08.development.sheffield.sdl.corp";
            string login             = "******";
            string password          = "******";

            Trados2007ServerAccount target = new Trados2007ServerAccount(translationServer, login, password);

            Assert.IsTrue(target.IsServerUp);
        }
        public void Trados2007ServerAccount_Constructor_OKForInvalidHostname()
        {
            string translationServer = @"SOMEIDIOTICNAME";
            string login             = "******";
            string password          = "******";

            Trados2007ServerAccount target = new Trados2007ServerAccount(translationServer, login, password);

            Assert.Fail("Should not pass");
        }
        public void Trados2007ServerAccount_Constructor_OKForValidHostname()
        {
            string translationServer = @"VQ01EN-S3E-08";
            string login             = "******";
            string password          = "******";

            Trados2007ServerAccount target = new Trados2007ServerAccount(translationServer, login, password);

            Assert.IsTrue(target.IsServerUp);
        }
        public void Trados2007ServerAccount_Constructor_OKForInvalidIp()
        {
            string translationServer = @"10.207.100.148";
            string login             = "******";
            string password          = "******";

            Trados2007ServerAccount target = new Trados2007ServerAccount(translationServer, login, password);

            Assert.IsFalse(target.IsServerUp);
        }
        public void Trados2007ServerAccount_TMExists_OKForNonExisting()
        {
            string translationServer       = @"10.27.100.148";
            string login                   = "******";
            string password                = "******";
            Trados2007ServerAccount target = new Trados2007ServerAccount(translationServer, login, password);

            var result = target.CheckTranslationMemoryExists("some imaginary non-existing name");

            Assert.IsFalse((bool)result);
        }
        public void Trados2007ServerAccount_GetTMs_NotEmptyList()
        {
            string translationServer       = @"10.27.100.148";
            string login                   = "******";
            string password                = "******";
            Trados2007ServerAccount target = new Trados2007ServerAccount(translationServer, login, password);

            var result = target.GetTranslationMemories();

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Count > 0);
            // minor checks for validness
            Assert.IsTrue(result[0].SupportsSourceConcordanceSearch);
            Assert.IsNotNull(result[0].Uri);
            Assert.IsNotNull(result[0].LanguageDirection);
        }
 internal string GetServerStatus(Trados2007ServerAccount el)
 {
     return(el.IsServerUp ? "Available" : "Not available");
 }