Examples of RiakObject


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

        assertEquals("Little bunny foo foo.", f.fooValue);
       
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new RiakJacksonModule());
        String json = mapper.writeValueAsString(f);
        RiakObject ro = uvResp.getValue(RiakObject.class);
        assertEquals(json, ro.getValue().toString());
       
    }
View Full Code Here

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

       
        f = uvResp.getValue(Foo.class);
        assertNotNull(f);
        assertEquals("Little bunny foo foo.", f.fooValue);
       
        RiakObject ro = uvResp.getValue(RiakObject.class);
        assertEquals("Little bunny foo foo.", ro.getValue().toString());
    }
View Full Code Here

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

                        .withUpdate(new Update<RiakObject>(){

                                        @Override
                                        public RiakObject apply(RiakObject original)
                                        {
                                            return new RiakObject().setValue(BinaryValue.create("value"));
                                        }
                                    })
                        .withStoreOption(Option.RETURN_BODY, true)
                        .build();
       
        UpdateValue.Response response = client.execute(uv);
        RiakObject ro = response.getValues().get(0);
        assertNotNull(ro.getVClock());
    }
View Full Code Here

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

        StoreBucketProperties sbp = new StoreBucketProperties.Builder(ns)
                                    .withSearchIndex(index.getName())
                                    .build();
        client.execute(sbp);
       
        RiakObject ro = new RiakObject()
                        .setContentType("application/json")
                        .setValue(BinaryValue.create("{\"name_s\":\"Lion-o\", \"age_i\":30, \"leader_b\":true}"));
        Location location = new Location(ns, "liono");
        StoreValue sv = new StoreValue.Builder(ro).withLocation(location).build();
        client.execute(sv);
       
        ro = new RiakObject()
                .setContentType("application/json")
                .setValue(BinaryValue.create("{\"name_s\":\"Cheetara\", \"age_i\":28, \"leader_b\":false}"));
        location = new Location(ns, "cheetara");
        sv = new StoreValue.Builder(ro).withLocation(location).build();
        client.execute(sv);
       
        ro = new RiakObject()
                .setContentType("application/json")
                .setValue(BinaryValue.create("{\"name_s\":\"Snarf\", \"age_i\":43}"));
        location = new Location(ns, "snarf");
        sv = new StoreValue.Builder(ro).withLocation(location).build();
        client.execute(sv);
       
        ro = new RiakObject()
                .setContentType("application/json")
                .setValue(BinaryValue.create("{\"name_s\":\"Panthro\", \"age_i\":36}"));
        location = new Location(ns, "panthro");
        sv = new StoreValue.Builder(ro).withLocation(location).build();
        client.execute(sv);
View Full Code Here

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

        String keyPrefix = "mr_test_";
        Namespace ns = new Namespace(bucketType, mrBucketName);
        for (int i = 0; i < 200; i++)
        {
            Location loc = new Location(ns, keyPrefix + i);
            RiakObject ro = new RiakObject().setContentType("text/plain")
                .setValue(BinaryValue.create(Integer.toString(i)));
            ro.getIndexes().getIndex(LongIntIndex.named("user_id")).add((long)i);
            StoreValue sv = new StoreValue.Builder(ro).withLocation(loc).build();
            RiakFuture<StoreValue.Response, Location> future = client.executeAsync(sv);
            future.await();
            assertTrue(future.isSuccess());
        }
View Full Code Here

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

        String keyPrefix = "mr_test_";
        Namespace ns = new Namespace(bucketType, mrBucketName);
        for (int i = 0; i < 200; i++)
        {
            Location loc = new Location(ns, keyPrefix + i);
            RiakObject ro = new RiakObject().setContentType("text/plain")
                .setValue(BinaryValue.create(Integer.toString(i)));
            // Single index key used on all 200 objects
            ro.getIndexes().getIndex(LongIntIndex.named("user_id")).add(1L);
            StoreValue sv = new StoreValue.Builder(ro).withLocation(loc).build();
            RiakFuture<StoreValue.Response, Location> future = client.executeAsync(sv);
            future.await();
            assertTrue(future.isSuccess());
        }
