Ejemplo n.º 1
0
        void m_worker_DoWork(object sender, DoWorkEventArgs e)
        {
            if (e.Argument is VCServerPathNodeViewModel)
            {
                VCServerPathNodeViewModel node = e.Argument as VCServerPathNodeViewModel;
                node.GetItems(m_server);
                e.Result = node;
            }
            else
            {
                TfsTeamProjectCollection collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(m_migrationSource.ServerUrl));
                m_server = collection.GetService <VersionControlServer>();

                Item item = m_server.GetItem(VersionControlPath.RootFolder + m_migrationSource.SourceIdentifier);
                VCServerPathRootViewModel rootNode = new VCServerPathRootViewModel(item, this);
                rootNode.Load(m_server);
                rootNode.IsExpanded = true;
                SelectedNode        = rootNode;
                string[] tokens = m_filterItem.FilterString.Split(VersionControlPath.Separator);
                for (int i = 2; i < tokens.Length; i++)
                {
                    SelectedNode.Load(m_server);
                    SelectedNode.IsExpanded = true;

                    VCServerPathNodeViewModel newSelectedNode = SelectedNode.Children.FirstOrDefault(x => string.Equals(x.DisplayName, tokens[i]));

                    if (newSelectedNode != null)
                    {
                        SelectedNode = newSelectedNode;
                    }
                    else
                    {
                        break;
                    }
                }
                e.Result = rootNode;
            }
        }
Ejemplo n.º 2
0
        public void CreateShelveset(bool force = false)
        {
            try
            {
                if (ProjectCollectionUri == null)
                {
                    return;
                }
                var teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(ProjectCollectionUri);
                teamProjectCollection.Credentials = CredentialCache.DefaultNetworkCredentials;
                teamProjectCollection.EnsureAuthenticated();

                var service = (VersionControlServer)teamProjectCollection.GetService(typeof(VersionControlServer));
                var infos   = new AutoShelveInfos(this);
                foreach (var workspaceInfo in Workstation.Current.GetAllLocalWorkspaceInfo())
                {
                    if (workspaceInfo.MappedPaths.Length <= 0 || !workspaceInfo.ServerUri.Equals(ProjectCollectionUri))
                    {
                        continue;
                    }

                    Task.Run(() =>
                    {
                        var result = CreateShelvesetInternal(service, workspaceInfo, infos, force);
                        if (!result.IsSuccess)
                        {
                            InvalidateConnection(); // Force re-init on next attempt
                        }
                        ShelvesetCreated?.Invoke(this, result);
                    });
                }
            }
            catch (Exception ex)
            {
                InvalidateConnection(); // Force re-init on next attempt
                TfsShelvesetErrorReceived?.Invoke(this, new TfsShelvesetErrorEventArgs(error: ex));
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Connects to the Project Collection
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnConnect_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (cboServer.Text != string.Empty)
         {
             Mouse.OverrideCursor = Cursors.Wait;
             _tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(cboServer.Text),
                                                                             new UICredentialsProvider());
             _tfs.EnsureAuthenticated();
             LoadProjects();
             _wis = (WorkItemStore)_tfs.GetService(typeof(WorkItemStore));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Mouse.OverrideCursor = null;
     }
 }
Ejemplo n.º 4
0
        private static IEnumerable <WorkingFolder> GetWorkingFolders(string tfsName, string tfsWorkSpace, string[] tfsProjects, ref Workspace workspace)
        {
            TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(tfsName));

            tfs.Authenticate();

            VersionControlServer versionControl = tfs.GetService <VersionControlServer>();

            if (string.IsNullOrEmpty(tfsWorkSpace))
            {
                tfsWorkSpace = Environment.MachineName;
            }
            Workspace[] workSpaces = versionControl.QueryWorkspaces(tfsWorkSpace, versionControl.AuthorizedUser, Environment.MachineName);
            if (workSpaces.Length == 0)
            {
                throw new Exception($"TFS WorkSpace '{tfsWorkSpace}' not found");
            }

            workspace = workSpaces[0];
            List <WorkingFolder> folders = new List <WorkingFolder>(workspace.Folders);

            return(FindWorkingFolders(tfsProjects, folders));
        }
Ejemplo n.º 5
0
        private VssHttpMessageHandler GetHttpHandler(string tfsUri)
        {
            VssCredentials vssCreds;
            var            tfsCollectionUri = new Uri(tfsUri);

            using (var collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tfsCollectionUri))
            {
                // Build agents run non-attended and most often non-interactive so make sure not to create a credential prompt
                collection.ClientCredentials.AllowInteractive = false;
                collection.EnsureAuthenticated();

                this.logger.LogInfo(Resources.DOWN_DIAG_ConnectedToTFS, tfsUri);

                // We need VSS credentials that encapsulate all types of credentials (NetworkCredentials for TFS, OAuth for VSO)
                var connection = collection as TfsConnection;
                vssCreds = TfsClientCredentialsConverter.ConvertToVssCredentials(connection.ClientCredentials, tfsCollectionUri);
            }

            Debug.Assert(vssCreds != null, "Not expecting ConvertToVssCredentials ");
            var vssHttpMessageHandler = new VssHttpMessageHandler(vssCreds, new VssHttpRequestSettings());

            return(vssHttpMessageHandler);
        }
Ejemplo n.º 6
0
        public IEnumerable <Changeset> PullChangesets(Uri tfsConnectionstring, string projectName, DateTime startDate, DateTime endDate)
        {
            try
            {
                VersionSpec versionFrom = new DateVersionSpec(startDate);
                VersionSpec versionTo   = new DateVersionSpec(endDate);

                TfsTeamProjectCollection projectCollection =
                    TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tfsConnectionstring);
                VersionControlServer versionControlServer = (VersionControlServer)projectCollection.GetService(typeof(VersionControlServer));

                IEnumerable changesetHistory =
                    versionControlServer.QueryHistory("$/" + projectName + "/", VersionSpec.Latest, 0,
                                                      RecursionType.Full, null, versionFrom, versionTo, int.MaxValue,
                                                      false, false);

                return(changesetHistory.Cast <Changeset>().ToList());
            }
            catch (Exception ex)
            {
                throw new TeamFoundationException("Unable to get versionControlServer for TFS server " + tfsConnectionstring.AbsoluteUri, ex);
            }
        }
