Examples of BlobMetadata


Examples of org.jclouds.blobstore.domain.BlobMetadata

      case CONTAINER:
      case FOLDER:
      case RELATIVE_PATH:
         return metadata.getName();
      case BLOB:
         BlobMetadata blobMd = (BlobMetadata) metadata;
         for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) {
            if (metadata.getName().endsWith(suffix)) {
               return metadata.getName().substring(0, metadata.getName().lastIndexOf(suffix));
            }
         }
         // It is important that this is last, in case there is a file with a known directory
         // suffix who also has content type set to application/directory
         if (blobMd.getContentMetadata().getContentType() != null
               && blobMd.getContentMetadata().getContentType().equals("application/directory"))
            return metadata.getName();
      }
      return null;
   }
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobMetadata

                                      .statusCode(200).message("ok")
                                      .payload("")
                                      .addHeader(HttpHeaders.LAST_MODIFIED, "Wed, 09 Sep 2009 19:50:23 GMT").build();
      from.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      from.getPayload().getContentMetadata().setContentLength(100l);
      BlobMetadata metadata = parser.apply(from);
      assertEquals(metadata.getName(), "key");
   }
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobMetadata

    public void testBlobMetadata_withDefaultMetadata() throws IOException {
        String BLOB_KEY = TestUtils.createRandomBlobKey(null, null);
        // create the blob
        TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY);

        BlobMetadata metadata = blobStore.blobMetadata(CONTAINER_NAME, BLOB_KEY);
        assertNotNull(metadata, "Metadata null");

        assertEquals(metadata.getName(), BLOB_KEY, "Wrong blob name");
        assertEquals(metadata.getType(), StorageType.BLOB, "Wrong blob type");
        assertEquals(metadata.getContentMetadata().getContentType(), "application/unknown", "Wrong blob content-type");
        assertEquals(base16().lowerCase().encode(metadata.getContentMetadata().getContentMD5()), metadata.getETag(),
                "Wrong blob MD5");
        assertEquals(metadata.getLocation(), null, "Wrong blob location");
        assertEquals(metadata.getProviderId(), null, "Wrong blob provider id");
        assertEquals(metadata.getUri(), null, "Wrong blob URI");
        assertNotNull(metadata.getUserMetadata(), "No blob UserMetadata");
        assertEquals(metadata.getUserMetadata().size(), 0, "Wrong blob UserMetadata");
        // metadata.getLastModified()
        File file = new File(TARGET_CONTAINER_NAME, BLOB_KEY);
        assertEquals(metadata.getContentMetadata().getContentLength(), Long.valueOf(file.length()), "Wrong blob size");
    }
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobMetadata

   /**
    * parses the http response headers to create a new {@link MutableBlobProperties} object.
    */
   public MutableBlobProperties apply(HttpResponse from) {
      BlobMetadata base = blobMetadataParser.apply(from);
      MutableBlobProperties to = blobToBlobProperties.apply(base);
      to.setContainer(container);
      return to;
   }
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobMetadata

         addBlobToContainer(containerName, blob);
         validateContent(containerName, key);

         PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, maxResults(1));

         BlobMetadata metadata = (BlobMetadata) getOnlyElement(container);
         // transient container should be lenient and not return metadata on undetailed listing.

         assertEquals(metadata.getUserMetadata().size(), 0);

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

Examples of org.jclouds.blobstore.domain.BlobMetadata

         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

Examples of org.jclouds.blobstore.domain.BlobMetadata

         view.getBlobStore().putBlob(containerName,
                  view.getBlobStore().blobBuilder("hello").payload(TEST_STRING).build());
         assertConsistencyAwareContainerSize(containerName, 1);

         BlobMetadata metadata = view.getBlobStore().blobMetadata(containerName, "hello");

         assert metadata.getPublicUri() != null : metadata;

         assertEquals(Strings2.toStringAndClose(view.utils().http().get(metadata.getPublicUri())), TEST_STRING);

      } finally {
         // this container is now public, so we can't reuse it directly
         recycleContainerAndAddToPool(containerName);
      }
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobMetadata

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

         assertConsistencyAwareBlobInLocation(containerName, blobName, nonDefault);

      } finally {
         // this container is now public, so we can't reuse it directly
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobMetadata

         view.getBlobStore().putBlob(containerName,
                  view.getBlobStore().blobBuilder("hello").payload(TEST_STRING).build());
         assertConsistencyAwareContainerSize(containerName, 1);

         BlobMetadata metadata = view.getBlobStore().blobMetadata(containerName, "hello");

         assert metadata.getPublicUri() != null : metadata;

         assertEquals(Strings2.toStringAndClose(view.utils().http().get(metadata.getPublicUri())), TEST_STRING);

      } finally {
         // this container is now public, so we can't reuse it directly
         recycleContainer(containerName);
      }
View Full Code Here

Examples of org.jclouds.blobstore.domain.BlobMetadata

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

         assertConsistencyAwareBlobInLocation(containerName, blobName, nonDefault);

      } finally {
         // this container is now public, so we can't reuse it directly
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.