Package com.basho.riak.client.query

Examples of com.basho.riak.client.query.RiakObject


  @Test
  public void testStoreFetchDelete() throws ExecutionException, InterruptedException
  {

    RiakObject o = RiakObject.create(bucket.unsafeGetValue()).setValue("test value");
    StoreMeta storeMeta = new StoreMeta.Builder().returnBody(true).build();

    StoreOperation<RiakObject> store =
      new StoreOperation<RiakObject>(bucket, o)
        .withConverter(domainObjectConverter)
        .withStoreMeta(storeMeta);

    cluster.execute(store);

    RiakObject storeReturn = store.get();

    BinaryValue returnedKey = BinaryValue.create(storeReturn.getBucketAsBytes());
    FetchOperation<RiakObject> fetch =
      new FetchOperation<RiakObject>(bucket, returnedKey)
      .withConverter(domainObjectConverter);

    cluster.execute(fetch);

    RiakObject fetchReturn = fetch.get();

    DeleteOperation delete = new DeleteOperation(bucket, returnedKey);

    cluster.execute(delete);

    delete.get();

    FetchOperation<RiakObject> tombstoneFetch =
      new FetchOperation<RiakObject>(bucket, returnedKey)
      .withConverter(domainObjectConverter);

    cluster.execute(tombstoneFetch);

    RiakObject tombstone = tombstoneFetch.get();

    Assert.assertTrue(tombstone.isNotFound());

  }
View Full Code Here


  @Test
  public void testSiblings() throws ExecutionException, InterruptedException
  {

    RiakObject o = RiakObject.create(bucket.unsafeGetValue()).setValue("test value");
    StoreMeta storeMeta = new StoreMeta.Builder().returnBody(true).build();

    StoreOperation<RiakObject> store1 =
      new StoreOperation<RiakObject>(bucket, o)
        .withConverter(domainObjectConverter)
        .withStoreMeta(storeMeta);

    cluster.execute(store1);

    RiakObject storeReturn1 = store1.get();

    BinaryValue key = BinaryValue.create(storeReturn1.getKeyAsBytes());
    StoreOperation<RiakObject> store2 =
      new StoreOperation<RiakObject>(bucket, key, o)
        .withConverter(domainObjectConverter)
        .withStoreMeta(storeMeta);

    cluster.execute(store2);

    RiakObject storeReturn2 = store2.get();


  }
View Full Code Here

TOP

Related Classes of com.basho.riak.client.query.RiakObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.