Ejemplo n.º 7
0
        public IEnumerable <IShelveset> GetShelvesetByOwner(string serverUrl, string actingUserName, string ownerName)
        {
            TfsTeamProjectCollection teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(serverUrl));

            teamProjectCollection.EnsureAuthenticated();

            VersionControlServer vcServer             = teamProjectCollection.GetService <VersionControlServer>();
            HashSet <string>     workspaceBranchNames = new HashSet <string>();

            foreach (Workspace workspace in vcServer.QueryWorkspaces(null, actingUserName, null))
            {
                workspace.Folders.ToList().ForEach(f => workspaceBranchNames.Add(f.ServerItem));
            }

            foreach (Shelveset shelveset in vcServer.QueryShelvesets(null, ownerName))
            {
                PendingSet changeSet = vcServer.QueryShelvedChanges(shelveset).FirstOrDefault();
                if (changeSet != null)
                {
                    yield return(new AdapterShelveset(shelveset, changeSet.PendingChanges, workspaceBranchNames.ToArray()));
                }
            }
        }
Ejemplo n.º 8
0
        //protected override void Dispose(bool disposing)
        //{
        //    if (disposing && (this.components != null))
        //    {
        //        this.components.Dispose();
        //    }
        //    base.Dispose(disposing);
        //}

        private TfsTeamProjectCollection GetServer(string serverName)
        {
            //TfsTeamProjectCollection tfsProj = tpp.SelectedTeamProjectCollection;
            TfsTeamProjectCollection server = null;

            try
            {
                if (!this._servers.ContainsKey(serverName))
                {
                    server = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(serverName));
                    //server = TeamFoundationServerFactory.GetServer(serverName, new UICredentialsProvider());
                    server.EnsureAuthenticated();
                    this._servers.Add(serverName, server);
                    return(server);
                }
                return(this._servers[serverName]);
            }
            catch (Exception exception)
            {
                MessageBox.Show(this, exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return(null);
            }
        }
Ejemplo n.º 9
0
        public static void DeleteWorkItemsOneByOne(string uri, List <int> ids)
        {
            try
            {
                TfsTeamProjectCollection tfs;

                tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(uri)); // https://mytfs.visualstudio.com/DefaultCollection
                tfs.Authenticate();

                var workItemStore = new WorkItemStore(tfs);

                foreach (var id in ids)
                {
                    List <int> idList = new List <int>();
                    idList.Add(id);
                    workItemStore.DestroyWorkItems(idList);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error while deleting workitems one by one " + ex.Message);
            }
        }
Ejemplo n.º 10
0
        public void CreateManualBuild(string buildStatus, string collection, string buildLog, string dropPath, string buildFlavour, string localPath, string buildPlatform, string buildTarget, string project, string buildDefinition, bool createBuildDefinitionIfNotExists, string buildController, string buildNumber, string serverPath, bool keepForever)
        {
            // Get the TeamFoundation Server
            var tfsCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(collection));

            // Get the Build Server
            var buildServer = (IBuildServer)tfsCollection.GetService(typeof(IBuildServer));

            // Create a fake definition
            var definition = CreateOrGetBuildDefinition(buildServer, project, buildDefinition, createBuildDefinitionIfNotExists,
                                                        buildController, dropPath);

            // Create the build detail object
            var buildDetail = definition.CreateManualBuild(buildNumber);

            buildDetail.KeepForever = keepForever;

            // Create platform/flavor information against which test results can be published
            var buildProjectNode = buildDetail.Information.AddBuildProjectNode(buildFlavour, localPath, buildPlatform, serverPath, DateTime.Now, buildTarget);

            if (!string.IsNullOrEmpty(dropPath))
            {
                buildDetail.DropLocation = dropPath;
            }

            if (!string.IsNullOrEmpty(buildLog))
            {
                buildDetail.LogLocation = buildLog;
            }

            buildProjectNode.Save();

            // Complete the build by setting the status to succeeded
            var buildStatusEnum = (BuildStatus)Enum.Parse(typeof(BuildStatus), buildStatus);

            buildDetail.FinalizeStatus(buildStatusEnum);
        }
