Examples of MutableBlobMetadata


Examples of org.jclouds.blobstore.domain.MutableBlobMetadata

      this.blobFactory = checkNotNull(blobFactory, "blobFactory");
   }

   public Blob apply(HttpResponse from) {
      checkNotNull(from, "request");
      MutableBlobMetadata metadata = metadataParser.apply(from);
      Blob blob = blobFactory.create(metadata);
      blob.getAllHeaders().putAll(from.getHeaders());
      blob.setPayload(from.getPayload());
      return blob;
   }
View Full Code Here

Examples of org.jclouds.blobstore.domain.MutableBlobMetadata

   public MutableBlobMetadata apply(HttpResponse from) {
      checkNotNull(from, "request");
      checkState(name != null, "name must be initialized by now");

      MutableBlobMetadata to = metadataFactory.get();
      to.setName(name);
      to.setUri(endpoint);
      if (from.getPayload() != null)
         HttpUtils.copy(from.getPayload().getContentMetadata(), to.getContentMetadata());
      addETagTo(from, to);
      parseLastModifiedOrThrowException(from, to);
      addUserMetadataTo(from, to);
      return to;
   }
View Full Code Here

Examples of org.jclouds.blobstore.domain.MutableBlobMetadata

   public void testSetLastModified() {
      HttpResponse from = HttpResponse.builder()
                                      .statusCode(200).message("ok")
                                      .payload("")
                                      .addHeader(HttpHeaders.LAST_MODIFIED, "Wed, 09 Sep 2009 19:50:23 GMT").build();
      MutableBlobMetadata metadata = blobMetadataProvider.get();
      parser.parseLastModifiedOrThrowException(from, metadata);
      assertEquals(metadata.getLastModified(), new SimpleDateFormatDateService()
               .rfc822DateParse("Wed, 09 Sep 2009 19:50:23 GMT"));
   }
View Full Code Here

Examples of org.jclouds.blobstore.domain.MutableBlobMetadata

   public void testSetLastModifiedIso8601() {
      HttpResponse from = HttpResponse.builder()
                                      .statusCode(200).message("ok")
                                      .payload("")
                                      .addHeader(HttpHeaders.LAST_MODIFIED, "2011-01-28T17:35:08.000Z").build();
      MutableBlobMetadata metadata = blobMetadataProvider.get();
      parser.parseLastModifiedOrThrowException(from, metadata);
      assertEquals(metadata.getLastModified(), new SimpleDateFormatDateService()
               .iso8601DateParse("2011-01-28T17:35:08.000Z"));
   }
View Full Code Here

Examples of org.jclouds.blobstore.domain.MutableBlobMetadata

   @Test(expectedExceptions = HttpException.class)
   public void testSetLastModifiedException() {
      HttpResponse from = HttpResponse.builder()
                                      .statusCode(200).message("ok")
                                      .payload("").build();
      MutableBlobMetadata metadata = blobMetadataProvider.get();
      parser.parseLastModifiedOrThrowException(from, metadata);
   }
View Full Code Here

Examples of org.jclouds.blobstore.domain.MutableBlobMetadata

   public void testAddETagTo() {
      HttpResponse from = HttpResponse.builder()
                                      .statusCode(200).message("ok")
                                      .payload("")
                                      .addHeader(HttpHeaders.ETAG, "0xfeb").build();
      MutableBlobMetadata metadata = blobMetadataProvider.get();
      parser.addETagTo(from, metadata);
      assertEquals(metadata.getETag(), "0xfeb");
   }
View Full Code Here

Examples of org.jclouds.blobstore.domain.MutableBlobMetadata

   public void testAddUserMetadataTo() {
      HttpResponse from = HttpResponse.builder()
                                      .statusCode(200).message("ok")
                                      .payload("")
                                      .addHeader("prefix" + "key", "value").build();
      MutableBlobMetadata metadata = blobMetadataProvider.get();
      parser.addUserMetadataTo(from, metadata);
      assertEquals(metadata.getUserMetadata().get("key"), "value");
   }
View Full Code Here

Examples of org.jclouds.blobstore.domain.MutableBlobMetadata

   }

   public MutableBlobMetadata apply(ObjectInfo from) {
      if (from == null)
         return null;
      MutableBlobMetadata to = super.apply(from);
      to.setPublicUri(publicUriForObjectInfo.apply(from));

      return to;
   }
View Full Code Here

Examples of org.jclouds.blobstore.domain.MutableBlobMetadata

                                          .addHeader("Content-Range", "0-10485759/20232760").build();

      response.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      response.getPayload().getContentMetadata().setContentLength(10485760l);

      MutableBlobMetadata meta = blobMetadataProvider.get();
      expect(metadataParser.apply(response)).andReturn(meta);
      replay(metadataParser);

      Blob object = callable.apply(response);
      assertEquals(object.getPayload().getContentMetadata().getContentLength(), Long.valueOf(10485760));
View Full Code Here

Examples of org.jclouds.blobstore.domain.MutableBlobMetadata

   };

   @Test
   public void test1() {
      MutableBlobMetadata md = blobMetadataProvider.get();
      md.setName("dir/");
      md.setId("dir/");
      StorageMetadata rd = parser.apply(md);
      assertEquals(rd.getName(), "dir");
      assertEquals(rd.getProviderId(), "dir/");
      assertEquals(rd.getType(), StorageType.RELATIVE_PATH);
   }
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.