@Override
  public ServiceRecord resolve(String path) throws PathNotFoundException,
      NoRecordException, InvalidRecordException, IOException {
    // Read the entire file into byte array, should be small metadata

    Long size = fs.getFileStatus(formatDataPath(path)).getLen();
    byte[] bytes = new byte[size.intValue()];

    FSDataInputStream instream = fs.open(formatDataPath(path));
    int bytesRead = instream.read(bytes);
    instream.close();

    if (bytesRead < size) {
      throw new InvalidRecordException(path,
          "Expected " + size + " bytes, but read " + bytesRead);
    }

    // Unmarshal, check, and return
    ServiceRecord record = serviceRecordMarshal.fromBytes(path, bytes);
    RegistryTypeUtils.validateServiceRecord(path, record);
    return record;
  }
@Test
  public void testResolve() throws IOException {
    ServiceRecord record = createRecord("0");
    registry.bind("test/registryTestNode", record, 1);
    Assert.assertTrue(fs.exists(new Path("test/registryTestNode/_record")));

    System.out.println("Read record that exists");
    ServiceRecord readRecord = registry.resolve("test/registryTestNode");
    Assert.assertNotNull(readRecord);
    Assert.assertTrue(record.equals(readRecord));

    System.out.println("Try to read record that does not exist");
    try {
      readRecord = registry.resolve("test/nonExistentNode");
      Assert.fail("Should throw an error, record does not exist");
    } catch (IOException e) {
    }
  }