本文整理汇总了Java中com.couchbase.client.java.CouchbaseCluster.clusterManager方法的典型用法代码示例。如果您正苦于以下问题:Java CouchbaseCluster.clusterManager方法的具体用法?Java CouchbaseCluster.clusterManager怎么用?Java CouchbaseCluster.clusterManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.couchbase.client.java.CouchbaseCluster
的用法示例。
在下文中一共展示了CouchbaseCluster.clusterManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSimple
import com.couchbase.client.java.CouchbaseCluster; //导入方法依赖的package包/类
@Test
public void testSimple() throws Exception {
CouchbaseCluster cc = couchbase.geCouchbaseCluster();
ClusterManager cm = cc.clusterManager("Administrator","password");
List<BucketSettings> buckets = cm.getBuckets();
Assert.assertNotNull(buckets);
Assert.assertTrue(buckets.size() == 3);
BucketSettings settings = DefaultBucketSettings.builder()
.enableFlush(true).name("default").quota(100).replicas(0).type(BucketType.COUCHBASE).build();
settings = cm.insertBucket(settings);
CouchbaseWaitStrategy s = new CouchbaseWaitStrategy();
s.withBasicCredentials("Administrator", "password");
s.waitUntilReady(couchbase);
Bucket bucket = cc.openBucket("default");
Assert.assertNotNull(bucket);
}
示例2: beerBucketTest
import com.couchbase.client.java.CouchbaseCluster; //导入方法依赖的package包/类
@Test
public void beerBucketTest() throws InterruptedException {
CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
.bootstrapCarrierDirectPort(couchbase.getMappedPort(11210))
.bootstrapCarrierSslPort(couchbase.getMappedPort(11207))
.bootstrapHttpDirectPort(couchbase.getMappedPort(8091))
.bootstrapHttpSslPort(couchbase.getMappedPort(18091))
.build();
CouchbaseCluster cc = CouchbaseCluster.create(env);
ClusterManager cm = cc.clusterManager("Administrator", "password");
assertTrue(cm.hasBucket("beer-sample"));
Bucket bucket = cc.openBucket("beer-sample");
assertTrue(bucket.exists("21st_amendment_brewery_cafe"));
bucket.close();
}
示例3: initBuckets
import com.couchbase.client.java.CouchbaseCluster; //导入方法依赖的package包/类
private void initBuckets(Config config, CouchbaseCluster cluster) {
ClusterManager manager = cluster.clusterManager(config.getAdminUsername(), config.getAdminPassword());
config.getBucketsSettings().forEach(bucket -> {
if (!manager.hasBucket(bucket.name())) {
manager.insertBucket(bucket);
} else {
manager.updateBucket(bucket);
}
});
}