public void ShouldBeInvalidIfUserNameIsNull() { ClientConfiguration configuration = new ClientConfiguration() { Password = "******", Host = "smtp.google.com", Port = 445, Ssl = true }; ErrorList errors = configuration.Validate(); Assert.AreEqual(1, errors.Count); Assert.AreEqual("UserName can't be blank", errors[0].ToString()); }
public void ShouldBeInvalidIfHostIsNull() { ClientConfiguration configuration = new ClientConfiguration() { UserName = "******", Password = "******", Port = 445, Ssl = true }; ErrorList errors = configuration.Validate(); Assert.AreEqual(1, errors.Count); Assert.AreEqual("Host can't be blank", errors[0].ToString()); }
public AzureQueueDataManagerTests() { ClientConfiguration config = new ClientConfiguration(); config.TraceFilePattern = null; TraceLogger.Initialize(config); logger = TraceLogger.GetLogger("AzureQueueDataManagerTests", TraceLogger.LoggerType.Application); }
/// <summary> /// Initializes a new instance of <c>OAuth2Client</c>. /// </summary> /// <param name="configuration">The configuration.</param> /// <exception cref="ArgumentNullException"><paramref name="configuration"/> was <see langword="null"/>.</exception> public OAuth2Client(ClientConfiguration configuration) { if (null == configuration) throw new ArgumentNullException("configuration"); this.Configuration = configuration; }
public static void SetRootDomains() { const string accessId = "<your access id>"; const string accessKey = "<your access key>"; const string endpoint = "<valid host name>"; try { var conf = new ClientConfiguration(); var domainList = conf.RootDomainList; foreach (var domain in domainList) { Console.WriteLine(domain); } Console.WriteLine("\nafter modifed: "); var domains = new List<string> {".alibaba-inc.com", ".aliyuncs.gd"}; conf.RootDomainList = domains; foreach (string domain in conf.RootDomainList) { Console.WriteLine(domain); } var client = new OssClient(new Uri(endpoint), accessId, accessKey, conf); } catch (OssException ex) { Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}", ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId); } catch (Exception ex) { Console.WriteLine("Failed with error info: {0}", ex.Message); } }
private void GetClientEndpoint() { var clientFactory = new ClientFactory(); var clientConfig = new ClientConfiguration(); clientConfig.MaxSessions = 10; client = clientFactory.MakeNew(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 3000), clientConfig); }
public ProxiedMessageCenter(ClientConfiguration config, IPAddress localAddress, int gen, GrainId clientId, IGatewayListProvider gatewayListProvider) { lockable = new object(); MyAddress = SiloAddress.New(new IPEndPoint(localAddress, 0), gen); ClientId = clientId; Running = false; MessagingConfiguration = config; GatewayManager = new GatewayManager(config, gatewayListProvider); PendingInboundMessages = new RuntimeQueue<Message>(); gatewayConnections = new Dictionary<Uri, GatewayConnection>(); numMessages = 0; grainBuckets = new WeakReference[config.ClientSenderBuckets]; logger = TraceLogger.GetLogger("Messaging.ProxiedMessageCenter", TraceLogger.LoggerType.Runtime); if (logger.IsVerbose) logger.Verbose("Proxy grain client constructed"); IntValueStatistic.FindOrCreate(StatisticNames.CLIENT_CONNECTED_GATEWAY_COUNT, () => { lock (gatewayConnections) { return gatewayConnections.Values.Count(conn => conn.IsLive); } }); if (StatisticsCollector.CollectQueueStats) { queueTracking = new QueueTrackingStatistic("ClientReceiver"); } }
public void TestApiKeyConstructor() { ClientConfiguration config = new ClientConfiguration("someApiKey"); Assert.AreEqual("someApiKey", config.ApiKey); Assert.AreEqual(ClientConfiguration.DefaultBaseUrl, config.ApiBase); }
public Task InitializeGatewayListProvider(ClientConfiguration config, TraceLogger traceLogger) { deploymentId = config.DeploymentId; connectionString = config.DataConnectionString; maxStaleness = config.GatewayListRefreshPeriod; return TaskDone.Done; }
public void ShouldBeAbleToSaveTheConfigurationToFile() { ClientConfiguration configuration = new ClientConfiguration(); configuration.Save(configurationFileName); Assert.IsTrue(File.Exists(configurationFileName)); File.Delete(configurationFileName); }
public void TestApiKeyPlusBaseUrlConstructor() { ClientConfiguration config = new ClientConfiguration("someApiKey", "http://foobar.com"); Assert.AreEqual("someApiKey", config.ApiKey); Assert.AreEqual("http://foobar.com", config.ApiBase); }
static void Main(string[] args) { Console.WriteLine("Start"); var config = new ClientConfiguration() .LoadFromEmbeddedResource(typeof(Program), "Client.xml"); var system = ActorSystem.Configure() .Client() .From(config) .Register(typeof(ActorWithReminder).Assembly) .Done(); Console.WriteLine("Started"); while (true) { Console.WriteLine("Press c key to check reminder or r to register"); var k = Console.ReadKey(); if (k.KeyChar == 'c') { system.ActorOf<ActorWithReminder>("Any").Ask<bool>(new CheckReminder()) .ContinueWith(p => Console.WriteLine("Reminder check result: {0}", p.Result)); } if (k.KeyChar == 'r') { system.ActorOf<ActorWithReminder>("Any").Tell(new InitReminder()) .ContinueWith(p => Console.WriteLine("Reminder init result: {0}", p.Status)); } } }
public async Task<bool> Connect() { SpiderLogger.Info("------------------启动 Orleans Client.------------------"); try { if (!Orleans.GrainClient.IsInitialized) { ClientConfiguration config = new ClientConfiguration(); config.GatewayProvider = ClientConfiguration.GatewayProviderType.Config; IPEndPoint ip=new IPEndPoint(IPAddress.Parse("127.0.0.1"),30000); config.Gateways.Add(ip); config.StatisticsMetricsTableWriteInterval = TimeSpan.FromSeconds(30); config.StatisticsLogWriteInterval = TimeSpan.FromSeconds(300); config.StatisticsWriteLogStatisticsToTable = false; config.StatisticsPerfCountersWriteInterval = TimeSpan.FromSeconds(30); Orleans.GrainClient.Initialize(config); } IServices server = GrainClient.GrainFactory.GetGrain<IServices>(Guid.NewGuid()); return await server.ConnectToServer(Dns.GetHostName()); } catch (Exception ex) { SpiderLogger.Error("启动 Orleans Client 失败." + ex.Message+"\r\n"); SpiderLogger.Error(ex.StackTrace); return false; } }
internal static async Task<IGatewayListProvider> CreateGatewayListProvider(ClientConfiguration cfg) { IGatewayListProvider listProvider = null; ClientConfiguration.GatewayProviderType gatewayProviderToUse = cfg.GatewayProviderToUse; switch (gatewayProviderToUse) { case ClientConfiguration.GatewayProviderType.AzureTable: listProvider = AssemblyLoader.LoadAndCreateInstance<IGatewayListProvider>(Constants.ORLEANS_AZURE_UTILS_DLL, logger); break; case ClientConfiguration.GatewayProviderType.SqlServer: listProvider = AssemblyLoader.LoadAndCreateInstance<IGatewayListProvider>(Constants.ORLEANS_SQL_UTILS_DLL, logger); break; case ClientConfiguration.GatewayProviderType.Custom: listProvider = AssemblyLoader.LoadAndCreateInstance<IGatewayListProvider>(cfg.CustomGatewayProviderAssemblyName, logger); break; case ClientConfiguration.GatewayProviderType.ZooKeeper: listProvider = AssemblyLoader.LoadAndCreateInstance<IGatewayListProvider>(Constants.ORLEANS_ZOOKEEPER_UTILS_DLL, logger); break; case ClientConfiguration.GatewayProviderType.Config: listProvider = new StaticGatewayListProvider(); break; default: throw new NotImplementedException(gatewayProviderToUse.ToString()); } await listProvider.InitializeGatewayListProvider(cfg, LogManager.GetLogger(listProvider.GetType().Name)); return listProvider; }
public void GatewaySelection_ClientInit_EmptyList() { var cfg = new ClientConfiguration(); cfg.Gateways = null; bool failed = false; try { GrainClient.Initialize(cfg); } catch (Exception exc) { output.WriteLine(exc.ToString()); failed = true; } Assert.IsTrue(failed, "GatewaySelection_EmptyList failed as GatewayManager did not throw on empty Gateway list."); // Note: This part of the test case requires a silo local to be running in order to work successfully. //var listProvider = new TestListProvider(gatewayAddressUris); //cfg.Gateways = listProvider.GetGateways().Select(uri => //{ // return new IPEndPoint(IPAddress.Parse(uri.Host), uri.Port); //}).ToList(); //Client.Initialize(cfg); }
public Task InitializeGatewayListProvider(ClientConfiguration config, Logger logger) { _maxStaleness = config.GatewayListRefreshPeriod; Init(config.DeploymentId, config.DataConnectionString, logger); return TaskDone.Done; }
private static void InitializeAgatha() { var config = new ClientConfiguration(typeof(HelloWorldRequest).Assembly, typeof(Ninject.Container)) { CacheManagerImplementation = typeof(InvalidatingCacheManager) }; config.Initialize(); }
public static void Initialize(IKernel kernel) { var container = new Ninject.Container(kernel); var config = new ClientConfiguration(typeof(HelloWorldRequest).Assembly, container) { CacheManagerImplementation = typeof(InvalidatingCacheManager) }; config.Initialize(); }
public async Task InitializeGatewayListProvider(ClientConfiguration config, TraceLogger traceLogger) { logger = traceLogger; if (logger.IsVerbose3) logger.Verbose3("SqlMembershipTable.InitializeGatewayListProvider called."); deploymentId = config.DeploymentId; maxStaleness = config.GatewayListRefreshPeriod; orleansQueries = await RelationalOrleansQueries.CreateInstance(config.AdoInvariant, config.DataConnectionString); }
public ClientConfiguration(ClientConfiguration existing) : this(apiKey: existing?.ApiKey, cacheManager: existing?.CacheManager, baseUrl: existing?.BaseUrl, connectionTimeout: existing?.ConnectionTimeout, authenticationScheme: existing?.AuthenticationScheme, proxy: existing?.Proxy) { }
public StormpathConfiguration( ClientConfiguration client = null, ApplicationConfiguration application = null, WebConfiguration web = null) { this.Client = new ClientConfiguration(client ?? Default.Configuration.Client); this.Application = new ApplicationConfiguration(application ?? Default.Configuration.Application); this.Web = new WebConfiguration(web ?? Default.Configuration.Web); }
public Client(SessionManager _sessionManager, IPEndPoint _ipEndpoint, ClientConfiguration _clientConfiguration = null) { sessionManager = _sessionManager; ipEndPoint = _ipEndpoint; ApplyClientConfiguration(_clientConfiguration ?? new ClientConfiguration()); Guid = ShortGuid.New(); }
public static void Initialize(ClientConfiguration configuration) { // TODO: make this configurable from outside configuration.DeploymentId = RoleEnvironment.DeploymentId; configuration.DataConnectionString = RoleEnvironment.GetConfigurationSettingValue("DataConnectionString"); configuration.GatewayProvider = ClientConfiguration.GatewayProviderType.AzureTable; AzureClient.Initialize(configuration); }
public static JustGivingClient CreateClientValidRflCredentials(WireDataFormat wireDataFormat) { var cfg = new ClientConfiguration(ApiLocation, ApiKey, 1) { Username = RflUserName, Password = TestValidPassword, WireDataFormat = wireDataFormat }; return new JustGivingClient(cfg); }
public void CreateClientConfiguration() { const string organizationNumber = "123456789"; const string certificateThumbprint = "3k 7f 30 dd 05 d3 b7 fc..."; var clientConfiguration = new ClientConfiguration( Environment.DifiQa, certificateThumbprint, new Sender(organizationNumber)); }
static void InitializeActorSystemClient() { var config = new ClientConfiguration() .LoadFromEmbeddedResource<Startup>("Orleans.xml"); MvcApplication.System = ActorSystem.Configure().Azure() .Client() .From(config) .Register(typeof(Publisher).Assembly) .Done(); }
public JustGivingMobileClient(ClientConfiguration clientConfiguration, IHttpClient httpClient, IAccountApi accountApi, IDonationApi donationApi, IPageApi pageApi, ISearchApi searchApi, ICharityApi charityApi, IEventApi eventApi, ITeamApi teamApi, IOneSearchApi oneSearchApi, ICountryApi countryApi, ICurrencyApi currencyApi, IProjectApi projectApi) : base( clientConfiguration, httpClient, accountApi, donationApi, pageApi, searchApi, charityApi, eventApi, teamApi, oneSearchApi, countryApi, currencyApi, projectApi) { }
async Task IClientMetricsDataPublisher.Init(ClientConfiguration config, IPAddress address, string clientId) { deploymentId = config.DeploymentId; this.clientId = clientId; this.address = address; myHostName = config.DNSHostName; storage = new AzureTableDataManager<ClientMetricsData>( INSTANCE_TABLE_NAME, config.DataConnectionString, logger); await storage.InitTableAsync().WithTimeout(initTimeout); }
public static JustGivingClient CreateClientValidCredentials(WireDataFormat wireDataFormat, string username = null, string password = null) { var cfg = new ClientConfiguration(ApiLocation, ApiKey, 1) { Username = username ?? TestUsername, Password = password ?? TestValidPassword, WireDataFormat = wireDataFormat }; return new JustGivingClient(cfg); }
internal ClientStatisticsManager(ClientConfiguration config) { this.config = config; runtimeStats = new RuntimeStatisticsGroup(); logStatistics = new LogStatistics(config.StatisticsLogWriteInterval, false); logger = LogManager.GetLogger(GetType().Name); MessagingStatisticsGroup.Init(false); NetworkingStatisticsGroup.Init(false); ApplicationRequestsStatisticsGroup.Init(config.ResponseTimeout); }
public ClusterController(ICluster cluster, ClientConfiguration clientConfig) : this(clientConfig) { Cluster = cluster; }
async Task IClientMetricsDataPublisher.Init(ClientConfiguration config, IPAddress address, string clientId) { database = RelationalStorageUtilities.CreateGenericStorageInstance(config.AdoInvariant, config.DataConnectionString); queryConstants = await database.InitializeOrleansQueriesAsync(); }
public void ClientConfiguration_HeartbeachConfigCheckInterval_Defaults_To_2500() { var clientConfig = new ClientConfiguration(); Assert.AreEqual(2500, clientConfig.HeartbeatConfigInterval); }
public void CouchbaseConfiguration_OrphanedResponseLoggingEnabled_Default() { var config = new ClientConfiguration(); Assert.IsTrue(config.OperationTracingEnabled); }
protected ServiceClient(ClientConfiguration configuration) { _configuration = configuration; }
private static void AdjustConfig(ClientConfiguration config) { config.RegisterStreamProvider <EventHubStreamProvider>(StreamProviderName, BuildProviderSettings()); config.Gateways.Add(new IPEndPoint(IPAddress.Loopback, 40001)); }
public async Task <PacketCode> CreateSecondFactorRequest(PendingRequest request, ClientConfiguration clientConfig) { var userName = request.RequestPacket.UserName; var userPassword = request.RequestPacket.UserPassword; var displayName = request.DisplayName; var email = request.EmailAddress; var userPhone = request.UserPhone; var callingStationId = request.RequestPacket.CallingStationId; var url = _serviceConfiguration.ApiUrl + "/access/requests/ra"; var payload = new { Identity = userName, Name = displayName, Email = email, Phone = userPhone, PassCode = GetPassCodeOrNull(userPassword, clientConfig), CallingStationId = callingStationId, Capabilities = new { InlineEnroll = true } }; var response = await SendRequest(url, payload, clientConfig); var responseCode = ConvertToRadiusCode(response); request.State = response?.Id; request.ReplyMessage = response?.ReplyMessage; if (responseCode == PacketCode.AccessAccept && !response.Bypassed) { _logger.Information("Second factor for user '{user:l}' verified successfully. Authenticator '{authenticator:l}', account '{account:l}'", userName, response?.Authenticator, response?.Account); } if (responseCode == PacketCode.AccessReject) { var reason = response?.ReplyMessage; var phone = response?.Phone; _logger.Warning("Second factor verification for user '{user:l}' from {host:l}:{port} failed with reason='{reason:l}'. User phone {phone:l}", userName, request.RemoteEndpoint.Address, request.RemoteEndpoint.Port, reason, phone); } return(responseCode); }
private async Task <MultiFactorAccessRequest> SendRequest(string url, object payload, ClientConfiguration clientConfiguration) { try { //make sure we can communicate securely ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServicePointManager.DefaultConnectionLimit = 100; _logger.Debug("Sending request to API: {@payload}", payload); var json = JsonConvert.SerializeObject(payload); var requestData = Encoding.UTF8.GetBytes(json); byte[] responseData = null; //basic authorization var auth = Convert.ToBase64String(Encoding.ASCII.GetBytes(clientConfiguration.MultifactorApiKey + ":" + clientConfiguration.MultiFactorApiSecret)); using (var web = new WebClient()) { web.Headers.Add("Content-Type", "application/json"); web.Headers.Add("Authorization", "Basic " + auth); if (!string.IsNullOrEmpty(_serviceConfiguration.ApiProxy)) { _logger.Debug("Using proxy " + _serviceConfiguration.ApiProxy); var proxyUri = new Uri(_serviceConfiguration.ApiProxy); web.Proxy = new WebProxy(proxyUri); if (!string.IsNullOrEmpty(proxyUri.UserInfo)) { var credentials = proxyUri.UserInfo.Split(new[] { ':' }, 2); web.Proxy.Credentials = new NetworkCredential(credentials[0], credentials[1]); } } responseData = await web.UploadDataTaskAsync(url, "POST", requestData); } json = Encoding.UTF8.GetString(responseData); var response = JsonConvert.DeserializeObject <MultiFactorApiResponse <MultiFactorAccessRequest> >(json); _logger.Debug("Received response from API: {@response}", response); if (!response.Success) { _logger.Warning("Got unsuccessful response from API: {@response}", response); } return(response.Model); } catch (Exception ex) { _logger.Error($"Multifactor API host unreachable: {url}\n{ex.Message}"); if (clientConfiguration.BypassSecondFactorWhenApiUnreachable) { _logger.Warning("Bypass second factor"); return(MultiFactorAccessRequest.Bypass); } return(null); } }
public PutServerWideClientConfigurationCommand(DocumentConventions conventions, JsonOperationContext context, ClientConfiguration configuration) { if (conventions == null) { throw new ArgumentNullException(nameof(conventions)); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } _configuration = EntityToBlittable.ConvertCommandToBlittable(configuration, context); }
private void btnView_Click(object sender, EventArgs e) { string strCurrentDB = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\HisProductMapList.xml", "Config/SourceDB"), "DBType"); if (string.IsNullOrEmpty(strCurrentDB)) { ComUtil.MsgBox("没有进行字段匹配,无法导入!"); return; } //选择待导入的文件 string str = ""; if (strCurrentDB.CompareTo("EXCEL") == 0) { openFileDialog1.Filter = "Excel文档(*.xls)|*.xls"; } if (strCurrentDB.CompareTo("ACCESS") == 0) { openFileDialog1.Filter = "MDB文档(*.mdb)|*.mdb"; } openFileDialog1.FilterIndex = 1; openFileDialog1.Title = "打开文件"; openFileDialog1.InitialDirectory = EmedFunc.GetLocalPersonCfgPath(); openFileDialog1.RestoreDirectory = true; openFileDialog1.FileName = ""; openFileDialog1.ShowDialog(); try { str = openFileDialog1.FileName; if (!string.IsNullOrEmpty(str)) { this.txtImportFilePath.Text = str; ClientConfiguration.HisPath = str; string sql = string.Empty; if (strCurrentDB.CompareTo("EXCEL") == 0) { ClientConfiguration.ConnectionString = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = " + str + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1'"; sql = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\HisProductMapList.xml", "Config/Sqls/Sql").InnerText; } if (strCurrentDB.CompareTo("ACCESS") == 0) { string password = SecretUtil.DeSecret(FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/HisProductMapList.xml", "Config/DestDB"), "Password")); ClientConfiguration.ConnectionString = " Provider = Microsoft.Jet.OLEDB.4.0 ;Jet OLEDB:Database Password="******"; Data Source = " + str + ";"; sql = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\HisProductMapList.xml", "Config/ASqls/Sql").InnerText; } ClientConfiguration.Save(); DataTable dt = RequestSendDal.GetInstance().GetRequestSend(sql); dt.DefaultView.RowFilter = " PRODUCT_CODE is not null"; this.bindingSource1.DataSource = null; this.bindingSource1.DataSource = dt; } } catch (Exception ex) { this.bindingSource1.DataSource = null; ComUtil.MsgBox("不是有效的数据文件!"); } }
public ZooKeeperClusteringClientOptions(ILogger <ZooKeeperClusteringClientOptions> logger, ClientConfiguration clientConfiguration, IOptions <ZooKeeperGatewayListProviderOptions> options, IOptions <ClusterClientOptions> clusterClientOptions) { watcher = new ZooKeeperWatcher(logger); deploymentPath = "/" + clusterClientOptions.Value.ClusterId; deploymentConnectionString = options.Value.ConnectionString + deploymentPath; maxStaleness = clientConfiguration.GatewayListRefreshPeriod; }
public UMIController() { SessionModel.Initialize(); client = new Client <UMI>(SessionModel.AuthorizationHeader, clientadapter: ClientConfiguration.GetAdapterFromConfig()); }
public void CouchbaseConfiguration_OrphanedResponseLogger_CorrectDefault() { var configuration = new ClientConfiguration(); Assert.IsInstanceOf <OrphanedResponseLogger>(configuration.OrphanedResponseLogger); }
/// <summary> /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint. /// A client configuration can also be provided optionally to adjust REST client behaviors. /// </summary> /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param> /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param> /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param> public LoggingClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null) : base(authenticationDetailsProvider, clientConfiguration) { service = new Service { ServiceName = "LOGGING", ServiceEndpointPrefix = "", ServiceEndpointTemplate = "https://ingestion.logging.{region}.oci.{secondLevelDomain}" }; ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration(); if (authenticationDetailsProvider is IRegionProvider) { // Use region from Authentication details provider. SetRegion(((IRegionProvider)authenticationDetailsProvider).Region); } if (endpoint != null) { logger.Info($"Using endpoint specified \"{endpoint}\"."); SetEndpoint(endpoint); } this.retryConfiguration = clientConfigurationToUse.RetryConfiguration; }
public void CouchbaseConfiguration_Tracer_CorrectDefault() { var configuration = new ClientConfiguration(); Assert.IsInstanceOf <ThresholdLoggingTracer>(configuration.Tracer); }
public PutServerWideClientConfigurationOperation(ClientConfiguration configuration) { _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); }
/// <summary> /// Configures the test cluster plus client in-process, /// using the specified silo and client config configurations. /// </summary> public TestCluster(ClusterConfiguration clusterConfiguration, ClientConfiguration clientConfiguration) { this.ClusterConfiguration = clusterConfiguration; this.ClientConfiguration = clientConfiguration; this.UseSiloBuilderFactory <DefaultSiloBuilderFactory>(); }
/// <summary> /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint. /// A client configuration can also be provided optionally to adjust REST client behaviors. /// </summary> /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param> /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param> /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param> public WorkRequestsClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null) : base(authenticationDetailsProvider, clientConfiguration) { service = new Service { ServiceName = "WORKREQUESTS", ServiceEndpointPrefix = "", ServiceEndpointTemplate = "https://apigateway.{region}.oci.{secondLevelDomain}" }; ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration(); if (authenticationDetailsProvider is IRegionProvider) { // Use region from Authentication details provider. SetRegion(((IRegionProvider)authenticationDetailsProvider).Region); } if (endpoint != null) { logger.Info($"Using endpoint specified \"{endpoint}\"."); SetEndpoint(endpoint); } this.retryConfiguration = clientConfigurationToUse.RetryConfiguration; Paginators = new WorkRequestsPaginators(this); Waiters = new WorkRequestsWaiters(this); }
public void SetUp() { _endPoint = UriExtensions.GetEndPoint(Address); _clientConfig = new ClientConfiguration(); _clusterManager = new ClusterController(_clientConfig); }
private static void AdjustConfig(ClientConfiguration config) { config.RegisterStreamProvider <MemoryStreamProvider>(Fixture.StreamProviderName, BuildProviderSettings()); }
public Server(IIOService ioService, INodeAdapter nodeAdapter, ClientConfiguration clientConfiguration, IBucketConfig bucketConfig, ITypeTranscoder transcoder) : this(ioService, null, null, null, null, null, null, nodeAdapter, clientConfiguration, transcoder, bucketConfig) { }
public void Test_KeySeqnoObserver() { var configuration = new ClientConfiguration { Servers = new List <Uri> { new Uri(ConfigurationManager.AppSettings["bootstrapUrl"]) } }; var key = "Test_KeySeqnoObserver"; using (var cluster = new Cluster(configuration)) { using (var bucket = cluster.OpenBucket()) { bucket.Remove(key); } } configuration.Initialize(); var provider = new CarrierPublicationProvider( configuration, (pool) => new PooledIOService(pool), (config, endpoint) => new ConnectionPool <Connection>(config, endpoint), SaslFactory.GetFactory(), new DefaultConverter(), new DefaultTranscoder(new DefaultConverter(), new DefaultSerializer())); var configInfo = provider.GetConfig("default"); var features = new List <short>(); features.Add((short)ServerFeatures.MutationSeqno); var keyMapper = configInfo.GetKeyMapper(); var mappedNode = keyMapper.MapKey(key); var node = mappedNode.LocatePrimary(); foreach (var server in configInfo.Servers.Where(x => x.IsDataNode)) { var hello = new Hello("couchbase-net-sdk/2.1.4", features.ToArray(), provider.Transcoder, 0, 0); var result3 = server.Send(hello); Assert.IsTrue(result3.Success); } var result = node.Send(new Add <string>(key, "", (VBucket)mappedNode, new DefaultTranscoder(new DefaultConverter(), new DefaultSerializer()), 1000)); var clusterController = new Mock <IClusterController>(); clusterController.Setup(x => x.Transcoder).Returns(new DefaultTranscoder()); var pending = new ConcurrentDictionary <uint, IOperation>(); var keyObserver = new KeySeqnoObserver("thekey", pending, configInfo, clusterController.Object, 0, 1000); var durabilityReached = keyObserver.Observe(result.Token, ReplicateTo.Zero, PersistTo.One); Assert.IsTrue(durabilityReached); }
public void ClientConfiguration_VBucketRetrySleepTime_DefaultsTo100ms() { var config = new ClientConfiguration(); Assert.AreEqual(100, config.VBucketRetrySleepTime); }
public InfonavitInsuranceController() { SessionModel.Initialize(); client = new Client <InfonavitInsurance>(SessionModel.AuthorizationHeader, clientadapter: ClientConfiguration.GetAdapterFromConfig()); }
public void ReadsDefaultConfiguration() { ClientConfiguration clientConfig = _client.Configuration; Assert.IsNotNull(clientConfig.NodeRegistry); }
public TestConfigProvider(ClientConfiguration clientConfig) : base(clientConfig, null, null, null, null, null) { }
/// <summary> /// Ctor for creating Cluster instance. /// </summary> /// <param name="configuration">The ClientCOnfiguration to use for initialization.</param> /// <param name="clusterController">The ClusterManager instance use.</param> /// <remarks> /// This overload is primarly added for testing. /// </remarks> internal Cluster(ClientConfiguration configuration, IClusterController clusterController) { _configuration = configuration; _clusterController = clusterController; LogConfigurationAndVersion(_configuration); }
/// <summary> /// 浏览按钮的操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBrowse_Click(object sender, EventArgs e) { /****************************************************************** * * 修改时间:2007-3-21 * 修改人:ningbo * 修改原因: * 新增代码:EmedFunc.GetLocalPersonCfgPath() + "GpoOrderSend.xml" * ******************************************************************/ string strCurrentDB = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\GpoOrderSend.xml", "Config/SourceDB"), "DBType"); if (string.IsNullOrEmpty(strCurrentDB)) { MessageBox.Show("没有进行字段匹配,无法导入!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //选择待导入的文件 string str = ""; if (strCurrentDB.CompareTo("EXCEL") == 0) { openFileDialog1.Filter = "Excel文档(*.xls)|*.xls"; } //openFileDialog1.Filter = "DBF文档(*.dbf)|*.dbf|Excel文档(*.xls)|*.xls"; openFileDialog1.FilterIndex = 1; openFileDialog1.Title = "打开文件"; openFileDialog1.InitialDirectory = Application.StartupPath; openFileDialog1.RestoreDirectory = true; openFileDialog1.FileName = ""; openFileDialog1.ShowDialog(); try { str = openFileDialog1.FileName; if (!string.IsNullOrEmpty(str)) { this.txtImportFilePath.Text = str; ClientConfiguration.HisPath = str; if (strCurrentDB.CompareTo("EXCEL") == 0) { ClientConfiguration.ConnectionString = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = " + str + ";Extended Properties=Excel 8.0"; } //ClientConfiguration.ConnectionString = ClientConfiguration.ConnectionString.Replace(ClientConfiguration.HisPath, str); ClientConfiguration.Save(); //ClientConfiguration.Reload(); /****************************************************************** * * 修改时间:2007-3-21 * 修改人:ningbo * 修改原因: * 新增代码:EmedFunc.GetLocalPersonCfgPath() + "GpoOrderSend.xml" * ******************************************************************/ //string sql = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\GpoOrderSend.xml", "Config/Sqls/Sql").InnerText; //DataTable dt = GpoSendDao.GetInstance().GetErpSend(sql); DataTable dt = GetImportTable(); this.bindingSource1.DataSource = null; this.bindingSource1.DataSource = dt; //"导出采购订单"判断业务流程("进销存"企业对接功能),shangfu 2007-8-24 //如果为1就是进销存对接接口 string clientPlat = UserConfigXml.GetConfigInfo("ClientPlat", "type"); if (clientPlat.Equals("1")) { //dtImp = dt.Clone(); RetOrderItem(out count); } else { setErpSendMapData(out count); } int matchRowsCount = 0; foreach (DataGridViewRow dgvr in dgvErpSend.Rows) { if (dgvr.Cells["type"].Value == "0") { matchRowsCount++; } } if (matchRowsCount > 0) { btnImport.Enabled = true; } else { //btnImport.Enabled = false; } if (count > 0) { lbmess.Text = "有" + count.ToString() + "个产品编码(显示为红色)对应多条数据,请选择一条!"; if (dgvErpSend.RowCount > 0) { lbmess.Visible = true; } else { lbmess.Visible = false; } } } } catch (Exception) { this.bindingSource1.DataSource = null; MessageBox.Show("不是有效的数据文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint. /// A client configuration can also be provided optionally to adjust REST client behaviors. /// </summary> /// <param name="authenticationDetailsProvider">The authentication details provider. Required.</param> /// <param name="clientConfiguration">The client configuration that contains settings to adjust REST client behaviors. Optional.</param> /// <param name="endpoint">The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.</param> public ComputeInstanceAgentClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null) : base(authenticationDetailsProvider, clientConfiguration) { service = new Service { ServiceName = "COMPUTEINSTANCEAGENT", ServiceEndpointPrefix = "", ServiceEndpointTemplate = "https://iaas.{region}.{secondLevelDomain}" }; ClientConfiguration clientConfigurationToUse = clientConfiguration ?? new ClientConfiguration(); if (authenticationDetailsProvider is IRegionProvider) { // Use region from Authentication details provider. SetRegion(((IRegionProvider)authenticationDetailsProvider).Region); } if (endpoint != null) { logger.Info($"Using endpoint specified \"{endpoint}\"."); SetEndpoint(endpoint); } this.retryConfiguration = clientConfigurationToUse.RetryConfiguration; Paginators = new ComputeInstanceAgentPaginators(this); Waiters = new ComputeInstanceAgentWaiters(this); }
public Fixture() { BufferPool.InitGlobalBufferPool(Options.Create(new SiloMessagingOptions())); ClientConfiguration cfg = ClientConfiguration.LoadFromFile("ClientConfigurationForTesting.xml"); }