Ejemplo n.º 11
0
        public int CheckInFile(string filePath)
        {
            if (File.Exists(filePath))
            {
                using (var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(this.tfsServerUrl))
                {
                    var service   = tfs.GetService <VersionControlServer>();
                    var workspace = service.GetWorkspace(filePath);

                    var conflicts = workspace.QueryConflicts(new string[] { filePath }, true);
                    if (conflicts.Any())
                    {
                        var resolvedConflicts = new Conflict[conflicts.Length];
                        foreach (Conflict conflict in conflicts)
                        {
                            workspace.ResolveConflict(conflict, out resolvedConflicts);
                        }

                        if (resolvedConflicts.Any(resolvedConflict => !resolvedConflict.IsResolved))
                        {
                            throw new Exception(
                                      "Local copy of file saved but conflicts encountered during checkin - Merge and check in manually");
                        }
                    }

                    var pendingChanges = workspace.GetPendingChanges(filePath);
                    if (pendingChanges.Count() == 1)
                    {
                        return(workspace.CheckIn(pendingChanges, "loc file checked in from localization tool"));
                    }
                }

                throw new Exception("No pending changes - please check out file in first step");
            }

            return(-1);
        }
        protected override void ProcessRecordInEH()
        {
            if (string.IsNullOrWhiteSpace(URL))
            {
                throw new PSArgumentException("URL cannot be null or empty.");
            }

            VssCredentials creds = new VssClientCredentials();

            creds.Storage = new VssClientCredentialStorage();

            Uri teamCollectionURI = new Uri(URL);
            TfsTeamProjectCollection collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(teamCollectionURI, creds);

            collection.Authenticate();

            CmdletContext.Collection    = collection;
            CmdletContext.WorkItemStore = new WorkItemStore(collection);

            if (PassThru.IsPresent)
            {
                WriteObject(collection);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// ListShelveset Permit to list all shelvet to the current Project
        /// </summary>
        /// <returns>String shelvet name and Owner</returns>
        public static string ListShelveset()
        {
            if (tfsColl == null)
            {
                tfsColl = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(tfsExt.ActiveProjectContext.DomainUri));
            }
            if (vcs == null)
            {
                vcs = (VersionControlServer)tfsColl.GetService <VersionControlServer>();
            }

            Shelveset[] shelves = vcs.QueryShelvesets(null, null);
            string      temp    = string.Empty;

            foreach (Shelveset shelve in shelves)
            {
                temp += shelve.Name.ToString() + " : " + shelve.OwnerName + "\n";
                foreach (WorkItemCheckinInfo wici in shelve.WorkItemInfo)
                {
                    temp += "\t" + wici.WorkItem.ToString() + " \n";
                }
            }
            return(temp);
        }
Ejemplo n.º 14
0
        public string GetBranchName(string localPath)
        {
            var localWorkspace = Workstation.Current.GetLocalWorkspaceInfo(localPath);

            if (localWorkspace == null)
            {
                Debug.WriteLine("Unable to find local workspace for path '{0}'.", localPath);
                return(null);
            }

            var server    = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(localWorkspace.ServerUri);
            var service   = server.GetService <VersionControlServer>();
            var workspace = service.TryGetWorkspace(localPath);

            if (workspace == null)
            {
                Debug.WriteLine("Unable to find workspace for path '{0}'.", localPath);
                return(null);
            }

            var serverItemForLocalItem = workspace.GetServerItemForLocalItem(localPath);

            var branch = (
                from branchObject in service.QueryRootBranchObjects(RecursionType.Full)
                where serverItemForLocalItem.StartsWith(branchObject.Properties.RootItem.Item)
                select branchObject
                ).FirstOrDefault();

            if (branch == null)
            {
                Debug.WriteLine("Unable to find branch for path '{0}'.", localPath);
                return(null);
            }

            return(Path.GetFileName(branch.Properties.RootItem.Item));
        }
Ejemplo n.º 15
0
        public override IEnumerable <Event> PullEvents(DateTime startDateTime, DateTime stopDateTime, string alias)
        {
            TfsTeamProjectCollection projectCollection =
                TfsTeamProjectCollectionFactory.GetTeamProjectCollection(TeamFoundationServer);

            try
            {
                var identities = new[]
                {
                    projectCollection.TeamFoundationServer.AuthenticatedUserIdentity.AccountName,
                    projectCollection.TeamFoundationServer.AuthenticatedUserIdentity.DisplayName,
                    projectCollection.TeamFoundationServer.AuthenticatedUserDisplayName,
                    projectCollection.TeamFoundationServer.AuthenticatedUserName,
                    alias
                };

                return(PullEvents(startDateTime, stopDateTime, e => e.Participants.Any(s => identities.Contains(s.Value.Alias, StringComparer.OrdinalIgnoreCase))));
            }
            catch (TeamFoundationServerUnauthorizedException)
            {
                Trace.WriteLine("TFS server failed authentication");
                return(Enumerable.Empty <Event>());
            }
        }
Ejemplo n.º 16
0
        public static int CreateSharedStep(SharedStepsObject sharedStepsObject)
        {
            WorkItemType workItemType  = sharedStepsObject.project.WorkItemTypes["Shared Steps"];
            WorkItem     newSharedStep = new WorkItem(workItemType)
            {
                Title         = sharedStepsObject.title,
                AreaPath      = sharedStepsObject.testedWorkItem.AreaPath,
                IterationPath = sharedStepsObject.testedWorkItem.IterationPath
            };
            ActionResult result = Program.CheckValidationResult(newSharedStep);

            if (result.Success)
            {
                Program.AddsharedSteps(sharedStepsObject, newSharedStep.Id);
            }
            TfsTeamProjectCollection tfs;

            tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri((sharedStepsObject.uri)));
            tfs.Authenticate();
            ITestManagementService     service     = (ITestManagementService)tfs.GetService(typeof(ITestManagementService));
            ITestManagementTeamProject testProject = service.GetTeamProject(sharedStepsObject.project);

            return(newSharedStep.Id);
        }
Ejemplo n.º 17
0
        public static Project GetTeamProject(string uri, string name)
        {
            TfsTeamProjectCollection tfs;
            NetworkCredential        cred = new NetworkCredential("User", "password");

            tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(uri));

            //tfs.Credentials = cred;
            //tfs.Authenticate();
            tfs.EnsureAuthenticated();

            var workItemStore = new WorkItemStore(tfs);

            var project = (from Project pr in workItemStore.Projects
                           where pr.Name == name
                           select pr).FirstOrDefault();

            if (project == null)
            {
                throw new Exception($"Unable to find {name} in {uri}");
            }

            return(project);
        }
Ejemplo n.º 18
0
        public async static void CreateBuildDefinition(string teamProject)
        {
            var tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(collectionUrl));
            var bhc = tpc.GetClient <BuildHttpClient>();

            string templateProject = "TEMPLATE_PROJECT";
            int    templateId      = FindBuildDefinitionId(templateProject, "TEMPLATE_BUILD");

            BuildDefinition buildDefTemplate = (await bhc.GetDefinitionAsync(templateProject, templateId));

            buildDefTemplate.Project = null;
            buildDefTemplate.Name    = "NewBuild";
            var repository = buildDefTemplate.Repository;

            buildDefTemplate.Repository = null;
            repository.Url              = null;
            repository.Id               = null;
            repository.Name             = teamProject;
            buildDefTemplate.Repository = repository;
            var queue = buildDefTemplate.Queue;

            buildDefTemplate.Queue = null;
            AgentPoolQueue newQueue = new AgentPoolQueue();

            newQueue.Name          = queue.Name;
            buildDefTemplate.Queue = newQueue;

            buildDefTemplate.Variables.Clear();

            BuildDefinitionVariable var1 = new BuildDefinitionVariable();

            var1.Value = "value";
            buildDefTemplate.Variables.Add("key", var1);

            await bhc.CreateDefinitionAsync(buildDefTemplate, teamProject);
        }
