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