Package org.jclouds.azureblob.domain

Examples of org.jclouds.azureblob.domain.BlobProperties


            base16().lowerCase().encode(object.getProperties().getContentMetadata().getContentMD5()));
      // Test HEAD of missing object
      assert getApi().getBlobProperties(privateContainer, "non-existent-object") == null;

      // Test HEAD of object
      BlobProperties metadata = getApi().getBlobProperties(privateContainer, object.getProperties().getName());
      // TODO assertEquals(metadata.getName(),
      // object.getProperties().getName());
      // we can't check this while hacking around lack of content-md5, as GET of
      // the first byte will
      // show incorrect length 1, the returned size, as opposed to the real
      // length. This is an ok
      // tradeoff, as a container list will contain the correct size of the
      // objects in an
      // inexpensive fashion
      // http://code.google.com/p/jclouds/issues/detail?id=92
      // assertEquals(metadata.getSize(), data.length());
      assertEquals(metadata.getContentMetadata().getContentType(), "text/plain");
      // Azure doesn't return the Content-MD5 on head request..
      assertEquals(base16().lowerCase().encode(md5),
            base16().lowerCase().encode(object.getProperties().getContentMetadata().getContentMD5()));
      assertEquals(metadata.getETag(), newEtag);
      assertEquals(metadata.getMetadata().entrySet().size(), 1);
      assertEquals(metadata.getMetadata().get("mykey"), "metadata-value");

      // // Test POST to update object's metadata
      // Multimap<String, String> userMetadata = LinkedHashMultimap.create();
      // userMetadata.put("New-Metadata-1", "value-1");
      // userMetadata.put("New-Metadata-2", "value-2");
      // assertTrue(getApi().setBlobProperties(privateContainer,
      // object.getProperties().getName(),
      // userMetadata));

      // Test GET of missing object
      assert getApi().getBlob(privateContainer, "non-existent-object") == null;

      // Test GET of object (including updated metadata)
      AzureBlob getBlob = getApi().getBlob(privateContainer, object.getProperties().getName());
      assertEquals(Strings2.toString(getBlob.getPayload()), data);
      // TODO assertEquals(getBlob.getName(), object.getProperties().getName());
      assertEquals(getBlob.getPayload().getContentMetadata().getContentLength(), Long.valueOf(data.length()));
      assertEquals(getBlob.getProperties().getContentMetadata().getContentType(), "text/plain");
      assertEquals(base16().lowerCase().encode(md5),
            base16().lowerCase().encode(getBlob.getProperties().getContentMetadata().getContentMD5()));
      assertEquals(newEtag, getBlob.getProperties().getETag());
      // wait until we can update metadata
      // assertEquals(getBlob.getProperties().getMetadata().entries().size(),
      // 2);
      // assertEquals(
      // Iterables.getLast(getBlob.getProperties().getMetadata().get("New-Metadata-1")),
      // "value-1");
      // assertEquals(
      // Iterables.getLast(getBlob.getProperties().getMetadata().get("New-Metadata-2")),
      // "value-2");
      assertEquals(metadata.getMetadata().entrySet().size(), 1);
      assertEquals(metadata.getMetadata().get("mykey"), "metadata-value");

      // test listing
      ListBlobsResponse response = getApi().listBlobs(
            privateContainer,
            ListBlobsOptions.Builder
View Full Code Here


            base16().lowerCase().encode(object.getProperties().getContentMetadata().getContentMD5()));
      // Test HEAD of missing object
      assert getApi().getBlobProperties(privateContainer, "non-existent-object") == null;

      // Test HEAD of object
      BlobProperties metadata = getApi().getBlobProperties(privateContainer, object.getProperties().getName());
      // TODO assertEquals(metadata.getName(),
      // object.getProperties().getName());
      // we can't check this while hacking around lack of content-md5, as GET of
      // the first byte will
      // show incorrect length 1, the returned size, as opposed to the real
      // length. This is an ok
      // tradeoff, as a container list will contain the correct size of the
      // objects in an
      // inexpensive fashion
      // http://code.google.com/p/jclouds/issues/detail?id=92
      // assertEquals(metadata.getSize(), data.length());
      assertEquals(metadata.getContentMetadata().getContentType(), "text/plain");
      // Azure doesn't return the Content-MD5 on head request..
      assertEquals(base16().lowerCase().encode(md5),
            base16().lowerCase().encode(object.getProperties().getContentMetadata().getContentMD5()));
      assertEquals(metadata.getETag(), newEtag);
      assertEquals(metadata.getMetadata().entrySet().size(), 1);
      assertEquals(metadata.getMetadata().get("mykey"), "metadata-value");

      // // Test POST to update object's metadata
      // Multimap<String, String> userMetadata = LinkedHashMultimap.create();
      // userMetadata.put("New-Metadata-1", "value-1");
      // userMetadata.put("New-Metadata-2", "value-2");
      // assertTrue(getApi().setBlobProperties(privateContainer,
      // object.getProperties().getName(),
      // userMetadata));

      // Test GET of missing object
      assert getApi().getBlob(privateContainer, "non-existent-object") == null;

      // Test GET of object (including updated metadata)
      AzureBlob getBlob = getApi().getBlob(privateContainer, object.getProperties().getName());
      assertEquals(Strings2.toString(getBlob.getPayload()), data);
      // TODO assertEquals(getBlob.getName(), object.getProperties().getName());
      assertEquals(getBlob.getPayload().getContentMetadata().getContentLength(), Long.valueOf(data.length()));
      assertEquals(getBlob.getProperties().getContentMetadata().getContentType(), "text/plain");
      assertEquals(base16().lowerCase().encode(md5),
            base16().lowerCase().encode(getBlob.getProperties().getContentMetadata().getContentMD5()));
      assertEquals(newEtag, getBlob.getProperties().getETag());
      // wait until we can update metadata
      // assertEquals(getBlob.getProperties().getMetadata().entries().size(),
      // 2);
      // assertEquals(
      // Iterables.getLast(getBlob.getProperties().getMetadata().get("New-Metadata-1")),
      // "value-1");
      // assertEquals(
      // Iterables.getLast(getBlob.getProperties().getMetadata().get("New-Metadata-2")),
      // "value-2");
      assertEquals(metadata.getMetadata().entrySet().size(), 1);
      assertEquals(metadata.getMetadata().get("mykey"), "metadata-value");

      // test listing
      ListBlobsResponse response = getApi().listBlobs(
            privateContainer,
            ListBlobsOptions.Builder
View Full Code Here

   public boolean execute(String containerName, Object value, ListContainerOptions options) {
      try {
         byte[] toSearch = objectMD5.apply(value);
         for (BlobMetadata metadata : getAllBlobMetadata.execute(containerName, options)) {
            BlobProperties properties = client.getBlobProperties(containerName, metadata.getName());
            if (Arrays.equals(toSearch, properties.getContentMetadata().getContentMD5()))
               return true;
         }
         return false;
      } catch (Exception e) {
         Throwables.propagateIfPossible(e, BlobRuntimeException.class);
View Full Code Here

      } else if (qName.equals("BlobType")) {
         currentBlobType = BlobType.fromValue(currentText.toString().trim());
      } else if (qName.equals("LeaseStatus")) {
         currentLeaseStatus = LeaseStatus.fromValue(currentText.toString().trim());
      } else if (qName.equals("Blob")) {
         BlobProperties md = new BlobPropertiesImpl(currentBlobType, currentName, containerUrl.getPath().replace("/",
                  ""), currentUrl, currentLastModified, currentETag, currentSize, currentContentType,
                  currentContentMD5, currentContentEncoding, currentContentLanguage, currentExpires,
                  currentLeaseStatus, currentMetadata);
         blobMetadata.add(md);
         currentBlobType = null;
View Full Code Here

            base16().lowerCase().encode(object.getProperties().getContentMetadata().getContentMD5()));
      // Test HEAD of missing object
      assert getApi().getBlobProperties(privateContainer, "non-existent-object") == null;

      // Test HEAD of object
      BlobProperties metadata = getApi().getBlobProperties(privateContainer, object.getProperties().getName());
      // TODO assertEquals(metadata.getName(),
      // object.getProperties().getName());
      // we can't check this while hacking around lack of content-md5, as GET of
      // the first byte will
      // show incorrect length 1, the returned size, as opposed to the real
      // length. This is an ok
      // tradeoff, as a container list will contain the correct size of the
      // objects in an
      // inexpensive fashion
      // http://code.google.com/p/jclouds/issues/detail?id=92
      // assertEquals(metadata.getSize(), data.length());
      assertEquals(metadata.getContentMetadata().getContentType(), "text/plain");
      // Azure doesn't return the Content-MD5 on head request..
      assertEquals(base16().lowerCase().encode(md5),
            base16().lowerCase().encode(object.getProperties().getContentMetadata().getContentMD5()));
      assertEquals(metadata.getETag(), newEtag);
      assertEquals(metadata.getMetadata().entrySet().size(), 1);
      assertEquals(metadata.getMetadata().get("mykey"), "metadata-value");

      // // Test POST to update object's metadata
      // Multimap<String, String> userMetadata = LinkedHashMultimap.create();
      // userMetadata.put("New-Metadata-1", "value-1");
      // userMetadata.put("New-Metadata-2", "value-2");
      // assertTrue(getApi().setBlobProperties(privateContainer,
      // object.getProperties().getName(),
      // userMetadata));

      // Test GET of missing object
      assert getApi().getBlob(privateContainer, "non-existent-object") == null;

      // Test GET of object (including updated metadata)
      AzureBlob getBlob = getApi().getBlob(privateContainer, object.getProperties().getName());
      assertEquals(Strings2.toString(getBlob.getPayload()), data);
      // TODO assertEquals(getBlob.getName(), object.getProperties().getName());
      assertEquals(getBlob.getPayload().getContentMetadata().getContentLength(), Long.valueOf(data.length()));
      assertEquals(getBlob.getProperties().getContentMetadata().getContentType(), "text/plain");
      assertEquals(base16().lowerCase().encode(md5),
            base16().lowerCase().encode(getBlob.getProperties().getContentMetadata().getContentMD5()));
      assertEquals(newEtag, getBlob.getProperties().getETag());
      // wait until we can update metadata
      // assertEquals(getBlob.getProperties().getMetadata().entries().size(),
      // 2);
      // assertEquals(
      // Iterables.getLast(getBlob.getProperties().getMetadata().get("New-Metadata-1")),
      // "value-1");
      // assertEquals(
      // Iterables.getLast(getBlob.getProperties().getMetadata().get("New-Metadata-2")),
      // "value-2");
      assertEquals(metadata.getMetadata().entrySet().size(), 1);
      assertEquals(metadata.getMetadata().get("mykey"), "metadata-value");

      // test listing
      ListBlobsResponse response = getApi().listBlobs(
            privateContainer,
            ListBlobsOptions.Builder
View Full Code Here

            base16().lowerCase().encode(object.getProperties().getContentMetadata().getContentMD5()));
      // Test HEAD of missing object
      assert getApi().getBlobProperties(privateContainer, "non-existent-object") == null;

      // Test HEAD of object
      BlobProperties metadata = getApi().getBlobProperties(privateContainer, object.getProperties().getName());
      // TODO assertEquals(metadata.getName(),
      // object.getProperties().getName());
      // we can't check this while hacking around lack of content-md5, as GET of
      // the first byte will
      // show incorrect length 1, the returned size, as opposed to the real
      // length. This is an ok
      // tradeoff, as a container list will contain the correct size of the
      // objects in an
      // inexpensive fashion
      // http://code.google.com/p/jclouds/issues/detail?id=92
      // assertEquals(metadata.getSize(), data.length());
      assertEquals(metadata.getContentMetadata().getContentType(), "text/plain");
      // Azure doesn't return the Content-MD5 on head request..
      assertEquals(base16().lowerCase().encode(md5),
            base16().lowerCase().encode(object.getProperties().getContentMetadata().getContentMD5()));
      assertEquals(metadata.getETag(), newEtag);
      assertEquals(metadata.getMetadata().entrySet().size(), 1);
      assertEquals(metadata.getMetadata().get("mykey"), "metadata-value");

      // // Test POST to update object's metadata
      // Multimap<String, String> userMetadata = LinkedHashMultimap.create();
      // userMetadata.put("New-Metadata-1", "value-1");
      // userMetadata.put("New-Metadata-2", "value-2");
      // assertTrue(getApi().setBlobProperties(privateContainer,
      // object.getProperties().getName(),
      // userMetadata));

      // Test GET of missing object
      assert getApi().getBlob(privateContainer, "non-existent-object") == null;

      // Test GET of object (including updated metadata)
      AzureBlob getBlob = getApi().getBlob(privateContainer, object.getProperties().getName());
      assertEquals(Strings2.toStringAndClose(getBlob.getPayload().openStream()), data);
      // TODO assertEquals(getBlob.getName(), object.getProperties().getName());
      assertEquals(getBlob.getPayload().getContentMetadata().getContentLength(), Long.valueOf(data.length()));
      assertEquals(getBlob.getProperties().getContentMetadata().getContentType(), "text/plain");
      assertEquals(base16().lowerCase().encode(md5),
            base16().lowerCase().encode(getBlob.getProperties().getContentMetadata().getContentMD5()));
      assertEquals(newEtag, getBlob.getProperties().getETag());
      // wait until we can update metadata
      // assertEquals(getBlob.getProperties().getMetadata().entries().size(),
      // 2);
      // assertEquals(
      // Iterables.getLast(getBlob.getProperties().getMetadata().get("New-Metadata-1")),
      // "value-1");
      // assertEquals(
      // Iterables.getLast(getBlob.getProperties().getMetadata().get("New-Metadata-2")),
      // "value-2");
      assertEquals(metadata.getMetadata().entrySet().size(), 1);
      assertEquals(metadata.getMetadata().get("mykey"), "metadata-value");

      // test listing
      ListBlobsResponse response = getApi().listBlobs(
            privateContainer,
            ListBlobsOptions.Builder
View Full Code Here

            base16().lowerCase().encode(object.getProperties().getContentMetadata().getContentMD5()));
      // Test HEAD of missing object
      assert getApi().getBlobProperties(privateContainer, "non-existent-object") == null;

      // Test HEAD of object
      BlobProperties metadata = getApi().getBlobProperties(privateContainer, object.getProperties().getName());
      // TODO assertEquals(metadata.getName(),
      // object.getProperties().getName());
      // we can't check this while hacking around lack of content-md5, as GET of
      // the first byte will
      // show incorrect length 1, the returned size, as opposed to the real
      // length. This is an ok
      // tradeoff, as a container list will contain the correct size of the
      // objects in an
      // inexpensive fashion
      // http://code.google.com/p/jclouds/issues/detail?id=92
      // assertEquals(metadata.getSize(), data.length());
      assertEquals(metadata.getContentMetadata().getContentType(), "text/plain");
      // Azure doesn't return the Content-MD5 on head request..
      assertEquals(base16().lowerCase().encode(md5),
            base16().lowerCase().encode(object.getProperties().getContentMetadata().getContentMD5()));
      assertEquals(metadata.getETag(), newEtag);
      assertEquals(metadata.getMetadata().entrySet().size(), 1);
      assertEquals(metadata.getMetadata().get("mykey"), "metadata-value");

      // // Test POST to update object's metadata
      // Multimap<String, String> userMetadata = LinkedHashMultimap.create();
      // userMetadata.put("New-Metadata-1", "value-1");
      // userMetadata.put("New-Metadata-2", "value-2");
      // assertTrue(getApi().setBlobProperties(privateContainer,
      // object.getProperties().getName(),
      // userMetadata));

      // Test GET of missing object
      assert getApi().getBlob(privateContainer, "non-existent-object") == null;

      // Test GET of object (including updated metadata)
      AzureBlob getBlob = getApi().getBlob(privateContainer, object.getProperties().getName());
      assertEquals(Strings2.toString(getBlob.getPayload()), data);
      // TODO assertEquals(getBlob.getName(), object.getProperties().getName());
      assertEquals(getBlob.getPayload().getContentMetadata().getContentLength(), Long.valueOf(data.length()));
      assertEquals(getBlob.getProperties().getContentMetadata().getContentType(), "text/plain");
      assertEquals(base16().lowerCase().encode(md5),
            base16().lowerCase().encode(getBlob.getProperties().getContentMetadata().getContentMD5()));
      assertEquals(newEtag, getBlob.getProperties().getETag());
      // wait until we can update metadata
      // assertEquals(getBlob.getProperties().getMetadata().entries().size(),
      // 2);
      // assertEquals(
      // Iterables.getLast(getBlob.getProperties().getMetadata().get("New-Metadata-1")),
      // "value-1");
      // assertEquals(
      // Iterables.getLast(getBlob.getProperties().getMetadata().get("New-Metadata-2")),
      // "value-2");
      assertEquals(metadata.getMetadata().entrySet().size(), 1);
      assertEquals(metadata.getMetadata().get("mykey"), "metadata-value");

      // test listing
      ListBlobsResponse response = getApi().listBlobs(
            privateContainer,
            ListBlobsOptions.Builder
View Full Code Here

   public boolean execute(String containerName, Object value, ListContainerOptions options) {
      try {
         byte[] toSearch = objectMD5.apply(value);
         for (BlobMetadata metadata : getAllBlobMetadata.execute(containerName, options)) {
            BlobProperties properties = client.getBlobProperties(containerName, metadata.getName());
            if (Arrays.equals(toSearch, properties.getContentMetadata().getContentMD5()))
               return true;
         }
         return false;
      } catch (Exception e) {
         Throwables.propagateIfPossible(e, BlobRuntimeException.class);
View Full Code Here

      } else if (qName.equals("BlobType")) {
         currentBlobType = BlobType.fromValue(currentText.toString().trim());
      } else if (qName.equals("LeaseStatus")) {
         currentLeaseStatus = LeaseStatus.fromValue(currentText.toString().trim());
      } else if (qName.equals("Blob")) {
         BlobProperties md = new BlobPropertiesImpl(currentBlobType, currentName, containerUrl.getPath().replace("/",
                  ""), currentUrl, currentLastModified, currentETag, currentSize, currentContentType,
                  currentContentMD5, currentContentEncoding, currentContentLanguage, currentExpires,
                  currentLeaseStatus, currentMetadata);
         blobMetadata.add(md);
         currentBlobType = null;
View Full Code Here

      } else if (qName.equals("BlobType")) {
         currentBlobType = BlobType.fromValue(currentText.toString().trim());
      } else if (qName.equals("LeaseStatus")) {
         currentLeaseStatus = LeaseStatus.fromValue(currentText.toString().trim());
      } else if (qName.equals("Blob")) {
         BlobProperties md = new BlobPropertiesImpl(currentBlobType, currentName, containerUrl.getPath().replace("/",
                  ""), currentUrl, currentLastModified, currentETag, currentSize, currentContentType,
                  currentContentMD5, currentContentEncoding, currentContentLanguage, currentExpires,
                  currentLeaseStatus, currentMetadata);
         blobMetadata.add(md);
         currentBlobType = null;
View Full Code Here

TOP

Related Classes of org.jclouds.azureblob.domain.BlobProperties

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.