예제 #1
0
 private void testListNoKeys(String bucketType) throws InterruptedException, ExecutionException {
   Namespace ns = new Namespace(bucketType, bucketName.toString() + "_1");
   ListKeysOperation klistOp = new ListKeysOperation.Builder(ns).build();
   cluster.execute(klistOp);
   List<BinaryValue> kList = klistOp.get().getKeys();
   assertTrue(kList.isEmpty());
   resetAndEmptyBucket(ns);
 }
예제 #2
0
  private void testListKey(String bucketType) throws InterruptedException, ExecutionException {
    final Namespace ns = new Namespace(bucketType, bucketName.toString() + "_2");
    final BinaryValue key = BinaryValue.unsafeCreate("my_key".getBytes());
    final String value = "{\"value\":\"value\"}";

    RiakObject rObj = new RiakObject().setValue(BinaryValue.create(value));
    Location location = new Location(ns, key);
    StoreOperation storeOp = new StoreOperation.Builder(location).withContent(rObj).build();

    cluster.execute(storeOp);
    storeOp.get();

    ListKeysOperation klistOp = new ListKeysOperation.Builder(ns).build();
    cluster.execute(klistOp);
    List<BinaryValue> kList = klistOp.get().getKeys();

    assertEquals(kList.size(), 1);
    assertEquals(kList.get(0), key);
    resetAndEmptyBucket(ns);
  }