changeset 52206:2e495bbdc2b7

8208542: Add 4 JNDI tests to com/sun/jndi/dns/ListTests/ Reviewed-by: vtewari, rriggs
author xyin
date Mon, 22 Oct 2018 14:03:06 +0800
parents a562c65c3c74
children bca2b63dd839
files test/jdk/com/sun/jndi/dns/ListTests/ListBindingsInteriorNotFound.dns test/jdk/com/sun/jndi/dns/ListTests/ListBindingsInteriorNotFound.java test/jdk/com/sun/jndi/dns/ListTests/ListBindingsLeafNotFound.dns test/jdk/com/sun/jndi/dns/ListTests/ListBindingsLeafNotFound.java test/jdk/com/sun/jndi/dns/ListTests/ListInteriorNotFound.dns test/jdk/com/sun/jndi/dns/ListTests/ListInteriorNotFound.java test/jdk/com/sun/jndi/dns/ListTests/ListLeafNotFound.dns test/jdk/com/sun/jndi/dns/ListTests/ListLeafNotFound.java test/jdk/com/sun/jndi/dns/ListTests/ListTestBase.java
diffstat 9 files changed, 554 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jndi/dns/ListTests/ListBindingsInteriorNotFound.dns	Mon Oct 22 14:03:06 2018 +0800
@@ -0,0 +1,50 @@
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# Capture file for ListBindingsInteriorNotFound.java
+#
+# NOTE: This hexadecimal dump of DNS protocol messages was generated by
+#       running the ListBindingsInteriorNotFound application program against
+#       a real DNS server along with DNSTracer
+#
+################################################################################
+
+# DNS Request
+
+0000: 04 F0 01 00 00 01 00 00   00 00 00 00 05 68 6F 73  .............hos
+0010: 74 39 0B 73 75 62 64 6F   6D 61 69 6E 39 39 07 64  t9.subdomain99.d
+0020: 6F 6D 61 69 6E 31 03 63   6F 6D 00 00 06 00 01     omain1.com.....
+
+
+# DNS Response
+
+0000: 04 F0 85 83 00 01 00 00   00 01 00 00 05 68 6F 73  .............hos
+0010: 74 39 0B 73 75 62 64 6F   6D 61 69 6E 39 39 07 64  t9.subdomain99.d
+0020: 6F 6D 61 69 6E 31 03 63   6F 6D 00 00 06 00 01 C0  omain1.com......
+0030: 1E 00 06 00 01 00 00 00   00 00 26 02 6E 73 C0 1E  ..........&.ns..
+0040: 0A 70 6F 73 74 6D 61 73   74 65 72 C0 1E 00 00 00  .postmaster.....
+0050: 01 00 00 1C 20 00 00 0E   10 00 06 97 80 00 01 51  .... ..........Q
+0060: 80                                                 .
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jndi/dns/ListTests/ListBindingsInteriorNotFound.java	Mon Oct 22 14:03:06 2018 +0800
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.InitialDirContext;
+
+/*
+ * @test
+ * @bug 8208542
+ * @summary Tests that we get NameNotFoundException when doing a listBindings()
+ *          on a nonexistent interior entry.
+ * @library ../lib/
+ * @modules java.base/sun.security.util
+ * @run main ListBindingsInteriorNotFound
+ */
+
+public class ListBindingsInteriorNotFound extends ListTestBase {
+
+    public ListBindingsInteriorNotFound() {
+        setKey("host9.subdomain99");
+    }
+
+    public static void main(String[] args) throws Exception {
+        new ListBindingsInteriorNotFound().run(args);
+    }
+
+    /*
+     * Tests that we get NameNotFoundException when doing a listBindings()
+     * on a nonexistent interior entry.
+     */
+    @Override
+    public void runTest() throws Exception {
+        setContext(new InitialDirContext(env()));
+        NamingEnumeration enumObj = context().listBindings(getKey());
+
+        DNSTestUtils.debug("Enum is: " + enumObj);
+        throw new RuntimeException("Failed: expecting NameNotFoundException");
+    }
+
+    @Override
+    public boolean handleException(Exception e) {
+        if (e instanceof NameNotFoundException) {
+            System.out.println("Got expected exception: " + e);
+            return true;
+        }
+
+        return super.handleException(e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jndi/dns/ListTests/ListBindingsLeafNotFound.dns	Mon Oct 22 14:03:06 2018 +0800
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# Capture file for ListBindingsLeafNotFound.java
+#
+# NOTE: This hexadecimal dump of DNS protocol messages was generated by
+#       running the ListBindingsLeafNotFound application program against
+#       a real DNS server along with DNSTracer
+#
+################################################################################
+
+# DNS Request
+
+0000: FC 81 01 00 00 01 00 00   00 00 00 00 06 68 6F 73  .............hos
+0010: 74 39 39 07 64 6F 6D 61   69 6E 31 03 63 6F 6D 00  t99.domain1.com.
+0020: 00 06 00 01                                        ....
+
+
+# DNS Response
+
+0000: FC 81 85 83 00 01 00 00   00 01 00 00 06 68 6F 73  .............hos
+0010: 74 39 39 07 64 6F 6D 61   69 6E 31 03 63 6F 6D 00  t99.domain1.com.
+0020: 00 06 00 01 C0 13 00 06   00 01 00 00 00 00 00 26  ...............&
+0030: 02 6E 73 C0 13 0A 70 6F   73 74 6D 61 73 74 65 72  .ns...postmaster
+0040: C0 13 00 00 00 01 00 00   1C 20 00 00 0E 10 00 06  ......... ......
+0050: 97 80 00 01 51 80                                  ....Q.
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jndi/dns/ListTests/ListBindingsLeafNotFound.java	Mon Oct 22 14:03:06 2018 +0800
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.InitialDirContext;
+
+/*
+ * @test
+ * @bug 8208542
+ * @summary Tests that we get NameNotFoundException when listing a nonexistent
+ *          leaf entry using listBindings().
+ * @library ../lib/
+ * @modules java.base/sun.security.util
+ * @run main ListBindingsLeafNotFound
+ */
+
+public class ListBindingsLeafNotFound extends ListTestBase {
+
+    public ListBindingsLeafNotFound() {
+        setKey("host99");
+    }
+
+    public static void main(String[] args) throws Exception {
+        new ListBindingsLeafNotFound().run(args);
+    }
+
+    /*
+     * Tests that we get NameNotFoundException when listing a nonexistent
+     * leaf entry using listBindings().
+     */
+    @Override
+    public void runTest() throws Exception {
+        setContext(new InitialDirContext(env()));
+        NamingEnumeration enumObj = context().listBindings(getKey());
+
+        DNSTestUtils.debug("Enum is: " + enumObj);
+        throw new RuntimeException("Failed: expecting NameNotFoundException");
+    }
+
+    @Override
+    public boolean handleException(Exception e) {
+        if (e instanceof NameNotFoundException) {
+            System.out.println("Got expected exception: " + e);
+            return true;
+        }
+
+        return super.handleException(e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jndi/dns/ListTests/ListInteriorNotFound.dns	Mon Oct 22 14:03:06 2018 +0800
@@ -0,0 +1,50 @@
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# Capture file for ListInteriorNotFound.java
+#
+# NOTE: This hexadecimal dump of DNS protocol messages was generated by
+#       running the ListInteriorNotFound application program against
+#       a real DNS server along with DNSTracer
+#
+################################################################################
+
+# DNS Request
+
+0000: 7C DC 01 00 00 01 00 00   00 00 00 00 05 68 6F 73  .............hos
+0010: 74 39 0B 73 75 62 64 6F   6D 61 69 6E 39 39 07 64  t9.subdomain99.d
+0020: 6F 6D 61 69 6E 31 03 63   6F 6D 00 00 06 00 01     omain1.com.....
+
+
+# DNS Response
+
+0000: 7C DC 85 83 00 01 00 00   00 01 00 00 05 68 6F 73  .............hos
+0010: 74 39 0B 73 75 62 64 6F   6D 61 69 6E 39 39 07 64  t9.subdomain99.d
+0020: 6F 6D 61 69 6E 31 03 63   6F 6D 00 00 06 00 01 C0  omain1.com......
+0030: 1E 00 06 00 01 00 00 00   00 00 26 02 6E 73 C0 1E  ..........&.ns..
+0040: 0A 70 6F 73 74 6D 61 73   74 65 72 C0 1E 00 00 00  .postmaster.....
+0050: 01 00 00 1C 20 00 00 0E   10 00 06 97 80 00 01 51  .... ..........Q
+0060: 80                                                 .
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jndi/dns/ListTests/ListInteriorNotFound.java	Mon Oct 22 14:03:06 2018 +0800
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.InitialDirContext;
+
+/*
+ * @test
+ * @bug 8208542
+ * @summary Tests that we get NameNotFoundException when listing a nonexistent
+ *          interior entry.
+ * @library ../lib/
+ * @modules java.base/sun.security.util
+ * @run main ListInteriorNotFound
+ */
+
+public class ListInteriorNotFound extends ListTestBase {
+
+    public ListInteriorNotFound() {
+        setKey("host9.subdomain99");
+    }
+
+    public static void main(String[] args) throws Exception {
+        new ListInteriorNotFound().run(args);
+    }
+
+    /*
+     * Tests that we get NameNotFoundException when listing a nonexistent
+     * interior entry.
+     */
+    @Override
+    public void runTest() throws Exception {
+        setContext(new InitialDirContext(env()));
+        NamingEnumeration enumObj = context().list(getKey());
+
+        DNSTestUtils.debug("Enum is: " + enumObj);
+        throw new RuntimeException("Failed: expecting NameNotFoundException");
+    }
+
+    @Override
+    public boolean handleException(Exception e) {
+        if (e instanceof NameNotFoundException) {
+            System.out.println("Got expected exception: " + e);
+            return true;
+        }
+
+        return super.handleException(e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jndi/dns/ListTests/ListLeafNotFound.dns	Mon Oct 22 14:03:06 2018 +0800
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# Capture file for ListLeafNotFound.java
+#
+# NOTE: This hexadecimal dump of DNS protocol messages was generated by
+#       running the ListLeafNotFound application program against
+#       a real DNS server along with DNSTracer
+#
+################################################################################
+
+# DNS Request
+
+0000: A7 0D 01 00 00 01 00 00   00 00 00 00 06 68 6F 73  .............hos
+0010: 74 39 39 07 64 6F 6D 61   69 6E 31 03 63 6F 6D 00  t99.domain1.com.
+0020: 00 06 00 01                                        ....
+
+
+# DNS Response
+
+0000: A7 0D 85 83 00 01 00 00   00 01 00 00 06 68 6F 73  .............hos
+0010: 74 39 39 07 64 6F 6D 61   69 6E 31 03 63 6F 6D 00  t99.domain1.com.
+0020: 00 06 00 01 C0 13 00 06   00 01 00 00 00 00 00 26  ...............&
+0030: 02 6E 73 C0 13 0A 70 6F   73 74 6D 61 73 74 65 72  .ns...postmaster
+0040: C0 13 00 00 00 01 00 00   1C 20 00 00 0E 10 00 06  ......... ......
+0050: 97 80 00 01 51 80                                  ....Q.
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jndi/dns/ListTests/ListLeafNotFound.java	Mon Oct 22 14:03:06 2018 +0800
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.InitialDirContext;
+
+/*
+ * @test
+ * @bug 8208542
+ * @summary Tests that we get NameNotFoundException when listing a nonexistent
+ *          leaf entry.
+ * @library ../lib/
+ * @modules java.base/sun.security.util
+ * @run main ListLeafNotFound
+ */
+
+public class ListLeafNotFound extends ListTestBase {
+
+    public ListLeafNotFound() {
+        setKey("host99");
+    }
+
+    public static void main(String[] args) throws Exception {
+        new ListLeafNotFound().run(args);
+    }
+
+    /*
+     * Tests that we get NameNotFoundException when listing a nonexistent
+     * leaf entry.
+     */
+    @Override
+    public void runTest() throws Exception {
+        setContext(new InitialDirContext(env()));
+        NamingEnumeration enumObj = context().list(getKey());
+
+        DNSTestUtils.debug("Enum is: " + enumObj);
+        throw new RuntimeException("Failed: expecting NameNotFoundException");
+    }
+
+    @Override
+    public boolean handleException(Exception e) {
+        if (e instanceof NameNotFoundException) {
+            System.out.println("Got expected exception: " + e);
+            return true;
+        }
+
+        return super.handleException(e);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jndi/dns/ListTests/ListTestBase.java	Mon Oct 22 14:03:06 2018 +0800
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.Hashtable;
+
+/**
+ * Abstract test base for List related Tests, this class extends DNSTestBase.
+ *
+ * This test base will also been referenced outside of current open test folder,
+ * please double check all usages when modify this.
+ *
+ * @see DNSTestBase
+ * @see TestBase
+ */
+public abstract class ListTestBase extends DNSTestBase {
+    private String key;
+    private String[] children;
+
+    public ListTestBase() {
+        // set default test data
+        setKey("subdomain");
+        setChildren("host1", "host2", "host3", "host4", "host5", "host6",
+                "host7", "host8", "host9");
+    }
+
+    /**
+     * Verify given entries, will throw RuntimeException if any child missing.
+     *
+     * @param entries given entries
+     */
+    public void verifyEntries(Hashtable<?, ?> entries) {
+        if (entries.size() != children.length) {
+            throw new RuntimeException(
+                    "Expected " + children.length + " entries but found "
+                            + entries.size());
+        } else {
+            for (String child : children) {
+                if (entries.get(child.toLowerCase()) == null) {
+                    throw new RuntimeException("Missing " + child);
+                }
+            }
+        }
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public void setChildren(String... children) {
+        this.children = children;
+    }
+}