Package org.jclouds.blobstore.domain

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


         assertConsistencyAwareMapSize(map, 5);
         Set<Entry<String, Blob>> entries = map.entrySet();
         assertEquals(entries.size(), 5);
         for (Entry<String, Blob> entry : entries) {
            assertEquals(fiveStrings.get(entry.getKey()), getContentAsStringOrNullAndClose(entry.getValue()));
            Blob blob = entry.getValue();
            blob.setPayload("");
            Payloads.calculateMD5(blob);
            entry.setValue(blob);
         }
         assertConsistencyAware(new Runnable() {
            public void run() {
View Full Code Here


   public void testContains() throws InterruptedException, ExecutionException, TimeoutException, IOException {
      String bucketName = getContainerName();
      try {
         Map<String, Blob> map = createMap(view, bucketName);
         putStringWithMD5(map, "one", "apple");
         Blob blob = view.getBlobStore().blobBuilder("one").payload("apple").calculateMD5().build();
         assertConsistencyAwareContainsValue(map, blob);
      } finally {
         returnContainer(bucketName);
      }
   }
View Full Code Here

   @Test(groups = { "integration", "live" })
   public void testPut() throws IOException, InterruptedException {
      String bucketName = getContainerName();
      try {
         Map<String, Blob> map = createMap(view, bucketName);
         Blob blob = view.getBlobStore().blobBuilder("one").payload(Strings2.toInputStream("apple")).calculateMD5()
               .build();
         Blob old = map.put(blob.getMetadata().getName(), blob);
         getOneReturnsAppleAndOldValueIsNull(map, old);
         blob.setPayload(Strings2.toInputStream("bear"));
         Payloads.calculateMD5(blob);
         Blob apple = map.put(blob.getMetadata().getName(), blob);
         getOneReturnsBearAndOldValueIsApple(map, apple);
      } finally {
         returnContainer(bucketName);
      }
   }
View Full Code Here

   public void testPutTwiceIsOkAndDoesntOverwrite() throws InterruptedException {
      String containerName = getContainerName();
      try {
         view.getBlobStore().createContainerInLocation(null, containerName);

         Blob blob = view.getBlobStore().blobBuilder("hello").payload(TEST_STRING).build();
         view.getBlobStore().putBlob(containerName, blob);

         view.getBlobStore().createContainerInLocation(null, containerName);
         assertEquals(view.getBlobStore().countBlobs(containerName), 1);
      } finally {
View Full Code Here

   @Test
   public void testSignGetUrl() throws Exception {
      String name = "hello";
      String text = "fooooooooooooooooooooooo";

      Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
      String container = getContainerName();
      try {
         view.getBlobStore().putBlob(container, blob);
         assertConsistencyAwareContainerSize(container, 1);
         HttpRequest request = view.getSigner().signGetBlob(container, name);
View Full Code Here

   @Test
   public void testSignGetUrlOptions() throws Exception {
      String name = "hello";
      String text = "fooooooooooooooooooooooo";

      Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
      String container = getContainerName();
      try {
         view.getBlobStore().putBlob(container, blob);
         assertConsistencyAwareContainerSize(container, 1);
         HttpRequest request = view.getSigner().signGetBlob(container, name, range(0, 1));
View Full Code Here

   @Test
   public void testSignGetUrlWithTime() throws InterruptedException, IOException {
      String name = "hello";
      String text = "fooooooooooooooooooooooo";

      Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
      String container = getContainerName();
      try {
         view.getBlobStore().putBlob(container, blob);
         assertConsistencyAwareContainerSize(container, 1);
         HttpRequest request = view.getSigner().signGetBlob(container, name, 3 /* seconds */);
 
View Full Code Here

   @Test
   public void testSignPutUrl() throws Exception {
      String name = "hello";
      String text = "fooooooooooooooooooooooo";

      Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
      String container = getContainerName();
      try {
         HttpRequest request = view.getSigner().signPutBlob(container, blob);
         assertEquals(request.getFilters().size(), 0);
         Strings2.toString(view.utils().http().invoke(request).getPayload());
View Full Code Here

   @Test
   public void testSignPutUrlWithTime() throws Exception {
      String name = "hello";
      String text = "fooooooooooooooooooooooo";

      Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
      String container = getContainerName();
      try {
         HttpRequest request = view.getSigner().signPutBlob(container, blob, 3 /* seconds */);
         assertEquals(request.getFilters().size(), 0);

View Full Code Here

   @Test
   public void testSignRemoveUrl() throws Exception {
      String name = "hello";
      String text = "fooooooooooooooooooooooo";

      Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
      String container = getContainerName();
      try {
         view.getBlobStore().putBlob(container, blob);
         assertConsistencyAwareContainerSize(container, 1);
         HttpRequest request = view.getSigner().signRemoveBlob(container, name);
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.