當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。