Skip to content

Commit 64924b0

Browse files
committed
PR 31: Merge addTraceSwitch to master +semver: minor
- Updated code to try and improve performance. +semver: minor - Updated to improve performance by disabling the full text search for work items - Think we have fixed performance isues +semver: minor - Updated +semver: patch - Added telemitery switch - Merged conflict +semver: patch
1 parent 88f1113 commit 64924b0

File tree

2 files changed

+57
-28
lines changed

2 files changed

+57
-28
lines changed

TfsWitMigrator.Console/Program.cs

Lines changed: 55 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,59 @@ static void Main(string[] args)
3232

3333

3434
MigrationEngine me = new MigrationEngine();
35-
me.SetTarget(new TeamProjectContext(new Uri("https://tfs.test.company.com/tfs/collection/"), "project"));
36-
me.SetReflectedWorkItemIdFieldName("ReflectedWorkItemId");
37-
Dictionary<string, string> stateMapping = new Dictionary<string, string>();
38-
stateMapping.Add("New", "New");
39-
stateMapping.Add("Approved", "New");
40-
stateMapping.Add("Committed", "Active");
41-
stateMapping.Add("In Progress", "Active");
42-
stateMapping.Add("To Do", "New");
43-
stateMapping.Add("Done", "Closed");
44-
45-
46-
me.AddFieldMap("*", new FieldToTagFieldMap("System.State", "OriginalState:{0}"));
47-
me.AddFieldMap("*", new FieldMergeMap("System.Description", "company.department.project.ComponentName", "System.Description", @"Component Name: {1} <br/><br/>{0}"));
48-
me.AddFieldMap("*", new FieldMergeMap("System.Description", "Microsoft.VSTS.Common.BusinessValue", "System.Description", @"Business Value: {1} <br/><br/>{0}"));
49-
me.AddFieldMap("*", new FieldMergeMap("System.Description", "Microsoft.VSTS.Common.AcceptanceCriteria", "System.Description", @"{0} <br/><br/><h3>Acceptance Criteria</h3>{1}"));
50-
me.AddFieldMap("*", new FieldValueMap("System.State", "System.State", stateMapping));
51-
me.AddFieldMap("*", new FieldToFieldMap("Microsoft.VSTS.Common.BacklogPriority", "Microsoft.VSTS.Common.StackRank"));
52-
me.AddFieldMap("*", new FieldToFieldMap("Microsoft.VSTS.Scheduling.Effort", "Microsoft.VSTS.Scheduling.StoryPoints"));
53-
me.AddFieldMap("*", new FieldToFieldMap("Microsoft.VSTS.CMMI.AcceptanceCriteria", "Slb.SIS.Analysis"));
54-
55-
me.AddFieldMap("Bug", new FieldMergeMap("Microsoft.VSTS.TCM.ReproSteps", "company.department.TaiJi.ComponentName", "Microsoft.VSTS.TCM.ReproSteps", @"Component Name: {1} <br/><br/>{0}"));
56-
me.AddFieldMap("Bug", new FieldMergeMap("Microsoft.VSTS.TCM.ReproSteps", "Microsoft.VSTS.Common.BusinessValue", "Microsoft.VSTS.TCM.ReproSteps", @"Business Value: {1} <br/><br/>{0}"));
57-
me.AddFieldMap("Bug", new FieldMergeMap("Microsoft.VSTS.TCM.ReproSteps", "Microsoft.VSTS.Common.AcceptanceCriteria", "Microsoft.VSTS.TCM.ReproSteps", @"{0} <br/><br/><h3>Acceptance Criteria</h3>{1}"));
58-
me.AddFieldMap("Bug", new FieldMergeMap("System.Area", "company.department.TaiJi.ComponentName", "System.Area", @"{0}\{1}"));
59-
60-
me.AddProcessor(new WorkItemUpdate(me, @" AND [System.Id]=26204"));
35+
Telemetry.EnableTrace = true;
36+
37+
me.SetSource(new TeamProjectContext(new Uri("https://tfs.test.slb.com/tfs/Drilling/"), "TaiJi"));
38+
me.SetTarget(new TeamProjectContext(new Uri("https://tfs.test.slb.com/tfs/SLB1/"), "Taiji_New"));
39+
me.SetReflectedWorkItemIdFieldName("TfsMigrationTool.ReflectedWorkItemId");
40+
me.AddWorkItemTypeDefinition("User Story", new DescreteWitdMapper("User Story"));
41+
me.AddWorkItemTypeDefinition("Requirement", new DescreteWitdMapper("Requirement"));
42+
me.AddWorkItemTypeDefinition("Task", new DescreteWitdMapper("Task"));
43+
me.AddWorkItemTypeDefinition("Bug", new DescreteWitdMapper("Bug"));
44+
me.AddWorkItemTypeDefinition("Shared Steps", new DescreteWitdMapper("Shared Steps"));
45+
me.AddWorkItemTypeDefinition("Shared Parameter", new DescreteWitdMapper("Shared Parameter"));
46+
me.AddWorkItemTypeDefinition("Test Case", new DescreteWitdMapper("Test Case"));
47+
48+
// me.AddProcessor<NodeStructuresMigrationContext>();
49+
me.AddProcessor(new WorkItemMigrationContext(me, @"AND NOT [TfsMigrationTool.ReflectedWorkItemId] contains 'http' AND [System.WorkItemType] IN ('Shared Steps', 'Shared Parameter', 'Test Case', 'Requirement', 'Task', 'User Story', 'Bug') "));
50+
51+
//AND [TfsMigrationTool.ReflectedWorkItemId] = ''
52+
53+
//Dictionary<string, string> stateMapping = new Dictionary<string, string>();
54+
//stateMapping.Add("New", "New");
55+
//stateMapping.Add("Approved", "New");
56+
//stateMapping.Add("Committed", "Active");
57+
//stateMapping.Add("In Progress", "Active");
58+
//stateMapping.Add("To Do", "New");
59+
//stateMapping.Add("Done", "Closed");
60+
61+
//Dictionary<string, string> testPlanMapping = new Dictionary<string, string>();
62+
//testPlanMapping.Add("Yes", "End-User Functionality");
63+
//testPlanMapping.Add("No", "");
64+
//testPlanMapping.Add("", "");
65+
//testPlanMapping.Add("Blank", "");
66+
//me.AddFieldMap("User Story", new FieldValueMap("Slb.Drilling.NeedTestPlan", "Slb.SIS.UserStoryType", testPlanMapping));
67+
68+
//me.AddFieldMap("*", new FieldToTagFieldMap("System.State", "OriginalState:{0}"));
69+
////me.AddFieldMap("*", new FieldMergeMap("System.Description", "Microsoft.VSTS.Common.BusinessValue", "System.Description", @"Business Value: {1} <br/><br/>{0}"));
70+
////me.AddFieldMap("*", new FieldMergeMap("System.Description", "Microsoft.VSTS.Common.AcceptanceCriteria", "System.Description", @"{0} <br/><br/><h3>Acceptance Criteria</h3>{1}"));
71+
//me.AddFieldMap("*", new FieldValueMap("System.State", "System.State", stateMapping));
72+
//me.AddFieldMap("*", new FieldToFieldMap("Microsoft.VSTS.Common.BacklogPriority", "Microsoft.VSTS.Common.StackRank"));
73+
//me.AddFieldMap("*", new FieldToFieldMap("Microsoft.VSTS.Scheduling.Effort", "Microsoft.VSTS.Scheduling.StoryPoints"));
74+
//me.AddFieldMap("*", new FieldToFieldMap("Microsoft.VSTS.Common.AcceptanceCriteria", "Slb.SIS.Analysis"));
75+
//me.AddFieldMap("*", new FieldToFieldMap("Microsoft.VSTS.Common.AcceptanceCriteria", "SLB.SWT.VerifyDetails"));
76+
77+
//me.AddFieldMap("Bug", new FieldMergeMap("System.Area", "Slb.BGC.TaiJi.ComponentName", "System.Area", @"{0}\{1}"));
78+
//me.AddFieldMap("Bug", new FieldMergeMap("Microsoft.VSTS.TCM.ReproSteps", "Slb.BGC.TaiJi.ComponentName", "Microsoft.VSTS.TCM.ReproSteps", @"Component Name: {1} <br/><br/>{0}"));
79+
//me.AddFieldMap("Bug", new FieldMergeMap("Microsoft.VSTS.TCM.ReproSteps", "Microsoft.VSTS.Common.BusinessValue", "Microsoft.VSTS.TCM.ReproSteps", @"Business Value: {1} <br/><br/>{0}"));
80+
//me.AddFieldMap("*", new FieldToFieldMap("Slb.BGC.Regression", "Slb.SWT.Regression"));
81+
//me.AddFieldMap("*", new FieldToTagFieldMap("Microsoft.VSTS.Common.BusinessValue", "BV:{0}"));
82+
//me.AddFieldMap("*", new FieldToTagFieldMap("Slb.BGC.TaiJi.ComponentName", "CN:{0}"));
83+
//me.AddFieldMap("*", new FieldToFieldMap("Slb.BGC.MustFixBy", "Slb.SWT.MajorTargetedForVersion"));
84+
//me.AddFieldMap("*", new FieldToFieldMap("Microsoft.VSTS.Common.Severity", "Slb.SWT.UserImpact"));
85+
86+
//me.AddProcessor(new WorkItemUpdate(me, @" "));// AND [System.Id]=24125")); //
87+
6188

