< prev index next >
test/jdk/com/sun/jndi/dns/AttributeTests/GetAny.java
Print this page
@@ -26,56 +26,35 @@
* @bug 8195976
* @summary Tests that we can get the attributes of a DNS entry using special
* 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<Object, Object> env;
-
- env = DNSTestUtils.initEnv(socket, GetAny.class.getName(), argv);
+ public static void main(String[] args) throws Exception {
+ new GetAny().run(args);
+ }
- DirContext ctx = null;
+ @Override public Attributes getAttributes() {
+ return null;
+ }
- try {
- // connect to server
- ctx = new InitialDirContext(env);
+ @Override public void runTest() throws Exception {
+ initContext();
// Any type from IN class
- Attributes retAttrs = ctx.getAttributes(KEY, new String[] { "*" });
- DNSTestUtils.verifySchema(retAttrs, MANDATORY, OPTIONAL);
+ Attributes retAttrs = context()
+ .getAttributes(getKey(), new String[] { "*" });
+ verifyAttributes(retAttrs);
- retAttrs = ctx.getAttributes(KEY, new String[] { "* *" });
- DNSTestUtils.verifySchema(retAttrs, MANDATORY, OPTIONAL);
+ retAttrs = context().getAttributes(getKey(), new String[] { "* *" });
+ verifyAttributes(retAttrs);
- retAttrs = ctx.getAttributes(KEY, new String[] { "IN *" });
- DNSTestUtils.verifySchema(retAttrs, MANDATORY, OPTIONAL);
-
- } finally {
- DNSTestUtils.cleanup(ctx);
- }
+ retAttrs = context().getAttributes(getKey(), new String[] { "IN *" });
+ verifyAttributes(retAttrs);
}
}
< prev index next >