< prev index next >
test/jdk/com/sun/jndi/dns/AttributeTests/GetAny.java
Print this page
*** 26,81 ****
* @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";
! 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);
! DirContext ctx = null;
! try {
! // connect to server
! ctx = new InitialDirContext(env);
// Any type from IN class
! Attributes retAttrs = ctx.getAttributes(KEY, new String[] { "*" });
! DNSTestUtils.verifySchema(retAttrs, MANDATORY, OPTIONAL);
! retAttrs = ctx.getAttributes(KEY, new String[] { "* *" });
! DNSTestUtils.verifySchema(retAttrs, MANDATORY, OPTIONAL);
! retAttrs = ctx.getAttributes(KEY, new String[] { "IN *" });
! DNSTestUtils.verifySchema(retAttrs, MANDATORY, OPTIONAL);
!
! } finally {
! DNSTestUtils.cleanup(ctx);
! }
}
}
--- 26,60 ----
* @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/
* @run main GetAny
*/
import javax.naming.directory.Attributes;
! public class GetAny extends GetAttrsBase {
! public static void main(String[] args) throws Exception {
! new GetAny().run(args);
! }
! @Override public Attributes getAttributes() {
! return null;
! }
! @Override public void runTest() throws Exception {
! initContext();
// Any type from IN class
! Attributes retAttrs = context()
! .getAttributes(getKey(), new String[] { "*" });
! verifyAttributes(retAttrs);
! retAttrs = context().getAttributes(getKey(), new String[] { "* *" });
! verifyAttributes(retAttrs);
! retAttrs = context().getAttributes(getKey(), new String[] { "IN *" });
! verifyAttributes(retAttrs);
}
}
< prev index next >