Exemplo n.º 1
0
  /** http://code.google.com/p/jclouds/issues/detail?id=992 */
  public void testUseBucketWithUpperCaseName() throws Exception {
    String bucketName = CONTAINER_PREFIX + "-TestBucket";
    String blobName = "TestBlob.txt";
    StorageMetadata container = null;
    BlobStore store = view.getBlobStore();

    // Create and use a valid bucket name with uppercase characters in the bucket name (US regions
    // only)
    try {
      store.createContainerInLocation(null, bucketName);

      for (StorageMetadata metadata : store.list()) {
        if (metadata.getName().equals(bucketName)) {
          container = metadata;
          break;
        }
      }

      assertNotNull(container);

      store.putBlob(
          bucketName,
          store.blobBuilder(blobName).payload("This is a test!").contentType("text/plain").build());

      assertNotNull(store.getBlob(bucketName, blobName));
    } finally {
      if (container != null) {
        store.deleteContainer(bucketName);
      }
    }

    // Try to create the same bucket successfully created above in one of the non-US regions to
    // ensure an error is
    // encountered as expected.
    Location location = null;

    for (Location pLocation : store.listAssignableLocations()) {
      if (!ImmutableSet.of(Region.US_STANDARD, Region.US_EAST_1, Region.US_WEST_1, Region.US_WEST_2)
          .contains(pLocation.getId())) {
        location = pLocation;
        break;
      }
    }

    try {
      store.createContainerInLocation(location, bucketName);
      fail("Should had failed because in non-US regions, mixed-case bucket names are invalid.");
    } catch (AWSResponseException e) {
      assertEquals("InvalidBucketName", e.getError().getCode());
    }
  }
  /** Test of blobExists method, of class FilesystemAsyncBlobStore. */
  public void testBlobExists() throws IOException {
    boolean result;
    String blobKey;

    // when location doesn't exists
    blobKey = TestUtils.createRandomBlobKey();
    try {
      blobStore.blobExists(CONTAINER_NAME, blobKey);
      fail();
    } catch (ContainerNotFoundException cnfe) {
      // expected
    }

    // when location exists
    blobStore.createContainerInLocation(null, CONTAINER_NAME);
    result = blobStore.blobExists(CONTAINER_NAME, blobKey);
    assertFalse(result, "Blob exists");

    // create blob
    TestUtils.createBlobAsFile(CONTAINER_NAME, blobKey, TestUtils.getImageForBlobPayload());
    result = blobStore.blobExists(CONTAINER_NAME, blobKey);
    assertTrue(result, "Blob doesn't exist");

    // complex path test
    blobKey = TestUtils.createRandomBlobKey("ss/asdas/", "");
    result = blobStore.blobExists(CONTAINER_NAME, blobKey);
    assertFalse(result, "Blob exists");
    TestUtils.createBlobAsFile(CONTAINER_NAME, blobKey, TestUtils.getImageForBlobPayload());
    result = blobStore.blobExists(CONTAINER_NAME, blobKey);
    assertTrue(result, "Blob doesn't exist");
  }
  /** Test of removeBlob method, with only one blob with a complex path as key */
  @Test
  public void testRemoveBlob_ComplexBlobKey() throws IOException {
    final String BLOB_KEY = TestUtils.createRandomBlobKey("aa/bb/cc/dd/", null);
    boolean result;

    // checks that blob doesn't exists
    blobStore.createContainerInLocation(null, CONTAINER_NAME);
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
    assertFalse(result, "Blob exists");
    TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY, false);

    // create the blob
    TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY);
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
    assertTrue(result, "Blob doesn't exist");

    // remove it
    blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY);
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
    assertFalse(result, "Blob still exists");
    // file removed
    TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY, false);
    // also the entire directory structure was removed
    TestUtils.directoryExists(TARGET_CONTAINER_NAME + "/aa", false);
  }
  /** Test of getBlob method, of class FilesystemAsyncBlobStore. */
  public void testGetBlob() throws IOException {
    String blobKey = TestUtils.createRandomBlobKey();
    GetOptions options = null;
    Blob resultBlob;

    blobStore.createContainerInLocation(null, CONTAINER_NAME);

    resultBlob = blobStore.getBlob(CONTAINER_NAME, blobKey, options);
    assertNull(resultBlob, "Blob exists");

    // create blob
    TestUtils.createBlobsInContainer(CONTAINER_NAME, blobKey);

    resultBlob = blobStore.getBlob(CONTAINER_NAME, blobKey, options);

    assertNotNull(resultBlob, "Blob exists");
    // checks file content
    InputSupplier<FileInputStream> expectedFile =
        Files.newInputStreamSupplier(new File(TARGET_CONTAINER_NAME, blobKey));
    assertTrue(
        ByteStreams.equal(expectedFile, resultBlob.getPayload()),
        "Blob payload differs from file content");
    // metadata are verified in the test for blobMetadata, so no need to
    // perform a complete test here
    assertNotNull(resultBlob.getMetadata(), "Metadata null");
    MutableBlobMetadata metadata = resultBlob.getMetadata();
    assertEquals(blobKey, metadata.getName(), "Wrong blob metadata");
  }
 /**
  * Test of putBlob method with a complex key, with path in the filename, eg picture/filename.jpg
  */
 public void testPutBlobComplexName1() {
   blobStore.createContainerInLocation(null, CONTAINER_NAME);
   putBlobAndCheckIt(TestUtils.createRandomBlobKey("picture/putBlob-", ".jpg"));
   putBlobAndCheckIt(TestUtils.createRandomBlobKey("video/putBlob-", ".jpg"));
   putBlobAndCheckIt(TestUtils.createRandomBlobKey("putBlob-", ".jpg"));
   putBlobAndCheckIt(TestUtils.createRandomBlobKey("video/putBlob-", ".jpg"));
 }
  public void testRemoveBlob_TwoSimpleBlobKeys() throws IOException {
    final String BLOB_KEY1 = TestUtils.createRandomBlobKey(null, null);
    final String BLOB_KEY2 = TestUtils.createRandomBlobKey(null, null);
    boolean result;

    // create the container and checks that blob doesn't exists
    blobStore.createContainerInLocation(null, CONTAINER_NAME);
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
    assertFalse(result, "Blob1 exists");
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
    assertFalse(result, "Blob2 exists");

    // create the blob
    TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY1, BLOB_KEY2);
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
    assertTrue(result, "Blob " + BLOB_KEY1 + " doesn't exist");
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
    assertTrue(result, "Blob " + BLOB_KEY2 + " doesn't exist");

    // remove first blob
    blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY1);
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
    assertFalse(result, "Blob1 still exists");
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
    assertTrue(result, "Blob2 doesn't exist");
    TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY1, false);
    TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY2, true);
    // remove second blob
    blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY2);
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
    assertFalse(result, "Blob2 still exists");
    TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY2, false);
  }
 /**
  * Integration test, because countBlobs is not redefined in {@link FilesystemAsyncBlobStore} class
  */
 public void testCountBlobs_NoOptions() {
   blobStore.createContainerInLocation(null, CONTAINER_NAME);
   try {
     blobStore.countBlobs(PROVIDER);
     fail("Magically the method was implemented... Wow!");
   } catch (UnsupportedOperationException e) {
   }
 }
  /**
   * Integration test, because clearContainer is not redefined in {@link FilesystemAsyncBlobStore}
   * class
   */
  public void testClearContainer_NoOptions() throws IOException {
    final String CONTAINER_NAME2 = "containerToClear";

    // create containers
    blobStore.createContainerInLocation(null, CONTAINER_NAME);
    blobStore.createContainerInLocation(null, CONTAINER_NAME2);

    // creates blobs in first container
    Set<String> blobNamesCreatedInContainer1 =
        TestUtils.createBlobsInContainer(
            CONTAINER_NAME,
            "bbb" + File.separator + "ccc" + File.separator + "ddd" + File.separator + "1234.jpg",
            TestUtils.createRandomBlobKey(),
            "rrr" + File.separator + "sss" + File.separator + "788.jpg",
            "xdc" + File.separator + "wert.kpg");

    // creates blobs in second container
    blobStore.createContainerInLocation(null, CONTAINER_NAME2);
    Set<String> blobNamesCreatedInContainer2 =
        TestUtils.createBlobsInContainer(
            CONTAINER_NAME2,
            "asd"
                + File.separator
                + "bbb"
                + File.separator
                + "ccc"
                + File.separator
                + "ddd"
                + File.separator
                + "1234.jpg",
            TestUtils.createRandomBlobKey(),
            "rrr" + File.separator + "sss" + File.separator + "788.jpg",
            "xdc" + File.separator + "wert.kpg");

    // test blobs in containers
    checkForContainerContent(CONTAINER_NAME, blobNamesCreatedInContainer1);
    checkForContainerContent(CONTAINER_NAME2, blobNamesCreatedInContainer2);

    // delete blobs in first container
    blobStore.clearContainer(CONTAINER_NAME);
    checkForContainerContent(CONTAINER_NAME, null);
    checkForContainerContent(CONTAINER_NAME2, blobNamesCreatedInContainer2);
    // delete blobs in second container
    blobStore.clearContainer(CONTAINER_NAME2);
    checkForContainerContent(CONTAINER_NAME2, null);
  }
 /** Strategy to perform any pre setup, before {@link org.apache.camel.CamelContext} is created */
 @Override
 protected void doPreSetup() throws Exception {
   BlobStore blobStore =
       ContextBuilder.newBuilder("transient")
           .credentials("identity", "credential")
           .buildView(BlobStoreContext.class)
           .getBlobStore();
   blobStore.createContainerInLocation(null, TEST_CONTAINER);
   blobStore.clearContainer(TEST_CONTAINER);
 }
  public void testDeleteContainer() throws IOException {
    boolean result;
    String CONTAINER_NAME2 = "container-to-delete";
    String TARGET_CONTAINER_NAME2 = TestUtils.TARGET_BASE_DIR + CONTAINER_NAME2;
    blobStore.createContainerInLocation(null, CONTAINER_NAME);
    blobStore.createContainerInLocation(null, CONTAINER_NAME2);

    result = blobStore.containerExists(CONTAINER_NAME);
    assertTrue(result, "Container [" + CONTAINER_NAME + "] doesn't exists");
    TestUtils.directoryExists(TARGET_CONTAINER_NAME, true);
    result = blobStore.containerExists(CONTAINER_NAME2);
    assertTrue(result, "Container [" + CONTAINER_NAME2 + "] doesn't exists");
    TestUtils.directoryExists(TARGET_CONTAINER_NAME2, true);

    // create blobs inside container
    TestUtils.createBlobsInContainer(
        CONTAINER_NAME,
        TestUtils.createRandomBlobKey("testutils-", null),
        TestUtils.createRandomBlobKey("testutils-", null),
        TestUtils.createRandomBlobKey("ab123s" + File.separator + "testutils-", null));
    TestUtils.createBlobsInContainer(
        CONTAINER_NAME,
        TestUtils.createRandomBlobKey("testutils-", null),
        TestUtils.createRandomBlobKey("testutils-", null),
        TestUtils.createRandomBlobKey("asda123s" + File.separator + "testutils-", null),
        TestUtils.createRandomBlobKey("123-_3s" + File.separator + "testutils-", null));

    // delete first container
    blobStore.deleteContainer(CONTAINER_NAME);
    result = blobStore.containerExists(CONTAINER_NAME);
    assertFalse(result, "Container [" + CONTAINER_NAME + "] still exists");
    TestUtils.directoryExists(TARGET_CONTAINER_NAME, false);
    result = blobStore.containerExists(CONTAINER_NAME2);
    assertTrue(result, "Container [" + CONTAINER_NAME2 + "] still exists");
    TestUtils.directoryExists(TARGET_CONTAINER_NAME2, true);
    // delete second container
    blobStore.deleteContainer(CONTAINER_NAME2);
    result = blobStore.containerExists(CONTAINER_NAME2);
    assertFalse(result, "Container [" + CONTAINER_NAME2 + "] still exists");
    TestUtils.directoryExists(TARGET_CONTAINER_NAME2, false);
  }
  /** Test of createContainerInLocation method, of class FilesystemAsyncBlobStore. */
  public void testCreateContainerInLocation() throws IOException {
    final String CONTAINER_NAME2 = "funambol-test-2";
    final String TARGET_CONTAINER_NAME2 = TestUtils.TARGET_BASE_DIR + CONTAINER_NAME2;

    boolean result;

    result = blobStore.containerExists(CONTAINER_NAME);
    assertFalse(result, "Container exists");
    result = blobStore.createContainerInLocation(null, CONTAINER_NAME);
    assertTrue(result, "Container not created");
    result = blobStore.containerExists(CONTAINER_NAME);
    assertTrue(result, "Container doesn't exist");
    TestUtils.directoryExists(TARGET_CONTAINER_NAME, true);

    result = blobStore.containerExists(CONTAINER_NAME2);
    assertFalse(result, "Container exists");
    result = blobStore.createContainerInLocation(null, CONTAINER_NAME2);
    assertTrue(result, "Container not created");
    result = blobStore.containerExists(CONTAINER_NAME2);
    assertTrue(result, "Container doesn't exist");
    TestUtils.directoryExists(TestUtils.TARGET_BASE_DIR + CONTAINER_NAME2, true);
  }
  public void testDeleteContainer_EmptyContanier() {
    boolean result;
    blobStore.createContainerInLocation(null, CONTAINER_NAME);

    result = blobStore.containerExists(CONTAINER_NAME);
    assertTrue(result, "Container doesn't exists");
    TestUtils.directoryExists(TARGET_CONTAINER_NAME, true);

    // delete container
    blobStore.deleteContainer(CONTAINER_NAME);
    result = blobStore.containerExists(CONTAINER_NAME);
    assertFalse(result, "Container still exists");
    TestUtils.directoryExists(TARGET_CONTAINER_NAME, false);
  }
 @Test
 public void testInvalidContainerName() {
   String containerName = "file" + File.separator + "system";
   try {
     blobStore.createContainerInLocation(null, containerName);
     fail("Wrong container name not recognized");
   } catch (IllegalArgumentException e) {
   }
   try {
     blobStore.containerExists(containerName);
     fail("Wrong container name not recognized");
   } catch (IllegalArgumentException e) {
   }
 }
  @Test
  void testToBlob() {
    assertNull(ToBlob.INSTANCE.apply(null));
    BlobStore blobStore = getBlobStore();
    blobStore.createContainerInLocation(null, "container");
    blobStore.createDirectory("container", "one");

    blobStore.putBlob(
        "container",
        blobStore.blobBuilder("myblob").payload(ByteSource.wrap("testcontent".getBytes())).build());
    Blob representation = ToBlob.INSTANCE.apply(blobStore.getBlob("container", "myblob"));
    assertNotNull(representation);
    assertNotNull(representation.getBlobMetadata());
  }
 @Test
 void testToStorageMetadata() {
   assertNull(ToStorageMetadata.INSTANCE.apply(null));
   BlobStore blobStore = getBlobStore();
   blobStore.createContainerInLocation(null, "test");
   blobStore.createDirectory("test", "one");
   Set<StorageMetadata> storageMetadataSet =
       ImmutableSet.<StorageMetadata>builder()
           .addAll(transform(blobStore.list(), ToStorageMetadata.INSTANCE))
           .build();
   assertFalse(storageMetadataSet.isEmpty());
   StorageMetadata representation = storageMetadataSet.iterator().next();
   assertEquals("test", representation.getName());
 }
  /** Test of list method, of class FilesystemAsyncBlobStore. */
  public void testList_NoOptionSingleContainer() throws IOException {
    blobStore.createContainerInLocation(null, CONTAINER_NAME);
    // Testing list for an empty container
    checkForContainerContent(CONTAINER_NAME, null);

    // creates blobs in first container
    Set<String> blobsExpected =
        TestUtils.createBlobsInContainer(
            CONTAINER_NAME,
            "bbb" + File.separator + "ccc" + File.separator + "ddd" + File.separator + "1234.jpg",
            "4rrr.jpg",
            "rrr" + File.separator + "sss" + File.separator + "788.jpg",
            "xdc" + File.separator + "wert.kpg");

    checkForContainerContent(CONTAINER_NAME, blobsExpected);
  }
