Package org.jclouds.blobstore.domain

Examples of org.jclouds.blobstore.domain.Blob$Factory


            responses.put(i, this.exec.submit(new Callable<Void>() {

               @Override
               public Void call() throws Exception {
                  String name = blobCount.incrementAndGet() + "";
                  Blob blob = view.getBlobStore().blobBuilder(name).payload(testPayload).build();
                  view.getBlobStore().putBlob(container, blob);
                  assertConsistencyAwareBlobExists(container, name);
                  blob = view.getBlobStore().getBlob(container, name);

                  assert Arrays.equals(md5Supplier(blob.getPayload()), md5) : String.format(
                           "md5 didn't match on %s/%s", container, name);

                  view.getBlobStore().removeBlob(container, name);
                  assertConsistencyAwareBlobDoesntExist(container, name);
                  return null;
View Full Code Here


      try {

         String name = "apples";

         addObjectAndValidateContent(container, name);
         Blob blob1 = view.getBlobStore().getBlob(container, name, range(0, 5));
         validateMetadata(blob1.getMetadata(), container, name);
         assertEquals(getContentAsStringOrNullAndClose(blob1), TEST_STRING.substring(0, 6));

         Blob blob2 = view.getBlobStore().getBlob(container, name, range(6, TEST_STRING.length()));
         validateMetadata(blob2.getMetadata(), container, name);
         assertEquals(getContentAsStringOrNullAndClose(blob2), TEST_STRING.substring(6, TEST_STRING.length()));
      } finally {
         returnContainer(container);
      }
   }
View Full Code Here

      try {

         String name = "apples";

         addObjectAndValidateContent(container, name);
         Blob blob = view.getBlobStore().getBlob(container, name, range(0, 5).range(6, TEST_STRING.length()));
         validateMetadata(blob.getMetadata(), container, name);
         assertEquals(getContentAsStringOrNullAndClose(blob), TEST_STRING);
      } finally {
         returnContainer(container);
      }
   }
View Full Code Here

               .contentType(type);
      addContentMetadata(blobBuilder);
      if (content instanceof InputStream) {
         blobBuilder.calculateMD5();
      }
      Blob blob = blobBuilder.build();
      String container = getContainerName();
      try {
         assertNotNull(view.getBlobStore().putBlob(container, blob));
         blob = view.getBlobStore().getBlob(container, blob.getMetadata().getName());
         validateMetadata(blob.getMetadata(), container, name);
         checkContentMetadata(blob);

         String returnedString = getContentAsStringOrNullAndClose(blob);
         assertEquals(returnedString, realObject);
         PageSet<? extends StorageMetadata> set = view.getBlobStore().list(container);
View Full Code Here

                     outstream.write("foo".getBytes());
                  }
               }));
      addContentMetadata(blobBuilder);

      Blob blob = blobBuilder.build();

      String container = getContainerName();
      try {

         assertNotNull(view.getBlobStore().putBlob(container, blob));

         blob = view.getBlobStore().getBlob(container, blob.getMetadata().getName());
         String returnedString = getContentAsStringOrNullAndClose(blob);
         assertEquals(returnedString, "foo");
         validateMetadata(blob.getMetadata(), container, blob.getMetadata().getName());
         checkContentMetadata(blob);
         PageSet<? extends StorageMetadata> set = view.getBlobStore().list(container);
         assert set.size() == 1 : set;
      } finally {
         returnContainer(container);
View Full Code Here

   public void testMetadata() throws InterruptedException, IOException {
      String name = "hello";
      // NOTE all metadata in jclouds comes out as lowercase, in an effort to
      // normalize the
      // providers.
      Blob blob = view.getBlobStore().blobBuilder(name).userMetadata(ImmutableMap.of("Adrian", "powderpuff"))
               .payload(TEST_STRING).contentType(MediaType.TEXT_PLAIN).calculateMD5().build();
      String container = getContainerName();
      try {
         assertNull(view.getBlobStore().blobMetadata(container, "powderpuff"));

         addBlobToContainer(container, blob);
         Blob newObject = validateContent(container, name);

         BlobMetadata metadata = newObject.getMetadata();

         validateMetadata(metadata);
         validateMetadata(metadata, container, name);
         validateMetadata(view.getBlobStore().blobMetadata(container, name));
View Full Code Here

   }

   @Override
   public Blob get(Object key) {
      String realKey = prefixer.apply(checkNotNull(key, "key").toString());
      Blob blob = blobstore.getBlob(containerName, realKey);
      return blob != null ? stripPrefix(blob) : null;
   }
View Full Code Here

      return blob != null ? stripPrefix(blob) : null;
   }

   @Override
   public Blob put(String key, Blob value) {
      Blob returnVal = getLastValue(checkNotNull(key, "key"));
      blobstore.putBlob(containerName, correctBlobName.apply(key, value));
      return returnVal;
   }
View Full Code Here

      putBlobsStrategy.execute(containerName, transform(checkNotNull(map, "map").entrySet(), correctBlobName));
   }

   @Override
   public Blob remove(Object key) {
      Blob old = getLastValue(checkNotNull(key, "key"));
      String realKey = prefixer.apply(key.toString());
      blobstore.removeBlob(containerName, realKey);
      return old;
   }
View Full Code Here

      blobstore.removeBlob(containerName, realKey);
      return old;
   }

   private Blob getLastValue(Object key) {
      Blob old;
      try {
         old = get(checkNotNull(key, "key"));
      } catch (KeyNotFoundException e) {
         old = null;
      }
View Full Code Here

TOP

Related Classes of org.jclouds.blobstore.domain.Blob$Factory

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.