6289
//me.AddFieldMap("Requirement", new FieldToTagFieldMap("COMPANY.PRODUCT.ReqType", "ReqType:{0}"));
6390
//me.AddFieldMap("Requirement", new FieldToTagFieldMap("COMPANY.PRODUCT.Theme", "Theme:{0}"));
@@ -89,7 +116,8 @@ static void Main(string[] args)
89116
// me.AddWorkItemTypeDefinition("Bug", new DescreteWitdMapper("Bug"));
90117

91118
// me.AddProcessor<NodeStructuresMigrationContext>();
92-
// me.AddProcessor<WorkItemMigrationContext>();
119+
//tfsqc.Query = @"AND [TfsMigrationTool.ReflectedWorkItemId] = '' AND [Microsoft.VSTS.Common.ClosedDate] = '' AND [System.WorkItemType] IN ('Shared Steps', 'Shared Parameter', 'Test Case', 'Requirement', 'Task', 'User Story', 'Bug') ORDER BY [System.ChangedDate] ass "; // AND [Microsoft.VSTS.Common.ClosedDate] = '' AND [System.WorkItemType] = 'Test Case' AND [System.AreaPath] = 'Platform' ";// AND [System.Id] = 452603 ";
120+
93121
// me.AddProcessor<LinkMigrationContext>();
94122
//me.AddProcessor<AttachementExportMigrationContext>();
95123
// me.AddProcessor<AttachementImportMigrationContext>();

TfsWitMigrator.Core/Telemetry.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public static class Telemetry
1313
{
1414
private const string applicationInsightsKey = "a7622e0a-0b81-4be1-9e85-81d500642b6f";
1515
private static TelemetryClient telemetryClient;
16+
public static bool EnableTrace = false;
1617

1718
public static TelemetryClient Current { get {
1819
if (telemetryClient == null)
@@ -24,7 +25,7 @@ public static TelemetryClient Current { get {
2425

2526
public static void InitiliseTelemetry()
2627
{
27-
// Performance? Trace.Listeners.Add(new ApplicationInsightsTraceListener(applicationInsightsKey));
28+
if (EnableTrace) { Trace.Listeners.Add(new ApplicationInsightsTraceListener(applicationInsightsKey)); }
2829
Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey = applicationInsightsKey;
2930
telemetryClient = new TelemetryClient();
3031
telemetryClient.InstrumentationKey = applicationInsightsKey;

0 commit comments

Comments
 (0)