Exemplo n.º 17
0
  public void testMultipartChunkedFileStream() throws IOException, InterruptedException {

    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();
      blobStore.putBlob(containerName, blob, PutOptions.Builder.multipart());

    } finally {
      returnContainer(containerName);
    }
  }
Exemplo n.º 18
0
  public void testPutWithReducedRedundancyStorage() throws InterruptedException {
    String containerName = getContainerName();
    try {
      String blobName = "test-rrs";
      BlobStore blobStore = view.getBlobStore();
      blobStore.createContainerInLocation(null, containerName);

      Blob blob = blobStore.blobBuilder(blobName).payload("something").build();
      blobStore.putBlob(containerName, blob, storageClass(StorageClass.REDUCED_REDUNDANCY));

      S3Client s3Client = S3Client.class.cast(view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getApi());
      ListBucketResponse response = s3Client.listBucket(containerName, withPrefix(blobName));

      ObjectMetadata metadata = response.iterator().next();
      assertEquals(metadata.getStorageClass(), StorageClass.REDUCED_REDUNDANCY);

    } finally {
      returnContainer(containerName);
    }
  }
  @Override
  protected RouteBuilder createRouteBuilder() throws Exception {
    blobStore.createContainerInLocation(null, TEST_CONTAINER);
    ((JcloudsComponent) context.getComponent("jclouds"))
        .setBlobStores(Lists.newArrayList(blobStore));

    return new RouteBuilder() {
      public void configure() {
        from("direct:put")
            .setHeader(JcloudsConstants.BLOB_NAME, constant(TEST_BLOB_IN_DIR))
            .setHeader(JcloudsConstants.CONTAINER_NAME, constant(TEST_CONTAINER))
            .to("jclouds:blobstore:transient")
            .to("mock:results");

        from("direct:put-and-get")
            .setHeader(JcloudsConstants.BLOB_NAME, constant(TEST_BLOB_IN_DIR))
            .setHeader(JcloudsConstants.CONTAINER_NAME, constant(TEST_CONTAINER))
            .to("jclouds:blobstore:transient");
      }
    };
  }
  public void testRemoveBlob_SimpleBlobKey() throws IOException {
    final String BLOB_KEY = TestUtils.createRandomBlobKey(null, ".txt");
    boolean result;

    blobStore.createContainerInLocation(null, CONTAINER_NAME);

    // checks that blob doesn't exists
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
    assertFalse(result, "Blob exists");

    // create the blob
    TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY);
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
    assertTrue(result, "Blob exists");

    // remove it
    blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY);
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY);
    assertFalse(result, "Blob still exists");
    TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY, false);
  }
  public void testRanges() throws IOException {
    blobStore.createContainerInLocation(null, CONTAINER_NAME);
    String input = "abcdefgh";
    Payload payload;
    Blob blob = blobStore.blobBuilder("test").payload(new StringPayload(input)).build();
    blobStore.putBlob(CONTAINER_NAME, blob);

    GetOptions getOptionsRangeStartAt = new GetOptions();
    getOptionsRangeStartAt.startAt(1);
    Blob blobRangeStartAt =
        blobStore.getBlob(CONTAINER_NAME, blob.getMetadata().getName(), getOptionsRangeStartAt);
    payload = blobRangeStartAt.getPayload();
    try {
      assertEquals(input.substring(1), Strings2.toString(payload));
    } finally {
      Closeables.closeQuietly(payload);
    }

    GetOptions getOptionsRangeTail = new GetOptions();
    getOptionsRangeTail.tail(3);
    Blob blobRangeTail =
        blobStore.getBlob(CONTAINER_NAME, blob.getMetadata().getName(), getOptionsRangeTail);
    payload = blobRangeTail.getPayload();
    try {
      assertEquals(input.substring(5), Strings2.toString(payload));
    } finally {
      Closeables.closeQuietly(payload);
    }

    GetOptions getOptionsFragment = new GetOptions();
    getOptionsFragment.range(4, 6);
    Blob blobFragment =
        blobStore.getBlob(CONTAINER_NAME, blob.getMetadata().getName(), getOptionsFragment);
    payload = blobFragment.getPayload();
    try {
      assertEquals(input.substring(4, 7), Strings2.toString(payload));
    } finally {
      Closeables.closeQuietly(payload);
    }
  }
  /**
   * Test of removeBlob method, with two blobs with a complex path as key and when first blob is
   * removed, not all of its key's path is removed, because it is shared with the second blob's key
   */
  @Test
  public void testRemoveBlob_TwoComplexBlobKeys() throws IOException {
    final String BLOB_KEY1 = TestUtils.createRandomBlobKey("aa/bb/cc/dd/", null);
    final String BLOB_KEY2 = TestUtils.createRandomBlobKey("aa/bb/ee/ff/", null);
    boolean result;

    blobStore.createContainerInLocation(null, CONTAINER_NAME);

    // checks that blob doesn't exist
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
    assertFalse(result, "Blob1 exists");
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
    assertFalse(result, "Blob2 exists");

    // create the blobs
    TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY1, BLOB_KEY2);
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
    assertTrue(result, "Blob " + BLOB_KEY1 + " doesn't exist");
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
    assertTrue(result, "Blob " + BLOB_KEY2 + " doesn't exist");

    // remove first blob
    blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY1);
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY1);
    assertFalse(result, "Blob still exists");
    // first file deleted, not the second
    TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY1, false);
    TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY2, true);
    // only partial directory structure was removed, because it shares a path
    // with the second blob created
    TestUtils.directoryExists(TARGET_CONTAINER_NAME + "/aa/bb/cc/dd", false);
    TestUtils.directoryExists(TARGET_CONTAINER_NAME + "/aa/bb", true);
    // remove second blob
    blobStore.removeBlob(CONTAINER_NAME, BLOB_KEY2);
    result = blobStore.blobExists(CONTAINER_NAME, BLOB_KEY2);
    assertFalse(result, "Blob still exists");
    TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + BLOB_KEY2, false);
    // now all the directory structure is empty
    TestUtils.directoryExists(TARGET_CONTAINER_NAME + "/aa", false);
  }
  /** Test of list method of the root context */
  public void testList_Root() throws IOException {
    PageSet<? extends StorageMetadata> containersRetrieved;
    Set<String> containersCreated = Sets.newHashSet();

    // Testing list with no containers
    containersRetrieved = blobStore.list();
    assertTrue(
        containersRetrieved.isEmpty(), "List operation returns a not empty set of container");

    // Testing list with some containers
    String[] containerNames = {"34343", "aaaa", "bbbbb"};
    containersCreated = Sets.newHashSet();
    for (String containerName : containerNames) {
      blobStore.createContainerInLocation(null, containerName);
      containersCreated.add(containerName);
    }

    containersRetrieved = blobStore.list();
    assertEquals(
        containersCreated.size(), containersRetrieved.size(), "Different numbers of container");

    for (StorageMetadata data : containersRetrieved) {
      String containerName = data.getName();
      if (!containersCreated.remove(containerName)) {
        fail("Container list contains unexpected value [" + containerName + "]");
      }
    }
    assertTrue(containersCreated.isEmpty(), "List operation doesn't return all values.");

    for (String containerName : containerNames) {
      // delete all creaded containers
      blobStore.deleteContainer(containerName);
    }
    containersRetrieved = blobStore.list();
    assertTrue(
        containersRetrieved.isEmpty(), "List operation returns a not empty set of container");
  }
 /**
  * Integration test, because countBlobs is not redefined in {@link FilesystemAsyncBlobStore} class
  */
 public void testCountBlobs_NoOptions() {
   blobStore.createContainerInLocation(null, CONTAINER_NAME);
   blobStore.countBlobs(PROVIDER);
 }