Exemplo n.º 1
0
 internal SyncContext(TfsConnection sourceConnection, WorkItemStore sourceWIStore, string sourceProjectName, WorkItemStore destWIStore, string destProjectName, WorkItemsStageConfiguration mapping, WitMappingIndex index, IEngineEvents eventSink)
 {
     this.sourceConnection  = sourceConnection;
     this.sourceWIStore     = sourceWIStore;
     this.sourceProjectName = sourceProjectName;
     this.destWIStore       = destWIStore;
     this.destProjectName   = destProjectName;
     this.mapping           = mapping;
     this.index             = index;
     this.eventSink         = eventSink;
 }
Exemplo n.º 2
0
 internal SyncContext(SyncContext rhs)
 {
     this.sourceConnection  = rhs.sourceConnection;
     this.sourceWIStore     = rhs.sourceWIStore;
     this.sourceProjectName = rhs.sourceProjectName;
     this.destWIStore       = rhs.destWIStore;
     this.destProjectName   = rhs.destProjectName;
     this.mapping           = rhs.mapping;
     this.index             = rhs.index;
     this.eventSink         = rhs.eventSink;
 }
Exemplo n.º 3
0
 private void MakeConnections()
 {
     sourceConn = new TfsConnection()
     {
         CollectionUrl = new Uri(configuration.SourceConnection.CollectionUrl),
         ProjectName   = configuration.SourceConnection.ProjectName,
         Credential    = new NetworkCredential(configuration.SourceConnection.User, configuration.SourceConnection.Password)
     };
     destConn = new TfsConnection()
     {
         CollectionUrl = new Uri(configuration.DestinationConnection.CollectionUrl),
         ProjectName   = configuration.DestinationConnection.ProjectName,
         Credential    = new NetworkCredential(configuration.DestinationConnection.User, configuration.DestinationConnection.Password)
     };
 }
        // TODO move this code out of this class to remove dependency on Microsoft.TeamFoundation.WorkItemTracking.Client
        internal void SetDefaults(TfsConnection sourceConn, WorkItemStore sourceWIStore, TfsConnection destConn, WorkItemStore destWIStore)
        {
            // add defaults
            this.SourceQuery      = this.SourceQuery ?? string.Format("SELECT id FROM workitems WHERE [Team Project]='{0}'", sourceConn.ProjectName);
            this.DestinationQuery = this.DestinationQuery ?? string.Format("SELECT id FROM workitems WHERE [Team Project]='{0}'", destConn.ProjectName);
            this.AreaMap          = this.AreaMap ?? new AreaMap[] { new AreaMap()
                                                                    {
                                                                        SourcePath = "*", DestinationPath = "*"
                                                                    } };
            this.IterationMap = this.IterationMap ?? new IterationMap[] { new IterationMap()
                                                                          {
                                                                              SourcePath = "*", DestinationPath = "*"
                                                                          } };
            var defaultFieldRules = new FieldMap[] {
                new FieldMap()
                {
                    Source = "System.AreaId", Destination = ""
                },
                new FieldMap()
                {
                    Source = "System.AreaPath", Destination = "System.AreaPath", Translate = "MapAreaPath"
                },
                new FieldMap()
                {
                    Source = "System.IterationId", Destination = ""
                },
                new FieldMap()
                {
                    Source = "System.IterationPath", Destination = "System.IterationPath", Translate = "MapIterationPath"
                },
                new FieldMap()
                {
                    Source = "System.Reason", Destination = ""
                },
                new FieldMap()
                {
                    Source = "Microsoft.VSTS.Common.StateChangeDate", Destination = ""
                },
                new FieldMap()
                {
                    Source = "System.CreatedDate", Destination = ""
                },
                new FieldMap()
                {
                    Source = "System.ChangedDate", Destination = ""
                },
                new FieldMap()
                {
                    Source = "Microsoft.VSTS.Common.ActivatedDate", Destination = ""
                },
                new FieldMap()
                {
                    Source = "System.Rev", Destination = ""
                },
                new FieldMap()
                {
                    Source = "*", Destination = "*"
                }
            };
            var sourceWItypes = sourceWIStore.Projects[sourceConn.ProjectName].WorkItemTypes;

            if (this.WorkItemMappings == null)
            {
                var mappings = new List <WorkItemMap>();
                mappings.AddRange(sourceWItypes.ConvertAll(wit =>
                {
                    return(new WorkItemMap()
                    {
                        SourceType = wit.Name,
                        DestinationType = wit.Name,
                        Attachments = WorkItemMap.AttachmentMode.Sync,
                        RollbackValidationErrors = true,
                        Fields = defaultFieldRules
                    });
                }));
                this.WorkItemMappings = mappings.ToArray();
            }
            else
            {
                this.WorkItemMappings.ForEach(m =>
                {
                    if (m.Fields == null)
                    {
                        m.Fields = defaultFieldRules;
                    }
                    else if (m.DefaultRules)
                    {
                        var mixin = new List <FieldMap>();
                        mixin.AddRange(m.Fields);
                        mixin.AddRange(defaultFieldRules);
                        m.Fields = mixin.ToArray();
                    }
                });
            }
            this.LinkTypeMap = this.LinkTypeMap ?? new LinkTypeMap[] { new LinkTypeMap()
                                                                       {
                                                                           SourceType = "*", DestinationType = "*"
                                                                       } };
        }
