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);
  }
Exemplo n.º 2
0
 public void execute(String containerName, String directory) {
   Blob blob = connection.newBlob(directory + directorySuffix);
   blob.setPayload(Payloads.newByteArrayPayload(new byte[] {}));
   blob.getPayload().setContentType("application/directory");
   blob.getMetadata().setType(StorageType.RELATIVE_PATH);
   connection.putBlob(containerName, blob);
 }
  /** 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 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);
  }
 /**
  * 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) {
   }
 }
 /** 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);
 }
  /** Test of containerExists method, of class FilesystemAsyncBlobStore. */
  public void testContainerExists() throws IOException {
    boolean result;

    result = blobStore.containerExists(CONTAINER_NAME);
    assertFalse(result, "Container exists");

    // create container
    TestUtils.createContainerAsDirectory(CONTAINER_NAME);

    result = blobStore.containerExists(CONTAINER_NAME);
    assertTrue(result, "Container doesn't exist");
  }
  public void testListObjectsWhenResponseIs2xx() throws Exception {
    Map<HttpRequest, HttpResponse> requestResponseMap =
        ImmutableMap.<HttpRequest, HttpResponse>builder()
            .put(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess)
            .build();

    BlobStore clientWhenLocationsExist = requestsSendResponses(requestResponseMap);

    Set<? extends Location> locations = clientWhenLocationsExist.listAssignableLocations();
    assertNotNull(locations);
    assertEquals(locations.size(), 1);
    assertEquals(locations.iterator().next().getId(), "region-a.geo-1");
  }
  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
 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
 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) {
   }
 }
 /**
  * Integration test, because countBlobs is not redefined in {@link FilesystemAsyncBlobStore} class
  */
 public void testCountBlobs_NotExistingContainer() {
   try {
     blobStore.countBlobs(PROVIDER);
     fail("Magically the method was implemented... Wow!");
   } catch (UnsupportedOperationException e) {
   }
 }
 /**
  * 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"));
 }
Exemplo n.º 14
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);
    }
  }
  /**
   * Upload a large object from a File using the BlobStore API.
   *
   * @throws ExecutionException
   * @throws InterruptedException
   */
  private void uploadLargeObjectFromFile(File largeFile)
      throws InterruptedException, ExecutionException {
    System.out.format("Upload Large Object From File%n");

    ByteSource source = Files.asByteSource(largeFile);
    // create the payload and set the content length
    Payload payload = Payloads.newByteSourcePayload(source);
    payload.getContentMetadata().setContentLength(largeFile.length());

    Blob blob = blobStore.blobBuilder(largeFile.getName()).payload(payload).build();

    // configure the blobstore to use multipart uploading of the file
    String eTag = blobStore.putBlob(CONTAINER, blob, multipart());

    System.out.format("  Uploaded %s eTag=%s", largeFile.getName(), eTag);
  }
  public void testBlobMetadata_withDefaultMetadata() throws IOException {
    String BLOB_KEY = TestUtils.createRandomBlobKey(null, null);
    // create the blob
    TestUtils.createBlobsInContainer(CONTAINER_NAME, BLOB_KEY);

    BlobMetadata metadata = blobStore.blobMetadata(CONTAINER_NAME, BLOB_KEY);
    assertNotNull(metadata, "Metadata null");

    assertEquals(metadata.getName(), BLOB_KEY, "Wrong blob name");
    assertEquals(metadata.getType(), StorageType.BLOB, "Wrong blob type");
    assertEquals(
        metadata.getContentMetadata().getContentType(),
        "application/unknown",
        "Wrong blob content-type");
    assertEquals(
        base16().lowerCase().encode(metadata.getContentMetadata().getContentMD5()),
        metadata.getETag(),
        "Wrong blob MD5");
    assertEquals(metadata.getLocation(), null, "Wrong blob location");
    assertEquals(metadata.getProviderId(), null, "Wrong blob provider id");
    assertEquals(metadata.getUri(), null, "Wrong blob URI");
    assertNotNull(metadata.getUserMetadata(), "No blob UserMetadata");
    assertEquals(metadata.getUserMetadata().size(), 0, "Wrong blob UserMetadata");
    // metadata.getLastModified()
    File file = new File(TARGET_CONTAINER_NAME, BLOB_KEY);
    assertEquals(
        metadata.getContentMetadata().getContentLength(),
        Long.valueOf(file.length()),
        "Wrong blob size");
  }
 public void testDeleteContainer_NotExistingContainer() {
   try {
     blobStore.deleteContainer(CONTAINER_NAME);
     fail("No error when container doesn't exist");
   } catch (Exception e) {
   }
 }
  @Override
  protected Object doExecute() throws Exception {
    BlobStore blobStore = getBlobStore();
    List<String> locationNames = Lists.newArrayList();

    for (Location loc : blobStore.listAssignableLocations()) {
      locationNames.add(loc.getId());
    }

    Collections.sort(locationNames);
    for (String locationName : locationNames) {
      System.out.println(locationName);
    }

    return null;
  }
  /**
   * 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);
  }
Exemplo n.º 20
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());
    }
  }
 public void testGetBlob_NotExistingContainer() {
   try {
     blobStore.getBlob(CONTAINER_NAME, TestUtils.createRandomBlobKey(), null);
     fail("Retrieve must fail, container does not exist.");
   } catch (ContainerNotFoundException e) {
     // correct if arrive here
   }
 }
 public void testList_NotExistingContainer() {
   // Testing list for a not existing container
   try {
     blobStore.list(CONTAINER_NAME);
     fail("Found a not existing container");
   } catch (ContainerNotFoundException e) {
     // ok if arriver here
   }
 }
Exemplo n.º 23
0
  public void testDirectoryEndingWithSlash() throws InterruptedException {
    String containerName = getContainerName();
    try {
      BlobStore blobStore = view.getBlobStore();
      blobStore.createDirectory(containerName, "someDir");

      // According to the S3 documentation, a directory is nothing but a blob
      // whose name ends with a '/'. So let's try to remove the blob we just
      // created.
      blobStore.removeBlob(containerName, "someDir/");

      // The directory "someDir" shouldn't exist since we removed it. If this
      // test succeeds, it confirms that a directory (or folder) is nothing
      // but a blob with a name ending in '/'.
      assertEquals(blobStore.directoryExists(containerName, "someDir"), false);
    } finally {
      returnContainer(containerName);
    }
  }
Exemplo n.º 24
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);
    }
  }
  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);
  }
  /** 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");
  }
  /** Create a blob with putBlob method */
  private void putBlobAndCheckIt(String blobKey) {
    Blob blob;

    TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + blobKey, false);

    // create the blob
    blob = createBlob(blobKey, TestUtils.getImageForBlobPayload());
    String eTag = blobStore.putBlob(CONTAINER_NAME, blob);
    assertNotNull(eTag, "putBlob result null");
    assertNotSame(eTag, "", "putBlob result empty");

    // checks if the blob exists
    TestUtils.fileExists(TARGET_CONTAINER_NAME + File.separator + blobKey, true);
  }
  /** 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");
  }
  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 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);
  }