Package com.basho.riak.client.core.operations

Examples of com.basho.riak.client.core.operations.FetchOperation


        cluster.start();
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, "test_bucket");
        Location location = new Location(ns, "test_key2");
       
        FetchOperation operation =
            new FetchOperation.Builder(location).build();

        cluster.execute(operation);
       
        try
        {
            FetchOperation.Response response = operation.get();
            assertEquals(response.getObjectList().get(0).getValue().toString(), "This is a value!");
            assertTrue(!response.isNotFound());
        }
        catch(InterruptedException e)
        {
View Full Code Here


        cluster.start();
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, "test_bucket");
        Location location = new Location(ns, "test_key2");
       
        FetchOperation operation =
            new FetchOperation.Builder(location)
                    .build();

        cluster.execute(operation);
       
        try
        {
            operation.await();
            assertFalse(operation.isSuccess());
            assertNotNull(operation.cause());
        }
        finally
        {
            cluster.shutdown().get();
        }
View Full Code Here

        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, "test_bucket");
        Location location = new Location(ns, "test_key2");
       
        for (int i = 0; i < 6; i++)
        {
            FetchOperation operation =
                new FetchOperation.Builder(location)
                        .build();
           
            boolean accepted = node.execute(operation);
            assertTrue(accepted);
            operation.await();
            assertFalse(operation.isSuccess());
        }
       
        Thread.sleep(2000);
        assertEquals(State.HEALTH_CHECKING, node.getNodeState());
        node.shutdown().get();
View Full Code Here

        node.start();
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, "test_bucket");
        Location location = new Location(ns, "test_key2");
       
        FetchOperation operation =
            new FetchOperation.Builder(location)
                    .build();
       
        boolean accepted = node.execute(operation);
        assertTrue(accepted);
        FetchOperation.Response response = operation.get();
        assertEquals(response.getObjectList().get(0).getValue().toString(), "This is a value!");
        assertTrue(!response.isNotFound());
        node.shutdown().get();
    }
View Full Code Here

        node.start();
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, "test_bucket");
        Location location = new Location(ns, "test_key2");

        FetchOperation operation =
            new FetchOperation.Builder(location)
                    .build();
       
        boolean accepted = node.execute(operation);
        operation.await();
        assertFalse(operation.isSuccess());
        assertNotNull(operation.cause());
        node.shutdown().get();
    }
View Full Code Here

                .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

        ArgumentCaptor<FetchOperation> captor =
            ArgumentCaptor.forClass(FetchOperation.class);
        verify(mockCluster).execute(captor.capture());

        FetchOperation operation = captor.getValue();
        RiakKvPB.RpbGetReq.Builder builder =
            (RiakKvPB.RpbGetReq.Builder) Whitebox.getInternalState(operation, "reqBuilder");

        assertEquals("type", builder.getType().toStringUtf8());
        assertEquals("bucket", builder.getBucket().toStringUtf8());
View Full Code Here

                .build();
       
        cluster.execute(storeOp);
        storeOp.get();
       
        FetchOperation fetchOp =
            new FetchOperation.Builder(location).build();
               
       
        cluster.execute(fetchOp);
        FetchOperation.Response response = fetchOp.get();
        RiakObject rObj2 = response.getObjectList().get(0);
       
        assertEquals(rObj.getValue(), rObj2.getValue());
       
        DeleteOperation delOp =
            new DeleteOperation.Builder(location)
                .withVclock(rObj2.getVClock()).build();
        cluster.execute(delOp);
        delOp.get();
       
        fetchOp =
            new FetchOperation.Builder(location).build();
       
        cluster.execute(fetchOp);
        response = fetchOp.get();
        assertTrue(response.isNotFound());
        assertTrue(response.getObjectList().isEmpty());
       
       
    }
View Full Code Here

    {
        final BinaryValue key = BinaryValue.unsafeCreate("my_key_1".getBytes());
        final String value = "{\"value\":\"value\"}";
        Namespace ns = new Namespace(bucketType, bucketName.toString());
        Location location = new Location(ns, key);
        FetchOperation fetchOp =
            new FetchOperation.Builder(location).build();
               
        cluster.execute(fetchOp);
        FetchOperation.Response response = fetchOp.get();
        assertTrue(response.isNotFound());
        assertTrue(response.getObjectList().isEmpty());
       
    }
View Full Code Here

                .build();
       
        cluster.execute(storeOp);
        storeOp.get();
       
        FetchOperation fetchOp =
            new FetchOperation.Builder(location).build();
       
        cluster.execute(fetchOp);
        FetchOperation.Response response = fetchOp.get();
        assertFalse(response.isNotFound());
        List<RiakObject> objectList = response.getObjectList();
        assertEquals(1, objectList.size());
        RiakObject ro = objectList.get(0);
        assertEquals(ro.getValue().toString(), value);
View Full Code Here

TOP

Related Classes of com.basho.riak.client.core.operations.FetchOperation

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.