Skip to content

Commit 859989b

Browse files
committed
PR 32: Merge AddConfigurationJson to master
- Started adding configration to create fully configurable with no compile.. - Added all Field mapps to configuration +semver: major - Added all work item type mappings... only processors left! - And processors - i hate serilisation - Fixed json hadling of custom objects - Processor done too... now to add other processors... - Moved config bits into engine... - Refactor to bring Config and Execution to the same format - Added version to AI +semver:patch ... Related work items: #4876
1 parent 64924b0 commit 859989b

File tree

82 files changed

+1411
-528
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1411
-528
lines changed

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
assembly-versioning-scheme: None
22
mode: ContinuousDeployment
33
continuous-delivery-fallback-tag: ''
4-
next-version: 0.5.1
4+
next-version: 1.0.0
55
branches:
66
master:
77
mode: ContinuousDeployment

TfsWitMigrator.Console/Program.cs

Lines changed: 68 additions & 181 deletions
Large diffs are not rendered by default.

TfsWitMigrator.Console/VSTS.DataBulkEditor.Console.csproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<ProjectGuid>{033EB332-4A50-4C73-9B7D-A35D9F3C0513}</ProjectGuid>
88
<OutputType>Exe</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>VSTS.DataBulkEditor.Console</RootNamespace>
11-
<AssemblyName>VSTS.DataBulkEditor.Console</AssemblyName>
10+
<RootNamespace>VSTS.DataBulkEditor.ConsoleApp</RootNamespace>
11+
<AssemblyName>vstsbulkeditor</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<NuGetPackageImportStamp>
@@ -37,6 +37,10 @@
3737
<StartupObject>VSTS.DataBulkEditor.ConsoleApp.Program</StartupObject>
3838
</PropertyGroup>
3939
<ItemGroup>
40+
<Reference Include="CommandLine, Version=2.0.275.0, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
41+
<HintPath>..\packages\CommandLineParser.2.0.275-beta\lib\net45\CommandLine.dll</HintPath>
42+
<Private>True</Private>
43+
</Reference>
4044
<Reference Include="Microsoft.ApplicationInsights, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4145
<HintPath>..\packages\Microsoft.ApplicationInsights.2.1.0\lib\net45\Microsoft.ApplicationInsights.dll</HintPath>
4246
<Private>True</Private>

