Example #1
0
        public AreaManager(ProjectDetail projectDetail, ITfsCredentials tfsCredentials)
        {
            this.projectDetail = projectDetail;

            this.tfsTeamProjectCollection = TfsApi.Administration.TfsTeamProjectCollectionFactory.GetTeamProjectCollection(this.projectDetail.CollectionUri, tfsCredentials);

            this.teamConfig = this.tfsTeamProjectCollection.GetService<TeamSettingsConfigurationService>();

            this.commonStructureService = (ICommonStructureService4)this.tfsTeamProjectCollection.GetService(typeof(ICommonStructureService4));

            this.projectInfo = this.commonStructureService.GetProjectFromName(this.projectDetail.ProjectName);

            foreach (TeamConfiguration item in this.teamConfig.GetTeamConfigurationsForUser(new[] { this.projectInfo.Uri }))
            {
                this.teamConfiguration = item;
                break;
            }
        }
Example #2
0
        public TeamManager(Dto.ProjectDetail projectDetail, TfsApi.Contracts.ITfsCredentials tfsCredentials)
        {
            this.tfsCredentials = tfsCredentials;

            this.projectDetail = projectDetail;

            this.tfsTeamProjectCollection = TfsApi.Administration.TfsTeamProjectCollectionFactory.GetTeamProjectCollection(this.projectDetail.CollectionUri, this.tfsCredentials);

            this.teamSettingsConfigurationService = this.tfsTeamProjectCollection.GetService<TeamSettingsConfigurationService>();

            this.commonStructureService = (ICommonStructureService4)this.tfsTeamProjectCollection.GetService(typeof(ICommonStructureService4));

            this.projectInfo = this.commonStructureService.GetProjectFromName(this.projectDetail.ProjectName);

            this.groupSecurityService = (IGroupSecurityService)this.tfsTeamProjectCollection.GetService<IGroupSecurityService>();

            this.TfsTeamService = (Microsoft.TeamFoundation.Client.TfsTeamService)this.tfsTeamProjectCollection.GetService(typeof(Microsoft.TeamFoundation.Client.TfsTeamService));
        }
 private static ProjectInfo[] CreateProjectInfos(int quantity, int buildDefinitionQuantity, int buildDetailQuantity, IBuildServer mockBuildServer)
 {
     var projectInfos = new ProjectInfo[quantity];
     for (var i = 0; i < quantity; i++)
     {
         var projectInfo = new ProjectInfo {Name = string.Format("TeamProject{0}", i)};
         projectInfos[i] = projectInfo;
         mockBuildServer.Stub(m => m.QueryBuildDefinitions(projectInfo.Name))
             .Return(CreateFakeBuildDefinitions(projectInfo.Name, buildDefinitionQuantity, buildDetailQuantity, mockBuildServer));
     }
     return projectInfos;
 }
 public void OpenBuildSecurityDialog(string projectName, string projectUri)
 {
     var projectInfo = new ProjectInfo(projectUri, projectName, ProjectState.WellFormed);
     var artifactId = LinkingUtilities.DecodeUri(projectUri);
     _teamFoundationBuild.Value.BuildExplorerWrapper.OpenBuildSecurityDialog(projectInfo, projectInfo.Name, artifactId.ToolSpecificId);
 }
        public void OpenBuildDefinitionSecurityDialog(string projectName, string projectUri, string definitionName, string definitionUri)
        {
            var projectInfo = new ProjectInfo(projectUri, projectName, ProjectState.WellFormed);

            var projectArtifactId = LinkingUtilities.DecodeUri(projectUri);
            var definitionArtifactId = LinkingUtilities.DecodeUri(definitionUri);

            var securityToken = string.Concat(projectArtifactId.ToolSpecificId, BuildSecurity.NamespaceSeparator, definitionArtifactId.ToolSpecificId);

            _teamFoundationBuild.Value.BuildExplorerWrapper.OpenBuildSecurityDialog(projectInfo, definitionName, securityToken);
        }
 public MyTfsProject(ProjectInfo projectInfo, IBuildServer buildServer, MyTfsProjectCollection projectCollection)
 {
     _projectInfo = projectInfo;
     _buildServer = buildServer;
     _projectCollection = projectCollection;
 }
