Examples of RiakObject


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

    }
   
    private void testSimpleStore(String bucketType) throws InterruptedException, ExecutionException
    {
       
        RiakObject obj = new RiakObject().setValue(BinaryValue.create(value));
        Namespace ns = new Namespace(bucketType, bucketName.toString());
        Location location = new Location(ns, key);
        StoreOperation storeOp =
            new StoreOperation.Builder(location)
                .withContent(obj)
                .build();
       
        cluster.execute(storeOp);
        storeOp.get();
       
        FetchOperation fetchOp =
                new FetchOperation.Builder(location).build();
               
        cluster.execute(fetchOp);
        RiakObject obj2 = fetchOp.get().getObjectList().get(0);
       
        assertEquals(obj.getValue(), obj2.getValue());
              
    }
View Full Code Here

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

    when(mockFuture.get(anyLong(), any(TimeUnit.class))).thenReturn(mockResponse);
    when(mockFuture.isCancelled()).thenReturn(false);
    when(mockFuture.isDone()).thenReturn(true);
    when(mockCluster.execute(any(FutureOperation.class))).thenReturn(mockFuture);
    client = new RiakClient(mockCluster);
    riakObject = new RiakObject();
        riakObject.setVClock(vClock);
    riakObject.setValue(BinaryValue.create(new byte[]{'O', '_', 'o'}));
  }
View Full Code Here

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

                .withAllowMulti(true)
                .build();
        cluster.execute(op);
        op.get();
       
        RiakObject obj = new RiakObject().setValue(BinaryValue.create(value));
        Location location = new Location(ns, key);
      
        StoreOperation storeOp =
            new StoreOperation.Builder(location)
                .withContent(obj)
                .withReturnBody(true)
                .build();
       
        cluster.execute(storeOp);
        StoreOperation.Response response = storeOp.get();
        obj = response.getObjectList().get(0);
       
        assertNotNull(obj.getVClock());
       
        obj.setValue(BinaryValue.create("changed"));

        storeOp = new StoreOperation.Builder(location)
                .withContent(obj)
                .withReturnBody(true)
                .build();
       
        cluster.execute(storeOp);
        response = storeOp.get();
        obj = response.getObjectList().get(0);
       
        assertEquals(obj.getValue().toString(), "changed");
       
        resetAndEmptyBucket(ns);
    }
View Full Code Here

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

  @SuppressWarnings("unchecked")
  public void init() throws Exception
  {
    MockitoAnnotations.initMocks(this);

    riakObject = new RiakObject();
    riakObject.setValue(BinaryValue.create(new byte[]{'O', '_', 'o'}));

    ArrayList<RiakObject> objects = new ArrayList<RiakObject>();
    objects.add(riakObject);
View Full Code Here

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

    {
        // Empty buckets do not show up
        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(new Namespace(bucketType, bucketName.toString()), key);
        StoreOperation storeOp =
            new StoreOperation.Builder(location)
                .withContent(rObj)
                .build();
View Full Code Here

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

            };
       
        for (int i = 0; i < 1000; i++)
        {
            Namespace ns = new Namespace(bucketType, bucketName.toString() + i);
            RiakObject rObj = new RiakObject().setValue(BinaryValue.create(value));
            Location location = new Location(ns, key);
            StoreOperation storeOp =
                new StoreOperation.Builder(location)
                    .withContent(rObj)
                    .build();
View Full Code Here

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

       
        PojoWithRiakFields pojo = new PojoWithRiakFields();
        JSONConverter<PojoWithRiakFields> jc =
            new JSONConverter<PojoWithRiakFields>(new TypeReference<PojoWithRiakFields>(){});
       
        RiakObject o = jc.fromDomain(pojo, null, null).getRiakObject();
       
        String json = o.getValue().toString();
        assertFalse(fieldExistsInJson(json,"key"));
        assertFalse(fieldExistsInJson(json,"bucketName"));
        assertFalse(fieldExistsInJson(json,"bucketType"));
        assertFalse(fieldExistsInJson(json,"metadata"));
        assertFalse(fieldExistsInJson(json,"index"));
View Full Code Here

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

    {
       
        PojoWithRiakFieldsIncluded pojo = new PojoWithRiakFieldsIncluded();
        JSONConverter<PojoWithRiakFieldsIncluded> jc =
            new JSONConverter<PojoWithRiakFieldsIncluded>(new TypeReference<PojoWithRiakFieldsIncluded>(){});
        RiakObject o = jc.fromDomain(pojo, null, null).getRiakObject();
       
        String json = o.getValue().toString();
        assertTrue(fieldExistsInJson(json,"key"));
        assertTrue(fieldExistsInJson(json,"bucketName"));
        assertTrue(fieldExistsInJson(json,"bucketType"));
        assertTrue(fieldExistsInJson(json,"metadata"));
        assertTrue(fieldExistsInJson(json,"index"));
View Full Code Here

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

    {
        PojoWithRiakMethodsExcluded pojo = new PojoWithRiakMethodsExcluded();
        JSONConverter<PojoWithRiakMethods> jc =
            new JSONConverter<PojoWithRiakMethods>(new TypeReference<PojoWithRiakMethods>(){});
       
        RiakObject o = jc.fromDomain(pojo, null, null).getRiakObject();
       
        String json = o.getValue().toString();
        assertFalse(fieldExistsInJson(json,"key"));
        assertFalse(fieldExistsInJson(json,"bucketName"));
        assertFalse(fieldExistsInJson(json,"bucketType"));
        assertFalse(fieldExistsInJson(json,"usermeta"));
        assertFalse(fieldExistsInJson(json,"index"));
View Full Code Here

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

    {
        PojoWithRiakMethodsIncluded pojo = new PojoWithRiakMethodsIncluded();
        JSONConverter<PojoWithRiakMethodsIncluded> jc =
            new JSONConverter<PojoWithRiakMethodsIncluded>(new TypeReference<PojoWithRiakMethodsIncluded>(){});
       
        RiakObject o = jc.fromDomain(pojo, null, null).getRiakObject();
       
        String json = o.getValue().toString();
        assertTrue(fieldExistsInJson(json,"key"));
        assertTrue(fieldExistsInJson(json,"bucketName"));
        assertTrue(fieldExistsInJson(json,"bucketType"));
        assertTrue(fieldExistsInJson(json,"usermeta"));
        assertTrue(fieldExistsInJson(json,"index"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.