示例#1
0
        private static void CloseAssets()
        {
            int assetCount = 0;

            if (_config.AssetsToMigrate.Find(i => i.Name == "ListTypes").Enabled == true)
            {
                _logger.Info("Closing list types.");
                ImportListTypes listTypes = new ImportListTypes(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = listTypes.CloseListTypes();
                _logger.Info("-> Closed {0} list types.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Members").Enabled == true)
            {
                _logger.Info("Closing members.");
                ImportMembers members = new ImportMembers(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = members.CloseMembers();
                _logger.Info("-> Closed {0} members.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Teams").Enabled == true)
            {
                _logger.Info("Closing teams.");
                ImportTeams teams = new ImportTeams(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = teams.CloseTeams();
                _logger.Info("-> Closed {0} teams.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Goals").Enabled == true)
            {
                _logger.Info("Closing goals.");
                ImportGoals goals = new ImportGoals(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = goals.CloseGoals();
                _logger.Info("-> Closed {0} goals.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "FeatureGroups").Enabled == true)
            {
                _logger.Info("Closing feature groups.");
                ImportFeatureGroups featureGroups = new ImportFeatureGroups(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = featureGroups.CloseFeatureGroups();
                _logger.Info("-> Closed {0} feature groups.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Requests").Enabled == true)
            {
                _logger.Info("Closing requests.");
                ImportRequests requests = new ImportRequests(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = requests.CloseRequests();
                _logger.Info("-> Closed {0} requests.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Issues").Enabled == true)
            {
                _logger.Info("Closing issues.");
                ImportIssues issues = new ImportIssues(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = issues.CloseIssues();
                _logger.Info("-> Closed {0} issues.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Tests").Enabled == true)
            {
                _logger.Info("Closing tests.");
                ImportTests tests = new ImportTests(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = tests.CloseTests();
                _logger.Info("-> Closed {0} tests.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "RegressionTests").Enabled == true)
            {
                _logger.Info("Closing regression tests.");
                ImportRegressionTests tests = new ImportRegressionTests(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = tests.CloseRegressionTests();
                _logger.Info("-> Closed {0} regression tests.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Tasks").Enabled == true)
            {
                _logger.Info("Closing tasks.");
                ImportTasks tasks = new ImportTasks(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = tasks.CloseTasks();
                _logger.Info("-> Closed {0} tasks.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Defects").Enabled == true)
            {
                _logger.Info("Closing defects.");
                ImportDefects defects = new ImportDefects(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = defects.CloseDefects();
                _logger.Info("-> Closed {0} defects.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Stories").Enabled == true)
            {
                _logger.Info("Closing stories.");
                ImportStories stories = new ImportStories(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = stories.CloseStories();
                _logger.Info("-> Closed {0} stories.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Epics").Enabled == true)
            {
                _logger.Info("Closing epics.");
                ImportEpics epics = new ImportEpics(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = epics.CloseEpics();
                _logger.Info("-> Closed {0} epics.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Iterations").Enabled == true)
            {
                _logger.Info("Closing iterations.");
                ImportIterations iterations = new ImportIterations(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = iterations.CloseIterations();
                _logger.Info("-> Closed {0} iterations.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Schedules").Enabled == true)
            {
                _logger.Info("Closing schedules.");
                ImportSchedules schedules = new ImportSchedules(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = schedules.CloseSchedules();
                _logger.Info("-> Closed {0} schedules.", assetCount);
            }

            if (_config.AssetsToMigrate.Find(i => i.Name == "Projects").Enabled == true)
            {
                    _logger.Info("Closing projects.");
                ImportProjects projects = new ImportProjects(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                assetCount = projects.CloseProjects();
                _logger.Info("-> Closed {0} projects.", assetCount);
            }
        }
示例#2
0
        private static void ImportAssets()
        {
            foreach (MigrationConfiguration.AssetInfo asset in _config.AssetsToMigrate)
            {
                int assetCount = 0;
                switch (asset.Name)
                {
                    case "ListTypes":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing list types.");
                            ImportListTypes listTypes = new ImportListTypes(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = listTypes.Import();
                            _logger.Info("-> Imported {0} list types.", assetCount);
                        }
                        break;

                    case "Members":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing members.");
                            ImportMembers members = new ImportMembers(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = members.Import();
                            _logger.Info("-> Imported {0} members.", assetCount);
                        }
                        break;

                    case "MemberGroups":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing member groups.");
                            ImportMemberGroups memberGroups = new ImportMemberGroups(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = memberGroups.Import();
                            _logger.Info("-> Imported {0} member groups.", assetCount);
                        }
                        break;

                    case "Teams":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing teams.");
                            ImportTeams teams = new ImportTeams(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = teams.Import();
                            _logger.Info("-> Imported {0} teams.", assetCount);
                        }
                        break;

                    case "Schedules":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing schedules.");
                            ImportSchedules schedules = new ImportSchedules(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = schedules.Import();
                            _logger.Info("-> Imported {0} schedules.", assetCount);
                        }
                        break;

                    case "Projects":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing projects.");
                            ImportProjects projects = new ImportProjects(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = projects.Import();
                            _logger.Info("-> Imported {0} projects.", assetCount);

                            if (_config.V1Configurations.SetAllMembershipToRoot == true)
                            {
                                assetCount = projects.SetMembershipToRoot();
                                _logger.Info("-> Imported {0} project memberships to target root project.", assetCount);
                            }
                        }
                        break;

                    case "Programs":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing programs.");
                            ImportPrograms programs = new ImportPrograms(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = programs.Import();
                            _logger.Info("-> Imported {0} programs.", assetCount);
                        }
                        break;

                    case "Iterations":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing iterations.");
                            ImportIterations iterations = new ImportIterations(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = iterations.Import();
                            _logger.Info("-> Imported {0} iterations.", assetCount);
                        }
                        break;

                    case "Goals":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing goals.");
                            ImportGoals goals = new ImportGoals(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = goals.Import();
                            _logger.Info("-> Imported {0} goals.", assetCount);
                        }
                        break;

                    case "FeatureGroups":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing feature groups.");
                            ImportFeatureGroups featureGroups = new ImportFeatureGroups(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = featureGroups.Import();
                            _logger.Info("-> Imported {0} feature groups.", assetCount);

                            if (asset.EnableCustomFields == true)
                            {
                                ImportCustomFields custom = new ImportCustomFields(_sqlConn, _targetMetaAPI, _targetDataAPI, _config, asset.Name);
                                assetCount = custom.Import();
                                _logger.Debug("-> Imported {0} feature group custom fields.", assetCount);
                            }
                        }
                        break;

                    case "Requests":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing requests.");
                            ImportRequests requests = new ImportRequests(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = requests.Import();
                            _logger.Info("-> Imported {0} requests.", assetCount);
                        }
                        break;

                    case "Issues":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing issues.");
                            ImportIssues issues = new ImportIssues(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = issues.Import();
                            _logger.Info("-> Imported {0} issues.", assetCount);
                        }
                        break;

                    case "Epics":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing epics.");
                            ImportEpics epics = new ImportEpics(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = epics.Import();
                            _logger.Info("-> Imported {0} epics.", assetCount);

                            if (asset.EnableCustomFields == true)
                            {
                                ImportCustomFields custom = new ImportCustomFields(_sqlConn, _targetMetaAPI, _targetDataAPI, _config, asset.Name);
                                assetCount = custom.Import();
                                _logger.Debug("-> Imported {0} epic custom fields.", assetCount);
                            }
                        }
                        break;

                    case "Stories":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing stories.");
                            ImportStories stories = new ImportStories(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = stories.Import();
                            _logger.Info("-> Imported {0} stories.", assetCount);

                            if (asset.EnableCustomFields == true)
                            {
                                ImportCustomFields custom = new ImportCustomFields(_sqlConn, _targetMetaAPI, _targetDataAPI, _config, asset.Name);
                                assetCount = custom.Import();
                                _logger.Debug("-> Imported {0} story custom fields.", assetCount);
                            }
                        }
                        break;

                    case "Defects":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing defects.");
                            ImportDefects defects = new ImportDefects(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = defects.Import();
                            _logger.Info("-> Imported {0} defects.", assetCount);

                            if (asset.EnableCustomFields == true)
                            {
                                ImportCustomFields custom = new ImportCustomFields(_sqlConn, _targetMetaAPI, _targetDataAPI, _config, asset.Name);
                                assetCount = custom.Import();
                                _logger.Debug("-> Imported {0} defect custom fields.", assetCount);
                            }
                        }
                        break;

                    case "Tasks":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing tasks.");
                            ImportTasks tasks = new ImportTasks(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = tasks.Import();
                            _logger.Info("-> Imported {0} tasks.", assetCount);

                            if (asset.EnableCustomFields == true)
                            {
                                ImportCustomFields custom = new ImportCustomFields(_sqlConn, _targetMetaAPI, _targetDataAPI, _config, asset.Name);
                                assetCount = custom.Import();
                                _logger.Debug("-> Imported {0} task custom fields.", assetCount);
                            }
                        }
                        break;

                    case "Tests":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing tests.");
                            ImportTests tests = new ImportTests(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = tests.Import();
                            _logger.Info("-> Imported {0} tests.", assetCount);

                            if (asset.EnableCustomFields == true)
                            {
                                ImportCustomFields custom = new ImportCustomFields(_sqlConn, _targetMetaAPI, _targetDataAPI, _config, asset.Name);
                                assetCount = custom.Import();
                                _logger.Debug("-> Imported {0} test custom fields.", assetCount);
                            }
                        }
                        break;

                    case "OrphanedTests":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing orphaned tests.");
                            ImportOrphanedTests orphanedTests = new ImportOrphanedTests(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = orphanedTests.Import();
                            _logger.Info("-> Imported {0} orphaned tests.", assetCount);
                        }
                        break;

                    case "RegressionTests":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing regression tests.");
                            ImportRegressionTests regressionTests = new ImportRegressionTests(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = regressionTests.Import();
                            _logger.Info("-> Imported {0} regression tests.", assetCount);
                        }
                        break;

                    case "Actuals":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing actuals.");
                            ImportActuals actuals = new ImportActuals(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = actuals.Import();
                            _logger.Info("-> Imported {0} actuals.", assetCount);
                        }
                        break;

                    case "Links":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing links.");
                            ImportLinks links = new ImportLinks(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = links.Import();
                            _logger.Info("-> Imported {0} links.", assetCount);
                        }
                        break;

                    case "Conversations":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing conversations.");
                            ImportConversations conversations = new ImportConversations(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
                            assetCount = conversations.Import();
                            _logger.Info("-> Imported {0} conversations.", assetCount);
                        }
                        break;

                    case "Attachments":
                        if (asset.Enabled == true)
                        {
                            _logger.Info("Importing attachments.");
                            ImportAttachments attachments = new ImportAttachments(_sqlConn, _targetMetaAPI, _targetDataAPI, _targetImageConnector, _config);

                            if (String.IsNullOrEmpty(_config.V1Configurations.ImportAttachmentsAsLinksURL) == true)
                            {
                                assetCount = attachments.Import();
                                _logger.Info("-> Imported {0} attachments.", assetCount);
                            }
                            else
                            {
                                assetCount = attachments.ImportAttachmentsAsLinks();
                                _logger.Info("-> Imported {0} attachments as links.", assetCount);
                            }
                        }
                        break;

                    default:
                        break;
                }

            }
            // Dependencies
            _logger.Info("Setting Releationships and Dependencies.");
            ImportStories processStories = new ImportStories(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
            processStories.SetStoryDependencies();
            ImportDefects processDefects = new ImportDefects(_sqlConn, _targetMetaAPI, _targetDataAPI, _config);
            processDefects.SetDefectDependencies();
            processDefects.SetDefectRelationships();
        }