public void SetMissingStateReasonFieldMap(MigrationTestEnvironment env, Configuration config) { FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; MappedField mField1 = env.NewMappedField(CoreFieldReferenceNames.State, CoreFieldReferenceNames.Title); MappedField mField2 = env.NewMappedField(CoreFieldReferenceNames.Reason, CoreFieldReferenceNames.Description); fieldMap.MappedFields.MappedField.Add(mField1); fieldMap.MappedFields.MappedField.Add(mField2); WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); SetWitSessionCustomSetting(config, customSetting); }
private void TestEnvironment_FieldMapToEmpty(MigrationTestEnvironment env, Configuration config) { // Map field MappedField mField1 = env.NewMappedField(FIELD_PRIORITY, String.Empty); mField1.valueMap = string.Empty; // set value map name to be empty string // Map the rest of the fields using wild card MappedField defaultField = env.NewMappedField("*", "*"); FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); fieldMap.MappedFields.MappedField.Add(mField1); // Map work item type WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; // Build WIT Session custom setting WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); SetWitSessionCustomSetting(config, customSetting); }
void TestEnvironment_InsertTwoFieldMapToSameTargetInMappedField(MigrationTestEnvironment env, Configuration config) { // Map field MappedField mField1 = env.NewMappedField(FIELD_PRIORITY, FIELD_PRIORITY); mField1.valueMap = string.Empty; // set value map name to be empty string // Map to SAME field again MappedField defaultField = env.NewMappedField(FIELD_AREA_PATH, FIELD_PRIORITY); FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); fieldMap.MappedFields.MappedField.Add(mField1); // Map work item type WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; // Build WIT Session custom setting WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); SetWitSessionCustomSetting(config, customSetting); }
public void SetExcludePriorityFieldMap(MigrationTestEnvironment env, Configuration config) { FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; MappedField mField1 = env.NewMappedField(FIELD_TITLE, FIELD_TITLE); mField1.MapFromSide = env.GetSourceSideTypeEnum(); MappedField mField2 = env.NewMappedField(FIELD_DESCRIPTION, String.Empty); mField2.MapFromSide = env.GetSourceSideTypeEnum(); fieldMap.MappedFields.MappedField.Add(mField1); fieldMap.MappedFields.MappedField.Add(mField2); WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); SetWitSessionCustomSetting(config, customSetting); }
void TestEnvironment_ConfigureUserIdLookup(MigrationTestEnvironment env, Configuration config) { var aliasMapping = new AliasMapping(); aliasMapping.Left = "*"; aliasMapping.Right = "vseqa1"; aliasMapping.MappingRule = MappingRules.SimpleReplacement; var aliasMappings = new AliasMappings(); aliasMappings.AliasMapping.Add(aliasMapping); aliasMappings.DirectionOfMapping = MappingDirectionEnum.LeftToRight; config.SessionGroup.UserIdentityMappings.AliasMappings.Add(aliasMappings); var domainMapping = new DomainMapping(); domainMapping.Left = "*"; domainMapping.Right = "redmond"; domainMapping.MappingRule = MappingRules.SimpleReplacement; var domainMappings = new DomainMappings(); domainMappings.DomainMapping.Add(domainMapping); domainMappings.DirectionOfMapping = MappingDirectionEnum.LeftToRight; config.SessionGroup.UserIdentityMappings.DomainMappings.Add(domainMappings); config.SessionGroup.UserIdentityMappings.EnableValidation = false; config.SessionGroup.UserIdentityMappings.UserIdentityLookupAddins.UserIdentityLookupAddin.Add( "CDDE6B6B-72FC-43b6-BBD1-B8A89A788C6F"); // Tfs2010UserIdLookupAddin foreach (var ms in config.SessionGroup.MigrationSources.MigrationSource) { ms.Settings.DefaultUserIdProperty.UserIdPropertyName = UserIdPropertyNameEnum.DomainAlias; } }
private void TestEnvironment_MarkAllFilterStringNeglect(MigrationTestEnvironment env, Configuration config) { Debug.Assert(config.Providers.Provider.Count > 0, "No provider is present in the configuration."); Session sessionConfig = config.SessionGroup.Sessions.Session[0]; if (sessionConfig.Filters.FilterPair.Count <= 1) { for (int i = 0; i < 3; ++i) { FilterPair p = new FilterPair(); p.Neglect = true; FilterItem lItem = new FilterItem(); lItem.FilterString = "test" + i.ToString(); lItem.MigrationSourceUniqueId = sessionConfig.LeftMigrationSourceUniqueId; FilterItem rItem = new FilterItem(); lItem.FilterString = "test" + i.ToString(); lItem.MigrationSourceUniqueId = sessionConfig.RightMigrationSourceUniqueId; p.FilterItem.Add(lItem); p.FilterItem.Add(rItem); } } foreach (var filterPair in sessionConfig.Filters.FilterPair) { filterPair.Neglect = true; } }
private void SetFieldMap_NoWildCardMap(MigrationTestEnvironment env, Configuration config) { // Map Description to an invalide field MappedField mField1 = env.NewMappedField(FIELD_DESCRIPTION, FIELD_DESCRIPTION); // The field map does not have a wild card mapping like below: // Map the rest of the fields using wild card //MappedField defaultField = env.NewMappedField("*","*"); FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; //fieldMap.MappedFields.MappedField.Add(defaultField); fieldMap.MappedFields.MappedField.Add(mField1); WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); SetWitSessionCustomSetting(config, customSetting); }
public void SetAggregatedFieldMap(MigrationTestEnvironment env, Configuration config) { // Aggregated fields AggregatedFields aggregatedFields = new AggregatedFields(); FieldsAggregationGroup group = new FieldsAggregationGroup(); group.MapFromSide = env.GetSourceSideTypeEnum(); group.TargetFieldName = FIELD_DESCRIPTION; group.Format = AggregationFormat; SourceField f0 = new SourceField(); f0.Index = 0; f0.SourceFieldName = FIELD_TITLE; SourceField f1 = new SourceField(); f1.Index = 1; f1.SourceFieldName = "System.Rev"; group.SourceField.Add(f0); group.SourceField.Add(f1); aggregatedFields.FieldsAggregationGroup.Add(group); // construct FieldMap // Map all fields explictly using wildcard MappedField defaultField = env.NewMappedField("*", "*"); FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); // TODO: Create another test case for aggreated fields feature // Construct configurations with conflicting field maps //MappedField mField1 = env.NewMappedField(FIELD_TITLE,FIELD_DESCRIPTION); //MappedField mField2 = env.NewMappedField(FIELD_DESCRIPTION,FIELD_TITLE); //fieldMap.MappedFields.MappedField.Add(mField1); //fieldMap.MappedFields.MappedField.Add(mField2); fieldMap.AggregatedFields = aggregatedFields; WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); SetWitSessionCustomSetting(config, customSetting); }
private void TestEnvironment_InvalidateGuidStringCase(MigrationTestEnvironment env, Configuration config) { Debug.Assert(config.Providers.Provider.Count > 0, "No provider is present in the configuration."); ProviderElement p = config.Providers.Provider.First(); Debug.Assert(p.ReferenceName.Length > 0, "First provider has empty reference name."); p.ReferenceName = ChangeCase(p.ReferenceName); }
void TestEnvironment_SetTooLongConfigFriendlyName(MigrationTestEnvironment env, Configuration config) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 301; ++i) { sb.Append("a"); } config.FriendlyName = sb.ToString(); }
void TestEnvironment_SetEmptyFilterString(MigrationTestEnvironment env, Configuration config) { foreach (Session s in config.SessionGroup.Sessions.Session) { if (s.SessionType == SessionTypeEnum.VersionControl) { s.Filters.FilterPair.First().FilterItem.First().FilterString = string.Empty; break; } } }
public void SetConditionalHybridPriorityValueMap(MigrationTestEnvironment env, Configuration config) { // Map P2 to P1 Value v1 = env.NewValue("2", "1"); Value v2 = env.NewValue("*", "1"); v2.When.ConditionalSrcFieldName = "System.Description"; v2.When.ConditionalSrcFieldValue = ConditionalValueMapDescription; Value v3 = env.NewValue("2", "3"); v3.When.ConditionalSrcFieldName = "System.Description"; v3.When.ConditionalSrcFieldValue = ConditionalValueMapDescription; ValueMap vMap = new ValueMap(); vMap.name = "PriorityValueMap"; vMap.Value.Add(v1); vMap.Value.Add(v2); vMap.Value.Add(v3); // Map field MappedField mField1 = env.NewMappedField(FIELD_PRIORITY, FIELD_PRIORITY); mField1.valueMap = vMap.name; // Map the rest of the fields using wild card MappedField defaultField = env.NewMappedField("*", "*"); FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); fieldMap.MappedFields.MappedField.Add(mField1); // Map work item type WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; // Build WIT Session custom setting WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); customSetting.ValueMaps.ValueMap.Add(vMap); SetWitSessionCustomSetting(config, customSetting); }
void TestEnvironment_InsertWronglyIndexedAggrSrcField(MigrationTestEnvironment env, Configuration config) { // Aggregated fields AggregatedFields aggregatedFields = new AggregatedFields(); FieldsAggregationGroup group = new FieldsAggregationGroup(); group.MapFromSide = env.GetSourceSideTypeEnum(); group.TargetFieldName = FIELD_DESCRIPTION; group.Format = AggregationFormat; // NOTE: both source fields are assigned with indice 10 SourceField f0 = new SourceField(); f0.Index = 10; f0.SourceFieldName = FIELD_TITLE; SourceField f1 = new SourceField(); f1.Index = 10; f1.SourceFieldName = FIELD_DESCRIPTION; group.SourceField.Add(f0); group.SourceField.Add(f1); aggregatedFields.FieldsAggregationGroup.Add(group); // construct FieldMap // Map all fields explictly using wildcard MappedField defaultField = env.NewMappedField("*", "*"); FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); fieldMap.AggregatedFields = aggregatedFields; WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); SetWitSessionCustomSetting(config, customSetting); }
/// <summary> /// TfsServerDiff will verify the first VC session in the given configuration file /// </summary> /// <param name="configFileName"></param> public TfsServerDiff(Guid sessionGuid, MigrationTestEnvironment env, bool addOnBranchSourceNotFound, bool verbose) { m_testEnvironment = env; m_serverDiffEngine = new ServerDiffEngine(sessionGuid, false, verbose, SessionTypeEnum.VersionControl); m_diffComparer = new VCDiffComparer(m_serverDiffEngine); m_serverDiffEngine.RegisterDiffComparer(m_diffComparer); m_targetHistory = new List <Changeset>(); m_sourceHistory = new List <Changeset>(); m_sourceClient = GetTfsClient(env.SourceEndPoint.ServerUrl); m_targetClient = GetTfsClient(env.TargetEndPoint.ServerUrl); m_changeToAddOnBranchSourceNotFound = addOnBranchSourceNotFound; // TODO: //m_session.TryGetValue("SkipChangeComment", out m_skipChangeComment); Trace.WriteLine("[TODO] Skipped setting SkipChangeComment"); }
void TestEnvironment_AddCQHyperLinkTypeMapping(MigrationTestEnvironment env, Configuration config) { Debug.Assert(config.SessionGroup.Sessions.Session.Count == 1); Guid leftSrcUniqueId = new Guid(config.SessionGroup.Sessions.Session[0].LeftMigrationSourceUniqueId); Guid leftProviderId = new Guid(config.SessionGroup.MigrationSources[leftSrcUniqueId].ProviderReferenceName); if (leftProviderId.Equals(new Guid("D9637401-7385-4643-9C64-31585D77ED16"))) // CQ adapter id { LinkTypeMapping mapping = new LinkTypeMapping(); mapping.LeftLinkType = "ClearQuestAdapter.LinkType.Web.RecordHyperLink"; mapping.LeftMigrationSourceUniqueId = config.SessionGroup.Sessions.Session[0].LeftMigrationSourceUniqueId; mapping.RightLinkType = "Microsoft.TeamFoundation.Migration.TFS.LinkType.WorkItemToHyperlink"; mapping.RightMigrationSourceUniqueId = config.SessionGroup.Sessions.Session[0].RightMigrationSourceUniqueId; config.SessionGroup.Linking.LinkTypeMappings.LinkTypeMapping.Add(mapping); } }
void TestEnvironment_AddCQWebUrlBase(MigrationTestEnvironment env, Configuration config) { Debug.Assert(config.SessionGroup.Sessions.Session.Count == 1); Guid leftSrcUniqueId = new Guid(config.SessionGroup.Sessions.Session[0].LeftMigrationSourceUniqueId); Guid leftProviderId = new Guid(config.SessionGroup.MigrationSources[leftSrcUniqueId].ProviderReferenceName); if (leftProviderId.Equals(new Guid("D9637401-7385-4643-9C64-31585D77ED16"))) // CQ adapter id { Microsoft.TeamFoundation.Migration.BusinessModel.MigrationSource migrSrc = config.SessionGroup.MigrationSources[leftSrcUniqueId]; if (null != migrSrc) { CustomSetting setting = new CustomSetting(); setting.SettingKey = "CQWebRecordUrlFormat"; setting.SettingValue = TestCQHyperLinkBaseUrl; migrSrc.CustomSettings.CustomSetting.Add(setting); } } }
public void SetUserValueMap(MigrationTestEnvironment env, Configuration config) { // User Map Value v1 = env.NewValue(SourceUser, TargetUser); ValueMap vMap = new ValueMap(); vMap.name = "UserMap"; vMap.Value.Add(v1); // Map field MappedField mField1 = env.NewMappedField(FIELD_ASSIGNEDTO, FIELD_ASSIGNEDTO); mField1.valueMap = vMap.name; // Map the rest of the fields using wild card MappedField defaultField = env.NewMappedField("*", "*"); FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); fieldMap.MappedFields.MappedField.Add(mField1); // Map work item type WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; // Build WIT Session custom setting WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); customSetting.ValueMaps.ValueMap.Add(vMap); SetWitSessionCustomSetting(config, customSetting); }
private void SetInvalidFieldValueMap(MigrationTestEnvironment env, Configuration config) { ValueMap vMap = new ValueMap(); vMap.name = "PriorityValues"; var value = env.NewValue("*", "10000"); vMap.Value.Add(value); MappedField mField1 = env.NewMappedField(FIELD_PRIORITY, FIELD_PRIORITY); mField1.valueMap = "PriorityValues"; // Map the rest of the fields using wild card MappedField defaultField = env.NewMappedField("*", "*"); FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); fieldMap.MappedFields.MappedField.Add(mField1); WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.FieldMaps.FieldMap.Add(fieldMap); customSetting.ValueMaps.ValueMap.Add(vMap); SetWitSessionCustomSetting(config, customSetting); }
void TestEnvironment_InsertTwoFieldMapFromSameSourceInMappedFieldRight(MigrationTestEnvironment env, Configuration config) { // Map field MappedField mField1 = env.NewMappedField(FIELD_PRIORITY, FIELD_PRIORITY); mField1.MapFromSide = env.GetTargetSideTypeEnum(); mField1.valueMap = string.Empty; // set value map name to be empty string // Map to SAME field again MappedField defaultField = env.NewMappedField(FIELD_PRIORITY, FIELD_AREA_PATH); defaultField.MapFromSide = env.GetTargetSideTypeEnum(); FieldMap fieldMap = new FieldMap(); fieldMap.name = "BugToBugFieldMap"; fieldMap.MappedFields.MappedField.Add(defaultField); fieldMap.MappedFields.MappedField.Add(mField1); // Map work item type WorkItemTypeMappingElement typeMapping = new WorkItemTypeMappingElement(); typeMapping.LeftWorkItemTypeName = "Bug"; typeMapping.RightWorkItemTypeName = "Bug"; typeMapping.fieldMap = fieldMap.name; //=================== another work item type mapping MappedField mField1_1 = env.NewMappedField(FIELD_PRIORITY, FIELD_PRIORITY); mField1_1.MapFromSide = SourceSideTypeEnum.Right; mField1_1.valueMap = string.Empty; // set value map name to be empty string // Map to SAME field again MappedField defaultField_1 = env.NewMappedField(FIELD_PRIORITY, FIELD_AREA_PATH); defaultField_1.MapFromSide = SourceSideTypeEnum.Right; FieldMap fieldMap_1 = new FieldMap(); fieldMap_1.name = "BugToBugFieldMap_1"; fieldMap_1.MappedFields.MappedField.Add(defaultField_1); fieldMap_1.MappedFields.MappedField.Add(mField1_1); // Map work item type WorkItemTypeMappingElement typeMapping_1 = new WorkItemTypeMappingElement(); typeMapping_1.LeftWorkItemTypeName = "Bug_1"; typeMapping_1.RightWorkItemTypeName = "Bug_1"; typeMapping_1.fieldMap = fieldMap_1.name; // Build WIT Session custom setting WITSessionCustomSetting customSetting = new WITSessionCustomSetting(); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping); customSetting.WorkItemTypes.WorkItemType.Add(typeMapping_1); customSetting.FieldMaps.FieldMap.Add(fieldMap); customSetting.FieldMaps.FieldMap.Add(fieldMap_1); SetWitSessionCustomSetting(config, customSetting); }