Package com.basho.riak.client.core.util

Examples of com.basho.riak.client.core.util.BinaryValue


        }
       
        index.add(values);
       
        assertEquals(index.size(), 5);
        BinaryValue baw = values.remove(0);
        index.remove(values);
        assertEquals(index.size(), 1);
        assertTrue(index.hasValue(baw));
        for (BinaryValue b : values )
        {
View Full Code Here


       
        Iterator<BinaryValue> i = index.iterator();
       
        while (i.hasNext())
        {
            BinaryValue b = i.next();
            i.remove();
            assertFalse(index.hasValue(b));
        }
    }
View Full Code Here

   
    public void rawIndexQueryBuildsCorrectly()
    {
        Namespace ns = new Namespace("bucket_type", "bucket_name");
       
        BinaryValue indexMatch = BinaryValue.create("match");
        BinaryValue indexStart = BinaryValue.create("start");
        BinaryValue indexEnd = BinaryValue.create("end");
       
        RawIndexQuery riq =
            new RawIndexQuery.Builder(ns, "test_index", SecondaryIndexQuery.Type._INT, indexMatch)
                .build();
       
View Full Code Here

    {
        Assume.assumeTrue(test2i);
       
        RiakClient client = new RiakClient(cluster);
       
        BinaryValue indexKey = BinaryValue.create("index_test_index_key");
       
        IndexedPojo ip = new IndexedPojo();
        ip.key = "index_test_object_key";
        ip.bucketName = bucketName.toString();
        ip.indexKey = indexKey.getValue();
        ip.value = "My Object Value!";
       
        StoreValue sv = new StoreValue.Builder(ip).build();
        RiakFuture<StoreValue.Response, Location> svFuture = client.executeAsync(sv);
       
View Full Code Here

     * Update some info about a user in a table of users
     */

    resetAndEmptyBucket(carts);

    BinaryValue key = BinaryValue.create("user-info");

        /*

            Data structure:

View Full Code Here

    }
   
    private void testListBuckets(String bucketType) throws InterruptedException, ExecutionException
    {
        // 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 =
View Full Code Here

        testLargeBucketList(bucketType.toString());
    }
   
    private void testLargeBucketList(String bucketType) throws InterruptedException, ExecutionException
    {
        final BinaryValue key = BinaryValue.unsafeCreate("my_key".getBytes());
        final String value = "{\"value\":\"value\"}";
        final Semaphore semaphore = new Semaphore(10);
        final CountDownLatch latch = new CountDownLatch(1);
       
        RiakFutureListener<StoreOperation.Response, Location> listener =
View Full Code Here

    {

        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"));
View Full Code Here

    @Test
    public void testGetSetOp()
    {

        BinaryValue addition = BinaryValue.create("1");
        BinaryValue removal = BinaryValue.create("2");

        SetOp op = new SetOp()
            .add(addition)
            .remove(removal);

        DtUpdateOperation.Builder operation = new DtUpdateOperation.Builder(namespace);
        RiakDtPB.SetOp setOp = operation.getSetOp(op);

        BinaryValue serializedAddition = BinaryValue.unsafeCreate(setOp.getAdds(0).toByteArray());
        BinaryValue serializedRemoval = BinaryValue.unsafeCreate(setOp.getRemoves(0).toByteArray());

        assertEquals(addition, serializedAddition);
        assertEquals(removal, serializedRemoval);

    }
View Full Code Here

    @Test
    public void testGetRegisterOp()
    {

        final BinaryValue registerValue = BinaryValue.create("value");

        RegisterOp op = new RegisterOp(registerValue);

        DtUpdateOperation.Builder operation = new DtUpdateOperation.Builder(namespace);
        ByteString registerOp = operation.getRegisterOp(op);

        ByteString serializedValue = ByteString.copyFrom(registerValue.unsafeGetValue());
        assertEquals(serializedValue, registerOp);
    }
View Full Code Here

TOP

Related Classes of com.basho.riak.client.core.util.BinaryValue

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.