/**
   * simple delete.
   *
   * @throws Exception if failed
   */
  @Test
  public void delete() throws Exception {
    File file = new File(mapping, "delete/file.txt");
    put(file, "Hello, world!");

    HadoopDataSourceCore core = new HadoopDataSourceCore(profile);

    assertThat(file.exists(), is(true));
    boolean result = core.delete("delete", FilePattern.compile("**/*"), true, counter);

    assertThat(result, is(true));
    assertThat(file.exists(), is(false));
  }
  /**
   * simple delete.
   *
   * @throws Exception if failed
   */
  @Test
  public void delete_all() throws Exception {
    File file = new File(mapping, "file.txt");
    put(file, "Hello, world!");

    HadoopDataSourceCore core = new HadoopDataSourceCore(profile);

    assertThat(file.exists(), is(true));
    boolean result = core.delete("", FilePattern.compile("**"), true, counter);

    assertThat(result, is(true));
    assertThat(file.exists(), is(false));
    assertThat("the root directory must not be deleted", mapping.exists(), is(true));
  }
  /**
   * simple delete.
   *
   * @throws Exception if failed
   */
  @Test
  public void delete_multifile() throws Exception {
    File[] files = {
      new File(mapping, "delete/file.txt"),
      new File(mapping, "delete/file2.txt"),
      new File(mapping, "delete/a/file.txt"),
      new File(mapping, "delete/a/b/file.txt"),
    };
    for (File file : files) {
      put(file, "Hello, world!");
    }
    HadoopDataSourceCore core = new HadoopDataSourceCore(profile);

    for (File file : files) {
      assertThat(file.exists(), is(true));
    }
    boolean result = core.delete("delete", FilePattern.compile("**/*"), true, counter);

    assertThat(result, is(true));
    for (File file : files) {
      assertThat(file.exists(), is(false));
    }
  }
  /**
   * simple delete.
   *
   * @throws Exception if failed
   */
  @Test
  public void delete_sharetemp() throws Exception {
    HadoopDataSourceProfile shareTempProfile =
        new HadoopDataSourceProfile(
            conf,
            profile.getId(),
            profile.getContextPath(),
            profile.getFileSystemPath(),
            new Path(profile.getFileSystemPath(), "_TEMP"));
    HadoopDataSourceCore core = new HadoopDataSourceCore(shareTempProfile);

    File onProd = new File(mapping, "file.txt");
    File onTemp = new File(mapping, "_TEMP/temp.txt");
    put(onProd, "production");
    put(onTemp, "temporary");

    assertThat(onProd.exists(), is(true));
    assertThat(onTemp.exists(), is(true));

    boolean result = core.delete("", FilePattern.compile("**/*"), true, counter);
    assertThat(result, is(true));
    assertThat(onProd.exists(), is(false));
    assertThat(onTemp.exists(), is(true));
  }