@Override
  public List<String> list(String path)
      throws PathNotFoundException, InvalidPathnameException, IOException {
    FileStatus[] statArray = fs.listStatus(makePath(path));
    String basePath = fs.getFileStatus(makePath(path)).getPath().toString();

    List<String> paths = new ArrayList<String>();

    FileStatus stat;
    // Only count dirs; the _record files are hidden.
    for (int i = 0; i < statArray.length; i++) {
      stat = statArray[i];
      if (stat.isDirectory()) {
        String relativePath = relativize(basePath, stat.getPath().toString());
        paths.add(relativePath);
      }
    }

    return paths;
  }
@Test
  public void testList() throws IOException {
    System.out.println("pre-create test path with children and mocked records");

    fs.mkdirs(new Path("test/registryTestNode"));
    fs.mkdirs(new Path("test/registryTestNode/child1"));
    fs.mkdirs(new Path("test/registryTestNode/child2"));

    // Create and close stream immediately so they aren't blocking
    fs.create(new Path("test/registryTestNode/_record")).close();
    fs.create(new Path("test/registryTestNode/child1/_record")).close();

    List<String> ls = null;

    ls = registry.list("test/registryTestNode");
    Assert.assertNotNull(ls);
    Assert.assertEquals(2, ls.size());
    System.out.println(ls);
    Assert.assertTrue(ls.contains("child1"));
    Assert.assertTrue(ls.contains("child2"));

    ls = null;
    ls = registry.list("test/registryTestNode/child1");
    Assert.assertNotNull(ls);
    Assert.assertTrue(ls.isEmpty());
    ls = null;
    ls = registry.list("test/registryTestNode/child2");
    Assert.assertNotNull(ls);
    Assert.assertTrue(ls.isEmpty());
  }