Ejemplo n.º 19
0
        static void Main(string[] args)
        {
            TfsTeamProjectCollection   tfs     = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://pradeepn-tcm:8080/tfs/DefaultCollection"));
            ITestManagementTeamProject project = tfs.GetService <ITestManagementService>().GetTeamProject("Pradeep");

            // Create a test case.
            ITestCase testCase = CreateTestCase(project, "My test case");

            // Create test plan.
            ITestPlan plan = CreateTestPlan(project, "My test plan");

            // Create test configuration. You can reuse this instead of creating a new config everytime.
            ITestConfiguration config = CreateTestConfiguration(project, string.Format("My test config {0}", DateTime.Now));

            // Create test points.
            IList <ITestPoint> testPoints = CreateTestPoints(project,
                                                             plan,
                                                             new List <ITestCase>()
            {
                testCase
            },
                                                             new IdAndName[] { new IdAndName(config.Id, config.Name) });

            // Create test run using test points.
            ITestRun run = CreateTestRun(project, plan, testPoints);

            // Query results from the run.
            ITestCaseResult result = run.QueryResults()[0];

            // Fail the result.
            result.Outcome = TestOutcome.Failed;
            result.State   = TestResultState.Completed;
            result.Save();

            Console.WriteLine("Run {0} completed", run.Id);
        }
Ejemplo n.º 20
0
        private TfsTeamProjectCollection m_server = null;   // Team foundation server
        // private TeamFoundationServer m_server = null;


        public PostBeta2TeamFoundationServiceProvider(string serverUrl)
        {
            m_server = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(serverUrl));
            // m_server = new TeamFoundationServer(serverUrl);
            m_server.EnsureAuthenticated();
        }
Ejemplo n.º 21
0
        public string GetNativeId(MigrationSource migrationSourceConfig)
        {
            TfsTeamProjectCollection tfsServer = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(migrationSourceConfig.ServerUrl));

            return(tfsServer.InstanceId.ToString());
        }
Ejemplo n.º 22
0
        private static void Main(string[] args)
        {
            // Signal Processing Start
            Console.WriteLine("Processing - Start");

            try
            {
                // Declare Server And Domains
                Uri           server  = new Uri(ConfigurationManager.AppSettings["server"]);
                List <string> domains = ConfigurationManager.AppSettings["domains"]
                                        .Split('|')
                                        .Where(x => !string.IsNullOrWhiteSpace(x))
                                        .Select(x => string.Concat(x.Trim(), "\\"))
                                        .ToList();

                // Connect To Server
                TfsTeamProjectCollection tfsTeamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(server);
                VersionControlServer     versionControlServer     = tfsTeamProjectCollection.GetService <VersionControlServer>();

                // Record Server And Domain Information
                _output.AppendLine("Server");
                _output.AppendLine(string.Concat("* ", server.AbsoluteUri));
                _output.AppendLine();
                _output.AppendLine("Domain(s)");
                domains.ForEach(x => _output.AppendLine(string.Concat("* ", x)));
                _output.AppendLine();

                // Record Project Information
                List <TeamProject> projects = versionControlServer.GetAllTeamProjects(true).ToList();
                _output.AppendLine("Top-Level Projects");
                projects.ForEach(x => _output.AppendLine(string.Concat("* ", x.Name)));
                _output.AppendLine();

                // Get Changeset Information
                Dictionary <string, UserInformation> userInformationList = new Dictionary <string, UserInformation>();
                List <Changeset> changesets = versionControlServer.QueryHistory("$/", VersionSpec.Latest, 0, RecursionType.Full, null, null, null, Int32.MaxValue, false, false)
                                              .OfType <Changeset>()
                                              .ToList();
                foreach (Changeset changeset in changesets)
                {
                    string userName = changeset.Committer.ToLower();
                    domains.ForEach(x => userName = userName.StartsWith(x, StringComparison.CurrentCultureIgnoreCase) ? userName.Substring(x.Length) : userName);
                    if (!userName.Equals(changeset.Committer, StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (!userInformationList.ContainsKey(userName))
                        {
                            userInformationList.Add(userName, new UserInformation(changeset));
                        }
                        userInformationList[userName].ProcessChangeset(changeset);
                    }
                }

                // Record Changeset Information
                ProcessChangesetInformation("Changeset Information, By Name (Active Directory)", userInformationList.OrderBy(x => x.Key));
                ProcessChangesetInformation("Changeset Information, By Name (Display)", userInformationList.OrderBy(x => x.Value.DisplayName));
                ProcessChangesetInformation("Changeset Information, By Check In Date (Initial)", userInformationList.OrderBy(x => x.Value.CheckInInitial));
                ProcessChangesetInformation("Changeset Information, By Check In Date (Final)", userInformationList.OrderBy(x => x.Value.CheckInFinal));
                ProcessChangesetInformation("Changeset Information, By Check In Count", userInformationList.OrderByDescending(x => x.Value.CheckInCount));

                // Write Output
                File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Concat(AppDomain.CurrentDomain.FriendlyName, ".txt")), _output.ToString());

                // Signal Processing Complete
                Console.WriteLine("Processing - Complete");
                Console.WriteLine();
            }
            catch (Exception ex)
            {
                // Signal Processing Error
                Console.WriteLine("Processing - Error");
                Console.WriteLine();
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
                Console.WriteLine();
            }

            // Signal Program Exit
            Console.WriteLine("Press enter to exit ...");
            Console.ReadLine();
        }
