Java Code Examples for com.couchbase.mock.CouchbaseMock#createBucket()
The following examples show how to use
com.couchbase.mock.CouchbaseMock#createBucket() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CouchbaseClientTest.java From java-specialagent with Apache License 2.0 | 5 votes |
@BeforeClass public static void startCouchbaseMock() throws Exception { couchbaseMock = new CouchbaseMock("localhost", 8091, 2, 1); final BucketConfiguration bucketConfiguration = new BucketConfiguration(); bucketConfiguration.name = bucketName; bucketConfiguration.numNodes = 1; bucketConfiguration.numReplicas = 1; bucketConfiguration.password = ""; couchbaseMock.start(); couchbaseMock.waitForStartup(); couchbaseMock.createBucket(bucketConfiguration); }
Example 2
Source File: CouchbaseClientITest.java From java-specialagent with Apache License 2.0 | 5 votes |
public static void main(final String[] args) throws BucketAlreadyExistsException, InterruptedException, IOException { final CouchbaseMock couchbaseMock = new CouchbaseMock("localhost", 8091, 2, 1); final BucketConfiguration bucketConfiguration = new BucketConfiguration(); bucketConfiguration.name = bucketName; bucketConfiguration.numNodes = 1; bucketConfiguration.numReplicas = 1; bucketConfiguration.password = ""; couchbaseMock.start(); couchbaseMock.waitForStartup(); couchbaseMock.createBucket(bucketConfiguration); final Cluster cluster = CouchbaseCluster.create(DefaultCouchbaseEnvironment.builder().connectTimeout(TimeUnit.SECONDS.toMillis(60)).build()); final Bucket bucket = cluster.openBucket(bucketName); final JsonObject arthur = JsonObject .create().put("name", "Arthur") .put("email", "[email protected]") .put("interests", JsonArray.from("Holy Grail", "African Swallows")); bucket.upsert(JsonDocument.create("u:king_arthur", arthur)); System.out.println(bucket.get("u:king_arthur")); cluster.disconnect(60, TimeUnit.SECONDS); couchbaseMock.stop(); TestUtil.checkSpan(new ComponentSpanCount("couchbase-java-client.*", 2)); }