| | |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.Operation; |
| | | import org.opends.server.types.OperationType; |
| | | import org.opends.server.util.TestTimer; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static java.util.concurrent.TimeUnit.*; |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.forgerock.opendj.ldap.ModificationType.*; |
| | | import static org.forgerock.opendj.ldap.requests.Requests.*; |
| | |
| | | }; |
| | | assertEquals(LDAPDelete.run(nullPrintStream(), System.err, args), 0); |
| | | |
| | | assertNull(DirectoryServer.getAuthenticatedUsers().get(userDN)); |
| | | // AuthenticatedUsers is a POST_RESPONSE plugin: the registry is updated |
| | | // after the client already received the response, so poll briefly. |
| | | newAuthInfoTimer().repeatUntilSuccess(new TestTimer.CallableVoid() |
| | | { |
| | | @Override |
| | | public void call() throws Exception |
| | | { |
| | | assertNull(DirectoryServer.getAuthenticatedUsers().get(userDN)); |
| | | } |
| | | }); |
| | | } |
| | | finally |
| | | { |
| | |
| | | }; |
| | | assertEquals(LDAPModify.run(nullPrintStream(), System.err, args), 0); |
| | | |
| | | DN newUserDN = DN.valueOf("uid=test,ou=users,dc=example,dc=com"); |
| | | assertNotNull(DirectoryServer.getAuthenticatedUsers().get(newUserDN)); |
| | | assertEquals(DirectoryServer.getAuthenticatedUsers().get(newUserDN).size(), 1); |
| | | final DN newUserDN = DN.valueOf("uid=test,ou=users,dc=example,dc=com"); |
| | | // AuthenticatedUsers is a POST_RESPONSE plugin: the registry is updated |
| | | // after the client already received the response, so poll briefly. |
| | | newAuthInfoTimer().repeatUntilSuccess(new TestTimer.CallableVoid() |
| | | { |
| | | @Override |
| | | public void call() throws Exception |
| | | { |
| | | assertNotNull(DirectoryServer.getAuthenticatedUsers().get(newUserDN)); |
| | | assertEquals(DirectoryServer.getAuthenticatedUsers().get(newUserDN).size(), 1); |
| | | } |
| | | }); |
| | | } |
| | | finally |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Timer to await the asynchronous {@link AuthenticatedUsers} registry |
| | | * update: it is performed by a POST_RESPONSE plugin, i.e. after the client |
| | | * already received the operation response. |
| | | */ |
| | | private TestTimer newAuthInfoTimer() |
| | | { |
| | | return new TestTimer.Builder() |
| | | .maxSleep(10, SECONDS) |
| | | .sleepTimes(100, MILLISECONDS) |
| | | .toTimer(); |
| | | } |
| | | |
| | | /** |
| | | * Tests to ensure that the "ignore" password policy state update policy |
| | | * works as expected. |
| | | * |