Ejemplo n.º 23
0
        private static int Main(string[] args)
        {
            if (args.Length < 1 || String.Compare(args[0], "?") == 0 || String.Compare(args[0], "help", true) == 0)
            {
                displayHelp();
                return(0);
            }

            string teamProject     = "",
                   collection      = "",
                   fullProjectName = "",
                   csvFile         = "";

            foreach (var arg in args)
            {
                var param = arg.ToUpper();
                if (param.IndexOf("/PROJECT=") == 0)
                {
                    param           = param.Substring(param.IndexOf('=') + 1);
                    teamProject     = param.Substring(param.LastIndexOf('/') + 1);
                    collection      = param.Substring(0, param.LastIndexOf('/'));
                    fullProjectName = arg;
                }

                if (param.IndexOf("/IDS=") == 0)
                {
                    csvFile = param.Substring(param.IndexOf('=') + 1);
                }
            }

            if (string.IsNullOrWhiteSpace(teamProject) || string.IsNullOrWhiteSpace(collection))
            {
                Console.WriteLine("");
                Console.WriteLine("* Invalid parameters specified. Review 'help' and try again. *");
                Console.WriteLine("");
                displayHelp();
                return(0);
            }

            try
            {
                var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(collection));
                if (tfs != null)
                {
                    Console.WriteLine("");
                    if (string.IsNullOrWhiteSpace(csvFile))
                    {
                        Console.WriteLine("Are you sure you wish to remove all work-items found under");
                    }
                    else
                    {
                        Console.WriteLine("Are you sure you wish to remove selected work-items declared in");
                        Console.WriteLine("    " + csvFile);
                        Console.WriteLine("from under");
                    }
                    Console.WriteLine("    " + fullProjectName);
                    Console.Write("'Y' to continue, any other key to abort: ");

                    var input = Console.ReadKey();
                    if (input.Key == ConsoleKey.Y)
                    {
                        Console.WriteLine("");
                        Console.WriteLine("");
                        Console.WriteLine("This could take some time, please wait.");

                        int[] toDelete      = null;
                        var   workItemStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));

                        if (string.IsNullOrWhiteSpace(csvFile))
                        {
                            Console.WriteLine("    * Querying TFS project '{0}' for work-items to delete.", teamProject);
                            var queryResults = workItemStore.Query("Select [ID] From WorkItems");
                            toDelete = (from WorkItem workItem in queryResults select workItem.Id).ToArray();
                        }
                        else if (File.Exists(csvFile))
                        {
                            Console.WriteLine("    * Deleting work-items described in '{0}'.", csvFile);
                            var ids     = File.ReadAllText(csvFile);
                            var toParse = ids.Split(',');
                            int parsed;
                            var parsedIds = new List <int>();
                            foreach (var n in toParse)
                            {
                                if (int.TryParse(n, out parsed))
                                {
                                    parsedIds.Add(parsed);
                                }
                            }
                            toDelete = parsedIds.ToArray();
                        }

                        if (toDelete != null && toDelete.Count() > 0)
                        {
                            var errors  = workItemStore.DestroyWorkItems(toDelete);
                            var inError = (errors != null ? errors.Count() : 0);
                            if (inError > 0)
                            {
                                Console.Write("    * Failed to delete {0} WorkItems!", errors.Count());
                                foreach (var error in errors)
                                {
                                    Console.Write("        {0} - {1}", error.Id, error.Exception.Message);
                                }
                            }
                            else
                            {
                                Console.Write("    * Deleted {0} work-items.", toDelete.Count());
                            }
                            workItemStore.RefreshCache();
                            workItemStore.SyncToCache();
                        }
                        else
                        {
                            Console.WriteLine("No work-items found to delete in project '{0}'.", teamProject);
                        }
                    }
                    else
                    {
                        Console.WriteLine("");
                        Console.WriteLine("Phew, aborting delete, no damage done.");
                    }
                }
                else
                {
                    Console.WriteLine("No work-items deleted, unable to connect to TFS. Check URI specified.");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("");
                Console.WriteLine("Failed to delete work-items.");
                Console.Write(ex.Message);
                return(-1);
            }

            return(0);
        }
