本文整理汇总了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"));
}
示例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;
}
}
}
}
示例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);
}
示例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);
}
}
}
}
示例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());
}
示例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));
}
示例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();
}