当前位置: 首页>>代码示例>>C#>>正文


C# Cluster.CloseBucket方法代码示例

本文整理汇总了C#中Cluster.CloseBucket方法的典型用法代码示例。如果您正苦于以下问题:C# Cluster.CloseBucket方法的具体用法?C# Cluster.CloseBucket怎么用?C# Cluster.CloseBucket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cluster的用法示例。


在下文中一共展示了Cluster.CloseBucket方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: When_Bucket_Is_Not_Open_IsOpen_Returns_False

 public void When_Bucket_Is_Not_Open_IsOpen_Returns_False()
 {
     var cluster = new Cluster("couchbaseClients/couchbase");
     var bucket = cluster.OpenBucket("default");
     cluster.CloseBucket(bucket);
     Assert.IsFalse(cluster.IsOpen("default"));
 }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:7,代码来源:ClusterTests.cs

示例2: When_InValid_Credentials_Provided_Bucket_Created_UnSuccesfully

        public void When_InValid_Credentials_Provided_Bucket_Created_UnSuccesfully()
        {
            try
            {
                var config = ClientConfigUtil.GetConfiguration();
                config.BucketConfigs = new Dictionary<string, BucketConfiguration>
                {
                    {
                        "authenticated",
                        new BucketConfiguration
                        {
                            BucketName = "authenticated"
                        }
                    }
                };

                var cluster = new Cluster(config);
                var bucket = cluster.OpenBucket("authenticated", "secretw");
                cluster.CloseBucket(bucket);
                Assert.IsNotNull(bucket);
            }
            catch (AggregateException e)
            {
                foreach (var exception in e.InnerExceptions)
                {
                    if (exception.GetType() == typeof (AuthenticationException))
                    {
                        throw exception;
                    }
                }
            }
        }
开发者ID:orangeloop,项目名称:couchbase-net-client,代码行数:32,代码来源:BucketAuthenticationTests.cs

示例3: When_Valid_Credentials_Provided_Bucket_Created_Succesfully

        public void When_Valid_Credentials_Provided_Bucket_Created_Succesfully()
        {
            var config = ClientConfigUtil.GetConfiguration();
            config.BucketConfigs = new Dictionary<string, BucketConfiguration>
                {
                    {
                        "authenticated",
                        new BucketConfiguration
                        {
                            BucketName = "authenticated"
                        }
                    }
                };

            var cluster = new Cluster(config);
            var bucket = cluster.OpenBucket("authenticated", "secret");
            cluster.CloseBucket(bucket);
            Assert.IsNotNull(bucket);
            cluster.CloseBucket(bucket);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:20,代码来源:BucketAuthenticationTests.cs

示例4: Main

        static void Main(string[] args)
        {
            //Note: change the IP's below to your own cluster's IP's to run
            var config = new ClientConfiguration
            {
                Servers = new List<Uri>
                {
                    new Uri("http://192.168.56.101:8091/pools"),
                    new Uri("http://192.168.56.102:8091/pools"),
                    new Uri("http://192.168.56.103:8091/pools"),
                    new Uri("http://192.168.56.104:8091/pools"),
                },
                UseSsl = false,
                BucketConfigs = new Dictionary<string, BucketConfiguration>
                {
                    {"default", new BucketConfiguration
                    {
                        BucketName = "default",
                        UseSsl = true,
                        Password = "",
                        PoolConfiguration = new PoolConfiguration
                        {
                            MaxSize = 10,
                            MinSize = 5
                        }
                    }}
                }
            };

            using (var cluster = new Cluster(config))
            {
                IBucket bucket = null;
                try
                {
                    bucket = cluster.OpenBucket();
                    //use the bucket here
                }
                finally
                {
                    if (bucket != null)
                    {
                        cluster.CloseBucket(bucket);
                    }
                }
            }
        }
开发者ID:vinaas,项目名称:couchbase-net-examples,代码行数:46,代码来源:Program.cs

示例5: When_InValid_Credentials_Provided_Bucket_Created_UnSuccesfully

        public void When_InValid_Credentials_Provided_Bucket_Created_UnSuccesfully()
        {
            var ex = Assert.Throws<AggregateException>(() => {
                var config = ClientConfigUtil.GetConfiguration();
                config.BucketConfigs = new Dictionary<string, BucketConfiguration>
                {
                    {
                        "authenticated",
                        new BucketConfiguration
                        {
                            BucketName = "authenticated"
                        }
                    }
                };

                var cluster = new Cluster(config);
                var bucket = cluster.OpenBucket("authenticated", "secretw");
                cluster.CloseBucket(bucket);
                Assert.IsNotNull(bucket);
            });

            Assert.True(ex.InnerExceptions.OfType<AuthenticationException>().Any());
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:23,代码来源:BucketAuthenticationTests.cs

示例6: When_HttpConfigProvider_Used_ClusterInfo_Accessible

        public void When_HttpConfigProvider_Used_ClusterInfo_Accessible()
        {
            var clusterManager = new ClusterController(_clientConfig);
            //force use of StreamingHttpProvider by removing other providers
            clusterManager.ConfigProviders.Remove(
                clusterManager.ConfigProviders.Find(provider => !(provider is HttpStreamingProvider)));
            var cluster = new Cluster(_clientConfig, clusterManager);
            var bucket = cluster.OpenBucket("default", "");
            var info = cluster.Info;
            cluster.CloseBucket(bucket);
            cluster.Dispose();

            Assert.NotNull(info);
            Assert.NotNull(info.Pools());
            Assert.NotNull(info.BucketConfigs());
            Assert.Greater(info.BucketConfigs().Count, 0);
            Assert.NotNull(info.BucketConfigs().ElementAt(0));
        }
开发者ID:orangeloop,项目名称:couchbase-net-client,代码行数:18,代码来源:ClusterControllerTests.cs

示例7: When_Disposing_StreamingProvider_Worker_Thread_Does_Not_Hang_With_Bucket_Open_And_Closed

        public void When_Disposing_StreamingProvider_Worker_Thread_Does_Not_Hang_With_Bucket_Open_And_Closed()
        {
            //remove CCCP provider because we want to bootstrap off of the StreamingProvider
            var cccp = _clusterManager.ConfigProviders.Find(x => x is CarrierPublicationProvider);
            _clusterManager.ConfigProviders.Remove(cccp);

            var cluster = new Cluster(_clientConfig, _clusterManager);

            var bucket = cluster.OpenBucket();
            cluster.CloseBucket(bucket);
            cluster.Dispose();
        }
开发者ID:orangeloop,项目名称:couchbase-net-client,代码行数:12,代码来源:ClusterControllerTests.cs


注:本文中的Cluster.CloseBucket方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。