Example #7
0
 public AppTfsContext(TfsTeamProjectCollection collection, ProjectInfo selectedProject)
 {
     this.collection = collection;
     this.selectedProject = selectedProject;
 }
        private void BuildQueryHierarchy(ProjectInfo project, QueryHierarchy queryHierarchy)
        {
            tvwQueries.Nodes.Clear();

            var root = new TreeNode(project.Name);
            foreach (QueryFolder query in queryHierarchy)
            {
                DefineFolder(query, root);
            }

            tvwQueries.Nodes.Add(root);
        }
 public void OpenBuildSecurityDialog(ProjectInfo projectInfo, string name, string securityToken)
 {
     _openBuildSecurityDialogMethod.Value.Invoke(null, new object[] {projectInfo, name, securityToken});
 }
Example #10
0
        private async Task Connect(string tfsUrl, string projectName, bool source, bool bypassRules)
        {
            await Task.Factory.StartNew(() =>
            {
                if (source)
                {
                    SourceTFS = new TfsTeamProjectCollection(new Uri(tfsUrl));
                    var service = (ITestManagementService)SourceTFS.GetService(typeof(ITestManagementService));
                    SourceTestProject = (ITestManagementTeamProject)service.GetTeamProject(projectName);
                    SourceProject = new ProjectInfo()
                    {
                        Name = SourceTestProject.WitProject.Name,
                        Uri = SourceTestProject.WitProject.Uri.AbsoluteUri
                    };
                }
                else
                {
                    TargetTFS = new TfsTeamProjectCollection(new Uri(tfsUrl));
                    var service = (ITestManagementService)TargetTFS.GetService(typeof(ITestManagementService));
                    TargetTestProject = (ITestManagementTeamProject)service.GetTeamProject(projectName);
                    TargetProject = new ProjectInfo()
                    {
                        Name = TargetTestProject.WitProject.Name,
                        Uri = TargetTestProject.WitProject.Uri.AbsoluteUri
                    };

                    WorkItemStore store = new WorkItemStore(TargetTFS, bypassRules ? WorkItemStoreFlags.BypassRules : WorkItemStoreFlags.None);

                    TargetProjectWorkItemType = store.Projects[projectName].WorkItemTypes["Test Case"];
                }
            });
        }
		private List<Type> GetWorkItemTypes(ProjectInfo projectInfo)
		{
			string.Format("Getting TFS Work Item Types for project {0}", projectInfo.Name).Debug();
			var workItemTypes = new List<Type>();

			if (_projectCollectionWorkItemStore == null) return workItemTypes;

			var proj = _projectCollectionWorkItemStore.Projects[projectInfo.Name];

			if (proj == null || proj.WorkItemTypes == null) return workItemTypes;

			foreach (Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemType workItemType in proj.WorkItemTypes)
			{
				workItemTypes.Add(new Type(workItemType.Name, GetStates(workItemType)));
			}
			return workItemTypes;
		}
        private ProcessTemplateProperties GetProcessTemplateProperties(ProjectInfo pi)
        {
            ProcessTemplateProperties ptp = new ProcessTemplateProperties();
            // Read the properties
            string projectName = string.Empty;
            string projectState = string.Empty;
            int templateId = 0;
            ProjectProperty[] projectProperties = null;

            css.GetProjectProperties(pi.Uri, out projectName, out projectState, out templateId, out projectProperties);

            // Return the properties
            string currentVersion = projectProperties.Where(p => (p.Name == ProcessTemplateProperties.CURRENTVERSIONSTRING)).Select(p => p.Value).FirstOrDefault();
            string createVersion = projectProperties.Where(p => (p.Name == ProcessTemplateProperties.CREATEVERSIONSTRING)).Select(p => p.Value).FirstOrDefault();
            string pt = projectProperties.Where(p => (p.Name == ProcessTemplateProperties.PROCESSTEMPLATESTRING)).Select(p => p.Value).FirstOrDefault();

            ptp.CurrentVersion = currentVersion;
            ptp.CreateVersion = createVersion;
            ptp.ProcessTemplate = pt;
            ptp.CurrentProject = pi;

            return ptp;
        }