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); }
public static IBucket CreateBucket( ICluster cluster, string bucketName, string username, string password) { var clusterManager = cluster.CreateManager(username, password); var buckets = clusterManager.ListBuckets(); if (!buckets.Success) { throw new Exception(buckets.Message, buckets.Exception); } if (!buckets.Value.Any(b => b.Name.Equals( bucketName, StringComparison.InvariantCultureIgnoreCase))) { var createBucketResult = clusterManager.CreateBucket(bucketName); if (!createBucketResult.Success) { throw new Exception( createBucketResult.Message, createBucketResult.Exception); } } return(cluster.OpenBucket(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); }
public ClusterManagerFactory([NotNull] ICluster cluster, [NotNull] string username, [NotNull] string password) { Guard.AgainstNull(nameof(cluster), cluster); Guard.AgainstNullAndEmpty(nameof(username), username); Guard.AgainstNullAndEmpty(nameof(password), password); _initializer = new Lazy <IClusterManager>(() => cluster.CreateManager(username, password), LazyThreadSafetyMode.ExecutionAndPublication); }
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 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 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 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"); }
private void IgnoreIfNoReplicas() { var clusterManager = _cluster.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); var clusterInfo = clusterManager.ClusterInfo(); if (!clusterInfo.Success) { return; } var bucketConfig = clusterInfo.Value.BucketConfigs().FirstOrDefault(p => p.Name == _bucket.Name); if (bucketConfig != null && bucketConfig.ReplicaNumber <= 0) { Assert.Ignore("Bucket doesn't support replicas"); } }
public ClusterService(ICluster cluster, IAuthenticator authenticator) { cluster.Authenticate(authenticator); _clusterManager = cluster.CreateManager(); }
public void OneTimeSetUp() { _cluster = new Cluster(Utils.TestConfiguration.GetConfiguration("basic")); _clusterManager = _cluster.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); }
public ClusterProvisioner(Cluster cluster, string password, string username) { _cluster = cluster; _clusterManager = _cluster.CreateManager(password, username); }
public void OneTimeSetUp() { _cluster = new Cluster(Utils.TestConfiguration.GetConfiguration("basic")); _clusterManager = _cluster.CreateManager(ConfigurationManager.AppSettings["adminusername"], ConfigurationManager.AppSettings["adminpassword"]); }
public ClusterProvisioner(Cluster cluster, string password, string username) { _cluster = cluster; _clusterManager = _cluster.CreateManager(password, username); }
public void OneTimeSetUp() { _cluster = new Cluster(Utils.TestConfiguration.GetConfiguration("basic")); _clusterManager = _cluster.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword); }