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

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


  public void deleteAttachment(ERS3Attachment attachment)
      throws MalformedURLException, IOException {
    AWSAuthConnection conn = attachment.awsConnection();
    String bucket = attachment.bucket();
    String key = attachment.key();
    Response response = conn.delete(bucket, key, null);
    if (failed(response)) {
      throw new IOException("Failed to delete '" + bucket + "/" + key
          + "' to S3: Error " + response.connection.getResponseCode()
          + ": " + response.connection.getResponseMessage());
    }
View Full Code Here


          headers.put("Content-Disposition", Arrays
              .asList(new String[] { "attachment; filename="
                  + originalFileName }));
        }

        Response response = conn.putStream(bucket, key,
            attachmentStreamObject, headers);
        if (failed(response)) {
          throw new IOException("Failed to write '" + bucket + "/"
              + key + "' to S3: Error "
              + response.connection.getResponseCode() + ": "
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
        {
            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

TOP

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

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.