public ProxyConfigManager( ILogger <ProxyConfigManager> logger, IProxyConfigProvider provider, IClusterManager clusterManager, IRouteManager routeManager, IEnumerable <IProxyConfigFilter> filters, IConfigValidator configValidator, ProxyEndpointFactory proxyEndpointFactory, ITransformBuilder transformBuilder, IProxyHttpClientFactory httpClientFactory, IActiveHealthCheckMonitor activeHealthCheckMonitor) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _provider = provider ?? throw new ArgumentNullException(nameof(provider)); _clusterManager = clusterManager ?? throw new ArgumentNullException(nameof(clusterManager)); _routeManager = routeManager ?? throw new ArgumentNullException(nameof(routeManager)); _filters = filters ?? throw new ArgumentNullException(nameof(filters)); _configValidator = configValidator ?? throw new ArgumentNullException(nameof(configValidator)); _proxyEndpointFactory = proxyEndpointFactory ?? throw new ArgumentNullException(nameof(proxyEndpointFactory)); _transformBuilder = transformBuilder ?? throw new ArgumentNullException(nameof(transformBuilder)); _httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory)); _activeHealthCheckMonitor = activeHealthCheckMonitor ?? throw new ArgumentNullException(nameof(activeHealthCheckMonitor)); _conventions = new List <Action <EndpointBuilder> >(); DefaultBuilder = new ReverseProxyConventionBuilder(_conventions); _changeToken = new CancellationChangeToken(_cancellationTokenSource.Token); }
public ClusterInfoTests() { // These are satellite classes with simple functionality and adding the actual implementations // much more convenient than replicating functionality for the purpose of the tests. Provide <IDestinationManagerFactory, DestinationManagerFactory>(); _clusterManager = Provide <IClusterManager, ClusterManager>(); }
public Repository(IBucketProvider bucketProvider, ICluster clustur) { string name = typeof(Type) .GetAttributeValue((BucketNameAttribute dna) => dna.Name); if (string.IsNullOrEmpty(name)) { throw new BucketNotFoundException("BucketName Eklememiş"); } clustur.Authenticate("Administrator", "Qn4j123"); _clusterManager = clustur.CreateManager(); //burda kaldım clustur oluşturmuyor var bucketList = _clusterManager.ListBuckets(); if (bucketList.Success && !bucketList.Value.Any(x => x.Name == name)) { var bucketResult = CreateBucket(name); if (!bucketResult.Item1) { throw new BucketNotFoundException($"Bucket Oluşturulken hata alındı {bucketResult.Item2}"); } else { ExecQueryReturnList($"CREATE PRIMARY INDEX `{name}_primary_index` ON `{name}`"); } } _bucket = bucketProvider.GetBucket(name); }
internal MemcachedBucket(IClusterManager clusterManager, string bucketName, IByteConverter converter, ITypeSerializer serializer) { _clusterManager = clusterManager; _converter = converter; _serializer = serializer; Name = bucketName; }
public void OneTimeSetUp() { TestConfiguration.IgnoreIfMock(); _cluster = new Cluster(Utils.TestConfiguration.GetConfiguration("basic")); _cluster.SetupEnhancedAuth(); _clusterManager = _cluster.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); var listbucketsResult = _clusterManager.ListBuckets(); if (listbucketsResult.Value.Any(bucket => bucket.Name == BucketName)) { var removeResult = _clusterManager.RemoveBucket(BucketName); Assert.IsTrue(removeResult.Success); } var createResult = _clusterManager.CreateBucket(BucketName, replicaNumber: ReplicaNumber.Zero, flushEnabled: true); Assert.True(createResult.Success); // Allow time for bucket to be created and configuration to propagate before beginning operations Thread.Sleep(500); _bucket = _cluster.OpenBucket(BucketName); _bucketManager = _bucket.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); }
public void OneTimeSetUp() { TestConfiguration.IgnoreIfMock(); _cluster = new Cluster(Utils.TestConfiguration.GetConfiguration("basic")); _cluster.SetupEnhancedAuth(); _clusterManager = _cluster.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); }
/// <summary> /// Initializes a new Cluster instance with a given ClientConfiguration and ClusterManager. /// This overload is primarily provided for testing given that it allows you to set the /// major dependencies of the Cluster class and it's scope is internal. /// </summary> /// <param name="configuration"></param> /// <param name="clusterManager"></param> internal static void Initialize(ClientConfiguration configuration, IClusterManager clusterManager) { if (configuration == null || clusterManager == null) { throw new ArgumentNullException(configuration == null ? "configuration" : "clusterManager"); } configuration.Initialize(); var factory = new Func <CouchbaseCluster>(() => new CouchbaseCluster(configuration, clusterManager)); Initialize(factory); }
public ReverseProxyConfigManagerTests() { var httpClientFactoryMock = new Mock<IProxyHttpClientFactory>(MockBehavior.Strict); Mock<IProxyHttpClientFactoryFactory>() .Setup(p => p.CreateFactory()) .Returns(httpClientFactoryMock.Object); // The following classes simply store information and using the actual implementations // is easier than replicating functionality with mocks. Provide<IDestinationManagerFactory, DestinationManagerFactory>(); _clusterManager = Provide<IClusterManager, ClusterManager>(); _routeManager = Provide<IRouteManager, RouteManager>(); Provide<IRuntimeRouteBuilder, RuntimeRouteBuilder>(); }
public Task Configure(int clusterId) { if (this.ClusterManager == null) { Console.WriteLine($"<RaftLog> Client is configuring."); this.ClusterManager = this.GrainFactory.GetGrain <IClusterManager>(clusterId); this.RequestTimer = this.RegisterTimer(PumpRequest, null, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5)); } return(TaskDone.Done); }
private void TryCreateCluster1() { try { _cluster1 = new Cluster(_cluster1config); _cluster1.Authenticate(new ClassicAuthenticator("Administrator", "password")); _cluster1Man = _cluster1.CreateManager(); } catch (Exception) { // notifications, logging, etc Console.WriteLine("Error creating cluster 1"); } }
public void OneTimeSetUp() { _cluster = new Cluster(Utils.TestConfiguration.GetConfiguration("basic")); _clusterManager = _cluster.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); var createResult = _clusterManager.CreateBucket(BucketName, replicaNumber:ReplicaNumber.Zero, flushEnabled: true); Assert.True(createResult.Success); // Allow time for bucket to be created and configuration to propagate before beginning operations Thread.Sleep(500); _bucket = _cluster.OpenBucket(BucketName); _bucketManager = _bucket.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); }
public void OneTimeSetUp() { _cluster = new Cluster(Utils.TestConfiguration.GetConfiguration("basic")); _clusterManager = _cluster.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); var createResult = _clusterManager.CreateBucket(BucketName, flushEnabled: true, bucketType:BucketTypeEnum.Memcached); Console.WriteLine(createResult.Success); // Allow time for bucket to be created and configuration to propagate before beginning operations Thread.Sleep(500); _bucket = _cluster.OpenBucket(BucketName); _bucketManager = _bucket.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); }
public ReverseProxyConfigManager( ILogger <ReverseProxyConfigManager> logger, IDynamicConfigBuilder configBuilder, IRuntimeRouteBuilder routeEndpointBuilder, IClusterManager clusterManager, IRouteManager routeManager, IProxyDynamicEndpointDataSource dynamicEndpointDataSource) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _configBuilder = configBuilder ?? throw new ArgumentNullException(nameof(configBuilder)); _routeEndpointBuilder = routeEndpointBuilder ?? throw new ArgumentNullException(nameof(routeEndpointBuilder)); _clusterManager = clusterManager ?? throw new ArgumentNullException(nameof(clusterManager)); _routeManager = routeManager ?? throw new ArgumentNullException(nameof(routeManager)); _dynamicEndpointDataSource = dynamicEndpointDataSource ?? throw new ArgumentNullException(nameof(dynamicEndpointDataSource)); }
public void OneTimeSetUp() { _cluster = new Cluster(Utils.TestConfiguration.GetConfiguration("basic")); _clusterManager = _cluster.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); var createResult = _clusterManager.CreateBucket(BucketName, replicaNumber: ReplicaNumber.Zero, flushEnabled: true); Assert.True(createResult.Success); // Allow time for bucket to be created and configuration to propagate before beginning operations Thread.Sleep(500); _bucket = _cluster.OpenBucket(BucketName); _bucketManager = _bucket.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); }
public void OneTimeSetUp() { _cluster = new Cluster(Utils.TestConfiguration.GetConfiguration("basic")); _clusterManager = _cluster.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); var createResult = _clusterManager.CreateBucket(BucketName, flushEnabled: true, bucketType: BucketTypeEnum.Memcached); Console.WriteLine(createResult.Success); // Allow time for bucket to be created and configuration to propagate before beginning operations Thread.Sleep(500); _bucket = _cluster.OpenBucket(BucketName); _bucketManager = _bucket.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); }
public void BootStrapCluster() { //get a config pointing at the initial entry point node (EP) var config = new ClientConfiguration { Servers = new List <Uri> { new Uri("http://192.168.77.101:8091/") } }; //create the cluster object _cluster = new Cluster(config); //use the factory method to create a ClusterManager _manager = _cluster.CreateManager("Administrator", "password"); }
public void BootStrapCluster() { //get a config pointing at the initial entry point node (EP) var config = new ClientConfiguration { Servers = new List<Uri> { new Uri("http://192.168.77.101:8091/") } }; //create the cluster object _cluster = new Cluster(config); //use the factory method to create a ClusterManager _manager = _cluster.CreateManager("Administrator", "password"); }
public ProxyConfigManager( ILogger <ProxyConfigManager> logger, IProxyConfigProvider provider, IRuntimeRouteBuilder routeEndpointBuilder, IClusterManager clusterManager, IRouteManager routeManager, IEnumerable <IProxyConfigFilter> filters, IConfigValidator configValidator) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _provider = provider ?? throw new ArgumentNullException(nameof(provider)); _routeEndpointBuilder = routeEndpointBuilder ?? throw new ArgumentNullException(nameof(routeEndpointBuilder)); _clusterManager = clusterManager ?? throw new ArgumentNullException(nameof(clusterManager)); _routeManager = routeManager ?? throw new ArgumentNullException(nameof(routeManager)); _filters = filters ?? throw new ArgumentNullException(nameof(filters)); _configValidator = configValidator ?? throw new ArgumentNullException(nameof(configValidator)); _changeToken = new CancellationChangeToken(_cancellationTokenSource.Token); }
public HealthProbeWorkerTests() { // Set up all the parameter needed for healthProberWorker. Provide <IMonotonicTimer, MonotonicTimer>(); Provide <ILogger, Logger <HealthProbeWorker> >(); Mock <IProxyHttpClientFactoryFactory>() .Setup(f => f.CreateFactory()) .Returns(new Mock <IProxyHttpClientFactory>().Object); // Set up clusters. We are going to fake multiple service for us to probe. _clusterManager = Provide <IClusterManager, ClusterManager>(); _clusterConfig = new ClusterConfig( healthCheckOptions: new ClusterConfig.ClusterHealthCheckOptions( enabled: true, interval: TimeSpan.FromSeconds(1), timeout: TimeSpan.FromSeconds(1), port: 8000, path: "/example"), loadBalancingOptions: default,
public Task Configure(int id, List <int> serverIds, int clusterId) { if (this.Servers.Count == 0) { this.ServerId = id; Console.WriteLine($"<RaftLog> Server {id} is configuring."); foreach (var idx in serverIds) { this.Servers.Add(idx, this.GrainFactory.GetGrain <IServer>(idx)); } this.ClusterManager = this.GrainFactory.GetGrain <IClusterManager>(clusterId); this.BecomeFollower(); } return(TaskDone.Done); }
public HostManager(IAwsCredential awsCredential, PlatformDb db, IEventLogger eventLog) { Validate.NotNull(awsCredential, nameof(awsCredential)); this.db = db ?? throw new ArgumentNullException(nameof(db)); this.eventLog = eventLog ?? throw new ArgumentNullException(nameof(eventLog)); var region = AwsRegion.USEast1; // TODO: Configurable ec2 = new Ec2Client(region, awsCredential); ssm = new SsmClient(region, awsCredential); var elb = new ElbClient(region, awsCredential); this.clusterService = new ClusterService(db); this.clusterManager = new ClusterManager(clusterService, elb, eventLog); this.hostService = new HostService(db); this.imageService = new ImageService(db); this.hostTemplateService = new HostTemplateService(db); }
public override async Task OnActivateAsync() { if (this.Servers == null) { this.NumberOfServers = 5; this.Leader = null; this.LeaderTerm = 0; this.Cluster = this.GrainFactory.GetGrain <IClusterManager>(0); this.Servers = new Dictionary <int, IServer>(); for (int idx = 1; idx <= this.NumberOfServers; idx++) { Console.WriteLine($"<RaftLog> ClusterManager is creating server {idx}."); this.Servers.Add(idx, this.GrainFactory.GetGrain <IServer>(idx)); } this.Client = this.GrainFactory.GetGrain <IClient>(6); } await base.OnActivateAsync(); }
public override Task OnActivateAsync() { if (this.Servers == null) { this.NumberOfServers = 5; this.Leader = null; this.LeaderTerm = 0; this.Cluster = this.GrainFactory.GetGrain <IClusterManager>(0); this.Client = this.GrainFactory.GetGrain <IClient>(1); this.Servers = new Dictionary <int, IServer>(); for (int idx = 0; idx < this.NumberOfServers; idx++) { ActorModel.Log($"<RaftLog> ClusterManager is creating server {idx + 2}."); this.Servers.Add(idx + 2, this.GrainFactory.GetGrain <IServer>(idx + 2)); } } return(base.OnActivateAsync()); }
protected ConnectionProviderBase(IClusterManager clusterManager, IConnectionBuilder connectionBuilder, ConnectionProviderType providerType) { ClusterManager = clusterManager; ConnectionBuilder = connectionBuilder; Type = providerType; }
public void SetUp() { _clientConfig = new ClientConfiguration(); _clusterManager = new ClusterManager(_clientConfig); }
public StatusController(IClusterManager clusterManager) { this.clusterManager = clusterManager; }
public PooledKeyedConnectionProvider(IClusterManager clusterManager, IConnectionBuilder connectionBuilder) : base(clusterManager, connectionBuilder) { }
public ClusterProvisioner(Cluster cluster, string password, string username) { _cluster = cluster; _clusterManager = _cluster.CreateManager(password, username); }
/// <summary> /// Ctor for creating Cluster instance. /// </summary> /// <param name="configuration">The ClientCOnfiguration to use for initialization.</param> /// <param name="clusterManager">The ClusterManager instance use.</param> /// <remarks> /// This overload is primarly added for testing. /// </remarks> internal CouchbaseCluster(ClientConfiguration configuration, IClusterManager clusterManager) { _configuration = configuration; _clusterManager = clusterManager; }
public void OneTimeSetUp() { _cluster = new Cluster(Utils.TestConfiguration.GetConfiguration("basic")); _clusterManager = _cluster.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); }
private async Task InitAsync() { // Initialize a clean Couchbase bucket. cluster = new Cluster(); clusterManager = cluster.CreateManager(CouchbaseUID, CouchbasePWD); if (clusterManager.ListBuckets().Value.Count(b => b.Name == BucketName) > 0) { clusterManager.RemoveBucket(BucketName); } if (!clusterManager.CreateBucket(BucketName, 100).Success) { Assert.True(false, $"Could not create the [{BucketName}] Couchbase bucket."); } Bucket = cluster.OpenBucket(BucketName); // Crank up the sync gateway. syncGatewayProcess = Process.Start(SyncGatewayPath, $"-bucket \"{BucketName}\" -dbname \"{DatabaseName}\""); if (syncGatewayProcess.WaitForExit(2000)) { Assert.True(false, $"Could not start a Couchbase Sync Gateway. Verify that the service is not already running."); } // Initialize the sync gateway database. gateway = new Gateway( new GatewaySettings() { Host = "localhost" }); gatewayManager = gateway.CreateManager(); var databasesDeleted = false; foreach (var database in await gatewayManager.DatabaseListAsync()) { if (database == DatabaseName) { await gatewayManager.DatabaseRemoveAsync(database); databasesDeleted = true; } } if (databasesDeleted) { // Looks like the sync gateway needs some time to stablize // after deleting databases. await Task.Delay(TimeSpan.FromSeconds(5)); } await gatewayManager.DatabaseCreateAsync( new DatabaseConfiguration() { Name = DatabaseName, Bucket = BucketName, Server = "http://127.0.0.1:8091", Sync = "function (doc, oldDoc) { channel(doc.channels); }" }); }
/// <summary> /// Ctor for creating Cluster instance. /// </summary> /// <param name="configuration">The ClientCOnfiguration to use for initialization.</param> /// <param name="clusterManager">The ClusterManager instance use.</param> /// <remarks> /// This overload is primarly added for testing. /// </remarks> internal ClusterHelper(ClientConfiguration configuration, IClusterManager clusterManager) { _configuration = configuration; _clusterManager = clusterManager; }
/// <summary> /// Initializes a new Cluster instance with a given ClientConfiguration and ClusterManager. /// This overload is primarily provided for testing given that it allows you to set the /// major dependencies of the Cluster class and it's scope is internal. /// </summary> /// <param name="configuration"></param> /// <param name="clusterManager"></param> internal static void Initialize(ClientConfiguration configuration, IClusterManager clusterManager) { if (configuration == null || clusterManager == null) { throw new ArgumentNullException(configuration == null ? "configuration" : "clusterManager"); } configuration.Initialize(); var factory = new Func<CouchbaseCluster>(() => new CouchbaseCluster(configuration, clusterManager)); Initialize(factory); }
public ResourcesController(IClusterManager clusterManager) { this.clusterManager = clusterManager; }
public HealthProbeWorker(ILogger <HealthProbeWorker> logger, IClusterManager clusterManager, IClusterProberFactory clusterProberFactory) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _clusterManager = clusterManager ?? throw new ArgumentNullException(nameof(clusterManager)); _clusterProberFactory = clusterProberFactory ?? throw new ArgumentNullException(nameof(clusterProberFactory)); }
public void OneTimeSetUp() { _cluster = new Cluster(Utils.TestConfiguration.GetConfiguration("basic")); _clusterManager = _cluster.CreateManager(ConfigurationManager.AppSettings["adminusername"], ConfigurationManager.AppSettings["adminpassword"]); }