TfsWitMigrator.Console/packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3+
<package id="CommandLineParser" version="2.0.275-beta" targetFramework="net45" />
34
<package id="Microsoft.ApplicationInsights" version="2.1.0" targetFramework="net45" />
45
<package id="Microsoft.ApplicationInsights.TraceListener" version="2.1.0" targetFramework="net45" />
56
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Xml.Serialization;
7+
using VSTS.DataBulkEditor.Engine.Configuration.FieldMap;
8+
using VSTS.DataBulkEditor.Engine.Configuration.Processing;
9+
10+
namespace VSTS.DataBulkEditor.Engine.Configuration
11+
{
12+
public class EngineConfiguration
13+
{
14+
public bool TelemetryEnableTrace { get; set; }
15+
public TeamProjectConfig Target { get; set; }
16+
public TeamProjectConfig Source { get; set; }
17+
public string ReflectedWorkItemIDFieldName { get; set; }
18+
public List<IFieldMapConfig> FieldMaps { get; set; }
19+
public Dictionary<string, string> WorkItemTypeDefinition { get; set; }
20+
public List<ITfsProcessingConfig> Processors { get; set; }
21+
22+
public static EngineConfiguration GetDefault()
23+
{
24+
EngineConfiguration ec = new EngineConfiguration();
25+
ec.TelemetryEnableTrace = true;
26+
ec.Target = new TeamProjectConfig() { Name = "DemoProjt", Collection = new Uri("https://sdd2016.visualstudio.com/") };
27+
ec.Source = new TeamProjectConfig() { Name = "DemoProjs", Collection = new Uri("https://sdd2016.visualstudio.com/") };
28+
ec.ReflectedWorkItemIDFieldName = "TfsMigrationTool.ReflectedWorkItemId";
29+
ec.FieldMaps = new List<IFieldMapConfig>();
30+
ec.FieldMaps.Add(new FieldValueMapConfig()
31+
{
32+
WorkItemTypeName = "*",
33+
sourceField = "System.State",
34+
targetField = "System.State",
35+
valueMapping = new Dictionary<string, string> {
36+
{ "Approved", "New" },
37+
{ "New", "New" },
38+
{ "Committed", "Active" },
39+
{ "In Progress", "Active" },
40+
{ "To Do", "New" },
41+
{ "Done", "Closed" }
42+
}
43+
});
44+
ec.FieldMaps.Add(new FieldtoFieldMapConfig()
45+
{
46+
WorkItemTypeName = "*",
47+
sourceField = "Microsoft.VSTS.Common.BacklogPriority",
48+
targetField = "Microsoft.VSTS.Common.StackRank"
49+
});
50+
ec.FieldMaps.Add(new FieldtoTagMapConfig()
51+
{
52+
WorkItemTypeName = "*",
53+
sourceField = "System.State",
54+
formatExpression = "ScrumState:{0}"
55+
});
56+
ec.FieldMaps.Add(new FieldMergeMapConfig()
57+
{
58+
WorkItemTypeName = "*",
59+
sourceField1 = "System.Description",
60+
sourceField2 = "Microsoft.VSTS.Common.AcceptanceCriteria",
61+
targetField = "System.Description",
62+
formatExpression = @"{0} <br/><br/><h3>Acceptance Criteria</h3>{1}"
63+
});
64+
ec.FieldMaps.Add(new RegexFieldMapConfig()
65+
{
66+
WorkItemTypeName = "*",
67+
sourceField = "COMPANY.PRODUCT.Release",
68+
targetField = "COMPANY.DEVISION.MinorReleaseVersion",
69+
pattern = @"PRODUCT \d{4}.(\d{1})",
70+
replacement = "$1"
71+
});
72+
ec.FieldMaps.Add(new TreeToTagMapConfig()
73+
{
74+
WorkItemTypeName = "*",
75+
timeTravel = 1,
76+
toSkip = 3
77+
});
78+
ec.WorkItemTypeDefinition = new Dictionary<string, string> {
79+
{ "Bug", "Bug" },
80+
{ "Product Backlog Item", "Product Backlog Item" }
81+
};
82+
ec.Processors = new List<ITfsProcessingConfig>();
83+
ec.Processors.Add(new WorkItemMigrationConfig() { Disabled = true, QueryBit = @"AND [TfsMigrationTool.ReflectedWorkItemId] = '' AND [Microsoft.VSTS.Common.ClosedDate] = '' AND [System.WorkItemType] IN ('Shared Steps', 'Shared Parameter', 'Test Case', 'Requirement', 'Task', 'User Story', 'Bug')" });
84+
ec.Processors.Add(new WorkItemUpdateConfig() { Disabled = true, QueryBit = @"AND [TfsMigrationTool.ReflectedWorkItemId] = '' AND [Microsoft.VSTS.Common.ClosedDate] = '' AND [System.WorkItemType] IN ('Shared Steps', 'Shared Parameter', 'Test Case', 'Requirement', 'Task', 'User Story', 'Bug')" });
85+
ec.Processors.Add(new NodeStructuresMigrationConfig() { Disabled = true });
86+
ec.Processors.Add(new LinkMigrationConfig() { Disabled = true });
87+
ec.Processors.Add(new WorkItemPostProcessingConfig() { Disabled = true });
88+
ec.Processors.Add(new WorkItemDeleteConfig() { Disabled = true });
89+
ec.Processors.Add(new AttachementExportMigrationConfig() { Disabled = true });
90+
ec.Processors.Add(new AttachementImportMigrationConfig() { Disabled = true });
91+
ec.Processors.Add(new TestVeriablesMigrationConfig() { Disabled = true });
92+
ec.Processors.Add(new TestConfigurationsMigrationConfig() { Disabled = true });
93+
ec.Processors.Add(new TestPlansAndSuitsMigrationConfig() { Disabled = true });
94+
ec.Processors.Add(new TestRunsMigrationConfig() { Disabled = true });
95+
ec.Processors.Add(new ImportProfilePictureConfig() { Disabled = true });
96+
ec.Processors.Add(new ExportProfilePictureFromADConfig() { Disabled = true });
97+
return ec;
98+
}
99+
100+
}
101+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using Newtonsoft.Json.Linq;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace VSTS.DataBulkEditor.Engine.Configuration.FieldMap
9+
{
10+
public class FieldMapConfigJsonConverter : JsonCreationConverter<IFieldMapConfig>
11+
{
12+
protected override IFieldMapConfig Create(Type objectType, JObject jObject)
13+
{
14+
if (FieldExists("ObjectType", jObject))
15+
{
16+
string typename = jObject.GetValue("ObjectType").ToString();
17+
Type type = Type.GetType(typename, true);
18+
return (IFieldMapConfig)Activator.CreateInstance(type);
19+
}
20+
else
21+
{
22+
throw new NotImplementedException();
23+
}
24+
}
25+
26+
private bool FieldExists(string fieldName, JObject jObject)
27+
{
28+
return jObject[fieldName] != null;
29+
}
30+
}
31+
}
32+
33+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using VSTS.DataBulkEditor.Engine.ComponentContext;
7+
8+
namespace VSTS.DataBulkEditor.Engine.Configuration.FieldMap
9+
{
10+
public class FieldMergeMapConfig : IFieldMapConfig
11+
{
12+
public string WorkItemTypeName { get; set; }
13+
public string sourceField1 { get; set; }
14+
public string sourceField2 { get; set; }
15+
public string targetField { get; set; }
16+
public string formatExpression { get; set; }
17+
public Type FieldMap
18+
{
19+
get
20+
{
21+
return typeof(FieldMergeMap);
22+
}
23+
}
24+
}
25+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using VSTS.DataBulkEditor.Engine.ComponentContext;
7+
8+
namespace VSTS.DataBulkEditor.Engine.Configuration.FieldMap
9+
{
10+
public class FieldValueMapConfig : IFieldMapConfig
11+
{
12+
public string WorkItemTypeName { get; set; }
13+
public string sourceField { get; set; }
14+
public string targetField { get; set; }
15+
public Dictionary<string, string> valueMapping { get; set; }
16+
17+
18+
public Type FieldMap
19+
{
20+
get
21+
{
22+
return typeof(FieldValueMap);
23+
}
24+
}
25+
26+
}
27+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using VSTS.DataBulkEditor.Engine.ComponentContext;
7+
8+
namespace VSTS.DataBulkEditor.Engine.Configuration.FieldMap
9+
{
10+
public class FieldtoFieldMapConfig : IFieldMapConfig
11+
{
12+
public string WorkItemTypeName { get; set; }
13+
public string sourceField { get; set; }
14+
public string targetField { get; set; }
15+
public Type FieldMap
16+
{
17+
get
18+
{
19+
return typeof(FieldToFieldMap);
20+
}
21+
}
22+
}
23+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace VSTS.DataBulkEditor.Engine.Configuration.FieldMap
8+
{
9+
public class FieldtoTagMapConfig : IFieldMapConfig
10+
{
11+
public string WorkItemTypeName { get; set; }
12+
public string sourceField { get; set; }
13+
public string formatExpression { get; set; }
14+
public Type FieldMap
15+
{
16+
get
17+
{
18+
return typeof(FieldToTagFieldMap);
19+
}
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)