Examples of blobBuilder()


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

                  String.format("creating public container %s in location %s", containerName, nonDefault.getId()));
         blobStore.createContainerInLocation(nonDefault, containerName, publicRead());
         assertConsistencyAwareContainerExists(containerName);
         assertConsistencyAwareContainerInLocation(containerName, nonDefault);

         blobStore.putBlob(containerName, blobStore.blobBuilder(blobName).payload(payload).build());

         assertConsistencyAwareContainerSize(containerName, 1);

         BlobMetadata metadata = view.getBlobStore().blobMetadata(containerName, blobName);
         assertEquals(Strings2.toStringAndClose(view.utils().http().get(metadata.getPublicUri())), payload);
View Full Code Here

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

   }

   @Test
   public void testSignPutBlob() throws Exception {
      BlobStore signPutBlob = requestsSendResponses(init());
      Blob blob = signPutBlob.blobBuilder("name").forSigning().contentLength(2l).contentMD5(new byte[] { 0, 2, 4, 8 })
            .contentType("text/plain").expires(new Date(1000)).build();
      HttpRequest compare = putBlob();
      compare.setPayload(blob.getPayload());
      assertEquals(signPutBlob.getContext().getSigner().signPutBlob(container, blob), compare);
   }
View Full Code Here

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

   protected abstract HttpRequest putBlob();

   @Test
   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()

   }

   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()

                  String.format("creating public container %s in location %s", containerName, nonDefault.getId()));
         blobStore.createContainerInLocation(nonDefault, containerName, publicRead());
         assertConsistencyAwareContainerExists(containerName);
         assertConsistencyAwareContainerInLocation(containerName, nonDefault);

         blobStore.putBlob(containerName, blobStore.blobBuilder(blobName).payload(payload).build());

         assertConsistencyAwareContainerSize(containerName, 1);

         BlobMetadata metadata = view.getBlobStore().blobMetadata(containerName, blobName);
         assertEquals(Strings2.toStringAndClose(view.utils().http().get(metadata.getPublicUri())), payload);
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 uploadByteSource(String container, String name, String contentDisposition,
         ByteSource byteSource) throws IOException {
      BlobStore blobStore = view.getBlobStore();
      blobStore.putBlob(container, blobStore.blobBuilder(name)
            .payload(new ByteSourcePayload(byteSource))
            .contentType("text/plain")
            .contentMD5(byteSource.hash(md5()))
            .contentLength(byteSource.size())
            .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
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.