Package org.jclouds.blobstore

Examples of org.jclouds.blobstore.BlobStore


   @Test(groups = { "integration", "live" })
   public void testChunksAreDeletedWhenMultipartBlobIsDeleted() throws IOException, InterruptedException {
      String containerName = getContainerName();
      try {
         BlobStore blobStore = view.getBlobStore();

         long countBefore = blobStore.countBlobs(containerName);
         String blobName = "deleteme.txt";
         addMultipartBlobToContainer(containerName, blobName);

         blobStore.removeBlob(containerName, blobName);
         long countAfter = blobStore.countBlobs(containerName);

         assertEquals(countAfter, countBefore);
      } finally {
          returnContainer(containerName);
      }
View Full Code Here


      File file = new File("target/const.txt");
      Files.copy(oneHundredOneConstitutions, file);
      String containerName = getContainerName();

      try {
         BlobStore blobStore = view.getBlobStore();
         blobStore.createContainerInLocation(null, containerName);
         Blob blob = blobStore.blobBuilder("const.txt").payload(file).build();
         String expected = blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());
         String etag = blobStore.blobMetadata(containerName, "const.txt").getETag();
         assertEquals(etag, expected);
      } finally {
         returnContainer(containerName);
      }
   }
View Full Code Here

      File file = new File("target/const.txt");
      Files.copy(input, file);
      String containerName = getContainerName();

      try {
         BlobStore blobStore = view.getBlobStore();
         blobStore.createContainerInLocation(null, containerName);
         Blob blob = blobStore.blobBuilder("const.txt").payload(file).build();
         String expected = blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());
         String etag = blobStore.blobMetadata(containerName, "const.txt").getETag();
         assertEquals(etag, expected);
      } finally {
         returnContainer(containerName);
      }
   }
View Full Code Here

      }
   }

   @Test(groups = { "integration", "live" })
   public void testDuplicateCreateContainer() {
      BlobStore blobStore = view.getBlobStore();
      Location location = null;
      String container = "container";
      boolean created;

      created = blobStore.createContainerInLocation(location, container);
      assertTrue(created);

      created = blobStore.createContainerInLocation(location, container);
      assertFalse(created);
   }
View Full Code Here

   }

   private void runCreateContainerInLocation(String payload, Location nonDefault) throws InterruptedException,
            IOException {
      String blobName = "hello";
      BlobStore blobStore = view.getBlobStore();
      final String containerName = getScratchContainerName();
      try {
         Logger.getAnonymousLogger().info(
                  String.format("creating public container %s in location %s", containerName, nonDefault.getId()));
         blobStore.createContainerInLocation(nonDefault, containerName, publicRead());
         assertConsistencyAwareContainerExists(containerName);
         assertConsistencyAwareContainerInLocation(containerName, nonDefault);

         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);
View Full Code Here

   protected String text = "fooooooooooooooooooooooo";
   protected GetOptions options = range(0, 1);

   @Test
   public void testSignGetBlob() {
      BlobStore getBlob = requestsSendResponses(init());
      assertEquals(getBlob.getContext().getSigner().signGetBlob(container, name), getBlob());
   }
View Full Code Here

   protected abstract HttpRequest getBlob();

   @Test
   public void testSignGetBlobWithTime() {
      BlobStore getBlobWithTime = requestsSendResponses(init());
      HttpRequest compare = getBlobWithTime();
      assertEquals(getBlobWithTime.getContext().getSigner().signGetBlob(container, name, 3l /* seconds */),
            compare);
   }
View Full Code Here

   protected abstract HttpRequest getBlobWithTime();

   @Test
   public void testSignGetBlobWithOptions() {
      BlobStore getBlobWithOptions = requestsSendResponses(init());
      assertEquals(getBlobWithOptions.getContext().getSigner().signGetBlob(container, name, options),
            getBlobWithOptions());
   }
View Full Code Here

   protected abstract HttpRequest getBlobWithOptions();

   @Test
   public void testSignRemoveBlob() {
      BlobStore removeBlob = requestsSendResponses(init());
      assertEquals(removeBlob.getContext().getSigner().signRemoveBlob(container, name), removeBlob());
   }
View Full Code Here

      assertEquals(removeBlob.getContext().getSigner().signRemoveBlob(container, name), removeBlob());
   }

   @Test
   public void testSignPutBlob() throws Exception {
      BlobStore signPutBlob = requestsSendResponses(init());
      Blob blob = signPutBlob.blobBuilder("name").forSigning().contentLength(2l).contentMD5(new byte[] { 0, 2, 4, 8 })
            .contentType("text/plain").expires(new Date(1000)).build();
      HttpRequest compare = putBlob();
      compare.setPayload(blob.getPayload());
      assertEquals(signPutBlob.getContext().getSigner().signPutBlob(container, blob), compare);
   }
View Full Code Here

TOP

Related Classes of org.jclouds.blobstore.BlobStore

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.