public async Task GetTestData(string projectName, string buildType, int buildId, int changeId)
        {
            using (var client = GetClient())
            {
                var projectTask = client.GetStringAsync(_urls.GetProjectByNameId(projectName));
                var pMsg        = await projectTask;
                var pData       = TeamCityProject.FromJson(pMsg);


                var buildsTask = client.GetStringAsync(_urls.GetBuilds(buildType));
                var bsMsg      = await buildsTask;
                var bsData     = TeamCityBuilds.FromJson(bsMsg);

                var buildTask = client.GetStringAsync(_urls.GetBuild(buildId));
                var bMsg      = await buildTask;
                var bData     = TeamCityBuild.FromJson(bMsg);


                var changesTask = client.GetStringAsync(_urls.GetChanges(buildId));
                var csMsg       = await changesTask;
                var csData      = TeamCityChanges.FromJson(csMsg);

                var changeTask = client.GetStringAsync(_urls.GetChange(changeId));
                var cMsg       = await changeTask;
                var cData      = TeamCityChange.FromJson(cMsg);
            }
        }
Пример #2
0
 private void WriteBuildTypes(TeamCityProject Project, DirectoryInfo Directory, IDocumentFormatter Formatter)
 {
     Parallel.ForEach <BuildType>(Project.BuildTypes.BuildType, bt =>
     {
         WriteBuildType(bt, Directory, Formatter);
     });
 }
Пример #3
0
        public void GetProject_returns_specified_project()
        {
            // assign
            const string projectName = "Kotlin";

            // act
            TeamCityProject project = _sut.GetProject(projectName);

            // assert
            Assert.That(project.Id == projectName);
            Assert.That(project.Name == projectName);
        }
 public async Task <TeamCityProject> GetProjectData(string ProjectNameId)
 {
     try
     {
         using (var client = GetClient())
         {
             var projectTask = client.GetStringAsync(_urls.GetProjectByNameId(ProjectNameId));
             var pMsg        = await projectTask;
             var pData       = TeamCityProject.FromJson(pMsg);
             return(pData);
         }
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, "Unable to retrieve project data for Project: {0}", ProjectNameId);
         throw;
     }
 }
Пример #5
0
        private static BlockingCollection <BuildType> LoadBuildTypesCollection(TeamCityProject Project, int QueueSize)
        {
            BlockingCollection <Models.BuildType> buildTypes = new BlockingCollection <Models.BuildType>();

            // Each Build Type
            try
            {
                foreach (var bt in Project.BuildTypes.BuildType)
                {
                    buildTypes.Add(bt);
                }
            }
            finally
            {
                buildTypes.CompleteAdding();
            }

            return(buildTypes);
        }
Пример #6
0
        private bool AddSubProjectsAndBuildDefinitions(TeamCityProject project, List <BuildDefinitionSetting> activeBuildDefinitionSettings, TreeNodeCollection treeNodeCollection)
        {
            ThreeStateTreeNode node = new ThreeStateTreeNode(project.Name);
            bool allChildrenChecked = true;

            foreach (var buildDefinition in project.BuildDefinitions)
            {
                var isChecked = AddBuildDefinition(buildDefinition, node, activeBuildDefinitionSettings);
                allChildrenChecked = allChildrenChecked && isChecked;
            }

            foreach (var subProject in project.SubProjects)
            {
                var isChecked = AddSubProjectsAndBuildDefinitions(subProject, activeBuildDefinitionSettings, node.Nodes);
                allChildrenChecked = allChildrenChecked && isChecked;
            }

            node.Checked = allChildrenChecked;

            treeNodeCollection.Add(node);

            return(node.Checked);
        }
Пример #7
0
        private void GetProjectsComplete(TeamCityProject[] projects)
        {
            _ciEntryPointSetting.Url = _url.Text;
            _ciEntryPointSetting.UserName = _userName.Text;
            _ciEntryPointSetting.SetPassword(_password.Text);
            Settings.Save();

            ClearProjectNodes();
            var teamCityProjects = projects.OrderBy(i => i.Name);
            foreach (TeamCityProject project in teamCityProjects)
            {
                bool exists = Settings.BuildExistsAndIsActive(_teamCityCiEntryPoint.Name, project.Name);

                ThreeStateTreeNode node = new ThreeStateTreeNode(project.Name)
                {
                    Tag = project,
                    State = exists ? CheckBoxState.Checked : CheckBoxState.Unchecked
                };
                node.State = CheckBoxState.Indeterminate;
                node.Nodes.Add(PLACEHODER_TEXT);
                _projects.Nodes.Add(node);
                LoadBuildDefinitions(node);
            }
        }
Пример #8
0
        public void Write(TeamCityProject Project)
        {
            var di = CreateProjectFolder(Path.Combine(_documentSubFolder, FileHelper.GetSafeName(Project.Name)), _fileMode);

            WriteBuildTypes(Project, di, _formatter);
        }
 private void GetProjectsComplete(TeamCityProject[] projects)
 {
     SaveCredentials();
     ClearProjectNodes();
     AddRootProjects(projects);
     DeactivateProjectsNoLongerOnServer(projects);
 }
        private bool AddSubProjectsAndBuildDefinitions(TeamCityProject project, List<BuildDefinitionSetting> activeBuildDefinitionSettings, TreeNodeCollection treeNodeCollection)
        {
            ThreeStateTreeNode node = new ThreeStateTreeNode(project.Name);
            bool allChildrenChecked = true;

            foreach (var buildDefinition in project.BuildDefinitions)
            {
                var isChecked = AddBuildDefinition(buildDefinition, node, activeBuildDefinitionSettings);
                allChildrenChecked = allChildrenChecked && isChecked;
            }

            foreach (var subProject in project.SubProjects)
            {
                var isChecked = AddSubProjectsAndBuildDefinitions(subProject, activeBuildDefinitionSettings, node.Nodes);
                allChildrenChecked = allChildrenChecked && isChecked;
            }

            node.Checked = allChildrenChecked;

            treeNodeCollection.Add(node);

            return node.Checked;
        }
 private void AddRootProjects(TeamCityProject[] rootProjects)
 {
     var activeBuildDefinitionSettings = _ciEntryPointSetting.BuildDefinitionSettings.Where(bd => bd.Active).ToList();
     foreach (TeamCityProject project in rootProjects)
     {
         AddSubProjectsAndBuildDefinitions(project, activeBuildDefinitionSettings, _projects.Nodes);
     }
 }
        private void DeactivateProjectsNoLongerOnServer(TeamCityProject[] projectsOnServer)
        {
            var buildDefinitionsOnServer = GetAllBuildDefinitionsFlattened(projectsOnServer);

            var projectIdsOnServer = buildDefinitionsOnServer
                .Select(bd => bd.Id)
                .ToList();
            var projectsInSettingsButNoLongerOnServer = _ciEntryPointSetting.BuildDefinitionSettings.Where(
                bds => bds.BuildServer == _teamCityCiEntryPoint.Name && 
                !projectIdsOnServer.Contains(bds.Id));
            foreach (var buildDefinitionSetting in projectsInSettingsButNoLongerOnServer)
            {
                buildDefinitionSetting.Active = false;
            }
            Settings.Save();
        }
Пример #13
0
 private void GetProjectsComplete(TeamCityProject[] projects)
 {
     SaveCredentials();
     ClearProjectNodes();
     AddRootProjects(projects);
 }