Examples of RiakObject


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

           
        JSONConverter<EmptyPojoWithRiakFields> jc =
            new JSONConverter<EmptyPojoWithRiakFields>(new TypeReference<EmptyPojoWithRiakFields>(){});
        OrmExtracted orm = jc.fromDomain(pojo, null, null);
       
        RiakObject riakObject = orm.getRiakObject();
        riakObject.setLastModified(123);
        riakObject.setVTag("vtag");
       
        Location loc = new Location(orm.getNamespace(), orm.getKey());
        EmptyPojoWithRiakFields convertedPojo = jc.toDomain(riakObject, loc);
       
        assertEquals(pojo.key, convertedPojo.key);
View Full Code Here

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

        pojo.foo = "foo_value";
        pojo.bar = "bar_value";
       
       
        OrmExtracted orm = converter.fromDomain(pojo , null, null);
        RiakObject ro = orm.getRiakObject();
       
        assertNotNull(ro.getValue());
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, "bucket");
        Pojo pojo2 = converter.toDomain(ro, new Location(ns, "key"));
       
        assertEquals(pojo.foo, pojo2.foo);
View Full Code Here

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

        ConverterFactory factory = ConverterFactory.getInstance();
        Converter<RiakObject> converter = factory.getConverter(RiakObject.class);
       
        assertTrue(converter instanceof PassThroughConverter);
       
        RiakObject o = new RiakObject();
       
        RiakObject o2 = converter.toDomain(o, null);
        assertEquals(o, o2);
       
        OrmExtracted orm = converter.fromDomain(o, null, null);
        assertEquals(o, orm.getRiakObject());
       
View Full Code Here

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

       
       
        Converter.OrmExtracted orm = converter.fromDomain(foo, ns, BinaryValue.create("key"));
       
        assertNotNull(orm.getRiakObject());
        RiakObject obj = orm.getRiakObject();
        assertEquals(foo, obj.getValue().toString());
        assertEquals("text/plain", obj.getContentType());
        assertEquals(ns, orm.getNamespace());
        assertEquals("key", orm.getKey().toString());
    }
View Full Code Here

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

   
    @Test
    public void producesString()
    {
        String value = "some value";
        RiakObject obj = new RiakObject()
                        .setValue(BinaryValue.create(value));
        StringConverter converter = new StringConverter();
       
        String result = converter.toDomain(obj, null);
       
View Full Code Here

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

        byte[] expectedValue = new byte[]{'O', '_', 'o'};

        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, "bucket");
        BinaryValue key = BinaryValue.create("key".getBytes());

        RiakObject ro = new RiakObject();

        List<RiakLink> links = new ArrayList<RiakLink>();
        links.add(new RiakLink("bucket", "key", "tag"));
        ro.getLinks().addLinks(links);

        RiakIndexes indexes = ro.getIndexes();
        LongIntIndex longIndex = indexes.getIndex(LongIntIndex.named("dave"));
        longIndex.add(42L);

        ro.setValue(BinaryValue.unsafeCreate(expectedValue));

        Location location = new Location(ns, key);
        StoreOperation operation =
            new StoreOperation.Builder(location)
                .withContent(ro)
View Full Code Here

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

        assertTrue(gpf.list.containsAll(gpf2.list));

        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new RiakJacksonModule());
        String json = mapper.writeValueAsString(gpf2);
        RiakObject ro = resp.getValue(RiakObject.class);
        assertEquals(json, ro.getValue().toString());
       
    }
View Full Code Here

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

        assertTrue(gpf.list.containsAll(gpf2.list));

        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new RiakJacksonModule());
        String json = mapper.writeValueAsString(gpf2);
        RiakObject ro = resp.getValue(RiakObject.class);
        assertEquals(json, ro.getValue().toString());
       
    }
View Full Code Here

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

        assertEquals(1, gpi.value.intValue());
       
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new RiakJacksonModule());
        String json = mapper.writeValueAsString(gpi);
        RiakObject ro = resp.getValue(RiakObject.class);
        assertEquals(json, ro.getValue().toString());
       
        resp = client.execute(uv);
        gpi = resp.getValue(tr);
        assertNotNull(gpi);
        assertNotNull(gpi.value);
View Full Code Here

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

        assertNotNull(gpi);
        assertNotNull(gpi.value);
        assertEquals(3, gpi.value.intValue());
       
        // Check to see that the custom conversion is right
        RiakObject ro = uvResp.getValue(RiakObject.class);
        assertEquals("3", ro.getValue().toString());
    }
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.