Beispiel #1
0
        private void InitializeCQClient()
        {
            Microsoft.TeamFoundation.Migration.BusinessModel.MigrationSource migrationSourceConfig = m_configurationService.MigrationSource;
            string dbSet  = migrationSourceConfig.ServerUrl;
            string userDb = migrationSourceConfig.SourceIdentifier;

            ICredentialManagementService credManagementService =
                m_serviceContainer.GetService(typeof(ICredentialManagementService)) as ICredentialManagementService;

            ICQLoginCredentialManager loginCredManager =
                CQLoginCredentialManagerFactory.CreateCredentialManager(credManagementService, migrationSourceConfig);

            // connect to user session
            UserSessionConnConfig = new ClearQuestConnectionConfig(loginCredManager.UserName,
                                                                   loginCredManager.Password,
                                                                   userDb,
                                                                   dbSet);
            m_userSession = CQConnectionFactory.GetUserSession(UserSessionConnConfig);

            #region we won't need admin session until we start syncing cq schema
            //// connect to admin session
            //if (!string.IsNullOrEmpty(loginCredManager.AdminUserName))
            //{
            //    AdminSessionConnConfig = new ClearQuestConnectionConfig(loginCredManager.AdminUserName,
            //                                                                loginCredManager.AdminPassword ?? string.Empty,
            //                                                                userDb,
            //                                                                dbSet);
            //    m_adminSession = CQConnectionFactory.GetAdminSession(AdminSessionConnConfig);
            //}
            #endregion
            MigrationContext = new ClearQuestMigrationContext(m_userSession, migrationSourceConfig);
        }
Beispiel #2
0
        void m_worker_DoWork(object sender, DoWorkEventArgs e)
        {
            Debug.Assert(e.Argument is MigrationSource, "Wrong argument type");
            MigrationSource migrationSourceConfig = e.Argument as MigrationSource;

            string dbSet  = migrationSourceConfig.ServerUrl;
            string userDb = migrationSourceConfig.SourceIdentifier;

            CredentialManagementService credManagementService =
                new CredentialManagementService(migrationSourceConfig);

            ICQLoginCredentialManager  loginCredManager      = CQLoginCredentialManagerFactory.CreateCredentialManager(credManagementService, migrationSourceConfig);
            ClearQuestConnectionConfig userSessionConnConfig = new ClearQuestConnectionConfig(loginCredManager.UserName,
                                                                                              loginCredManager.Password,
                                                                                              userDb,
                                                                                              dbSet);

            ClearQuestOleServer.Session userSession = CQConnectionFactory.GetUserSession(userSessionConnConfig);

            Dictionary <string, bool> queryList = CQWorkSpace.GetQueryListWithValidity(userSession);

            e.Result = queryList;
        }
Beispiel #3
0
        private void InitializeCQClient()
        {
            MigrationSource migrationSourceConfig = m_configurationService.MigrationSource;
            string          dbSet  = migrationSourceConfig.ServerUrl;
            string          userDb = migrationSourceConfig.SourceIdentifier;

            ICredentialManagementService credManagementService =
                m_serviceContainer.GetService(typeof(ICredentialManagementService)) as ICredentialManagementService;

            ICQLoginCredentialManager loginCredManager =
                CQLoginCredentialManagerFactory.CreateCredentialManager(credManagementService, migrationSourceConfig);

            // connect to user session
            UserSessionConnConfig = new ClearQuestConnectionConfig(loginCredManager.UserName,
                                                                   loginCredManager.Password,
                                                                   userDb,
                                                                   dbSet);
            m_userSession = CQConnectionFactory.GetUserSession(UserSessionConnConfig);

            #region admin session is not needed until we sync context
            //// connect to admin session
            //if (!string.IsNullOrEmpty(loginCredManager.AdminUserName))
            //{
            //    AdminSessionConnConfig = new ClearQuestConnectionConfig(loginCredManager.AdminUserName,
            //                                                                loginCredManager.AdminPassword ?? string.Empty,
            //                                                                userDb,
            //                                                                dbSet);
            //    m_adminSession = CQConnectionFactory.GetAdminSession(AdminSessionConnConfig);
            //}
            #endregion

            // parse the filter strings in the configuration file
            m_filters = new CQRecordFilters(m_configurationService.Filters, m_userSession);

            m_migrationContext = new ClearQuestMigrationContext(m_userSession, migrationSourceConfig);
        }
        public void Initialize(Configuration configuration)
        {
            CredentialManagementService credManagementService = new CredentialManagementService(configuration);

            foreach (MigrationSource ms in configuration.SessionGroup.MigrationSources.MigrationSource)
            {
                try
                {
                    string dbSet  = ms.ServerUrl;
                    string userDb = ms.SourceIdentifier;

                    ICQLoginCredentialManager loginCredManager =
                        CQLoginCredentialManagerFactory.CreateCredentialManager(credManagementService, ms);
                    Guid migrSrcId = new Guid(ms.InternalUniqueId);

                    var userSessionConnConfig = new ClearQuestConnectionConfig(loginCredManager.UserName,
                                                                               loginCredManager.Password,
                                                                               userDb,
                                                                               dbSet);
                    ClearQuestOleServer.Session userSession = CQConnectionFactory.GetUserSession(userSessionConnConfig);

                    if (!m_cqSessions.ContainsKey(migrSrcId))
                    {
                        m_cqSessions.Add(migrSrcId, userSession);
                    }
                }
                catch (ClearQuestInvalidConfigurationException)
                {
                    continue;
                }
                catch (Exception e)
                {
                    TraceManager.TraceException(e);
                }
            }
        }