Examples of blobBuilder()


Examples of org.jclouds.blobstore.BlobStore.blobBuilder()

            }
         }

         assertNotNull(container);

         store.putBlob(bucketName, store.blobBuilder(blobName)
                                          .payload("This is a test!")
                                          .contentType("text/plain")
                                          .build());

         assertNotNull(store.getBlob(bucketName, blobName));
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore.blobBuilder()

   }

   @Test(expectedExceptions = UnsupportedOperationException.class)
   public void testSignPutBlobWithTime() throws Exception {
      BlobStore signPutBloblWithTime = requestsSendResponses(init());
      Blob blob = signPutBloblWithTime.blobBuilder(name).payload(text).contentType("text/plain").build();
      HttpRequest compare = putBlobWithTime();
      compare.setPayload(blob.getPayload());
      assertEquals(signPutBloblWithTime.getContext().getSigner().signPutBlob(container, blob, 3l /* seconds */),
         compare);
   }
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore.blobBuilder()

      BlobStore blobStore = view.getBlobStore();
      try {
         final String blobName = "hello";
         final Date expires = new Date((System.currentTimeMillis() / 1000) * 1000 + 60 * 1000);

         blobStore.putBlob(container, blobStore.blobBuilder(blobName).payload(TEST_STRING).expires(expires).build());

         assertConsistencyAwareBlobExpiryMetadata(container, blobName, expires);

      } finally {
         returnContainer(container);
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore.blobBuilder()

      assertNull(ToBlob.INSTANCE.apply(null));
      BlobStore blobStore = getBlobStore();
      blobStore.createContainerInLocation(null, "container");
      blobStore.createDirectory("container", "one");

      blobStore.putBlob("container", blobStore.blobBuilder("myblob").payload(ByteSource.wrap("testcontent".getBytes())).build());
      Blob representation = ToBlob.INSTANCE.apply(blobStore.getBlob("container", "myblob"));
      assertNotNull(representation);
      assertNotNull(representation.getBlobMetadata());
   }
}
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore.blobBuilder()

   @Override
   protected Object doExecute() throws Exception {
      BlobStore blobStore = getBlobStore();

      BlobBuilder builder = blobStore.blobBuilder(blobName);
      if (stringPayload) {
         builder = builder.payload(payload.getBytes())// use default Charset
      } else if (urlPayload) {
         InputStream input = new URL(payload).openStream();
         try {
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore.blobBuilder()

   }

   private void uploadInputSupplier(String container, String name, String contentDisposition,
         InputSupplier<? extends InputStream> supplier) throws IOException {
      BlobStore blobStore = view.getBlobStore();
      blobStore.putBlob(container, blobStore.blobBuilder(name)
            .payload(new InputStreamSupplierPayload(supplier))
            .contentType("text/plain")
            .contentMD5(md5Supplier(supplier))
            .contentLength(ByteStreams.length(supplier))
            .contentDisposition(contentDisposition)
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore.blobBuilder()

      BlobStore blobStore = view.getBlobStore();
      try {
         final String blobName = "hello";
         final Date expires = new Date((System.currentTimeMillis() / 1000) * 1000 + 60 * 1000);

         blobStore.putBlob(container, blobStore.blobBuilder(blobName).payload(TEST_STRING).expires(expires).build());

         assertConsistencyAwareBlobExpiryMetadata(container, blobName, expires);

      } finally {
         returnContainer(container);
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore.blobBuilder()

   private void putBlobWithMd5(byte[] payload, HashCode contentMD5) throws InterruptedException, IOException {
      String container = getContainerName();
      BlobStore blobStore = view.getBlobStore();
      try {
         String blobName = "putBlobWithMd5-" + new Random().nextLong();
         Blob blob = blobStore
            .blobBuilder(blobName)
            .payload(payload)
            .contentMD5(contentMD5.asBytes())
            .build();
         blobStore.putBlob(container, blob);
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore.blobBuilder()

   protected void addMultipartBlobToContainer(String containerName, String key) throws IOException {
      File fileToUpload = createFileBiggerThan(PART_SIZE);

      BlobStore blobStore = view.getBlobStore();
      blobStore.createContainerInLocation(null, containerName);
      Blob blob = blobStore.blobBuilder(key)
         .payload(fileToUpload)
         .build();
      blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());
   }
View Full Code Here

Examples of org.jclouds.blobstore.BlobStore.blobBuilder()

     */
    public String pushToS3(OutboundConfiguration outboundConfiguration, String payloadIdentifier, byte[] payload)
            throws InvalidCredentialsException {
        BlobStore s3BlobStore = getBlobStoreContext().getBlobStore();
        String bucketName = createBucket(outboundConfiguration);
        Blob blob = s3BlobStore.blobBuilder(payloadIdentifier).payload(payload).build();
        return s3BlobStore.putBlob(bucketName,blob);
    }

    /**
     * Extracts a bucket name from an OutboundConfiguration.  If the OutboundConfiguration's namespace property is non-null
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.