@Override
  public void register(String path, ServiceRecord record) throws IOException {
    op(path, record, addRecordCommand);
  }
@Test
  public void testAppRegistration() throws Exception {
    ServiceRecord record = getMarshal().fromBytes("somepath",
        APPLICATION_RECORD.getBytes());
    getRegistryDNS().register(
        "/registry/users/root/services/org-apache-slider/test1/", record);

    // start assessing whether correct records are available
    List<Record> recs = assertDNSQuery("test1.root.dev.test.");
    assertEquals("wrong result", "192.168.1.5",
        ((ARecord) recs.get(0)).getAddress().getHostAddress());

    recs = assertDNSQuery("management-api.test1.root.dev.test.", 2);
    assertEquals("wrong target name", "test1.root.dev.test.",
        ((CNAMERecord) recs.get(0)).getTarget().toString());
    assertTrue("not an ARecord",
        recs.get(isSecure() ? 2 : 1) instanceof ARecord);

    recs = assertDNSQuery("appmaster-ipc-api.test1.root.dev.test.",
        Type.SRV, 1);
    assertTrue("not an SRV record", recs.get(0) instanceof SRVRecord);
    assertEquals("wrong port", 1026, ((SRVRecord) recs.get(0)).getPort());

    recs = assertDNSQuery("appmaster-ipc-api.test1.root.dev.test.", 2);
    assertEquals("wrong target name", "test1.root.dev.test.",
        ((CNAMERecord) recs.get(0)).getTarget().toString());
    assertTrue("not an ARecord",
        recs.get(isSecure() ? 2 : 1) instanceof ARecord);

    recs = assertDNSQuery("http-api.test1.root.dev.test.", 2);
    assertEquals("wrong target name", "test1.root.dev.test.",
        ((CNAMERecord) recs.get(0)).getTarget().toString());
    assertTrue("not an ARecord",
        recs.get(isSecure() ? 2 : 1) instanceof ARecord);

    recs = assertDNSQuery("http-api.test1.root.dev.test.", Type.SRV,
        1);
    assertTrue("not an SRV record", recs.get(0) instanceof SRVRecord);
    assertEquals("wrong port", 1027, ((SRVRecord) recs.get(0)).getPort());

    assertDNSQuery("test1.root.dev.test.", Type.TXT, 3);
    assertDNSQuery("appmaster-ipc-api.test1.root.dev.test.", Type.TXT, 1);
    assertDNSQuery("http-api.test1.root.dev.test.", Type.TXT, 1);
    assertDNSQuery("management-api.test1.root.dev.test.", Type.TXT, 1);
  }