< prev index next >
test/jdk/com/sun/jndi/ldap/NoWaitForReplyTest.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2011, 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.
--- 1,7 ----
/*
! * Copyright (c) 2011, 2020, 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.
*** 43,53 ****
// start the LDAP server
DummyServer ldapServer = new DummyServer();
ldapServer.start();
// Set up the environment for creating the initial context
! Hashtable env = new Hashtable(11);
env.put(Context.PROVIDER_URL, "ldap://localhost:" +
ldapServer.getPortNumber());
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
--- 43,53 ----
// start the LDAP server
DummyServer ldapServer = new DummyServer();
ldapServer.start();
// Set up the environment for creating the initial context
! Hashtable<Object, Object> env = new Hashtable<>(11);
env.put(Context.PROVIDER_URL, "ldap://localhost:" +
ldapServer.getPortNumber());
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
*** 68,78 ****
DirContext ctx = new InitialDirContext(env);
SearchControls scl = new SearchControls();
scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
System.out.println("Client: performing search");
! NamingEnumeration answer =
ctx.search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
// Server will never reply: either we waited in the call above until
// the timeout (fail) or we did not wait and reached here (pass).
passed = true;
--- 68,78 ----
DirContext ctx = new InitialDirContext(env);
SearchControls scl = new SearchControls();
scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
System.out.println("Client: performing search");
! NamingEnumeration<SearchResult> answer =
ctx.search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
// Server will never reply: either we waited in the call above until
// the timeout (fail) or we did not wait and reached here (pass).
passed = true;
< prev index next >