Ejemplo n.º 24
0
        public int DeepCopy(WiDcConfig a_WiDcConfig)
        {
            this.store = new WorkItemStore(TfsTeamProjectCollectionFactory.GetTeamProjectCollection(a_WiDcConfig.tfsuri));
            WorkItem   workItem1 = this.store.GetWorkItem(a_WiDcConfig.RootWorkItemId);
            List <int> list1     = new List <int>();

            this.touchedWiIds.Add(a_WiDcConfig.RootWorkItemId);
            Dictionary <int, string> dictionary = new Dictionary <int, string>();

            foreach (WorkItemLink workItemLink in (VariableSizeList)workItem1.WorkItemLinks)
            {
                if (!this.touchedWiIds.Contains(workItemLink.TargetId))
                {
                    if (workItemLink.LinkTypeEnd.Name == a_WiDcConfig.PrimaryLinkTypeEnd)
                    {
                        int targetId = workItemLink.TargetId;
                        int key      = -1;
                        if (!a_WiDcConfig.WorkItemTypesToIgnore.Contains(((object)this.store.GetWorkItem(targetId).Type.Name).ToString()))
                        {
                            if (!this.ReplacedIds.TryGetValue(targetId, out key))
                            {
                                a_WiDcConfig.RootWorkItemId = targetId;
                                key = this.DeepCopy(a_WiDcConfig);
                            }
                            list1.Add(targetId);
                            dictionary.Add(key, workItemLink.LinkTypeEnd.Name);
                            this.ReplacedIds.Add(targetId, key);
                        }
                    }
                    else if (!a_WiDcConfig.WorkItemLinkTypesToIgnore.Contains(workItemLink.LinkTypeEnd.Name))
                    {
                        this.CompleteLinkList.Add(workItemLink);
                    }
                }
            }
            WorkItem workItem2 = !a_WiDcConfig.CopyAttachments ? workItem1.Copy(workItem1.Type, WorkItemCopyFlags.None) : workItem1.Copy(workItem1.Type, WorkItemCopyFlags.CopyFiles);

            workItem2.History = "Deep Copy: Copied original WI";
            workItem2.Save();
            WorkItemLink link1 = new WorkItemLink(this.store.WorkItemLinkTypes.LinkTypeEnds[a_WiDcConfig.HistoricLinkTypeEndTo], a_WiDcConfig.RootWorkItemId);

            //dd, 03.04.2014 - wegen Castingfehler
            //link1.Comment = a_WiDcConfig.HistoryComment + (object)"(" + (string)(object)workItem1.Id + "-->" + (string)(object)workItem2.Id + ")";
            link1.Comment = a_WiDcConfig.HistoryComment + "(" + workItem1.Id.ToString() + "-->" + workItem2.Id.ToString() + ")";
            workItem2.WorkItemLinks.Add(link1);
            workItem2.History = "Deep Copy: Added History Link";
            workItem2.Save();
            foreach (KeyValuePair <int, string> keyValuePair in dictionary)
            {
                WorkItemLink link2 = new WorkItemLink(this.store.WorkItemLinkTypes.LinkTypeEnds[keyValuePair.Value], keyValuePair.Key);
                workItem2.WorkItemLinks.Add(link2);
            }
            workItem2.History = "Deep Copy: Added Parent/Child Links to Work Items";
            workItem2.Save();
            List <Hyperlink> list2 = new List <Hyperlink>();
            List <Hyperlink> list3 = new List <Hyperlink>();

            foreach (Link link2 in (VariableSizeList)workItem1.Links)
            {
                if (link2.BaseType == BaseLinkType.Hyperlink)
                {
                    Hyperlink hyperlink1 = link2 as Hyperlink;
                    string    location   = hyperlink1.Location;
                    if (a_WiDcConfig.ReplaceHyperlinkUri)
                    {
                        foreach (KeyValuePair <string, string> keyValuePair in a_WiDcConfig.UrlReplaceDic)
                        {
                            location = location.Replace(keyValuePair.Key, keyValuePair.Value);
                        }
                    }
                    Hyperlink hyperlink2 = new Hyperlink(location);
                    hyperlink2.Comment = link2.Comment;
                    list2.Add(hyperlink2);
                    list3.Add(hyperlink1);
                }
            }
            foreach (Hyperlink hyperlink in list3)
            {
                workItem2.Links.Remove((Link)hyperlink);
            }
            foreach (Hyperlink link2 in list2)
            {
                workItem2.Links.Add(link2);
            }
            workItem2.History = !a_WiDcConfig.ReplaceHyperlinkUri ? "Deep Copy: Added Hyperlinks (no URL replacement)" : "Deep Copy: Added Hyperlinks (with URL replacement)";
            if (workItem2.IsValid())
            {
                workItem2.Save();
            }
            if (a_WiDcConfig.KeepChangesetLinks)
            {
                foreach (Link link2 in (VariableSizeList)workItem1.Links)
                {
                    if (link2.BaseType == BaseLinkType.ExternalLink)
                    {
                        ExternalLink externalLink = link2 as ExternalLink;
                        if (externalLink != null && externalLink.ArtifactLinkType.Name == "Fixed in Changeset")
                        {
                            workItem2.Links.Add(new ExternalLink(link2.ArtifactLinkType, externalLink.LinkedArtifactUri));
                        }
                    }
                }
                workItem2.History = "Deep Copy: Added Changeset Links";
                workItem2.Save();
            }
            else if (a_WiDcConfig.KeepLinkToLatestChangesetOnly)
            {
                int num = a_WiDcConfig.NrOfChangesetLinksToKeep;
                List <ExternalLink> list4 = new List <ExternalLink>();
                foreach (Link link2 in (VariableSizeList)workItem1.Links)
                {
                    if (link2.BaseType == BaseLinkType.ExternalLink)
                    {
                        ExternalLink externalLink = link2 as ExternalLink;
                        if (externalLink != null && externalLink.ArtifactLinkType.Name == "Fixed in Changeset")
                        {
                            list4.Add(externalLink);
                        }
                    }
                }
                ExternalLink externalLink1 = (ExternalLink)null;
                foreach (ExternalLink externalLink2 in list4)
                {
                    if (externalLink1 == null)
                    {
                        externalLink1 = externalLink2;
                    }
                    else if (((object)externalLink1.LinkedArtifactUri).ToString().Substring(((object)externalLink1.LinkedArtifactUri).ToString().IndexOf("Changeset/")).CompareTo(((object)externalLink2.LinkedArtifactUri).ToString().Substring(((object)externalLink2.LinkedArtifactUri).ToString().IndexOf("Changeset/"))) < 0)
                    {
                        externalLink1 = externalLink2;
                    }
                }
                if (externalLink1 != null)
                {
                    workItem2.Links.Add(new ExternalLink(externalLink1.ArtifactLinkType, externalLink1.LinkedArtifactUri));
                    workItem2.History = "Deep Copy: Added latest Changeset Link";
                    workItem2.Save();
                }
            }
            if (a_WiDcConfig.KeepVersionedItemLinks)
            {
                foreach (Link link2 in (VariableSizeList)workItem1.Links)
                {
                    if (link2.BaseType == BaseLinkType.ExternalLink)
                    {
                        ExternalLink externalLink = link2 as ExternalLink;
                        if (externalLink != null && externalLink.ArtifactLinkType.Name == "Source Code File")
                        {
                            workItem2.Links.Add(new ExternalLink(link2.ArtifactLinkType, externalLink.LinkedArtifactUri));
                        }
                    }
                }
            }
            workItem2.History = "Deep Copy: Added Versioned Item Links";
            workItem2.Save();
            if (a_WiDcConfig.ReplaceCustomFieldValue)
            {
                Field field1 = (Field)null;
                foreach (Field field2 in (ReadOnlyList)workItem2.Fields)
                {
                    if (field2.ReferenceName == a_WiDcConfig.CustomFieldRefName)
                    {
                        field1 = field2;
                        break;
                    }
                }
                if (field1 != null)
                {
                    object obj = workItem2.Fields[a_WiDcConfig.CustomFieldRefName].Value;
                    try
                    {
                        field1.Value      = (object)a_WiDcConfig.CustomFieldValue;
                        workItem2.History = "Deep Copy: Replaced Custom Field value.";
                        workItem2.Save();
                    }
                    catch
                    {
                        field1.Value      = obj;
                        workItem2.History = "Deep Copy: Replaced Custom Field value - FAILED [wrong value type!].";
                        workItem2.Save();
                    }
                }
            }
            return(workItem2.Id);
        }
