Package org.jclouds.blobstore

Examples of org.jclouds.blobstore.BlobMap$Factory


   @Override
   @Test(groups = { "integration", "live" })
   public void testValues() throws IOException, InterruptedException {
      String bucketName = getContainerName();
      try {
         BlobMap map = createMap(view, bucketName);

         putFiveStrings(map);
         putFiveStringsUnderPath(map);

         Collection<Blob> blobs = map.values();
         assertConsistencyAwareMapSize(map, 5);
         Set<String> blobsAsString = Sets.newLinkedHashSet();
         for (Blob blob : blobs) {
            blobsAsString.add(getContentAsStringOrNullAndClose(blob));
         }
View Full Code Here


   @Override
   @Test(groups = { "integration", "live" })
   public void testEntrySet() throws IOException, InterruptedException {
      String bucketName = getContainerName();
      try {
         final BlobMap map = createMap(view, bucketName);
         putFiveStrings(map);
         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() {
               for (Blob blob : map.values()) {
                  try {
                     assertEquals(getContentAsStringOrNullAndClose(blob), "");
                  } catch (IOException e) {
                     Throwables.propagate(e);
                  }
View Full Code Here

   public void testPutMoreThanSingleListing() throws InterruptedException, ExecutionException, TimeoutException {
      if (maxResultsForTestListings() == 0)
         return;
      String bucketName = getContainerName();
      try {
         BlobMap map = createMap(view, bucketName);
         Builder<String> keySet = ImmutableSet.builder();
         for (int i = 0; i < maxResultsForTestListings() + 1; i++) {
            keySet.add(i + "");
         }

         Map<String, Blob> newMap = Maps.newLinkedHashMap();
         for (String key : keySet.build()) {
            newMap.put(key, map.blobBuilder().name(key).payload(key).build());
         }
         map.putAll(newMap);
         newMap.clear();

         assertConsistencyAwareMapSize(map, maxResultsForTestListings() + 1);
         assertConsistencyAwareKeySetEquals(map, keySet.build());
         map.clear();
         assertConsistencyAwareMapSize(map, 0);
      } finally {
         returnContainer(bucketName);
      }
   }
View Full Code Here

      return context.createBlobMap(bucket, options);
   }

   @Override
   protected void addTenObjectsUnderPrefix(String containerName, String prefix) throws InterruptedException {
      BlobMap blobMap = createMap(view, containerName, inDirectory(prefix));
      for (int i = 0; i < 10; i++) {
         blobMap.put(i + "", blobMap.blobBuilder().name(i + "").payload(i + "content").build());
      }
   }
View Full Code Here

      }
   }

   @Override
   protected void addTenObjectsUnderRoot(String containerName) throws InterruptedException {
      BlobMap blobMap = createMap(view, containerName, ListContainerOptions.NONE);
      for (int i = 0; i < 10; i++) {
         blobMap.put(i + "", blobMap.blobBuilder().name(i + "").payload(i + "content").build());
      }
   }
View Full Code Here

   }

   @Override
   public PollResult poll(boolean initial, Object checkPoint) throws Exception {
      String container = containerName.get();
      BlobMap blobs = ctx.createBlobMap(container);
      Map<String, Object> props = ImmutableMap.copyOf(filterValues(transformEntries(blobs, toStringOrNull), notNull()));
      log.info("{}: {} properties in container {}", new Object[] { ctx.unwrap().getName(), props.size(), container });
      return PollResult.createFull(props);
   }
View Full Code Here

      // TODO can expiry data be stored in a blob's metadata? More efficient purging that way. See
      // https://jira.jboss.org/jira/browse/ISPN-334
      if (!cfg.isLazyPurgingOnly()) {
         acquireGlobalLock(false);
         try {
            final BlobMap blobMap = ctx.createBlobMap(containerName);
            if (multiThreadedPurge) {
               purgerService.execute(new Runnable() {
                  public void run() {
                     try {
                        purge(blobMap);
View Full Code Here

   @Override
   @Test(groups = { "integration", "live" })
   public void testValues() throws IOException, InterruptedException {
      String bucketName = getContainerName();
      try {
         BlobMap map = createMap(view, bucketName);

         putFiveStrings(map);
         putFiveStringsUnderPath(map);

         Collection<Blob> blobs = map.values();
         assertConsistencyAwareMapSize(map, 5);
         Set<String> blobsAsString = Sets.newLinkedHashSet();
         for (Blob blob : blobs) {
            blobsAsString.add(getContentAsStringOrNullAndClose(blob));
         }
View Full Code Here

   @Override
   @Test(groups = { "integration", "live" })
   public void testEntrySet() throws IOException, InterruptedException {
      String bucketName = getContainerName();
      try {
         final BlobMap map = createMap(view, bucketName);
         putFiveStrings(map);
         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() {
               for (Blob blob : map.values()) {
                  try {
                     assertEquals(getContentAsStringOrNullAndClose(blob), "");
                  } catch (IOException e) {
                     Throwables.propagate(e);
                  }
View Full Code Here

   public void testPutMoreThanSingleListing() throws InterruptedException, ExecutionException, TimeoutException {
      if (maxResultsForTestListings() == 0)
         return;
      String bucketName = getContainerName();
      try {
         BlobMap map = createMap(view, bucketName);
         Builder<String> keySet = ImmutableSet.builder();
         for (int i = 0; i < maxResultsForTestListings() + 1; i++) {
            keySet.add(i + "");
         }

         Map<String, Blob> newMap = Maps.newLinkedHashMap();
         for (String key : keySet.build()) {
            newMap.put(key, map.blobBuilder().name(key).payload(key).build());
         }
         map.putAll(newMap);
         newMap.clear();

         assertConsistencyAwareMapSize(map, maxResultsForTestListings() + 1);
         assertConsistencyAwareKeySetEquals(map, keySet.build());
         map.clear();
         assertConsistencyAwareMapSize(map, 0);
      } finally {
         returnContainer(bucketName);
      }
   }
View Full Code Here

TOP

Related Classes of org.jclouds.blobstore.BlobMap$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.