View Full Code Here

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

        }
    }

    private void initValues(String bucketType) throws ExecutionException, InterruptedException
    {
        RiakObject obj = new RiakObject();

    obj.setValue(BinaryValue.create("Alice was beginning to get very tired of sitting by her sister on the " +
        "bank, and of having nothing to do: once or twice she had peeped into the " +
        "book her sister was reading, but it had no pictures or conversations in " +
        "it, 'and what is the use of a book,' thought Alice 'without pictures or " +
        "conversation?'"));
        Namespace ns = new Namespace(bucketType, mrBucket);
    Location location = new Location(ns, "p1");
    client.execute(new StoreValue.Builder(obj).withLocation(location).build());

    obj.setValue(BinaryValue.create("So she was considering in her own mind (as well as she could, for the " +
        "hot day made her feel very sleepy and stupid), whether the pleasure " +
        "of making a daisy-chain would be worth the trouble of getting up and " +
        "picking the daisies, when suddenly a White Rabbit with pink eyes ran " +
        "close by her."));

    location = new Location(ns, "p2");
    client.execute(new StoreValue.Builder(obj).withLocation(location).build());


    obj.setValue(BinaryValue.create("The rabbit-hole went straight on like a tunnel for some way, and then " +
        "dipped suddenly down, so suddenly that Alice had not a moment to think " +
        "about stopping herself before she found herself falling down a very deep " +
        "well."));
    location = new Location(ns, "p3");
    client.execute(new StoreValue.Builder(obj).withLocation(location).build());
View Full Code Here

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

            String key = keyPrefix + i;
            String value = valuePrefix + i;
            Location loc = new Location(ns, key);
            locations.add(loc);
            values.add(BinaryValue.create(value));
            RiakObject o = new RiakObject().setValue(BinaryValue.create(value));
           
            StoreValue sv = new StoreValue.Builder(o).withLocation(loc).build();
            client.execute(sv);
        }
       
View Full Code Here

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

    }
   
    private void prepSearch(BinaryValue searchBucketType, BinaryValue searchBucket) throws InterruptedException, ExecutionException
    {

        RiakObject obj = new RiakObject().setContentType("application/json");
                           
        obj.setValue(BinaryValue.create("{ \"content_s\":\"Alice was beginning to get very tired of sitting by her sister on the " +
                    "bank, and of having nothing to do: once or twice she had peeped into the " +
                    "book her sister was reading, but it had no pictures or conversations in " +
                    "it, 'and what is the use of a book,' thought Alice 'without pictures or " +
                    "conversation?'\"}"));

        Namespace namespace = new Namespace(searchBucketType, searchBucket);
        Location location = new Location(namespace, BinaryValue.unsafeCreate("p1".getBytes()));
        StoreOperation storeOp =
            new StoreOperation.Builder(location)
                .withContent(obj)
                .build();
       
        cluster.execute(storeOp);
        storeOp.get();
       
        obj.setValue(BinaryValue.create("{ \"content_s\":\"So she was considering in her own mind (as well as she could, for the " +
                    "hot day made her feel very sleepy and stupid), whether the pleasure " +
                    "of making a daisy-chain would be worth the trouble of getting up and " +
                    "picking the daisies, when suddenly a White Rabbit with pink eyes ran " +
                    "close by her.\", \"multi_ss\":[\"this\",\"that\"]}"));
       
       
        location = new Location(namespace, BinaryValue.unsafeCreate("p2".getBytes()));
        storeOp =
            new StoreOperation.Builder(location)
                .withContent(obj)
                .build();
       
        cluster.execute(storeOp);
        storeOp.get();
       
        obj.setValue(BinaryValue.create("{ \"content_s\":\"The rabbit-hole went straight on like a tunnel for some way, and then " +
                    "dipped suddenly down, so suddenly that Alice had not a moment to think " +
                    "about stopping herself before she found herself falling down a very deep " +
                    "well.\"}"));
       
        location = new Location(namespace, BinaryValue.unsafeCreate("p3".getBytes()));
View Full Code Here

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

        String value = "value";
        Namespace ns = new Namespace(bucketType, bucketName.toString());
       
        for (long i = 0; i < 100; i++)
        {
            RiakObject obj = new RiakObject().setValue(BinaryValue.create(value));

            obj.getIndexes().getIndex(LongIntIndex.named(indexName)).add(5L);
            Location location = new Location(ns, BinaryValue.unsafeCreate((keyBase + i).getBytes()));
            StoreOperation storeOp =
                new StoreOperation.Builder(location)
                    .withContent(obj)
                    .build();
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.