Package com.basho.riak.client.api

Examples of com.basho.riak.client.api.RiakClient


   
   
    @Test
    public void storeAnnotatedPojo() throws ExecutionException, InterruptedException
    {
        RiakClient client = new RiakClient(cluster);
       
        RiakAnnotatedPojo pojo = new RiakAnnotatedPojo();
       
        pojo.bucketType = "default";
        pojo.bucketName = bucketName.toString();
        pojo.key = "test_store_key_3";
        pojo.contentType = null; // converter will set
        pojo.value = "my value";
       
         StoreValue sv =
            new StoreValue.Builder(pojo)
                .withOption(Option.RETURN_BODY, true)
                .build();
       
        StoreValue.Response resp = client.execute(sv);
       
        RiakAnnotatedPojo rap = resp.getValue(RiakAnnotatedPojo.class);
       
        assertNotNull(rap.bucketName);
        assertEquals(pojo.bucketName, rap.bucketName);
View Full Code Here


    @Test
    public void storeAnnotatedPojoWithIndexes() throws ExecutionException, InterruptedException
    {
        Assume.assumeTrue(test2i);
       
        RiakClient client = new RiakClient(cluster);
       
        RiakAnnotatedPojo pojo = new RiakAnnotatedPojo();
       
        pojo.bucketType = "default";
        pojo.bucketName = bucketName.toString();
        pojo.key = "test_store_key_3";
        pojo.contentType = null; // converter will set
        pojo.value = "my value";
       
        Set<String> emailAddys = new HashSet<String>();
        emailAddys.add("roach@basho.com");
       
        pojo.emailIndx = emailAddys;
        pojo.userId = 1L;
       
        StoreValue sv =
            new StoreValue.Builder(pojo)
                .withOption(Option.RETURN_BODY, true)
                .build();
       
        StoreValue.Response resp = client.execute(sv);
       
        RiakAnnotatedPojo rap = resp.getValue(RiakAnnotatedPojo.class);
       
        assertTrue(rap.emailIndx.containsAll(emailAddys));
        assertEquals(rap.userId, pojo.userId);
View Full Code Here

    }
   
    @Test
    public void riakGeneratesKey() throws ExecutionException, InterruptedException
    {
        RiakClient client = new RiakClient(cluster);
       
        RiakAnnotatedPojo pojo = new RiakAnnotatedPojo();
       
        pojo.bucketType = "default";
        pojo.bucketName = bucketName.toString();
        pojo.contentType = null; // converter will set
        pojo.value = "my value";
       
         StoreValue sv =
            new StoreValue.Builder(pojo)
                .withOption(Option.RETURN_BODY, true)
                .build();
       
        StoreValue.Response resp = client.execute(sv);
       
        RiakAnnotatedPojo rap = resp.getValue(RiakAnnotatedPojo.class);
       
        assertNotNull(rap.key);
        assertFalse(rap.key.isEmpty());
View Full Code Here

{
   
    @Test
    public void simpleTest() throws ExecutionException, InterruptedException
    {
        RiakClient client = new RiakClient(cluster);
       
        String keyPrefix = "key_";
        String valuePrefix = "value_";
        List<Location> locations = new LinkedList<Location>();
        List<BinaryValue> values = new LinkedList<BinaryValue>();
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, bucketName.toString());
       
        // Store some stuff
        for (int i = 0; i < 5; i++)
        {
            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);
        }
       
        MultiFetch mf = new MultiFetch.Builder().addLocations(locations).build();
       
        MultiFetch.Response mfr = client.execute(mf);
       
        assertEquals(locations.size(), mfr.getResponses().size());
       
        List<Location> returnedLocations = new LinkedList<Location>();
        List<BinaryValue> returnedValues = new LinkedList<BinaryValue>();
View Full Code Here

TOP

Related Classes of com.basho.riak.client.api.RiakClient

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.