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


Java ClusterManager.insertBucket方法代码示例

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


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

示例1: testSimple

import com.couchbase.client.java.cluster.ClusterManager; //导入方法依赖的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);
}
 
开发者ID:ldoguin,项目名称:couchbase-test-docker,代码行数:17,代码来源:CouchbaseDriverTest.java

示例2: init

import com.couchbase.client.java.cluster.ClusterManager; //导入方法依赖的package包/类
@PostConstruct
public void init() throws Exception {
    couchbaseContainer = AbstractSpringBootTestConfig.couchbaseContainer;
    BucketSettings settings = DefaultBucketSettings.builder()
            .enableFlush(true).name("default").quota(100).replicas(0).type(BucketType.COUCHBASE).build();
    ClusterManager clusterManager = couchbaseContainer.geCouchbaseCluster().clusterManager(AbstractSpringBootTestConfig.clusterUser, AbstractSpringBootTestConfig.clusterPassword);
    if (!clusterManager.hasBucket("default")){
        settings =  clusterManager.insertBucket(settings);
        waitForContainer();
    }

}
 
开发者ID:ldoguin,项目名称:testcontainers-spring-boot-couchbase,代码行数:13,代码来源:CouchbaseConfiguration.java

示例3: eval

import com.couchbase.client.java.cluster.ClusterManager; //导入方法依赖的package包/类
@Override
public Sequence eval(final Sequence[] args, final Sequence contextSequence) throws XPathException {

    // Get connection details
    final String clusterId = args[0].itemAt(0).getStringValue();
    CouchbaseClusterManager.getInstance().validate(clusterId);

    // Get additional parameters
    final String bucketName = (args[1].isEmpty()) ? Constants.DEFAULT_BUCKET : args[1].itemAt(0).getStringValue();
    final String username = args[2].itemAt(0).getStringValue();
    final String password = args[3].itemAt(0).getStringValue();
    final Map<String, Object> parameters = (args[4].isEmpty())
            ? new HashMap<>()
            : ConversionTools.convert((AbstractMapType) args[4].itemAt(0));

    try {
        // Get reference to cluster manager
        final ClusterManager clusterManager = CouchbaseClusterManager.getInstance().get(clusterId).clusterManager(username, password);

        // Get configuaration
        final BucketSettings bucketSettings = parseParameters(bucketName, parameters);

        // Execute
        final BucketSettings insertBucket = clusterManager.insertBucket(bucketSettings);

        // Return results
        return new StringValue(insertBucket.toString());


    } catch (final Throwable ex) {
        return GenericExceptionHandler.handleException(this, ex);
    }
}
 
开发者ID:weXsol,项目名称:Couchbase,代码行数:34,代码来源:InsertBucket.java

示例4: init

import com.couchbase.client.java.cluster.ClusterManager; //导入方法依赖的package包/类
@BeforeClass
public static void init() {
    //here is where you'd get the environment
    cachingProvider = new CouchbaseCachingProvider();
    //here is where we get the cluster
    cacheManager = (CouchbaseCacheManager) cachingProvider.getCacheManager();

    ClusterManager manager = cacheManager.cluster.clusterManager(CLUSTER_LOGIN, CLUSTER_PWD);
    boolean hasBucket = manager.hasBucket(CACHE_NAME);
    if (!hasBucket) {
        manager.insertBucket(DefaultBucketSettings.builder()
                                                  .name(CACHE_NAME)
                                                  .enableFlush(true)
                                                  .quota(100)
                                                  .build());
    }

    //here we create a dedicated cache for most of the tests
    CouchbaseConfiguration<String, String> cbConfig = new CouchbaseConfiguration.Builder<String, String>(
            CACHE_NAME, KeyConverter.STRING_KEY_CONVERTER)
            .useDedicatedBucket(CACHE_NAME, "")
            .build();
    dedicatedCache = (CouchbaseCache<String, String>) cacheManager.createCache(CACHE_NAME, cbConfig);
    keyConverter = dedicatedCache.keyConverter();

    //prepare data
    if (hasBucket) {
        dedicatedCache.bucket.bucketManager().flush();
    }
    dedicatedCache.bucket.insert(SerializableDocument.create(keyConverter.asString(TEST_KEY), TEST_VALUE));
    dedicatedCache.bucket.insert(SerializableDocument.create(keyConverter.asString(TEST_KEY) + "2", TEST_VALUE + "2"));
    dedicatedCache.bucket.insert(SerializableDocument.create(keyConverter.asString("remove"), TEST_VALUE));
    dedicatedCache.bucket.insert(SerializableDocument.create(keyConverter.asString("oldremove"), TEST_VALUE));
    dedicatedCache.bucket.insert(SerializableDocument.create(keyConverter.asString("getremove"), TEST_VALUE));
    dedicatedCache.bucket.insert(SerializableDocument.create(keyConverter.asString("itremove"), TEST_VALUE));
    dedicatedCache.bucket.insert(SerializableDocument.create(keyConverter.asString("replace"), TEST_VALUE));
    dedicatedCache.bucket.insert(SerializableDocument.create(keyConverter.asString("oldreplace"), TEST_VALUE));
    dedicatedCache.bucket.insert(SerializableDocument.create(keyConverter.asString("getreplace"), TEST_VALUE));

    //TODO prepare view
}
 
开发者ID:couchbaselabs,项目名称:couchbase-java-cache,代码行数:42,代码来源:BasicOperationTest.java


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