Package com.basho.riak.client.core.query

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


    private void testStoreWithVClockAndReturnbody(String bucketType) throws InterruptedException, ExecutionException
    {
        // Enable allow_multi, store a new item, then do a read/modify/write
        // using the vclock
       
        Namespace ns = new Namespace(bucketType, bucketName.toString() + "_1");
        StoreBucketPropsOperation op =
            new StoreBucketPropsOperation.Builder(ns)
                .withAllowMulti(true)
                .build();
        cluster.execute(op);
View Full Code Here


    public void beforeTest() throws InterruptedException, ExecutionException
    {
        resetAndEmptyBucket(bucketName);
        if (testBucketType)
        {
            resetAndEmptyBucket(new Namespace(bucketType, bucketName));
        }
    }
View Full Code Here

        cluster.shutdown().get();
    }
   
    public static void resetAndEmptyBucket(BinaryValue name) throws InterruptedException, ExecutionException
    {
        resetAndEmptyBucket(new Namespace(Namespace.DEFAULT_BUCKET_TYPE, name.toString()));

    }
View Full Code Here

{
    @Test
    public void simpleTest() throws ExecutionException, InterruptedException
    {
        RiakClient client = new RiakClient(cluster);
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, bucketName.toString());
        Location loc = new Location(ns, "test_update_key1");
        UpdateValue uv = new UpdateValue.Builder(loc)
                            .withStoreOption(Option.RETURN_BODY, true)
                            .withUpdate(new UpdatePojo())
                            .build();
View Full Code Here

   
    @Test
    public void updateAnnotatedPojo() throws ExecutionException, InterruptedException
    {
        RiakClient client = new RiakClient(cluster);
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, bucketName.toString());
        Location loc = new Location(ns, "test_update_key2");
        UpdateValue uv = new UpdateValue.Builder(loc)
                            .withStoreOption(Option.RETURN_BODY, true)
                            .withUpdate(new UpdateAnnotatedPojo())
                            .build();
       
        UpdateValue.Response resp = client.execute(uv);
        RiakAnnotatedPojo rap = resp.getValue(RiakAnnotatedPojo.class);
       
        assertNotNull(rap.bucketName);
        assertEquals(ns.getBucketNameAsString(), rap.bucketName);
        assertNotNull(rap.key);
        assertEquals(loc.getKeyAsString(), rap.key);
        assertNotNull(rap.bucketType);
        assertEquals(ns.getBucketTypeAsString(), rap.bucketType);
        assertNotNull(rap.contentType);
        assertEquals("application/json", rap.contentType);
        assertNotNull(rap.vclock);
        assertNotNull(rap.vtag);
        assertNotNull(rap.lastModified);
View Full Code Here

        // 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 =
            new StoreOperation.Builder(location)
                .withContent(rObj)
                .build();
       
View Full Code Here

                }
            };
       
        for (int i = 0; i < 1000; i++)
        {
            Namespace ns = new Namespace(bucketType, bucketName.toString() + i);
            RiakObject rObj = new RiakObject().setValue(BinaryValue.create(value));
            Location location = new Location(ns, key);
            StoreOperation storeOp =
                new StoreOperation.Builder(location)
                    .withContent(rObj)
                    .build();
            storeOp.addListener(listener);
            semaphore.acquire();
            cluster.execute(storeOp);
        }
       
        latch.await();
       
        ListBucketsOperation listOp = new ListBucketsOperation.Builder()
                                        .withBucketType(BinaryValue.createFromUtf8(bucketType))
                                        .build();
        cluster.execute(listOp);
        List<BinaryValue> bucketList = listOp.get().getBuckets();
        assertTrue(bucketList.size() >= 1000);
       
        for (int i = 0; i < 1000; i++)
        {
            Namespace ns = new Namespace(bucketType, bucketName.toString() + i);
            resetAndEmptyBucket(ns);
        }
       
    }
View Full Code Here

  }

    @Test
  public void testBucketInputSerializer() throws IOException
    {
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, "bucket");
        BucketInput input = new BucketInput(ns, null);

    jg.writeObject(input);
        assertEquals("\"bucket\"", out.toString());
    }
View Full Code Here

   
  @Test
  public void testBucketInputSerializerWithFilter() throws IOException
  {

    Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, "bucket");
    ArrayList<KeyFilter> filters = new ArrayList<KeyFilter>();
    filters.add(new EndsWithFilter("dave"));
    BucketInput input = new BucketInput(ns, filters);

    jg.writeObject(input);
View Full Code Here

  }
   
    @Test public void testBucketInputSerializerWithType() throws IOException
    {
        Namespace ns = new Namespace("type", "bucket");
        BucketInput input = new BucketInput(ns, null);
        jg.writeObject(input);
        assertEquals("[\"type\",\"bucket\"]", out.toString());
    }
View Full Code Here

TOP

Related Classes of com.basho.riak.client.core.query.Namespace

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.