Examples of RiakClient


Examples of com.basho.riak.client.RiakClient

    private RiakClient impl;

    /** Connect to Riak using the given configuration. */
    public static PlainClient getClient(RiakConfig config) {
        return new PlainClient(new RiakClient(config));
    }
View Full Code Here

Examples of com.basho.riak.client.RiakClient

        return new PlainClient(new RiakClient(config));
    }

    /** Connect to Riak using the given URL. */
    public static PlainClient getClient(String url) {
        return new PlainClient(new RiakClient(url));
    }
View Full Code Here

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

    @Test
    public void testMatchQuery() throws InterruptedException, ExecutionException
    {
        Assume.assumeTrue(test2i);
       
        RiakClient client = new RiakClient(cluster);
       
        IndexedPojo ip = new IndexedPojo();
        ip.key = "index_test_object_key";
        ip.bucketName = bucketName.toString();
        ip.indexKey = 123456L;
        ip.value = "My Object Value!";
       
        StoreValue sv = new StoreValue.Builder(ip).build();
        RiakFuture<StoreValue.Response, Location> svFuture = client.executeAsync(sv);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        IndexedPojo ip2 = new IndexedPojo();
        ip2.key = "index_test_object_key2";
        ip2.bucketName = bucketName.toString();
        ip2.indexKey = 123456L;
        ip2.value = "My Object Value!";
       
        sv = new StoreValue.Builder(ip2).build();
        svFuture = client.executeAsync(sv);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, bucketName.toString());
       
        IntIndexQuery iiq =
            new IntIndexQuery.Builder(ns, "test_index", 123456L).withKeyAndIndex(true).build();
        IntIndexQuery.Response iResp = client.execute(iiq);
       
        assertTrue(iResp.hasEntries());
        assertEquals(2, iResp.getEntries().size());
       
        boolean found = false;
View Full Code Here

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

    @Test
    public void testRangeQuery() throws InterruptedException, ExecutionException
    {
        Assume.assumeTrue(test2i);
       
        RiakClient client = new RiakClient(cluster);
       
        IndexedPojo ip = new IndexedPojo();
        ip.key = "index_test_object_key1";
        ip.bucketName = bucketName.toString();
        ip.indexKey = 1L;
        ip.value = "My Object Value!";
       
        StoreValue sv = new StoreValue.Builder(ip).build();
        RiakFuture<StoreValue.Response, Location> svFuture = client.executeAsync(sv);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        IndexedPojo ip2 = new IndexedPojo();
        ip2.key = "index_test_object_key2";
        ip2.bucketName = bucketName.toString();
        ip2.indexKey = 25L;
        ip2.value = "My Object Value!";
       
        sv = new StoreValue.Builder(ip2).build();
        svFuture = client.executeAsync(sv);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, bucketName.toString());
       
        IntIndexQuery iiq =
            new IntIndexQuery.Builder(ns, "test_index", Long.MIN_VALUE, Long.MAX_VALUE)
                .withKeyAndIndex(true)
                .build();
       
        IntIndexQuery.Response iResp = client.execute(iiq);
        assertTrue(iResp.hasEntries());
        assertEquals(2, iResp.getEntries().size());
       
        boolean found = false;
        for (IntIndexQuery.Response.Entry e : iResp.getEntries())
View Full Code Here

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

    @Test
    public void testMatchQuery() throws InterruptedException, ExecutionException
    {
        Assume.assumeTrue(test2i);
       
        RiakClient client = new RiakClient(cluster);
       
        IndexedPojo ip = new IndexedPojo();
        ip.key = "index_test_object_key";
        ip.bucketName = bucketName.toString();
        ip.indexKey = new BigInteger("91234567890123456789012345678901234567890");
        ip.value = "My Object Value!";
       
        StoreValue sv = new StoreValue.Builder(ip).build();
        RiakFuture<StoreValue.Response, Location> svFuture = client.executeAsync(sv);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        IndexedPojo ip2 = new IndexedPojo();
        ip2.key = "index_test_object_key2";
        ip2.bucketName = bucketName.toString();
        ip2.indexKey = new BigInteger("91234567890123456789012345678901234567890");
        ip2.value = "My Object Value!";
       
        sv = new StoreValue.Builder(ip2).build();
        svFuture = client.executeAsync(sv);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, bucketName.toString());
       
        BigIntIndexQuery iiq =
            new BigIntIndexQuery.Builder(ns, "test_index", new BigInteger("91234567890123456789012345678901234567890"))
                .withKeyAndIndex(true).build();
        BigIntIndexQuery.Response iResp = client.execute(iiq);
       
        assertTrue(iResp.hasEntries());
        assertEquals(2, iResp.getEntries().size());
       
        boolean found = false;
