--- old/test/jdk/com/sun/jndi/dns/AttributeTests/GetAny.java 2018-07-12 14:53:08.000000000 +0800 +++ new/test/jdk/com/sun/jndi/dns/AttributeTests/GetAny.java 2018-07-12 14:53:08.000000000 +0800 @@ -28,54 +28,33 @@ * qualifiers. * @modules java.base/sun.security.util * @library ../lib/ - * @build DNSTestUtils DNSServer DNSTracer * @run main GetAny */ import javax.naming.directory.Attributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.InitialDirContext; -import java.net.DatagramSocket; -import java.net.InetAddress; -import java.util.Hashtable; -public class GetAny { - private static final String KEY = "host1"; +public class GetAny extends GetAttrsBase { - private static final String[] MANDATORY = { "A", "MX", "HINFO", "TXT", "29" - // "LOC" - }; - - private static final String[] OPTIONAL = {}; - - public static void main(String argv[]) throws Exception { - // Create socket on localhost only to avoid possible noise packet - DatagramSocket socket = new DatagramSocket(0, - InetAddress.getLoopbackAddress()); - - // initialize test - Hashtable env; - - env = DNSTestUtils.initEnv(socket, GetAny.class.getName(), argv); - - DirContext ctx = null; + public static void main(String[] args) throws Exception { + new GetAny().run(args); + } - try { - // connect to server - ctx = new InitialDirContext(env); + @Override public Attributes getAttributes() { + return null; + } - // Any type from IN class - Attributes retAttrs = ctx.getAttributes(KEY, new String[] { "*" }); - DNSTestUtils.verifySchema(retAttrs, MANDATORY, OPTIONAL); + @Override public void runTest() throws Exception { + initContext(); - retAttrs = ctx.getAttributes(KEY, new String[] { "* *" }); - DNSTestUtils.verifySchema(retAttrs, MANDATORY, OPTIONAL); + // Any type from IN class + Attributes retAttrs = context() + .getAttributes(getKey(), new String[] { "*" }); + verifyAttributes(retAttrs); - retAttrs = ctx.getAttributes(KEY, new String[] { "IN *" }); - DNSTestUtils.verifySchema(retAttrs, MANDATORY, OPTIONAL); + retAttrs = context().getAttributes(getKey(), new String[] { "* *" }); + verifyAttributes(retAttrs); - } finally { - DNSTestUtils.cleanup(ctx); - } + retAttrs = context().getAttributes(getKey(), new String[] { "IN *" }); + verifyAttributes(retAttrs); } }