本文整理匯總了Java中com.couchbase.client.java.document.JsonLongDocument類的典型用法代碼示例。如果您正苦於以下問題:Java JsonLongDocument類的具體用法?Java JsonLongDocument怎麽用?Java JsonLongDocument使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JsonLongDocument類屬於com.couchbase.client.java.document包,在下文中一共展示了JsonLongDocument類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: bootIdGen
import com.couchbase.client.java.document.JsonLongDocument; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void bootIdGen() throws Exception {
String bucket = "beers";
Object bean = new Object();
new MockUnit(Env.class, Config.class, Binder.class)
.expect(noenvprops)
.expect(serviceKey(new Env.ServiceKey()))
.expect(createEnv)
.expect(setProperty(bucket))
.expect(cluster("couchbase://localhost"))
.expect(bind(bucket, CouchbaseCluster.class))
.expect(bind(null, CouchbaseCluster.class))
.expect(noClusterManager)
// buckets
.expect(bucketPassword(bucket, null))
.expect(openBucket(bucket, null))
.expect(bind(bucket, Bucket.class))
.expect(bind(null, Bucket.class))
.expect(bind(bucket, AsyncBucket.class))
.expect(bind(null, AsyncBucket.class))
// repository
.expect(repository(bucket))
.expect(bind(bucket, Repository.class))
.expect(bind(null, Repository.class))
.expect(bind(bucket, AsyncRepository.class))
.expect(bind(null, AsyncRepository.class))
// converter hack
.expect(converterHack)
// datastore
.expect(asyncds())
.expect(bind(bucket, AsyncDatastore.class))
.expect(bind(null, AsyncDatastore.class))
.expect(ds())
.expect(bind(bucket, Datastore.class))
.expect(bind(null, Datastore.class))
// session
.expect(openBucket(bucket, null, false))
.expect(bucketPassword(bucket, null))
.expect(bind("session", Bucket.class))
// onStop
.expect(onStop)
.expect(unit -> {
unit.mockStatic(IdGenerator.class);
expect(IdGenerator.getOrGenId(eq(bean), unit.capture(Supplier.class))).andReturn(13L);
Bucket b = unit.first(Bucket.class);
JsonLongDocument json = JsonLongDocument.create("1", 2L);
expect(b.counter(bean.getClass().getName(), 1, 1)).andReturn(json);
})
.run(unit -> {
new Couchbase("couchbase://localhost/" + bucket)
.configure(unit.get(Env.class), unit.get(Config.class), unit.get(Binder.class));
}, unit -> {
assertEquals(13L, unit.captured(Function.class).iterator().next().apply(bean));
assertEquals(2L, unit.captured(Supplier.class).iterator().next().get());
});
}