Ejemplo n.º 25
0
 private static TfsTeamProjectCollection GetTfsTeamProjects()
 {
     TfsTeamProjects = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(TfsServerUrl));
     TfsTeamProjects.Connect(ConnectOptions.None);
     return(TfsTeamProjects);
 }
Ejemplo n.º 26
0
        public void SetWorkItemStore(Uri tfsUri, string project)
        {
            var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tfsUri);

            this.WorkItemStore = tfs.GetService <WorkItemStore>();
        }
Ejemplo n.º 27
0
        public static void MyClassInitialize(TestContext testContext)
        {
            _testContext = testContext;

            AIT.TFS.SyncService.Service.AssemblyInit.Instance.Init();
            AIT.TFS.SyncService.Adapter.TFS2012.AssemblyInit.Instance.Init();

            var serverConfig = CommonConfiguration.TfsTestServerConfiguration(_testContext);

            CommonConfiguration.ReplaceConfigFileTokens(_testContext);
            var config = CommonConfiguration.GetSimpleFieldConfiguration("Requirement", Direction.OtherToTfs, FieldValueType.PlainText, "System.Title");

            _testAdapter = SyncServiceFactory.CreateTfsTestAdapter(serverConfig.TeamProjectCollectionUrl, serverConfig.TeamProjectName, config);
            var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(serverConfig.TeamProjectCollectionUrl));

            _testManagement = projectCollection.GetService <ITestManagementService>().GetTeamProject(serverConfig.TeamProjectName);

            var sharedSteps = _testManagement.SharedSteps.Query("SELECT * FROM WorkItems WHERE System.Title='UnitTest_SharedStep'");

            _sharedStep = sharedSteps.FirstOrDefault();

            if (_sharedStep == null)
            {
                _sharedStep = _testManagement.SharedSteps.Create();
                var sharedStep1 = _sharedStep.CreateTestStep();
                sharedStep1.Title          = "First Shared Step";
                sharedStep1.ExpectedResult = "Result of first shared step";

                var sharedStep2 = _sharedStep.CreateTestStep();
                sharedStep2.Title          = "Second Shared Step .: @ParametersDontLikeSpecialChars";
                sharedStep2.ExpectedResult = "Result of second shared step";

                _sharedStep.Actions.Add(sharedStep1);
                _sharedStep.Actions.Add(sharedStep2);

                _sharedStep.Title = "UnitTest_SharedStep_1";
                _sharedStep.Save();
            }
            else
            {
                var sharedStep1 = _sharedStep.Actions[0] as ITestStep;
                if (sharedStep1 != null)
                {
                    sharedStep1.Title          = "First Shared Step";
                    sharedStep1.ExpectedResult = "Result of first shared step";
                }

                var sharedStep2 = _sharedStep.Actions[1] as ITestStep;
                if (sharedStep2 != null)
                {
                    sharedStep2.Title          = "Second Shared Step .: @ParametersDontLikeSpecialChars";
                    sharedStep2.ExpectedResult = "Result of second shared step";
                }

                _sharedStep.WorkItem.Open();
                _sharedStep.Save();
            }

            var testCases = _testManagement.TestCases.Query("SELECT * FROM WorkItems WHERE System.Title='UnitTest_TestCase'");

            _testCase = testCases.FirstOrDefault();

            if (_testCase == null)
            {
                _testCase       = _testManagement.TestCases.Create();
                _testCase.Title = "UnitTest_TestCase";

                var step1 = _testCase.CreateTestStep();
                step1.Title          = "First Step";
                step1.ExpectedResult = "Result of first step";

                var step2 = _testCase.CreateTestStep();
                step2.Title          = "Second Step";
                step2.ExpectedResult = "Result of second step";

                var step3 = _testCase.CreateTestStep();
                step3.Title          = "@DescriptionParameter";
                step3.ExpectedResult = "@ExpectedResultParameter";

                var ssr = _testCase.CreateSharedStepReference();
                ssr.SharedStepId = _sharedStep.Id;

                _testCase.Actions.Add(step1);
                _testCase.Actions.Add(step2);
                _testCase.Actions.Add(ssr);
                _testCase.Actions.Add(step3);
                _testCase.Save();
            }

            var testConfigurations = _testManagement.TestConfigurations.Query("Select * from TestConfiguration where Name='UnitTest_TestConfiguration'");

            _testConfiguration = testConfigurations.FirstOrDefault();

            if (_testConfiguration == null)
            {
                _testConfiguration      = _testManagement.TestConfigurations.Create();
                _testConfiguration.Name = "UnitTest_TestConfiguration";
                _testConfiguration.Save();
            }
        }
