@Override
  public boolean mknode(String path, boolean createParents)
      throws PathNotFoundException, InvalidPathnameException, IOException {
    Path registryPath = makePath(path);

    // getFileStatus throws FileNotFound if the path doesn't exist. If the
    // file already exists, return.
    try {
      fs.getFileStatus(registryPath);
      return false;
    } catch (FileNotFoundException e) {
    }

    if (createParents) {
      // By default, mkdirs creates any parent dirs it needs
      fs.mkdirs(registryPath);
    } else {
      FileStatus parentStatus = null;

      if (registryPath.getParent() != null) {
        parentStatus = fs.getFileStatus(registryPath.getParent());
      }

      if (registryPath.getParent() == null || parentStatus.isDirectory()) {
        fs.mkdirs(registryPath);
      } else {
        throw new PathNotFoundException("no parent for " + path);
      }
    }
    return true;
  }
@Test
  public void testMkNodeAlreadyExists() throws IOException {
    System.out.println("pre-create test path");
    fs.mkdirs(new Path("test/registryTestNode"));

    System.out.println(
        "Try to mknode existing path -- should be noop and return false");
    Assert.assertFalse(registry.mknode("test/registryTestNode", true));
    Assert.assertFalse(registry.mknode("test/registryTestNode", false));
  }