View Full Code Here

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

    @Test
    public void testRangeQuery() throws InterruptedException, ExecutionException
    {
        Assume.assumeTrue(test2i);
       
        RiakClient client = new RiakClient(cluster);
       
        IndexedPojo ip = new IndexedPojo();
        ip.key = "index_test_object_key1";
        ip.bucketName = bucketName.toString();
        ip.indexKey = new BigInteger("91234567890123456789012345678901234567890");
        ip.value = "My Object Value!";
       
        StoreValue sv = new StoreValue.Builder(ip).build();
        RiakFuture<StoreValue.Response, Location> svFuture = client.executeAsync(sv);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        IndexedPojo ip2 = new IndexedPojo();
        ip2.key = "index_test_object_key2";
        ip2.bucketName = bucketName.toString();
        ip2.indexKey = new BigInteger("91234567890123456789012345678901234567898");
        ip2.value = "My Object Value!";
       
        sv = new StoreValue.Builder(ip2).build();
        svFuture = client.executeAsync(sv);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, bucketName.toString());
        BigIntIndexQuery iiq =
            new BigIntIndexQuery.Builder(ns, "test_index",
                                         new BigInteger("91234567890123456789012345678901234567890"),
                                         new BigInteger("91234567890123456789012345678901234567898"))
                .withKeyAndIndex(true)
                .build();
       
        BigIntIndexQuery.Response iResp = client.execute(iiq);
        assertTrue(iResp.hasEntries());
        assertEquals(2, iResp.getEntries().size());
       
        boolean found = false;
        for (BigIntIndexQuery.Response.Entry e : iResp.getEntries())
View Full Code Here

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

    @Test
    public void simpleTest() throws InterruptedException, ExecutionException
    {
        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);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, bucketName.toString());
       
        RawIndexQuery biq  =
            new RawIndexQuery.Builder(ns, "test_index", Type._BIN, indexKey).withKeyAndIndex(true).build();
        RawIndexQuery.Response iResp = client.execute(biq);
       
        assertTrue(iResp.hasEntries());
        RawIndexQuery.Response.Entry first = iResp.getEntries().iterator().next();
        assertEquals(ip.key, first.getRiakObjectLocation().getKey().toString());
        assertArrayEquals(ip.indexKey, first.getIndexKey().getValue());
View Full Code Here

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

    @Test
    public void testMatchQuery() throws ExecutionException, InterruptedException
    {
        Assume.assumeTrue(test2i);
       
        RiakClient client = new RiakClient(cluster);
       
        IndexedPojo ip = new IndexedPojo();
        ip.key = "index_test_object_key";
        ip.bucketName = bucketName.toString();
        ip.indexKey = "index_test_index_key";
        ip.value = "My Object Value!";
       
        StoreValue sv = new StoreValue.Builder(ip).build();
        RiakFuture<StoreValue.Response, Location> svFuture = client.executeAsync(sv);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        IndexedPojo ip2 = new IndexedPojo();
        ip2.key = "index_test_object_key2";
        ip2.bucketName = bucketName.toString();
        ip2.indexKey = "index_test_index_key";
        ip2.value = "My Object Value!";
       
        sv = new StoreValue.Builder(ip2).build();
        svFuture = client.executeAsync(sv);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, bucketName.toString());
       
        BinIndexQuery biq  =
            new BinIndexQuery.Builder(ns, "test_index", "index_test_index_key").withKeyAndIndex(true).build();
        BinIndexQuery.Response iResp = client.execute(biq);

        assertTrue(iResp.hasEntries());
        assertEquals(2, iResp.getEntries().size());
       
        boolean found = false;
View Full Code Here

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

    @Test
    public void testRangeQuery() throws InterruptedException, ExecutionException
    {
        Assume.assumeTrue(test2i);
       
        RiakClient client = new RiakClient(cluster);
       
        IndexedPojo ip = new IndexedPojo();
        ip.key = "index_test_object_key1";
        ip.bucketName = bucketName.toString();
        ip.indexKey = "index_test_index_key1";
        ip.value = "My Object Value!";
       
        StoreValue sv = new StoreValue.Builder(ip).build();
        RiakFuture<StoreValue.Response, Location> svFuture = client.executeAsync(sv);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        IndexedPojo ip2 = new IndexedPojo();
        ip2.key = "index_test_object_key2";
        ip2.bucketName = bucketName.toString();
        ip2.indexKey = "index_test_index_key2";
        ip2.value = "My Object Value!";
       
        sv = new StoreValue.Builder(ip2).build();
        svFuture = client.executeAsync(sv);
       
        svFuture.await();
        assertTrue(svFuture.isSuccess());
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, bucketName.toString());
        BinIndexQuery biq  =
            new BinIndexQuery.Builder(ns, "test_index", "index_test_index_key0", "index_test_index_key9").withKeyAndIndex(true).build();
        BinIndexQuery.Response iResp = client.execute(biq);
       
        assertTrue(iResp.hasEntries());
        assertEquals(2, iResp.getEntries().size());
       
        boolean found = false;
View Full Code Here

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

   
    private void simpleTest(String bucketType)
    {
        try
        {
            RiakClient client = new RiakClient(cluster);
            Namespace ns = new Namespace(bucketType, bucketName.toString());
            Location loc = new Location(ns, "test_fetch_key1");
           
            Pojo pojo = new Pojo();
            pojo.value = "test value";
            StoreValue sv =
                new StoreValue.Builder(pojo).withLocation(loc).build();
           
            StoreValue.Response resp = client.execute(sv);
           
           
            FetchValue fv = new FetchValue.Builder(loc).build();
            FetchValue.Response fResp = client.execute(fv);
           
            assertEquals(pojo.value, fResp.getValue(Pojo.class).value);
           
            RiakObject ro = fResp.getValue(RiakObject.class);
            assertNotNull(ro.getValue());
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.