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


Java JsonLongDocument类代码示例

本文整理汇总了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());
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:60,代码来源:CouchbaseTest.java


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