Exemplo n.º 5
0
 public void ExecutingDestinationQuery(string queryName, TfsConnection destConn)
 {
     this.Info("Executing source query {2} on {0}\\{1}.", destConn.CollectionUrl, destConn.ProjectName, queryName);
 }
Exemplo n.º 6
0
 public void ExecutingSourceQuery(string queryName, TfsConnection sourceConn)
 {
     this.Info("Executing source query {2} on {0}\\{1}.", sourceConn.CollectionUrl, sourceConn.ProjectName, queryName);
 }
Exemplo n.º 7
0
 protected string GetUsername(TfsConnection conn)
 {
     return(conn.GetUsername());
 }
Exemplo n.º 8
0
 public void DestinationConnected(TfsConnection destConn)
 {
     this.Info("Connected to destination {0}\\{1} as {2}.", destConn.CollectionUrl, destConn.ProjectName, GetUsername(destConn));
 }
Exemplo n.º 9
0
 public void ConnectingDestination(TfsConnection destConn)
 {
     this.Verbose("Connecting to destination {0}.", destConn.CollectionUrl);
 }
Exemplo n.º 10
0
 public PipelineStage(TfsConnection source, TfsConnection dest, IEngineEvents eventHandler)
 {
     sourceConn = source;
     destConn   = dest;
     eventSink  = eventHandler;
 }
Exemplo n.º 11
0
 public void SourceConnected(TfsConnection sourceConn)
 {
     this.Info("Connected to source {0}\\{1} as {2}.", sourceConn.CollectionUrl, sourceConn.ProjectName, GetUsername(sourceConn));
 }
Exemplo n.º 12
0
 public void ConnectingSource(TfsConnection sourceConn)
 {
     this.Verbose("Connecting to source {0}.", sourceConn.CollectionUrl);
 }
 public AreasAndIterationsStage(TfsConnection source, TfsConnection dest, IEngineEvents eventHandler, StageOptions options)
     : base(source, dest, eventHandler)
 {
     this.options = options;
 }
 public IterationsStage(TfsConnection source, TfsConnection dest, IEngineEvents eventHandler)
     : base(source, dest, eventHandler, StageOptions.Iterations)
 {
 }
Exemplo n.º 15
0
 public WorkItemsStage(TfsConnection source, TfsConnection dest, IEngineEvents eventHandler)
     : base(source, dest, eventHandler)
 {
     //no-op
 }
Exemplo n.º 16
0
 // TODO move this code out of this class to remove dependency on Microsoft.TeamFoundation.WorkItemTracking.Client
 internal void SetDefaults(TfsConnection sourceConn, WorkItemStore sourceWIStore, TfsConnection destConn, WorkItemStore destWIStore)
 {
     // add defaults
     this.SourceQuery      = this.SourceQuery ?? string.Format("SELECT id FROM workitems WHERE [Team Project]='{0}'", sourceConn.ProjectName);
     this.DestinationQuery = this.DestinationQuery ?? string.Format("SELECT id FROM workitems WHERE [Team Project]='{0}'", destConn.ProjectName);
     this.AreaMap          = this.AreaMap ?? new AreaMap[] { new AreaMap()
                                                             {
                                                                 SourcePath = "*", DestinationPath = "*"
                                                             } };
     this.IterationMap = this.IterationMap ?? new IterationMap[] { new IterationMap()
                                                                   {
                                                                       SourcePath = "*", DestinationPath = "*"
                                                                   } };
     if (this.WorkItemMappings == null)
     {
         var mappings = new List <WorkItemMap>();
         foreach (WorkItemType wit in sourceWIStore.Projects[sourceConn.ProjectName].WorkItemTypes)
         {
             mappings.Add(new WorkItemMap()
             {
                 SourceType      = wit.Name,
                 DestinationType = wit.Name,
                 SyncAttachments = true,
                 Fields          = new FieldMap[] {
                     // HACK these names are OK for Scrum, but ...
                     new FieldMap()
                     {
                         Source = "Area ID", Destination = ""
                     },
                     new FieldMap()
                     {
                         Source = "Area Path", Destination = "Area Path", Translate = "MapAreaPath"
                     },
                     new FieldMap()
                     {
                         Source = "Iteration ID", Destination = ""
                     },
                     new FieldMap()
                     {
                         Source = "Iteration Path", Destination = "Iteration Path", Translate = "MapIterationPath"
                     },
                     new FieldMap()
                     {
                         Source = "Reason", Destination = ""
                     },
                     new FieldMap()
                     {
                         Source = "State Change Date", Destination = ""
                     },
                     new FieldMap()
                     {
                         Source = "Created Date", Destination = ""
                     },
                     new FieldMap()
                     {
                         Source = "Changed Date", Destination = ""
                     },
                     new FieldMap()
                     {
                         Source = "*", Destination = "*"
                     }
                 }
             });
         }//for
         this.WorkItemMappings = mappings.ToArray();
     }
     this.LinkTypeMap = this.LinkTypeMap ?? new LinkTypeMap[] { new LinkTypeMap()
                                                                {
                                                                    SourceType = "*", DestinationType = "*"
                                                                } };
 }
Exemplo n.º 17
0
 public GlobalListsStage(TfsConnection source, TfsConnection dest, IEngineEvents eventHandler)
     : base(source, dest, eventHandler)
 {
     //no-op
 }
Exemplo n.º 18
0
 public void BypassingRulesOnDestinationWorkItemStore(TfsConnection destConn)
 {
     this.Info("Bypassing validation rules on destination project {0}.", destConn.ProjectName);
 }