diff --git a/appsettings.json b/appsettings.json index 5453c5908..5187bb442 100644 --- a/appsettings.json +++ b/appsettings.json @@ -17,6 +17,7 @@ "Collection": "", "Project": "", "AllowCrossProjectLinking": false, + "ReflectedWorkItemIdField": "Custom.ReflectedWorkItemId", "Authentication": { "AuthenticationMode": "AccessToken", "AccessToken": "", @@ -36,6 +37,7 @@ "Collection": "", "Project": "", "AllowCrossProjectLinking": false, + "ReflectedWorkItemIdField": "Custom.ReflectedWorkItemId", "Authentication": { "AuthenticationMode": "AccessToken", "AccessToken": "", @@ -57,6 +59,7 @@ "Collection": "https://dev.azure.com/nkdagility-preview/", "Project": "migrationSource1", "AllowCrossProjectLinking": false, + "ReflectedWorkItemIdField": "Custom.ReflectedWorkItemId", "Authentication": { "AuthenticationMode": "AccessToken", "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", @@ -65,16 +68,13 @@ "Password": "", "Domain": "" } - }, - "LanguageMaps": { - "AreaPath": "Area", - "IterationPath": "Iteration" } }, "TfsEndpoint": { "Collection": "https://dev.azure.com/nkdagility-preview/", "Project": "migrationSource1", "AllowCrossProjectLinking": false, + "ReflectedWorkItemIdField": "Custom.ReflectedWorkItemId", "Authentication": { "AuthenticationMode": "AccessToken", "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", @@ -93,7 +93,8 @@ "AuthenticationMode": "AccessToken", "AccessToken": "jklsadhjksahfkjsdhjksahsadjhksadhsad", "Organisation": "https://dev.azure.com/xxx/", - "Project": "myProject" + "Project": "myProject", + "ReflectedWorkItemIdField": "Custom.ReflectedWorkItemId" } }, "CommonTools": { @@ -446,21 +447,10 @@ }, "TfsWorkItemMigrationProcessor": { "Enabled": false, - "UpdateCreatedDate": true, - "UpdateCreatedBy": true, "WIQLQuery": "SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = @TeamProject AND [System.WorkItemType] NOT IN ('Test Suite', 'Test Plan','Shared Steps','Shared Parameter','Feedback Request') ORDER BY [System.ChangedDate] desc", - "FixHtmlAttachmentLinks": true, - "WorkItemCreateRetryLimit": 5, "FilterWorkItemsThatAlreadyExistInTarget": false, - "PauseAfterEachWorkItem": false, - "AttachRevisionHistory": false, - "GenerateMigrationComment": true, "SourceName": "Source", - "TargetName": "Target", - "WorkItemIDs": [], - "MaxGracefulFailures": 0, - "SkipRevisionWithInvalidIterationPath": false, - "SkipRevisionWithInvalidAreaPath": false + "TargetName": "Target" }, "ExportUsersForMappingProcessor": { "Enabled": true, diff --git a/src/MigrationTools.Clients.TfsObjectModel/EndPoints/Infrastructure/TfsTeamProjectAuthentication.cs b/src/MigrationTools.Clients.TfsObjectModel/EndPoints/Infrastructure/TfsTeamProjectAuthentication.cs index a198afa8b..55c5b68ab 100644 --- a/src/MigrationTools.Clients.TfsObjectModel/EndPoints/Infrastructure/TfsTeamProjectAuthentication.cs +++ b/src/MigrationTools.Clients.TfsObjectModel/EndPoints/Infrastructure/TfsTeamProjectAuthentication.cs @@ -17,6 +17,7 @@ public class TfsAuthenticationOptions : IValidateOptions), "** removed as a secret ***")] diff --git a/src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsEndpointOptions.cs b/src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsEndpointOptions.cs index ebe2556fc..8408717c8 100644 --- a/src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsEndpointOptions.cs +++ b/src/MigrationTools.Clients.TfsObjectModel/Endpoints/TfsEndpointOptions.cs @@ -26,10 +26,13 @@ public class TfsEndpointOptions : EndpointOptions [JsonProperty(Order = -1)] [Required] public string ReflectedWorkItemIdField { get; set; } - public bool AllowCrossProjectLinking { get; set; } + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool AllowCrossProjectLinking { get; set; } = false; [Required] - public TfsLanguageMapOptions LanguageMaps { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public TfsLanguageMapOptions LanguageMaps { get; set; } = new TfsLanguageMapOptions() { AreaPath = "Area", IterationPath = "Iteration" }; } public class TfsEndpointOptionsValidator : IValidateOptions diff --git a/src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessorOptions.cs b/src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessorOptions.cs index 970a97665..3e729be72 100644 --- a/src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessorOptions.cs +++ b/src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessorOptions.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.Options; using System.Text.RegularExpressions; using System.DirectoryServices.AccountManagement; +using Newtonsoft.Json; namespace MigrationTools.Processors { @@ -21,7 +22,8 @@ public class TfsWorkItemMigrationProcessorOptions : ProcessorOptions, IWorkItemP /// not the internal create date) /// /// true - public bool UpdateCreatedDate { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool UpdateCreatedDate { get; set; } = true; /// /// If this is enabled the creation process on the target project will create the items with the original creation date. @@ -29,7 +31,8 @@ public class TfsWorkItemMigrationProcessorOptions : ProcessorOptions, IWorkItemP /// not the internal create date) /// /// true - public bool UpdateCreatedBy { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool UpdateCreatedBy { get; set; } = true; /// @@ -44,15 +47,17 @@ public class TfsWorkItemMigrationProcessorOptions : ProcessorOptions, IWorkItemP /// fields as well as discussion comments. You must specify a PersonalAccessToken in the Source project for Azure DevOps; /// TFS should use integrated authentication. /// - /// ? - public bool FixHtmlAttachmentLinks { get; set; } + /// true + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool FixHtmlAttachmentLinks { get; set; } = true; /// /// **beta** If set to a number greater than 0 work items that fail to save will retry after a number of seconds equal to the retry count. /// This allows for periodic network glitches not to end the process. /// /// 5 - public int WorkItemCreateRetryLimit { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public int WorkItemCreateRetryLimit { get; set; } = 5; /// /// This loads all of the work items already saved to the Target and removes them from the Source work item list prior to commencing the run. @@ -65,24 +70,28 @@ public class TfsWorkItemMigrationProcessorOptions : ProcessorOptions, IWorkItemP /// Pause after each work item is migrated /// /// false - public bool PauseAfterEachWorkItem { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool PauseAfterEachWorkItem { get; set; } = false; /// /// This will create a json file with the revision history and attach it to the work item. Best used with `MaxRevisions` or `ReplayRevisions`. /// - /// ? - public bool AttachRevisionHistory { get; set; } + /// false + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool AttachRevisionHistory { get; set; } = false; /// /// If enabled, adds a comment recording the migration /// - /// false - public bool GenerateMigrationComment { get; set; } + /// true + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool GenerateMigrationComment { get; set; } = true; /// /// A list of work items to import /// /// [] + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public IList WorkItemIDs { get; set; } /// @@ -90,17 +99,20 @@ public class TfsWorkItemMigrationProcessorOptions : ProcessorOptions, IWorkItemP /// continue until the number of failed items reaches the configured value, after which the migration fails. /// /// 0 - public int MaxGracefulFailures { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public int MaxGracefulFailures { get; set; } = 0; /// /// This will skip a revision if the source iteration has not been migrated i.e. it was deleted /// - public bool SkipRevisionWithInvalidIterationPath { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool SkipRevisionWithInvalidIterationPath { get; set; } = false; /// /// When set to true, this setting will skip a revision if the source area has not been migrated, has been deleted or is somehow invalid, etc. /// - public bool SkipRevisionWithInvalidAreaPath { get; set; } + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] + public bool SkipRevisionWithInvalidAreaPath { get; set; } = false; } diff --git a/src/MigrationTools/Endpoints/Infrastructure/EndpointOptions.cs b/src/MigrationTools/Endpoints/Infrastructure/EndpointOptions.cs index ccf62a523..708978ce2 100644 --- a/src/MigrationTools/Endpoints/Infrastructure/EndpointOptions.cs +++ b/src/MigrationTools/Endpoints/Infrastructure/EndpointOptions.cs @@ -24,7 +24,10 @@ public abstract class EndpointOptions : IEndpointOptions [JsonIgnore] public string Name { get; set; } + + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List EndpointEnrichers { get; set; } + [JsonIgnore] public bool Enabled { get; set; } diff --git a/src/MigrationTools/Processors/Infrastructure/ProcessorOptions.cs b/src/MigrationTools/Processors/Infrastructure/ProcessorOptions.cs index 92ed9a478..e516e2d80 100644 --- a/src/MigrationTools/Processors/Infrastructure/ProcessorOptions.cs +++ b/src/MigrationTools/Processors/Infrastructure/ProcessorOptions.cs @@ -34,14 +34,18 @@ public abstract class ProcessorOptions : IProcessorOptions, IValidateOptions /// List of Enrichers that can be used to add more features to this processor. Only works with Native Processors and not legacy Processors. /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List Enrichers { get; set; } + [Required] public string SourceName { get; set; } + [Required] public string TargetName { get; set; } /// /// `Refname` will be used in the future to allow for using named Options without the need to copy all of the options. /// + [JsonIgnore] public string RefName { get; set; } public IProcessorOptions GetSample()