Ejemplo n.º 28
0
        public Validation()
        {
            _tfsServer = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(ConfigurationManager.AppSettings["TfsServer"]));
            _vsoServer = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(ConfigurationManager.AppSettings["VsoServer"]));
            _vsoStore  = _vsoServer.GetService <WorkItemStore>();
            _tfsStore  = _tfsServer.GetService <WorkItemStore>();

            var actionValue = ConfigurationManager.AppSettings["Action"];

            if (actionValue.Equals("validate", StringComparison.OrdinalIgnoreCase))
            {
                _action = Action.Validate;
            }
            else
            {
                _action = Action.Compare;
            }

            var runDateTime = DateTime.Now.ToString("yyyy-MM-dd-HHmmss");

            var dataFilePath = ConfigurationManager.AppSettings["DataFilePath"];
            var dataDir      = string.IsNullOrWhiteSpace(dataFilePath) ? Directory.GetCurrentDirectory() : dataFilePath;
            var dirName      = string.Format("{0}\\Log-{1}", dataDir, runDateTime);


            if (!Directory.Exists(dirName))
            {
                Directory.CreateDirectory(dirName);
            }

            _errorLog  = new Logging(string.Format("{0}\\Error.txt", dirName));
            _statusLog = new Logging(string.Format("{0}\\Status.txt", dirName));
            _fullLog   = new Logging(string.Format("{0}\\FullLog.txt", dirName));

            _taskList = new List <Task>();

            if (!_action.Equals(Action.Compare))
            {
                return;
            }

            _valFieldErrorLog          = new Logging(string.Format("{0}\\FieldError.txt", dirName));
            _valTagErrorLog            = new Logging(string.Format("{0}\\TagError.txt", dirName));
            _valPostMigrationUpdateLog = new Logging(string.Format("{0}\\PostMigrationUpdate.txt", dirName));

            _imageLog = new Logging(string.Format("{0}\\ItemsWithImage.txt", dirName));

            _commonFields        = new List <string>();
            _itemTypesToValidate = new List <string>();

            var fields = ConfigurationManager.AppSettings["CommonFields"].Split(',');

            foreach (var field in fields)
            {
                _commonFields.Add(field);
            }

            var types = ConfigurationManager.AppSettings["WorkItemTypes"].Split(',');

            foreach (var type in types)
            {
                _itemTypesToValidate.Add(type);
            }
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Gets the team project collection.
 /// </summary>
 /// <returns></returns>
 public TfsTeamProjectCollection GetTeamProjectCollection()
 {
     return(TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(this.TfsServer.ActiveProjectContext.DomainUri)));
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="cfg">Configuration</param>
        public TfsCore(TfsMigrationDataSource cfg)
        {
            m_rwLock = new ReaderWriterLock();
            m_cfg    = cfg;
            //m_missingArea = missingArea;
            //m_missingIteration = missingIteration;

            m_srv = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(cfg.ServerName));
            m_srv.EnsureAuthenticated();
            TraceManager.TraceInformation("Authenticated User for Uri {0} is '{1}'", m_srv.Uri, m_srv.AuthorizedIdentity.DisplayName);

            //// Verify whether the user is in the service account group. Throw an exception if it is not.
            //// TODO: move this to proper location
            //IGroupSecurityService gss = (IGroupSecurityService)m_srv.GetService(typeof(IGroupSecurityService));
            //Identity serviceAccountIdentity = gss.ReadIdentity(SearchFactor.ServiceApplicationGroup, null, QueryMembership.None);
            //if (!gss.IsMember(serviceAccountIdentity.Sid, m_srv.AuthenticatedUserIdentity.Sid))
            //{
            //    throw new MigrationException(
            //        string.Format(TfsWITAdapterResources.UserNotInServiceAccountGroup, m_srv.AuthenticatedUserName, m_srv.Name));
            //}

            m_store = CreateWorkItemStore();
            m_name  = string.Format(
                CultureInfo.InvariantCulture,
                "{0} ({1})",
                m_store.TeamProjectCollection.Name,
                m_cfg.Project);

            Project p = m_store.Projects[cfg.Project];

            m_projectUri = p.Uri.ToString();
            m_projectId  = p.Id;

            //// Check existence of default area and iteration, if any
            //if (!string.IsNullOrEmpty(cfg.DefaultArea))
            //{
            //    m_defaultAreaId = GetNode(Node.TreeType.Area, cfg.DefaultArea, false);
            //}
            //else
            //{
            //    m_defaultAreaId = p.Id;
            //}
            //if (!string.IsNullOrEmpty(cfg.DefaultIteration))
            //{
            //    m_defaultIterationId = GetNode(Node.TreeType.Iteration, cfg.DefaultIteration, false);
            //}
            //else
            //{
            //    m_defaultIterationId = p.Id;
            //}
            /// TODO: replace the code below with configuration in consideration
            m_defaultAreaId      = p.Id;
            m_defaultIterationId = p.Id;

            // Obtain registration info
            IRegistration regSvc = (IRegistration)m_store.TeamProjectCollection.GetService(typeof(IRegistration));

            RegistrationEntry[] res = regSvc.GetRegistrationEntries(ToolNames.WorkItemTracking);

            if (res.Length != 1)
            {
                throw new MigrationException(TfsWITAdapterResources.ErrorMalformedRegistrationData, cfg.ServerName);
            }

            RegistrationEntry e = res[0];

            // Extract all data from the registration entry.
            for (int i = 0; i < e.ServiceInterfaces.Length; i++)
            {
                ServiceInterface si = e.ServiceInterfaces[i];

                if (TFStringComparer.ServiceInterface.Equals(si.Name, ServiceInterfaces.WorkItem))
                {
                    m_witUrl = si.Url;
                }
                else if (TFStringComparer.ServiceInterface.Equals(si.Name, "ConfigurationSettingsUrl"))
                {
                    m_configUrl = si.Url;
                }
            }

            for (int i = 0; i < e.RegistrationExtendedAttributes.Length; i++)
            {
                RegistrationExtendedAttribute a = e.RegistrationExtendedAttributes[i];

                if (RegistrationUtilities.Compare(a.Name, "AttachmentServerUrl") == 0)
                {
                    m_attachUrl = a.Value;
                    break;
                }
            }

            if (string.IsNullOrEmpty(m_witUrl) || string.IsNullOrEmpty(m_configUrl) ||
                string.IsNullOrEmpty(m_attachUrl))
            {
                throw new MigrationException(TfsWITAdapterResources.ErrorMalformedRegistrationData,
                                             m_cfg.ServerName);
            }

            m_attachUrl = CombineUrl(m_attachUrl, m_witUrl);
        }