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; } }
/// <summary>Snippet for CreateDomainMappingAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task CreateDomainMappingRequestObjectAsync() { // Create client DomainMappingsClient domainMappingsClient = await DomainMappingsClient.CreateAsync(); // Initialize request argument(s) CreateDomainMappingRequest request = new CreateDomainMappingRequest { Parent = "", DomainMapping = new DomainMapping(), OverrideStrategy = DomainOverrideStrategy.UnspecifiedDomainOverrideStrategy, }; // Make the request Operation <DomainMapping, OperationMetadataV1> response = await domainMappingsClient.CreateDomainMappingAsync(request); // Poll until the returned long-running operation is complete Operation <DomainMapping, OperationMetadataV1> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result DomainMapping result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <DomainMapping, OperationMetadataV1> retrievedResponse = await domainMappingsClient.PollOnceCreateDomainMappingAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result DomainMapping retrievedResult = retrievedResponse.Result; } }
public void GetDomainMappingRequestObject() { moq::Mock <DomainMappings.DomainMappingsClient> mockGrpcClient = new moq::Mock <DomainMappings.DomainMappingsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetDomainMappingRequest request = new GetDomainMappingRequest { Name = "name1c9368b0", }; DomainMapping expectedResponse = new DomainMapping { Name = "name1c9368b0", Id = "id74b70bb8", SslSettings = new SslSettings(), ResourceRecords = { new ResourceRecord(), }, }; mockGrpcClient.Setup(x => x.GetDomainMapping(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); DomainMappingsClient client = new DomainMappingsClientImpl(mockGrpcClient.Object, null); DomainMapping response = client.GetDomainMapping(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetDomainMappingRequestObjectAsync() { moq::Mock <DomainMappings.DomainMappingsClient> mockGrpcClient = new moq::Mock <DomainMappings.DomainMappingsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetDomainMappingRequest request = new GetDomainMappingRequest { Name = "name1c9368b0", }; DomainMapping expectedResponse = new DomainMapping { Name = "name1c9368b0", Id = "id74b70bb8", SslSettings = new SslSettings(), ResourceRecords = { new ResourceRecord(), }, }; mockGrpcClient.Setup(x => x.GetDomainMappingAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <DomainMapping>(stt::Task.FromResult(expectedResponse), null, null, null, null)); DomainMappingsClient client = new DomainMappingsClientImpl(mockGrpcClient.Object, null); DomainMapping responseCallSettings = await client.GetDomainMappingAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); DomainMapping responseCancellationToken = await client.GetDomainMappingAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
private bool IsRuleApplicable(RichIdentity sourceUserIdentity, DomainMapping rule, bool leftToRight) { string fromDomainName = (leftToRight ? rule.Left : rule.Right); if (string.IsNullOrEmpty(fromDomainName)) { return(false); } bool mappingRuleIsKnown = false; switch (rule.MappingRule) { case MappingRules.SimpleReplacement: case MappingRules.Ignore: case MappingRules.FormatStringComposition: case MappingRules.FormatStringDecomposition: mappingRuleIsKnown = true; break; default: TraceManager.TraceError("Unknown DisplayNameMapping.MappingRule type"); mappingRuleIsKnown = false; break; } if (!mappingRuleIsKnown) { return(false); } return(fromDomainName.Equals(UserIdentityMappingConfigSymbols.ANY, StringComparison.OrdinalIgnoreCase) || fromDomainName.Equals(sourceUserIdentity.Domain ?? string.Empty, StringComparison.OrdinalIgnoreCase)); }
/// <summary>Snippet for UpdateDomainMapping</summary> public void UpdateDomainMappingRequestObject() { // Snippet: UpdateDomainMapping(UpdateDomainMappingRequest, CallSettings) // Create client DomainMappingsClient domainMappingsClient = DomainMappingsClient.Create(); // Initialize request argument(s) UpdateDomainMappingRequest request = new UpdateDomainMappingRequest { Name = "", DomainMapping = new DomainMapping(), UpdateMask = new FieldMask(), }; // Make the request Operation <DomainMapping, OperationMetadataV1> response = domainMappingsClient.UpdateDomainMapping(request); // Poll until the returned long-running operation is complete Operation <DomainMapping, OperationMetadataV1> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result DomainMapping result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <DomainMapping, OperationMetadataV1> retrievedResponse = domainMappingsClient.PollOnceUpdateDomainMapping(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result DomainMapping retrievedResult = retrievedResponse.Result; } // End snippet }
public void Handle(PropertyInfo property, Type type, DomainMapping mapper) { var convention = new ComponentConvention(property); componentConvention(convention); convention.Map(type, mapper); }
public void Map(Type type, DomainMapping mapper) { mapper.MapComponent(this.property, subMapping => { foreach (var typeProperty in this.property.PropertyType.GetProperties()) { string propertyName = this.prefix(type, property.PropertyType, typeProperty.Name) + typeProperty.Name + this.suffix(type, property.PropertyType, typeProperty.Name); subMapping.MapProperty(typeProperty, propertyName); } }); }
/// <summary>Snippet for GetDomainMapping</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetDomainMappingRequestObject() { // Create client DomainMappingsClient domainMappingsClient = DomainMappingsClient.Create(); // Initialize request argument(s) GetDomainMappingRequest request = new GetDomainMappingRequest { Name = "", }; // Make the request DomainMapping response = domainMappingsClient.GetDomainMapping(request); }
/// <summary>Snippet for GetDomainMappingAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetDomainMappingRequestObjectAsync() { // Create client DomainMappingsClient domainMappingsClient = await DomainMappingsClient.CreateAsync(); // Initialize request argument(s) GetDomainMappingRequest request = new GetDomainMappingRequest { Name = "", }; // Make the request DomainMapping response = await domainMappingsClient.GetDomainMappingAsync(request); }
public void MyTestInitialize() { var mappingsCollection = new DomainMappings(); mappingsCollection.DirectionOfMapping = MappingDirectionEnum.LeftToRight; foreach (var mapping in m_leftToRigthMappings) { DomainMapping mappingRule = new DomainMapping(); mappingRule.Left = mapping.Left; mappingRule.Right = mapping.Right; mappingRule.MappingRule = MappingRules.SimpleReplacement; mappingsCollection.DomainMapping.Add(mappingRule); } m_aliasMappings.Add(mappingsCollection); mappingsCollection = new DomainMappings(); mappingsCollection.DirectionOfMapping = MappingDirectionEnum.RightToLeft; foreach (var mapping in m_rightToLeftMappings) { DomainMapping mappingRule = new DomainMapping(); mappingRule.Left = mapping.Left; mappingRule.Right = mapping.Right; mappingRule.MappingRule = MappingRules.SimpleReplacement; mappingsCollection.DomainMapping.Add(mappingRule); } m_aliasMappings.Add(mappingsCollection); mappingsCollection = new DomainMappings(); mappingsCollection.DirectionOfMapping = MappingDirectionEnum.TwoWay; foreach (var mapping in m_twoWayMappings) { DomainMapping mappingRule = new DomainMapping(); mappingRule.Left = mapping.Left; mappingRule.Right = mapping.Right; mappingRule.MappingRule = MappingRules.SimpleReplacement; mappingsCollection.DomainMapping.Add(mappingRule); } foreach (var mapping in m_ignoreMappings) { DomainMapping mappingRule = new DomainMapping(); mappingRule.Left = mapping.Left; mappingRule.Right = mapping.Right; mappingRule.MappingRule = MappingRules.Ignore; mappingsCollection.DomainMapping.Add(mappingRule); } m_aliasMappings.Add(mappingsCollection); }
/// <summary>Snippet for GetDomainMappingAsync</summary> public async Task GetDomainMappingRequestObjectAsync() { // Snippet: GetDomainMappingAsync(GetDomainMappingRequest, CallSettings) // Additional: GetDomainMappingAsync(GetDomainMappingRequest, CancellationToken) // Create client DomainMappingsClient domainMappingsClient = await DomainMappingsClient.CreateAsync(); // Initialize request argument(s) GetDomainMappingRequest request = new GetDomainMappingRequest { Name = "", }; // Make the request DomainMapping response = await domainMappingsClient.GetDomainMappingAsync(request); // End snippet }
public void Map(Type type, DomainMapping mapper) { this.handlers.Add(componentHandler); this.handlers.Add(new PropertyHandler()); this.handlers.Add(new OneToManyHandler(foreignKeyFormatter)); foreach (var property in type.GetProperties()) { foreach (var handler in this.handlers) { if (handler.CanHandle(property)) { handler.Handle(property, type, mapper); break; } } } mapper.Table.Schema = this.schema; mapper.Table.Name = this.prefix + type.Name + this.suffix; }
public void Handle(PropertyInfo property, Type type, DomainMapping mapper) { mapper.MapID(property, type, primaryKeyFormatter); }
public static void Configure() { DomainMapping.Configure(); }
public void ComputeMatrix <M, V>(M Matrix, V AffineOffset, double oodt = 1.0) where M : IMutableMatrixEx where V : IList <double> { if (!Matrix.RowPartitioning.EqualsPartition(this.CodomainMapping)) { throw new ArgumentException("Mismatch between matrix columns and domain variable mapping."); } if (!Matrix.ColPartition.EqualsPartition(this.DomainMapping)) { throw new ArgumentException("Mismatch between matrix columns and domain variable mapping."); } if (DomainMapping.NoOfVariables != CodomainMapping.NoOfVariables) { throw new NotSupportedException($"Mismatch between number of variables in domain ({DomainMapping.NoOfVariables}) and codomain ({CodomainMapping.NoOfVariables})."); } double[] VarDiag = m_Owner.m_diagonal; int J = GridData.iLogicalCells.NoOfLocalUpdatedCells; int NoOfVar = DomainMapping.NoOfVariables; if (NoOfVar != VarDiag.Length) { throw new NotSupportedException(); } Basis[] domBs = DomainMapping.BasisS.ToArray(); Basis[] codBs = CodomainMapping.BasisS.ToArray(); void SetCellDiag(int j) { for (int iVar = 0; iVar < NoOfVar; iVar++) { int Ncol = domBs[iVar].GetLength(j); int Nrow = codBs[iVar].GetLength(j); if (Nrow != Ncol) { throw new NotSupportedException($"Diagonal block of {iVar}-th variable is not square: domain basis dimension is {Ncol}, codomain basis dimension is {Nrow}."); } for (int n = 0; n < Nrow; n++) { int idx = DomainMapping.GlobalUniqueCoordinateIndex(iVar, j, n); Matrix[idx, idx] += oodt * VarDiag[iVar]; } } } if (subMask != null) { foreach (int j in subMask.ItemEnum) { SetCellDiag(j); } } else { for (int j = 0; j < J; j++) { SetCellDiag(j); } } }
public void Handle(PropertyInfo property, Type type, DomainMapping mapper) { mapper.MapProperty(property); }
public void Handle(PropertyInfo property, Type type, DomainMapping mapper) { mapper.MapList(masterMap, property, property.PropertyType.GetGenericArguments().First(), type, foreignKeyFormatter); }
public void Handle(PropertyInfo property, Type type, DomainMapping mapper) { mapper.MapForeignRelationship(property, property.PropertyType.GetGenericArguments().First(), foreignKeyFormatter); }
public void Handle(PropertyInfo property, Type type, DomainMapping mapper) { mapper.MapForeignRelationship(property, property.PropertyType, foreignKeyFormatter); }
public void Handle(PropertyInfo property, Type type, DomainMapping mapper) { mapper.MapForeignRelationship(masterMap, property, foreignKeyFormatter); }
private bool TryApplyMappingRule(RichIdentity sourceUserIdentity, bool leftToRight, RichIdentity mappingOutput, DomainMapping rule) { if (IsRuleApplicable(sourceUserIdentity, rule, leftToRight)) { return(ApplyRule(sourceUserIdentity, leftToRight, mappingOutput, rule)); } else { return(false); } }
private bool ApplyRule(RichIdentity sourceUserIdentity, bool leftToRight, RichIdentity mappingOutput, DomainMapping rule) { string toDomainName = (leftToRight ? rule.Right : rule.Left); IStringManipulationRule stringManipulationRule = StringManipulationRuleFactory.GetInstance(rule.MappingRule); if (stringManipulationRule != null) { mappingOutput.Domain = stringManipulationRule.Apply(sourceUserIdentity.Domain, toDomainName); return(true); } else { return(false); } }
private bool MapUser( RichIdentity sourceUserIdentity, bool leftToRight, RichIdentity mappedUserIdentity) { m_mappingRuleComparer.MapFromLeftToRight = leftToRight; NotifyingCollection <DomainMapping> unidirectionalRules; if (leftToRight) { if (!m_perDirectionMappings.ContainsKey(MappingDirectionEnum.LeftToRight)) { return(false); } unidirectionalRules = m_perDirectionMappings[MappingDirectionEnum.LeftToRight]; } else { if (!m_perDirectionMappings.ContainsKey(MappingDirectionEnum.RightToLeft)) { return(false); } unidirectionalRules = m_perDirectionMappings[MappingDirectionEnum.RightToLeft]; } bool mapped = false; DomainMapping appliedUnidirectionalRule = null; RichIdentity unidirectionalMappingOutput = null; foreach (DomainMapping rule in unidirectionalRules) { RichIdentity mappingOutput = new RichIdentity(); if (TryApplyMappingRule(sourceUserIdentity, leftToRight, mappingOutput, rule)) { if (appliedUnidirectionalRule == null || m_mappingRuleComparer.Compare(rule, appliedUnidirectionalRule) < 0) { appliedUnidirectionalRule = rule; unidirectionalMappingOutput = mappingOutput; } mapped = true; } } if (mapped) { mappedUserIdentity.Domain = unidirectionalMappingOutput.Domain; return(true); } DomainMapping appliedBidirectionalRule = null; RichIdentity bidirectionalMappingOutput = null; if (m_perDirectionMappings.ContainsKey(MappingDirectionEnum.TwoWay)) { foreach (DomainMapping rule in m_perDirectionMappings[MappingDirectionEnum.TwoWay]) { RichIdentity mappingOutput = new RichIdentity(); if (TryApplyMappingRule(sourceUserIdentity, leftToRight, mappingOutput, rule)) { if (appliedBidirectionalRule == null || m_mappingRuleComparer.Compare(rule, appliedBidirectionalRule) < 0) { appliedBidirectionalRule = rule; bidirectionalMappingOutput = mappingOutput; } mapped = true; } } } if (mapped) { mappedUserIdentity.Domain = bidirectionalMappingOutput.Domain; } return(mapped); }