Code cleanup in tests
Replaced such pattern:
Entry entry = TestCaseUtils.makeEntry(ldifLines);
AddOperation addOperation = getRootConnection().processAdd(entry);
assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
assertNotNull(DirectoryServer.getEntry(entry.getName()));
with the follwing code:
Entry entry = TestCaseUtils.addEntry(ldifLines);
and modified TestCaseUtils.addEntry() to:
1) return the added entry
2) check that DirectoryServer.getEntry() can find the newly added entry
| | |
| | | * operation. |
| | | * |
| | | * @param lines The lines that make up the entry to be added. |
| | | * |
| | | * @return the added entry |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | public static void addEntry(String... lines) throws Exception |
| | | public static Entry addEntry(String... lines) throws Exception |
| | | { |
| | | Entry entry = makeEntry(lines); |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS, |
| | | addOperation.getErrorMessage().toString()); |
| | | assertNotNull(DirectoryServer.getEntry(entry.getName())); |
| | | return entry; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.extensions.TestPasswordValidator; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindResponseProtocolOp; |
| | |
| | | import org.opends.server.protocols.ldap.ModifyResponseProtocolOp; |
| | | import org.opends.server.tools.LDAPPasswordModify; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.RawModification; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | TestPasswordValidator.setNextInvalidReason(null); |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "-h", "127.0.0.1", |
| | |
| | | TestPasswordValidator.setNextInvalidReason(null); |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | TestPasswordValidator.setNextReturnValue(false); |
| | | String[] args = |
| | | { |
| | |
| | | TestPasswordValidator.setNextInvalidReason(null); |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "-h", "127.0.0.1", |
| | |
| | | TestPasswordValidator.setNextInvalidReason(null); |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "-h", "127.0.0.1", |
| | |
| | | TestPasswordValidator.setNextInvalidReason(null); |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "-h", "127.0.0.1", |
| | |
| | | TestPasswordValidator.setNextInvalidReason(null); |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "-h", "127.0.0.1", |
| | |
| | | TestPasswordValidator.setNextInvalidReason(null); |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | org.opends.server.tools.LDAPReader r = new org.opends.server.tools.LDAPReader(s); |
| | | LDAPWriter w = new LDAPWriter(s); |
| | |
| | | TestPasswordValidator.setNextInvalidReason(null); |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | org.opends.server.tools.LDAPReader r = new org.opends.server.tools.LDAPReader(s); |
| | | LDAPWriter w = new LDAPWriter(s); |
| | |
| | | TestPasswordValidator.setNextInvalidReason(null); |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | org.opends.server.tools.LDAPReader r = new org.opends.server.tools.LDAPReader(s); |
| | | LDAPWriter w = new LDAPWriter(s); |
| | |
| | | TestPasswordValidator.setNextInvalidReason(null); |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | org.opends.server.tools.LDAPReader r = new org.opends.server.tools.LDAPReader(s); |
| | | LDAPWriter w = new LDAPWriter(s); |
| | |
| | | TestPasswordValidator.setNextInvalidReason(null); |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | org.opends.server.tools.LDAPReader r = new org.opends.server.tools.LDAPReader(s); |
| | | LDAPWriter w = new LDAPWriter(s); |
| | |
| | | import java.util.UUID; |
| | | |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.backends.task.Task; |
| | |
| | | import org.opends.server.tasks.TasksTestCase; |
| | | import org.opends.server.tools.LDAPModify; |
| | | import org.opends.server.tools.LDAPSearch; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | "objectClass: organizationalUnit", |
| | | "ou: People"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = conn.processAdd(e); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.ENTRY_ALREADY_EXISTS); |
| | | } |
| | | |
| | |
| | | "objectClass: organizationalUnit", |
| | | "ou: test"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = conn.processAdd(e); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.NO_SUCH_OBJECT); |
| | | assertEquals(addOperation.getMatchedDN(), DN.valueOf("o=ldif")); |
| | | } |
| | |
| | | assertFalse(DirectoryServer.entryExists( |
| | | DN.valueOf("uid=user.1,ou=People,o=ldif"))); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: o=ldif", |
| | | "objectClass: top", |
| | | "objectClass: organization", |
| | | "o: ldif"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = conn.processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=ldif"))); |
| | | assertFalse(DirectoryServer.entryExists( |
| | | DN.valueOf("uid=user.1,ou=People,o=ldif"))); |
| | |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | |
| | | // Add an entry to the server that we can delete. |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Establish a connection to the server and bind as a root user. |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | |
| | | // Add an entry to the server that we can rename. |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Establish a connection to the server and bind as a root user. |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | | import org.opends.server.plugins.UpdatePreOpPlugin; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.*; |
| | | import org.opends.server.protocols.ldap.AddRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.AddResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPAttribute; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.tools.LDAPModify; |
| | | import org.opends.server.tools.LDAPReader; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.CancelRequest; |
| | | import org.opends.server.types.CancelResult; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.LockManager; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.Operation; |
| | | import org.opends.server.types.RawAttribute; |
| | | import org.opends.server.types.WritabilityMode; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.testng.annotations.AfterMethod; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | new LDAPAttribute("objectClass", byteStrings("top", "organizationalUnit")), |
| | | new LDAPAttribute("ou", byteStrings("People"))); |
| | | |
| | | AddOperation addOperation = |
| | | getRootConnection().processAdd(ByteString.valueOf("ou=People,o=test"), attrs); |
| | | AddOperation addOperation = getRootConnection().processAdd("ou=People,o=test", attrs); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(addOperation); |
| | | } |
| | |
| | | new LDAPAttribute("objectClass", byteStrings("top", "organizationalUnit")), |
| | | new LDAPAttribute("ou", byteStrings("People"))); |
| | | |
| | | AddOperation addOperation = |
| | | getRootConnection().processAdd(ByteString.valueOf("invalid"), attrs); |
| | | AddOperation addOperation = getRootConnection().processAdd("invalid", attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | new LDAPAttribute("objectClass", byteStrings("top", "organization")), |
| | | new LDAPAttribute("o", byteStrings("test"))); |
| | | |
| | | AddOperation addOperation = |
| | | getRootConnection().processAdd(ByteString.valueOf("o=test"), attrs); |
| | | AddOperation addOperation = getRootConnection().processAdd("o=test", attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | new LDAPAttribute("objectClass", byteStrings("top", "organization")), |
| | | new LDAPAttribute("o", byteStrings("undefined"))); |
| | | |
| | | AddOperation addOperation = |
| | | getRootConnection().processAdd(ByteString.valueOf("o=undefined"), attrs); |
| | | AddOperation addOperation = getRootConnection().processAdd("o=undefined", attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | new LDAPAttribute("objectClass", byteStrings("top", "organizationalUnit")), |
| | | new LDAPAttribute("ou", byteStrings("People"))); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | AddOperation addOperation = |
| | | conn.processAdd(ByteString.valueOf("ou=People,o=undefined"), attrs); |
| | | AddOperation addOperation = getRootConnection().processAdd("ou=People,o=undefined", attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | new LDAPAttribute("objectClass", byteStrings("top", "organizationalUnit")), |
| | | new LDAPAttribute("ou", byteStrings("People"))); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | AddOperation addOperation = |
| | | conn.processAdd(ByteString.valueOf("ou=People,o=missing,o=test"), |
| | | attrs); |
| | | AddOperation addOperation = getRootConnection().processAdd("ou=People,o=missing,o=test", attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | new LDAPAttribute("objectClass", byteStrings("top", "undefined")), |
| | | new LDAPAttribute("ou", byteStrings("People"))); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | AddOperation addOperation = |
| | | conn.processAdd(ByteString.valueOf("ou=People,o=test"), |
| | | attrs); |
| | | AddOperation addOperation = getRootConnection().processAdd(ByteString.valueOf("ou=People,o=test"), attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | new LDAPAttribute("ou", byteStrings("People")), |
| | | new LDAPAttribute("description", byteStrings("bar"))); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | AddOperation addOperation = |
| | | conn.processAdd(ByteString.valueOf("ou=People,o=test"), |
| | | attrs); |
| | | AddOperation addOperation = getRootConnection().processAdd(ByteString.valueOf("ou=People,o=test"), attrs); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | new LDAPAttribute("ou", byteStrings("People")), |
| | | new LDAPAttribute("description;lang-en-us", byteStrings("foo"))); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | AddOperation addOperation = |
| | | conn.processAdd(ByteString.valueOf("ou=People,o=test"), |
| | | attrs); |
| | | AddOperation addOperation = getRootConnection().processAdd(ByteString.valueOf("ou=People,o=test"), attrs); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | new LDAPAttribute("ou", byteStrings("People")), |
| | | new LDAPAttribute("description;lang-en-us", byteStrings("foo"))); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | AddOperation addOperation = |
| | | conn.processAdd(ByteString.valueOf("ou=People,o=test"), |
| | | attrs); |
| | | AddOperation addOperation = getRootConnection().processAdd(ByteString.valueOf("ou=People,o=test"), attrs); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | new LDAPAttribute("objectClass", byteStrings("top", "ds-root-dse", "extensibleObject")), |
| | | new LDAPAttribute("cn", byteStrings("Root DSE"))); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | AddOperation addOperation = |
| | | conn.processAdd(ByteString.empty(), attrs); |
| | | getRootConnection().processAdd(ByteString.empty(), attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | String backendID = createBackendID(baseDN); |
| | | Entry backendEntry = createBackendEntry(backendID, false, baseDN); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(backendEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | processAdd(backendEntry); |
| | | assertNull(DirectoryServer.getBackend(backendID)); |
| | | assertNull(DirectoryServer.getBackendWithBaseDN(baseDN)); |
| | | |
| | |
| | | String backendID = createBackendID(baseDN); |
| | | Entry backendEntry = createBackendEntry(backendID, true, baseDN); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(backendEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | processAdd(backendEntry); |
| | | |
| | | Backend<?> backend = DirectoryServer.getBackend(backendID); |
| | | assertNotNull(backend); |
| | | assertEquals(backend, DirectoryServer.getBackendWithBaseDN(baseDN)); |
| | | assertNull(backend.getParentBackend()); |
| | | assertTrue(backend.getSubordinateBackends().length == 0); |
| | | assertFalse(backend.entryExists(baseDN)); |
| | | assertTrue(DirectoryServer.isNamingContext(baseDN)); |
| | | |
| | | Entry e = createEntry(baseDN); |
| | | addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(backend.entryExists(baseDN)); |
| | | assertBackend(baseDN, backend); |
| | | createEntry(baseDN, backend); |
| | | |
| | | DeleteOperation deleteOperation = getRootConnection().processDelete(backendEntry.getName()); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | String backendID = createBackendID(baseDN); |
| | | Entry backendEntry = createBackendEntry(backendID, false, baseDN); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(backendEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | processAdd(backendEntry); |
| | | assertNull(DirectoryServer.getBackend(backendID)); |
| | | assertFalse(DirectoryServer.isNamingContext(baseDN)); |
| | | |
| | |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | Backend<?> backend = DirectoryServer.getBackend(backendID); |
| | | assertNotNull(backend); |
| | | assertEquals(backend, DirectoryServer.getBackendWithBaseDN(baseDN)); |
| | | assertNull(backend.getParentBackend()); |
| | | assertTrue(backend.getSubordinateBackends().length == 0); |
| | | assertFalse(backend.entryExists(baseDN)); |
| | | assertTrue(DirectoryServer.isNamingContext(baseDN)); |
| | | |
| | | Entry e = createEntry(baseDN); |
| | | addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(backend.entryExists(baseDN)); |
| | | assertBackend(baseDN, backend); |
| | | createEntry(baseDN, backend); |
| | | |
| | | |
| | | // Modify the backend to disable it. |
| | |
| | | String parentBackendID = createBackendID(parentBaseDN); |
| | | Entry parentBackendEntry = createBackendEntry(parentBackendID, true, |
| | | parentBaseDN); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(parentBackendEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | processAdd(parentBackendEntry); |
| | | |
| | | Backend<?> parentBackend = DirectoryServer.getBackend(parentBackendID); |
| | | assertNotNull(parentBackend); |
| | | assertEquals(parentBackend, |
| | | DirectoryServer.getBackendWithBaseDN(parentBaseDN)); |
| | | assertNull(parentBackend.getParentBackend()); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 0); |
| | | assertFalse(parentBackend.entryExists(parentBaseDN)); |
| | | assertTrue(DirectoryServer.isNamingContext(parentBaseDN)); |
| | | |
| | | Entry e = createEntry(parentBaseDN); |
| | | addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(parentBackend.entryExists(parentBaseDN)); |
| | | assertBackend(parentBaseDN, parentBackend); |
| | | createEntry(parentBaseDN, parentBackend); |
| | | |
| | | |
| | | // Create the child backend and the corresponding base entry. |
| | |
| | | String childBackendID = createBackendID(childBaseDN); |
| | | Entry childBackendEntry = createBackendEntry(childBackendID, true, |
| | | childBaseDN); |
| | | |
| | | addOperation = getRootConnection().processAdd(childBackendEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | processAdd(childBackendEntry); |
| | | |
| | | Backend<?> childBackend = DirectoryServer.getBackend(childBackendID); |
| | | assertNotNull(childBackend); |
| | |
| | | assertFalse(childBackend.entryExists(childBaseDN)); |
| | | assertFalse(DirectoryServer.isNamingContext(childBaseDN)); |
| | | |
| | | e = createEntry(childBaseDN); |
| | | addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(childBackend.entryExists(childBaseDN)); |
| | | createEntry(childBaseDN, childBackend); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | |
| | | String childBackendID = createBackendID(childBaseDN); |
| | | Entry childBackendEntry = createBackendEntry(childBackendID, true, |
| | | childBaseDN); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(childBackendEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | processAdd(childBackendEntry); |
| | | |
| | | Backend<?> childBackend = DirectoryServer.getBackend(childBackendID); |
| | | assertNotNull(childBackend); |
| | | assertEquals(childBackend, |
| | | DirectoryServer.getBackendWithBaseDN(childBaseDN)); |
| | | assertFalse(childBackend.entryExists(childBaseDN)); |
| | | assertNull(childBackend.getParentBackend()); |
| | | assertTrue(childBackend.getSubordinateBackends().length == 0); |
| | | assertFalse(childBackend.entryExists(childBaseDN)); |
| | | |
| | | Entry e = createEntry(childBaseDN); |
| | | addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(childBackend.entryExists(childBaseDN)); |
| | | assertBackend(childBaseDN, childBackend); |
| | | createEntry(childBaseDN, childBackend); |
| | | assertTrue(DirectoryServer.isNamingContext(childBaseDN)); |
| | | |
| | | |
| | |
| | | String parentBackendID = createBackendID(parentBaseDN); |
| | | Entry parentBackendEntry = createBackendEntry(parentBackendID, true, |
| | | parentBaseDN); |
| | | |
| | | addOperation = getRootConnection().processAdd(parentBackendEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | processAdd(parentBackendEntry); |
| | | |
| | | Backend<?> parentBackend = DirectoryServer.getBackend(parentBackendID); |
| | | assertNotNull(parentBackend); |
| | |
| | | assertEquals(parentBackend, childBackend.getParentBackend()); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 1); |
| | | |
| | | e = createEntry(parentBaseDN); |
| | | addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(parentBackend.entryExists(parentBaseDN)); |
| | | createEntry(parentBaseDN, parentBackend); |
| | | assertTrue(DirectoryServer.isNamingContext(parentBaseDN)); |
| | | assertFalse(DirectoryServer.isNamingContext(childBaseDN)); |
| | | |
| | |
| | | assertNull(DirectoryServer.getBackend(parentBackendID)); |
| | | } |
| | | |
| | | |
| | | private void assertBackend(DN baseDN, Backend<?> backend) throws DirectoryException |
| | | { |
| | | assertNotNull(backend); |
| | | assertEquals(backend, DirectoryServer.getBackendWithBaseDN(baseDN)); |
| | | assertFalse(backend.entryExists(baseDN)); |
| | | assertNull(backend.getParentBackend()); |
| | | assertTrue(backend.getSubordinateBackends().length == 0); |
| | | assertFalse(backend.entryExists(baseDN)); |
| | | assertTrue(DirectoryServer.isNamingContext(baseDN)); |
| | | } |
| | | |
| | | /** |
| | | * Tests the ability of the Directory Server to work properly when inserting |
| | |
| | | String parentBackendID = createBackendID(parentBaseDN); |
| | | Entry parentBackendEntry = createBackendEntry(parentBackendID, true, |
| | | parentBaseDN); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(parentBackendEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | processAdd(parentBackendEntry); |
| | | |
| | | Backend<?> parentBackend = DirectoryServer.getBackend(parentBackendID); |
| | | assertNotNull(parentBackend); |
| | | assertEquals(parentBackend, |
| | | DirectoryServer.getBackendWithBaseDN(parentBaseDN)); |
| | | assertNull(parentBackend.getParentBackend()); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 0); |
| | | assertFalse(parentBackend.entryExists(parentBaseDN)); |
| | | |
| | | Entry e = createEntry(parentBaseDN); |
| | | addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(parentBackend.entryExists(parentBaseDN)); |
| | | assertBackend(parentBaseDN, parentBackend); |
| | | createEntry(parentBaseDN, parentBackend); |
| | | assertTrue(DirectoryServer.isNamingContext(parentBaseDN)); |
| | | |
| | | |
| | |
| | | String grandchildBackendID = createBackendID(grandchildBaseDN); |
| | | Entry grandchildBackendEntry = createBackendEntry(grandchildBackendID, true, |
| | | grandchildBaseDN); |
| | | |
| | | addOperation = getRootConnection().processAdd(grandchildBackendEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | processAdd(grandchildBackendEntry); |
| | | |
| | | Backend<?> grandchildBackend = DirectoryServer.getBackend(grandchildBackendID); |
| | | assertNotNull(grandchildBackend); |
| | |
| | | |
| | | // Verify that we can't create the grandchild base entry because its parent |
| | | // doesn't exist. |
| | | e = createEntry(grandchildBaseDN); |
| | | addOperation = getRootConnection().processAdd(e); |
| | | Entry e = StaticUtils.createEntry(grandchildBaseDN); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.NO_SUCH_OBJECT); |
| | | assertFalse(grandchildBackend.entryExists(grandchildBaseDN)); |
| | | |
| | |
| | | String childBackendID = createBackendID(childBaseDN); |
| | | Entry childBackendEntry = createBackendEntry(childBackendID, true, |
| | | childBaseDN); |
| | | |
| | | addOperation = getRootConnection().processAdd(childBackendEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | processAdd(childBackendEntry); |
| | | |
| | | Backend<?> childBackend = DirectoryServer.getBackend(childBackendID); |
| | | assertNotNull(childBackend); |
| | | assertEquals(childBackend, |
| | | DirectoryServer.getBackendWithBaseDN(childBaseDN)); |
| | | assertNotNull(childBackend.getParentBackend()); |
| | | assertEquals(parentBackend, childBackend.getParentBackend()); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 1); |
| | | assertFalse(childBackend.entryExists(childBaseDN)); |
| | | assertTrue(childBackend.getSubordinateBackends().length == 1); |
| | | assertEquals(childBackend.getSubordinateBackends()[0], grandchildBackend); |
| | | assertEquals(grandchildBackend.getParentBackend(), childBackend); |
| | | |
| | | e = createEntry(childBaseDN); |
| | | addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(childBackend.entryExists(childBaseDN)); |
| | | createBackend(childBaseDN, childBackend, parentBackend, grandchildBackend); |
| | | createEntry(childBaseDN, childBackend); |
| | | |
| | | // Now we can create the grandchild base entry. |
| | | e = createEntry(grandchildBaseDN); |
| | | addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(grandchildBackend.entryExists(grandchildBaseDN)); |
| | | createEntry(grandchildBaseDN, grandchildBackend); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | |
| | | // valid, and make sure that it got re-inserted back into the same place in |
| | | // the hierarchy. |
| | | childBackend = DirectoryServer.getBackend(childBackendID); |
| | | assertNotNull(childBackend); |
| | | assertEquals(childBackend, |
| | | DirectoryServer.getBackendWithBaseDN(childBaseDN)); |
| | | assertNotNull(childBackend.getParentBackend()); |
| | | assertEquals(parentBackend, childBackend.getParentBackend()); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 1); |
| | | assertFalse(childBackend.entryExists(childBaseDN)); |
| | | assertTrue(childBackend.getSubordinateBackends().length == 1); |
| | | assertEquals(childBackend.getSubordinateBackends()[0], grandchildBackend); |
| | | assertEquals(grandchildBackend.getParentBackend(), childBackend); |
| | | createBackend(childBaseDN, childBackend, parentBackend, grandchildBackend); |
| | | |
| | | |
| | | // Since the memory backend that we're using for this test doesn't retain |
| | |
| | | |
| | | // Add the child entry back into the server to get things back to the way |
| | | // they were before we disabled the backend. |
| | | e = createEntry(childBaseDN); |
| | | addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(childBackend.entryExists(childBaseDN)); |
| | | createEntry(childBaseDN, childBackend); |
| | | |
| | | |
| | | // We should again be able to see all three entries when performing a |
| | |
| | | assertNull(DirectoryServer.getBackend(parentBackendID)); |
| | | } |
| | | |
| | | private void createBackend(DN childBaseDN, Backend<?> childBackend, Backend<?> parentBackend, |
| | | Backend<?> grandchildBackend) throws DirectoryException |
| | | { |
| | | assertNotNull(childBackend); |
| | | assertEquals(childBackend, DirectoryServer.getBackendWithBaseDN(childBaseDN)); |
| | | assertNotNull(childBackend.getParentBackend()); |
| | | assertEquals(parentBackend, childBackend.getParentBackend()); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 1); |
| | | assertFalse(childBackend.entryExists(childBaseDN)); |
| | | assertTrue(childBackend.getSubordinateBackends().length == 1); |
| | | assertEquals(childBackend.getSubordinateBackends()[0], grandchildBackend); |
| | | assertEquals(grandchildBackend.getParentBackend(), childBackend); |
| | | } |
| | | |
| | | private void createEntry(DN baseDN, Backend<?> backend) throws DirectoryException |
| | | { |
| | | Entry e = StaticUtils.createEntry(baseDN); |
| | | processAdd(e); |
| | | assertTrue(backend.entryExists(baseDN)); |
| | | } |
| | | |
| | | private void processAdd(Entry e) |
| | | { |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | /** |
| | | * Creates an entry that may be used to add a new backend to the server. It |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User"); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | AddOperation addOperation = conn.processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | BindOperation bindOperation = |
| | | conn.processSimpleBind(ByteString.valueOf("uid=test,o=test"), |
| | | ByteString.valueOf("password")); |
| | |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection connection = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | // Add a test entry. |
| | | entry = TestCaseUtils.makeEntry( |
| | | entry = TestCaseUtils.addEntry( |
| | | "dn: uid=rogasawara,o=test", |
| | | "userpassword: password", |
| | | "objectclass: top", |
| | |
| | | "aci: (targetattr=\"*\")(version 3.0; acl \"Proxy Rights\"; " + |
| | | "allow(proxy) userdn=\"ldap:///uid=proxy.user,o=test\";)" |
| | | ); |
| | | AddOperation addOperation = connection.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(entry.getName())); |
| | | |
| | | // Add a user capable of using the proxied authorization control. |
| | | TestCaseUtils.addEntry( |
| | |
| | | import java.util.concurrent.locks.Lock; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | | import org.opends.server.plugins.ShortCircuitPlugin; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.DeleteRequestProtocolOp; |
| | |
| | | import org.opends.server.tools.LDAPDelete; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.workflowelement.localbackend.LocalBackendDeleteOperation; |
| | | import org.testng.annotations.AfterMethod; |
| | |
| | | |
| | | private DeleteOperation processDeleteRaw(String entryDN) |
| | | { |
| | | InternalClientConnection conn = getRootConnection(); |
| | | return conn.processDelete(ByteString.valueOf(entryDN)); |
| | | return getRootConnection().processDelete(ByteString.valueOf(entryDN)); |
| | | } |
| | | |
| | | private DeleteOperation processDelete(String entryDN) throws DirectoryException |
| | | { |
| | | InternalClientConnection conn = getRootConnection(); |
| | | return conn.processDelete(DN.valueOf(entryDN)); |
| | | } |
| | | |
| | | private void processAdd(String... entryLines) throws Exception |
| | | { |
| | | Entry e = TestCaseUtils.makeEntry(entryLines); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | return getRootConnection().processDelete(DN.valueOf(entryDN)); |
| | | } |
| | | |
| | | /** |
| | |
| | | public void testDeleteWithValidRawDNLeaf() throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | processAdd("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | |
| | | public void testDeleteWithValidProcessedDNLeaf() throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | processAdd("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | |
| | | public void testDeleteWithNonLeafRawDN() throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | processAdd("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | |
| | | public void testDeleteWithNonLeafProcessedDN() throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | processAdd("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | |
| | | public void testFailAddToSingleValuedAttribute(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailAddToSingleValuedOperationalAttribute(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailReplaceSingleValuedWithMultipleValues(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | return conn.processModify(ByteString.valueOf(entryDN), mods, requestControls); |
| | | } |
| | | |
| | | private void processAdd(String... entryLines) throws Exception |
| | | { |
| | | Entry entry = TestCaseUtils.makeEntry(entryLines); |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests to ensure that a modify attempt fails if an attempt is made to add a |
| | | * value that matches one that already exists. |
| | |
| | | public void testFailAddDuplicateValue(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailReplaceWithDuplicates(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailReplaceWithSyntaxViolation(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailAddSyntaxViolation(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailAddDisallowedAttribute(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailReplaceRDNAttribute(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailRemoveRDNAttribute(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailRemoveRDNValue(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailReplaceOneOfMultipleRDNAttributes(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: givenName=Test+sn=User," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailRemoveOneOfMultipleRDNValues(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: givenName=Test+sn=User," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessRemoveCompleteAttribute(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessRemoveOneOfManyValues(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessRemoveOnlyValue(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessRemoveAllOfManyValues(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailRemoveRequiredAttribute(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailRemoveRequiredAttributeValue(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessReplaceExistingWithNew(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessReplaceExistingWithSame(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessDeleteAndAddSameValue(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessDeleteAttributeWithOption(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessReplaceExistingWithNothing(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessReplaceNonExistingWithNothing(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessReplaceNonExistingWithNew(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessRemoveOnlyExistingAndAddNew(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessRemoveOneExistingAndAddNew(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessRemoveOneExistingAndAddMultipleNew(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailRemoveNonExistentAttribute(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailRemoveNonExistentValue(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailRemoveAllObjectClasses(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailReplaceObjectClassesWithNothing(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailRemoveStructuralObjectclass(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=People," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: organizationalUnit", |
| | |
| | | public void testFailAddSecondStructuralObjectClass(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=People," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: organizationalUnit", |
| | |
| | | public void testSuccessIncrementByOne(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessIncrementByTen(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessIncrementByNegativeOne(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailIncrementNonNumeric(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailIncrementValueNonNumeric(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessIncrementMultiValued(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailIncrementNoIncrementValues(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailIncrementMultipleIncrementValues(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailIncrementNonExisting(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessRemoveUnneededAuxiliaryObjectClass(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessAddAuxiliaryObjectClass(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailAddDuplicateObjectClass(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailRemoveNonExistingObjectClass(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailReplaceNoUserModification(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailServerCompletelyReadOnly(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSucceedServerInternalOnlyWritability(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailServerInternalOnlyWritability(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailBackendCompletelyReadOnly(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSucceedBackendInternalOnlyWritability(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testFailBackendInternalOnlyWritability(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessPermissiveModifyControlAddDuplicateValue(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessPermissiveModifyControlRemoveNonExistentValue(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testSuccessPermissiveModifyControlRemoveNonExistentAttribute(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testModifyDelAddPasswordAttribute(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=testPassword01.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testModifyDelOneAddOnePasswordAttribute(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=testPassword02.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | public void testModifyDelEncryptedAddOnePasswordAttribute(String baseDN) |
| | | throws Exception |
| | | { |
| | | processAdd( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=testPassword03.user," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | { |
| | | String baseDN = "dc=example,dc=com"; |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", baseDN); |
| | | processAdd("dn: cn=Test User," + baseDN, |
| | | TestCaseUtils.addEntry("dn: cn=Test User," + baseDN, |
| | | "objectClass: top", "objectClass: person", |
| | | "objectClass: organizationalPerson", "sn: User", "cn: Test User"); |
| | | |
| | |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | // Add new entry and modify. |
| | | processAdd("dn: cn=Test User2," + baseDN, |
| | | TestCaseUtils.addEntry("dn: cn=Test User2," + baseDN, |
| | | "objectClass: top", "objectClass: person", |
| | | "objectClass: organizationalPerson", "sn: User2", "cn: Test User2"); |
| | | |
| | |
| | | assertEquals(result, 0, "Schema update failed"); |
| | | |
| | | // Add new entry and modify (this time it should fail). |
| | | processAdd("dn: cn=Test User3," + baseDN, |
| | | TestCaseUtils.addEntry("dn: cn=Test User3," + baseDN, |
| | | "objectClass: top", "objectClass: person", |
| | | "objectClass: organizationalPerson", "sn: User3", "cn: Test User3"); |
| | | |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.clearJEBackend(true,"userRoot","dc=example,dc=com"); |
| | | |
| | | InternalClientConnection connection = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | // Add the suffix entry. |
| | | DN suffixDN = DN.valueOf(SUFFIX); |
| | | if (DirectoryServer.getEntry(suffixDN) == null) |
| | | { |
| | | Entry suffixEntry = StaticUtils.createEntry(suffixDN); |
| | | AddOperation addOperation = connection.processAdd(suffixEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(suffixEntry.getName())); |
| | | processAdd(StaticUtils.createEntry(suffixDN)); |
| | | } |
| | | |
| | | // Add a search base entry. |
| | | DN baseDN = DN.valueOf(BASE); |
| | | if (DirectoryServer.getEntry(baseDN) == null) |
| | | { |
| | | Entry baseEntry = StaticUtils.createEntry(baseDN); |
| | | AddOperation addOperation = connection.processAdd(baseEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(baseEntry.getName())); |
| | | processAdd(StaticUtils.createEntry(baseDN)); |
| | | } |
| | | |
| | | // Add a test ldapsubentry. |
| | | Entry ldapSubentry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=subentry," + BASE, |
| | | "objectclass: ldapsubentry"); |
| | | AddOperation addOperation = connection.processAdd(ldapSubentry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(ldapSubentry.getName())); |
| | | |
| | | // Add a test entry. |
| | | testEntry = TestCaseUtils.makeEntry( |
| | |
| | | } |
| | | |
| | | // The add operation changes the attributes, so let's duplicate the entry. |
| | | Entry duplicateEntry = testEntry.duplicate(false); |
| | | processAdd(testEntry.duplicate(false)); |
| | | |
| | | addOperation = connection.processAdd(duplicateEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(testEntry.getName())); |
| | | |
| | | // Add a test referral entry. |
| | | Entry referralEntry = TestCaseUtils.makeEntry( |
| | | // referral entry. |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=People," + BASE, |
| | | "objectclass: extensibleobject", |
| | | "objectclass: referral", |
| | | "ref: ldap://hostb/OU=People,O=MNN,C=US", |
| | | "ref: ldap://hostc/OU=People,O=MNN,C=US"); |
| | | addOperation = connection.processAdd(referralEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(referralEntry.getName())); |
| | | |
| | | Entry level1Entry = TestCaseUtils.makeEntry( |
| | | // level 1 entry. |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=level1," + BASE, |
| | | "objectclass: top", |
| | | "objectclass: organizationalunit", |
| | | "ou: level1"); |
| | | addOperation = connection.processAdd(level1Entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(level1Entry.getName())); |
| | | |
| | | Entry level2Entry = TestCaseUtils.makeEntry( |
| | | // level 2 entry. |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=level2,ou=level1," + BASE, |
| | | "objectclass: top", |
| | | "objectclass: organizationalunit", |
| | | "ou: level2"); |
| | | addOperation = connection.processAdd(level2Entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(level2Entry.getName())); |
| | | |
| | | Entry referral2Entry = TestCaseUtils.makeEntry( |
| | | // referral 2 entry. |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=level3,ou=level2,ou=level1," + BASE, |
| | | "objectclass: extensibleobject", |
| | | "objectclass: referral", |
| | | "ref: ldap://hostb/OU=People,O=MNN,C=US", |
| | | "ref: ldap://hostc/OU=People,O=MNN,C=US", |
| | | "ref: ldap://hostd/OU=People,O=MNN,C=US"); |
| | | addOperation = connection.processAdd(referral2Entry); |
| | | } |
| | | |
| | | private void processAdd(Entry e) throws DirectoryException |
| | | { |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(referral2Entry.getName())); |
| | | assertNotNull(DirectoryServer.getEntry(e.getName())); |
| | | } |
| | | |
| | | |
| | |
| | | public void testInheritedCollectiveAttributes() throws Exception |
| | | { |
| | | // Add test inherited from DN collective subentry. |
| | | Entry collectiveDNInheritedSubentry = TestCaseUtils.makeEntry( |
| | | Entry collectiveDNInheritedSubentry = addEntry( |
| | | "dn: cn=Inherited From DN Collective Subentry," + SUFFIX, |
| | | "objectClass: top", |
| | | "objectclass: subentry", |
| | |
| | | "inheritAttribute: postalAddress", |
| | | "subtreeSpecification: {base \"ou=Test SubEntry Manager\"}", |
| | | "cn: Inherited From DN Collective Subentry"); |
| | | addEntry(collectiveDNInheritedSubentry); |
| | | |
| | | // Add test inherited from RDN collective subentry. |
| | | Entry collectiveRDNInheritedSubentry = TestCaseUtils.makeEntry( |
| | | Entry collectiveRDNInheritedSubentry = addEntry( |
| | | "dn: cn=Inherited From RDN Collective Subentry," + SUFFIX, |
| | | "objectClass: top", |
| | | "objectclass: subentry", |
| | |
| | | "inheritAttribute: telephoneNumber", |
| | | "subtreeSpecification: {base \"ou=Test SubEntry Manager\"}", |
| | | "cn: Inherited From RDN Collective Subentry"); |
| | | addEntry(collectiveRDNInheritedSubentry); |
| | | |
| | | // Test Inherited Collective Attributes on test entry. |
| | | hasValues(testEntry.getName(), "postaladdress", "Sub City, Collective Street, AK 47"); |
| | |
| | | } |
| | | |
| | | // Add Relative Spec test subentry. |
| | | Entry relativeSubentry = TestCaseUtils.makeEntry( |
| | | Entry relativeSubentry = addEntry( |
| | | "dn: cn=Relative Subentry," + SUFFIX, |
| | | "objectClass: top", |
| | | "objectclass: subentry", |
| | | "subtreeSpecification: {base \"ou=Test SubEntry Manager\", specificationFilter \"(objectClass=*)\"}", |
| | | "cn: Subentry"); |
| | | addEntry(relativeSubentry); |
| | | |
| | | List<SubEntry> relativeSubList = |
| | | DirectoryServer.getSubentryManager().getSubentries(); |
| | |
| | | } |
| | | |
| | | // Add role entry. |
| | | Entry roleEntry = TestCaseUtils.makeEntry( |
| | | addEntry( |
| | | "dn: cn=Sales," + BASE, |
| | | "objectclass: top", |
| | | "objectclass: organizationalRole", |
| | |
| | | "telephoneNumber: +1 999 999 9999", |
| | | "cn: Sales" |
| | | ); |
| | | addEntry(roleEntry); |
| | | |
| | | // Add test entry. |
| | | testEntry = TestCaseUtils.makeEntry( |
| | | testEntry = addEntry( |
| | | "dn: uid=rogasawara," + BASE, |
| | | "objectclass: top", |
| | | "objectclass: person", |
| | |
| | | "manager: cn=Sales," + BASE, |
| | | "title: Sales" |
| | | ); |
| | | addEntry(testEntry); |
| | | |
| | | // Add test subentry. |
| | | ldapSubentry = TestCaseUtils.makeEntry( |
| | | ldapSubentry = addEntry( |
| | | "dn: cn=Subentry," + SUFFIX, |
| | | "objectClass: top", |
| | | "objectclass: subentry", |
| | | "subtreeSpecification: {base \"ou=Test SubEntry Manager\"}", |
| | | "cn: Subentry"); |
| | | addEntry(ldapSubentry); |
| | | |
| | | // Add test legacy subentry. |
| | | legacyLdapSubentry = TestCaseUtils.makeEntry( |
| | | legacyLdapSubentry = addEntry( |
| | | "dn: cn=Legacy Subentry," + SUFFIX, |
| | | "objectClass: top", |
| | | "objectclass: ldapSubentry", |
| | | "cn: Legacy Subentry"); |
| | | addEntry(legacyLdapSubentry); |
| | | |
| | | // Add test collective subentry. |
| | | collectiveSubentry = TestCaseUtils.makeEntry( |
| | | collectiveSubentry = addEntry( |
| | | "dn: cn=Collective Subentry," + SUFFIX, |
| | | "objectClass: top", |
| | | "objectclass: subentry", |
| | |
| | | "preferredLanguage;collective: fr", |
| | | "subtreeSpecification: {base \"ou=Test SubEntry Manager\"}", |
| | | "cn: Collective Subentry"); |
| | | addEntry(collectiveSubentry); |
| | | } |
| | | |
| | | private void addEntry(Entry e) throws DirectoryException |
| | | { |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(e.getName())); |
| | | } |
| | | } |
| | |
| | | DN suffixDN = DN.valueOf(SUFFIX); |
| | | if (DirectoryServer.getEntry(suffixDN) == null) |
| | | { |
| | | Entry suffixEntry = StaticUtils.createEntry(suffixDN); |
| | | AddOperation addOperation = getRootConnection().processAdd(suffixEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(suffixEntry.getName())); |
| | | createEntry(suffixDN); |
| | | } |
| | | |
| | | // Add base entry. |
| | | DN baseDN = DN.valueOf(BASE); |
| | | if (DirectoryServer.getEntry(baseDN) == null) |
| | | { |
| | | Entry baseEntry = StaticUtils.createEntry(baseDN); |
| | | AddOperation addOperation = getRootConnection().processAdd(baseEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(baseEntry.getName())); |
| | | createEntry(baseDN); |
| | | } |
| | | |
| | | // Add test entry. |
| | | Entry testEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=rogasawara," + BASE, |
| | | "objectclass: top", |
| | | "objectclass: person", |
| | |
| | | "cn: Rodney Ogasawara", |
| | | "title: Sales, Director" |
| | | ); |
| | | AddOperation addOperation = getRootConnection().processAdd(testEntry); |
| | | } |
| | | |
| | | private void createEntry(DN suffixDN) throws Exception |
| | | { |
| | | Entry e = StaticUtils.createEntry(suffixDN); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(testEntry.getName())); |
| | | assertNotNull(DirectoryServer.getEntry(e.getName())); |
| | | } |
| | | |
| | | @AfterClass |
| | |
| | | |
| | | // The values are selected on a basis that they |
| | | // should differ from default password policy. |
| | | Entry policyEntry = TestCaseUtils.makeEntry( |
| | | Entry policyEntry = TestCaseUtils.addEntry( |
| | | "dn: cn=Temp Policy," + SUFFIX, |
| | | "objectClass: top", |
| | | "objectClass: pwdPolicy", |
| | |
| | | "pwdSafeModify: TRUE" |
| | | ); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(policyEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(policyEntry.getName())); |
| | | |
| | | PasswordPolicy policy = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy( |
| | | DN.valueOf("cn=Temp Policy," + SUFFIX)); |
| | | assertNotNull(policy); |
| | |
| | | |
| | | // The values are selected on a basis that they |
| | | // should differ from default password policy. |
| | | Entry policyEntry = TestCaseUtils.makeEntry( |
| | | Entry policyEntry = TestCaseUtils.addEntry( |
| | | "dn: cn=Temp Validator Policy," + SUFFIX, |
| | | "objectClass: top", |
| | | "objectClass: pwdPolicy", |
| | |
| | | "ds-cfg-password-validator: cn=Length-Based Password Validator,cn=Password Validators,cn=config" |
| | | ); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(policyEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(policyEntry.getName())); |
| | | |
| | | PasswordPolicy policy = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy( |
| | | DN.valueOf("cn=Temp Validator Policy," + SUFFIX)); |
| | | assertNotNull(policy); |
| | |
| | | |
| | | // Add new subentry policy with the |
| | | // scope to apply to the user entry. |
| | | Entry policyEntry = TestCaseUtils.makeEntry( |
| | | Entry policyEntry = TestCaseUtils.addEntry( |
| | | "dn: cn=Temp Policy," + SUFFIX, |
| | | "objectClass: top", |
| | | "objectClass: pwdPolicy", |
| | |
| | | "pwdAttribute: userPassword" |
| | | ); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(policyEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(policyEntry.getName())); |
| | | |
| | | // Make sure just added policy is in effect. |
| | | testEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=rogasawara," + BASE)); |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | |
| | | InternalClientConnection connection = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | // Add the example.com entry |
| | | Entry exampleCom = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: dc=example,dc=com", |
| | | "objectclass: top", |
| | | "objectclass: domain", |
| | |
| | | ); |
| | | |
| | | // Add the people entry |
| | | Entry people = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=People,dc=example,dc=com", |
| | | "objectclass: top", |
| | | "objectclass: organizationalUnit", |
| | |
| | | ); |
| | | |
| | | // Add a test entry. |
| | | entry = TestCaseUtils.makeEntry( |
| | | entry = TestCaseUtils.addEntry( |
| | | "dn: uid=user.0,ou=People,dc=example,dc=com", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "description: This is the description for Aaccf Amar." |
| | | ); |
| | | |
| | | AddOperation addOperation = connection.processAdd(exampleCom); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(exampleCom.getName())); |
| | | |
| | | addOperation = connection.processAdd(people); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(people.getName())); |
| | | |
| | | addOperation = connection.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getEntry(entry.getName())); |
| | | |
| | | // Add a user capable of using the proxied authorization control. |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=proxy.user,o=test", |
| | |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | // Initialize a backend with a base entry. |
| | | TestCaseUtils.clearJEBackend(true, "userRoot", suffix); |
| | | |
| | | // Create a client connection for the test. |
| | | InternalClientConnection connection = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | // Check that suffix is accessible while suffix2 is not. |
| | | searchEntry(connection, suffix, true); |
| | | searchEntry(connection, suffix2, false); |
| | | searchEntry(suffix, true); |
| | | searchEntry(suffix2, false); |
| | | |
| | | // Add a new suffix in the backend and create a base entry for the |
| | | // new suffix. |
| | | String backendConfigDN = "ds-cfg-backend-id=userRoot," + DN_BACKEND_BASE; |
| | | modifyAttribute( |
| | | connection, backendConfigDN, |
| | | ModificationType.ADD, backendBaseDNName, suffix2); |
| | | addBaseEntry(connection, suffix2, "networkgroup suffix"); |
| | | modifyAttribute(backendConfigDN, ModificationType.ADD, backendBaseDNName, suffix2); |
| | | addBaseEntry(suffix2, "networkgroup suffix"); |
| | | |
| | | // Both old and new suffix should be accessible. |
| | | searchEntry(connection, suffix, true); |
| | | searchEntry(connection, suffix2, true); |
| | | searchEntry(suffix, true); |
| | | searchEntry(suffix2, true); |
| | | |
| | | // Remove the new suffix... |
| | | modifyAttribute( |
| | | connection, backendConfigDN, |
| | | ModificationType.DELETE, backendBaseDNName, suffix2); |
| | | modifyAttribute(backendConfigDN, ModificationType.DELETE, backendBaseDNName, suffix2); |
| | | |
| | | // ...and check that the removed suffix is no more accessible. |
| | | searchEntry(connection, suffix, true); |
| | | searchEntry(connection, suffix2, false); |
| | | searchEntry(suffix, true); |
| | | searchEntry(suffix2, false); |
| | | |
| | | // Replace the suffix with suffix2 in the backend |
| | | modifyAttribute( |
| | | connection, backendConfigDN, |
| | | ModificationType.REPLACE, backendBaseDNName, suffix2); |
| | | modifyAttribute(backendConfigDN, ModificationType.REPLACE, backendBaseDNName, suffix2); |
| | | |
| | | // Now none of the suffixes are accessible: this means the entries |
| | | // under the old suffix are not moved to the new suffix. |
| | | searchEntry(connection, suffix, false); |
| | | searchEntry(connection, suffix2, false); |
| | | searchEntry(suffix, false); |
| | | searchEntry(suffix2, false); |
| | | |
| | | // Add a base entry for the new suffix |
| | | addBaseEntry(connection, suffix2, "networkgroup suffix"); |
| | | addBaseEntry(suffix2, "networkgroup suffix"); |
| | | |
| | | // The new suffix is accessible while the old one is not. |
| | | searchEntry(connection, suffix, false); |
| | | searchEntry(connection, suffix2, true); |
| | | searchEntry(suffix, false); |
| | | searchEntry(suffix2, true); |
| | | |
| | | // Reset the configuration with previous suffix |
| | | modifyAttribute( |
| | | connection, backendConfigDN, |
| | | ModificationType.REPLACE, backendBaseDNName, suffix); |
| | | modifyAttribute(backendConfigDN, ModificationType.REPLACE, backendBaseDNName, suffix); |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * Searches an entry on a given connection. |
| | | * |
| | | * @param connection the connection to use for the search request |
| | | * @param baseDN the request base DN string |
| | | * @param shouldExist if true the searched entry is expected to be found |
| | | */ |
| | | private void searchEntry( |
| | | InternalClientConnection connection, |
| | | String baseDN, |
| | | boolean shouldExist |
| | | ) throws Exception |
| | | private void searchEntry(String baseDN, boolean shouldExist) throws Exception |
| | | { |
| | | SearchOperation search = connection.processSearch(baseDN, SearchScope.BASE_OBJECT, "(objectClass=*)"); |
| | | SearchOperation search = getRootConnection().processSearch(baseDN, SearchScope.BASE_OBJECT, "(objectClass=*)"); |
| | | |
| | | // Compare the result code with the expected one |
| | | assertEquals(search.getResultCode(), shouldExist ? ResultCode.SUCCESS : ResultCode.NO_SUCH_OBJECT); |
| | |
| | | /** |
| | | * Creates a base entry for the given suffix. |
| | | * |
| | | * @param connection the connection to use for the add request |
| | | * @param suffix the suffix for which the base entry is to be created |
| | | */ |
| | | private void addBaseEntry( |
| | | InternalClientConnection connection, |
| | | String suffix, |
| | | String namingAttribute |
| | | ) throws Exception |
| | | private void addBaseEntry(String suffix, String namingAttribute) throws Exception |
| | | { |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: " + suffix, |
| | | "objectClass: top", |
| | | "objectClass: organization", |
| | | "o: " + namingAttribute); |
| | | |
| | | AddOperation addOperation = connection.processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Adds/Deletes/Replaces an attribute in a given entry. |
| | | * |
| | | * @param connection the connection to use for the modify request |
| | | * @param baseDN the request base DN string |
| | | * @param modType the modification type (add/delete/replace) |
| | | * @param attributeName the name of the attribute to add/delete/replace |
| | | * @param attributeValue the value of the attribute to add/delete/replace |
| | | */ |
| | | private void modifyAttribute( |
| | | InternalClientConnection connection, |
| | | String baseDN, |
| | | ModificationType modType, |
| | | String attributeName, |
| | |
| | | Attribute attributeToModify = |
| | | Attributes.create(attributeName, attributeValue); |
| | | mods.add(new Modification(modType, attributeToModify)); |
| | | ModifyOperation modifyOperation = connection.processModify( |
| | | DN.valueOf(baseDN), mods); |
| | | ModifyOperation modifyOperation = getRootConnection().processModify(DN.valueOf(baseDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.core.networkgroups; |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.EnumSet; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.RequestFilteringQOSPolicyCfgDefn.AllowedOperations; |
| | | import org.opends.server.admin.std.meta.RequestFilteringQOSPolicyCfgDefn.AllowedSearchScopes; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Modification; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.opends.server.types.OperationType; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.types.operation.PreParseAddOperation; |
| | | import org.opends.server.types.operation.PreParseBindOperation; |
| | | import org.opends.server.types.operation.PreParseCompareOperation; |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.forgerock.opendj.ldap.SearchScope.*; |
| | | import static org.opends.server.admin.std.meta.RequestFilteringQOSPolicyCfgDefn.AllowedOperations.*; |
| | | import static org.opends.server.admin.std.meta.RequestFilteringQOSPolicyCfgDefn.AllowedSearchScopes.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.assertFalse; |
| | | import static org.testng.Assert.assertTrue; |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | /* |
| | | /** |
| | | * This set of tests test the resource limits. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | public class RequestFilteringPolicyTest extends DirectoryServerTestCase { |
| | | //=========================================================================== |
| | | // |
| | | // B E F O R E C L A S S |
| | | // |
| | | //=========================================================================== |
| | | |
| | | /** |
| | |
| | | * @throws Exception if the environment could not be set up. |
| | | */ |
| | | @BeforeClass |
| | | public void setUp() |
| | | throws Exception |
| | | public void setUp() throws Exception |
| | | { |
| | | // This test suite depends on having the schema available, |
| | | // so we'll start the server. |
| | |
| | | |
| | | |
| | | //=========================================================================== |
| | | // |
| | | // D A T A P R O V I D E R |
| | | // |
| | | //=========================================================================== |
| | | |
| | | /* Provides information to create an allowedAttribute policy and a filter |
| | | * to test. |
| | | */ |
| | | /** Provides information to create an allowedAttribute policy and a filter to test. */ |
| | | @DataProvider (name = "AllowedAttributesSet") |
| | | public Object[][] initAllowedAttributesSet() |
| | | { |
| | | TreeSet<String> allowedAttr_uid_cn = new TreeSet<String>(); |
| | | allowedAttr_uid_cn.add("uid"); |
| | | allowedAttr_uid_cn.add("cn"); |
| | | TreeSet<String> allowedAttr_uid_cn = newTreeSet("uid", "cn"); |
| | | TreeSet<String> allowedAttr_cn = newTreeSet("cn"); |
| | | TreeSet<String> allowedAttr_uid = newTreeSet("uid"); |
| | | |
| | | TreeSet<String> allowedAttr_cn = new TreeSet<String>(); |
| | | allowedAttr_cn.add("cn"); |
| | | |
| | | TreeSet<String> allowedAttr_uid = new TreeSet<String>(); |
| | | allowedAttr_uid.add("uid"); |
| | | |
| | | Object[][] myData = { |
| | | return new Object[][] { |
| | | // allowed attributes, attribute to test, success |
| | | {allowedAttr_uid_cn, "uid=*", true}, |
| | | {allowedAttr_uid_cn, "cn=*", true}, |
| | |
| | | {allowedAttr_uid, "uid=*", true}, |
| | | {allowedAttr_uid, "(&(uid=user.1)(cn=*))", false} |
| | | }; |
| | | |
| | | return myData; |
| | | } |
| | | |
| | | /* Provides information to create a prohibitedAttribute policy and a filter |
| | | * to test. |
| | | */ |
| | | /** Provides information to create a prohibitedAttribute policy and a filter to test. */ |
| | | @DataProvider (name = "ProhibitedAttributesSet") |
| | | public Object[][] initProhibitedAttributesSet() |
| | | { |
| | | TreeSet<String> prohibitedAttr_uid = new TreeSet<String>(); |
| | | prohibitedAttr_uid.add("uid"); |
| | | TreeSet<String> prohibitedAttr_uid = newTreeSet("uid"); |
| | | TreeSet<String> prohibitedAttr_cn = newTreeSet("cn"); |
| | | |
| | | TreeSet<String> prohibitedAttr_cn = new TreeSet<String>(); |
| | | prohibitedAttr_cn.add("cn"); |
| | | |
| | | Object[][] myData = { |
| | | return new Object[][] { |
| | | // prohibited attributes, attribute to test, success |
| | | {prohibitedAttr_uid, "uid=*", false}, |
| | | {prohibitedAttr_cn, "uid=*", true}, |
| | | {prohibitedAttr_cn, "(&(uid=user.1)(cn=*))", false} |
| | | }; |
| | | |
| | | return myData; |
| | | } |
| | | |
| | | /* Provides information to create an allowedSearchScopes policy and a |
| | | * scope to test. |
| | | */ |
| | | /** Provides information to create an allowedSearchScopes policy and a scope to test. */ |
| | | @DataProvider (name = "AllowedSearchScopesSet") |
| | | public Object[][] initAllowedSearchScopesSet() |
| | | { |
| | | TreeSet<AllowedSearchScopes> scopes_all = |
| | | new TreeSet<AllowedSearchScopes>(); |
| | | scopes_all.add(AllowedSearchScopes.BASE); |
| | | scopes_all.add(AllowedSearchScopes.CHILDREN); |
| | | scopes_all.add(AllowedSearchScopes.ONE); |
| | | scopes_all.add(AllowedSearchScopes.SUB); |
| | | TreeSet<AllowedSearchScopes> scopes_all = newTreeSet2(BASE, CHILDREN, ONE, SUB); |
| | | TreeSet<AllowedSearchScopes> scope_base = newTreeSet2(BASE); |
| | | TreeSet<AllowedSearchScopes> scope_children = newTreeSet2(CHILDREN); |
| | | TreeSet<AllowedSearchScopes> scope_one = newTreeSet2(ONE); |
| | | TreeSet<AllowedSearchScopes> scope_sub = newTreeSet2(SUB); |
| | | |
| | | TreeSet<AllowedSearchScopes> scope_base = |
| | | new TreeSet<AllowedSearchScopes>(); |
| | | scope_base.add(AllowedSearchScopes.BASE); |
| | | |
| | | TreeSet<AllowedSearchScopes> scope_children = |
| | | new TreeSet<AllowedSearchScopes>(); |
| | | scope_children.add(AllowedSearchScopes.CHILDREN); |
| | | |
| | | TreeSet<AllowedSearchScopes> scope_one = |
| | | new TreeSet<AllowedSearchScopes>(); |
| | | scope_one.add(AllowedSearchScopes.ONE); |
| | | |
| | | TreeSet<AllowedSearchScopes> scope_sub = |
| | | new TreeSet<AllowedSearchScopes>(); |
| | | scope_sub.add(AllowedSearchScopes.SUB); |
| | | |
| | | Object[][] myData = { |
| | | return new Object[][] { |
| | | // allowed search scopes, scope to test, success |
| | | {scopes_all, SearchScope.BASE_OBJECT, true}, |
| | | {scope_base, SearchScope.BASE_OBJECT, true}, |
| | |
| | | {scope_sub, SearchScope.SUBORDINATES, false}, |
| | | {scope_sub, SearchScope.WHOLE_SUBTREE, true} |
| | | }; |
| | | |
| | | return myData; |
| | | } |
| | | |
| | | /* Provides information to create a allowedSubtree policy and |
| | | /** |
| | | * Provides information to create a allowedSubtree policy and |
| | | * a subtree search to test. |
| | | */ |
| | | @DataProvider (name = "AllowedSubtreesSet") |
| | | public Object[][] initAllowedSubtreesSet() |
| | | throws DirectoryException |
| | | { |
| | | TreeSet<DN> subtrees1 = new TreeSet<DN>(); |
| | | subtrees1.add(DN.valueOf("ou=people,dc=example,dc=com")); |
| | | TreeSet<DN> subtrees1 = newTreeSet(DN.valueOf("ou=people,dc=example,dc=com")); |
| | | TreeSet<DN> subtrees2 = newTreeSet(DN.valueOf("ou=test,dc=example,dc=com")); |
| | | TreeSet<DN> subtrees3 = newTreeSet(DN.valueOf("dc=example,dc=com")); |
| | | TreeSet<DN> subtrees4 = newTreeSet( |
| | | DN.valueOf("dc=example,dc=com"), |
| | | DN.valueOf("dc=test,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees2 = new TreeSet<DN>(); |
| | | subtrees2.add(DN.valueOf("ou=test,dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees3 = new TreeSet<DN>(); |
| | | subtrees3.add(DN.valueOf("dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees4 = new TreeSet<DN>(); |
| | | subtrees4.add(DN.valueOf("dc=example,dc=com")); |
| | | subtrees4.add(DN.valueOf("dc=test,dc=com")); |
| | | |
| | | Object[][] myData = { |
| | | return new Object[][] { |
| | | // allowed subtrees, subtree to test, success |
| | | {subtrees1, "ou=people,dc=example,dc=com", true}, |
| | | {subtrees2, "ou=people,dc=example,dc=com", false}, |
| | |
| | | {subtrees4, "dc=example,dc=com", true}, |
| | | {subtrees4, "ou=people,dc=example,dc=com", true} |
| | | }; |
| | | |
| | | return myData; |
| | | } |
| | | |
| | | /* Provides information to create a prohibitedSubtree policy and |
| | | /** Provides information to create a prohibitedSubtree policy and |
| | | * a subtree search to test. |
| | | */ |
| | | @DataProvider (name = "ProhibitedSubtreesSet") |
| | | public Object[][] initProhibitedSubtreesSet() throws DirectoryException |
| | | { |
| | | TreeSet<DN> subtrees1 = new TreeSet<DN>(); |
| | | subtrees1.add(DN.valueOf("ou=people,dc=example,dc=com")); |
| | | TreeSet<DN> subtrees1 = newTreeSet(DN.valueOf("ou=people,dc=example,dc=com")); |
| | | TreeSet<DN> subtrees2 = newTreeSet(DN.valueOf("ou=test,dc=example,dc=com")); |
| | | TreeSet<DN> subtrees3 = newTreeSet(DN.valueOf("dc=example,dc=com")); |
| | | TreeSet<DN> subtrees4 = newTreeSet( |
| | | DN.valueOf("dc=example,dc=com"), |
| | | DN.valueOf("dc=test,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees2 = new TreeSet<DN>(); |
| | | subtrees2.add(DN.valueOf("ou=test,dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees3 = new TreeSet<DN>(); |
| | | subtrees3.add(DN.valueOf("dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees4 = new TreeSet<DN>(); |
| | | subtrees4.add(DN.valueOf("dc=example,dc=com")); |
| | | subtrees4.add(DN.valueOf("dc=test,dc=com")); |
| | | |
| | | Object[][] myData = { |
| | | return new Object[][] { |
| | | // prohibited subtrees, subtree to test, success |
| | | {subtrees1, "ou=people,dc=example,dc=com", false}, |
| | | {subtrees2, "ou=people,dc=example,dc=com", true}, |
| | |
| | | {subtrees1, "dc=example,dc=com", true}, |
| | | {subtrees4, "ou=people,dc=example,dc=com", false} |
| | | }; |
| | | |
| | | return myData; |
| | | } |
| | | |
| | | /* Provides information to create a complex subtree policy and a |
| | | /** Provides information to create a complex subtree policy and a |
| | | * subtree search to test. |
| | | */ |
| | | @DataProvider (name = "ComplexSubtreesSet") |
| | | public Object[][] initComplexSubtreesSet() throws DirectoryException |
| | | { |
| | | TreeSet<DN> subtrees_empty = new TreeSet<DN>(); |
| | | TreeSet<DN> subtrees_empty = newTreeSet(); |
| | | TreeSet<DN> subtrees_root = newTreeSet(DN.valueOf("dc=example,dc=com")); |
| | | TreeSet<DN> subtrees_people = newTreeSet(DN.valueOf("ou=people,dc=example,dc=com")); |
| | | TreeSet<DN> subtrees_entry = newTreeSet(DN.valueOf("uid=user.1,ou=people,dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees_root = new TreeSet<DN>(); |
| | | subtrees_root.add(DN.valueOf("dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees_people = new TreeSet<DN>(); |
| | | subtrees_people.add(DN.valueOf("ou=people,dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees_entry = new TreeSet<DN>(); |
| | | subtrees_entry.add(DN.valueOf("uid=user.1,ou=people,dc=example,dc=com")); |
| | | |
| | | Object[][] myData = { |
| | | return new Object[][] { |
| | | // allowed subtree, prohibited subtree, subtree to test, success |
| | | {subtrees_root, subtrees_people, "dc=example,dc=com", true}, |
| | | {subtrees_root, subtrees_people, "ou=people,dc=example,dc=com", false}, |
| | |
| | | {subtrees_empty, subtrees_people, "dc=example,dc=com", true}, |
| | | {subtrees_empty, subtrees_people, "ou=people,dc=example,dc=com", false} |
| | | }; |
| | | return myData; |
| | | } |
| | | |
| | | /* Provides information to create an allowed operations policy. |
| | | */ |
| | | /** Provides information to create an allowed operations policy. */ |
| | | @DataProvider (name = "AllowedOperationsSet") |
| | | public Object[][] initAllowedOperationsSet() |
| | | { |
| | | TreeSet<AllowedOperations> ops_all = new TreeSet<AllowedOperations>(); |
| | | ops_all.add(AllowedOperations.ADD); |
| | | ops_all.add(AllowedOperations.BIND); |
| | | ops_all.add(AllowedOperations.COMPARE); |
| | | ops_all.add(AllowedOperations.DELETE); |
| | | ops_all.add(AllowedOperations.EXTENDED); |
| | | ops_all.add(AllowedOperations.INEQUALITY_SEARCH); |
| | | ops_all.add(AllowedOperations.MODIFY); |
| | | ops_all.add(AllowedOperations.RENAME); |
| | | ops_all.add(AllowedOperations.SEARCH); |
| | | TreeSet<AllowedOperations> ops_all = newTreeSet2( |
| | | ADD, BIND, COMPARE, DELETE, EXTENDED, INEQUALITY_SEARCH, MODIFY, RENAME, SEARCH); |
| | | TreeSet<AllowedOperations> ops_search = newTreeSet2(INEQUALITY_SEARCH, SEARCH); |
| | | TreeSet<AllowedOperations> ops_add_del = newTreeSet2(ADD, DELETE); |
| | | |
| | | TreeSet<AllowedOperations> ops_search = new TreeSet<AllowedOperations>(); |
| | | ops_search.add(AllowedOperations.INEQUALITY_SEARCH); |
| | | ops_search.add(AllowedOperations.SEARCH); |
| | | |
| | | TreeSet<AllowedOperations> ops_add_del = new TreeSet<AllowedOperations>(); |
| | | ops_add_del.add(AllowedOperations.ADD); |
| | | ops_add_del.add(AllowedOperations.DELETE); |
| | | |
| | | Object[][] myData = { |
| | | return new Object[][] { |
| | | // allowed operations, operation to test, success |
| | | {ops_all, OperationType.ABANDON, true}, |
| | | {ops_all, OperationType.ADD, true}, |
| | |
| | | {ops_add_del, OperationType.DELETE, true}, |
| | | {ops_add_del, OperationType.EXTENDED, false} |
| | | }; |
| | | return myData; |
| | | } |
| | | |
| | | //=========================================================================== |
| | | // |
| | | // T E S T C A S E S |
| | | // |
| | | //=========================================================================== |
| | | |
| | | /** |
| | | * Tests the "allowed attributes" policy |
| | | */ |
| | | private <T extends java.lang.Enum<T>> TreeSet<T> newTreeSet2(T op1, T... ops) |
| | | { |
| | | return new TreeSet<T>(EnumSet.of(op1, ops)); |
| | | } |
| | | |
| | | /** Tests the "allowed attributes" policy. */ |
| | | @Test (dataProvider = "AllowedAttributesSet", groups = "virtual") |
| | | public void testAllowedAttributes( |
| | | final SortedSet<String> allowedAttributes, |
| | |
| | | }); |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | InternalSearchOperation search = conn.processSearch( |
| | | DN.valueOf("dc=example,dc=com"), |
| | | SearchScope.BASE_OBJECT, |
| | | LDAPFilter.decode(searchFilter).toSearchFilter()); |
| | | |
| | | boolean check = policy.isAllowed(search, messages); |
| | | if (success) { |
| | | assertTrue(check); |
| | | } else { |
| | | assertFalse(check); |
| | | } |
| | | InternalSearchOperation search = conn.processSearch("dc=example,dc=com", BASE_OBJECT, searchFilter); |
| | | assertEquals(policy.isAllowed(search, messages), success); |
| | | } |
| | | |
| | | /** |
| | | * Tests the "prohibited operations" policy |
| | | */ |
| | | /** Tests the "prohibited operations" policy. */ |
| | | @Test (dataProvider = "ProhibitedAttributesSet", groups = "virtual") |
| | | public void testProhibitedAttributes( |
| | | final SortedSet<String> prohibitedAttributes, |
| | |
| | | }); |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | InternalSearchOperation search = conn.processSearch( |
| | | DN.valueOf("dc=example,dc=com"), |
| | | SearchScope.BASE_OBJECT, |
| | | LDAPFilter.decode(searchFilter).toSearchFilter()); |
| | | |
| | | boolean check = policy.isAllowed(search, messages); |
| | | if (success) { |
| | | assertTrue(check); |
| | | } else { |
| | | assertFalse(check); |
| | | } |
| | | InternalSearchOperation search = conn.processSearch("dc=example,dc=com", BASE_OBJECT, searchFilter); |
| | | assertEquals(policy.isAllowed(search, messages), success); |
| | | } |
| | | |
| | | /** |
| | |
| | | }); |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | InternalSearchOperation search = conn.processSearch( |
| | | DN.valueOf("dc=example,dc=com"), |
| | | searchScope, |
| | | LDAPFilter.decode("objectclass=*").toSearchFilter()); |
| | | |
| | | boolean check = policy.isAllowed(search, messages); |
| | | if (success) { |
| | | assertTrue(check); |
| | | } else { |
| | | assertFalse(check); |
| | | } |
| | | InternalSearchOperation search = conn.processSearch("dc=example,dc=com", searchScope, "objectclass=*"); |
| | | assertEquals(policy.isAllowed(search, messages), success); |
| | | } |
| | | |
| | | /** |
| | |
| | | }); |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | InternalSearchOperation search = conn.processSearch( |
| | | DN.valueOf(searchSubtree), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | LDAPFilter.decode("objectclass=*").toSearchFilter()); |
| | | |
| | | boolean check = policy.isAllowed(search, messages); |
| | | if (success) { |
| | | assertTrue(check); |
| | | } else { |
| | | assertFalse(check); |
| | | } |
| | | InternalSearchOperation search = conn.processSearch(searchSubtree, WHOLE_SUBTREE, "objectclass=*"); |
| | | assertEquals(policy.isAllowed(search, messages), success); |
| | | } |
| | | |
| | | /** |
| | |
| | | }); |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | InternalSearchOperation search = conn.processSearch( |
| | | DN.valueOf(searchSubtree), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | LDAPFilter.decode("objectclass=*").toSearchFilter()); |
| | | |
| | | boolean check = policy.isAllowed(search, messages); |
| | | if (success) { |
| | | assertTrue(check); |
| | | } else { |
| | | assertFalse(check); |
| | | } |
| | | InternalSearchOperation search = conn.processSearch(searchSubtree, WHOLE_SUBTREE, "objectclass=*"); |
| | | assertEquals(policy.isAllowed(search, messages), success); |
| | | } |
| | | |
| | | /** |
| | |
| | | }); |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | InternalSearchOperation search = conn.processSearch( |
| | | DN.valueOf(searchSubtree), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | LDAPFilter.decode("objectclass=*").toSearchFilter()); |
| | | InternalSearchOperation search = conn.processSearch(searchSubtree, WHOLE_SUBTREE, "objectclass=*"); |
| | | assertEquals(policy.isAllowed(search, messages), success); |
| | | } |
| | | |
| | | boolean check = policy.isAllowed(search, messages); |
| | | if (success) { |
| | | assertTrue(check); |
| | | } else { |
| | | assertFalse(check); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Tests the allowed operations policy. |
| | |
| | | "uid=usr.1,ou=people,dc=example,dc=com", true); |
| | | break; |
| | | case SEARCH: |
| | | op = conn.processSearch(DN.valueOf("dc=example,dc=com"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | LDAPFilter.decode("uid>=user.1").toSearchFilter()); |
| | | op = conn.processSearch("dc=example,dc=com", WHOLE_SUBTREE, "uid>=user.1"); |
| | | break; |
| | | case UNBIND: |
| | | return; |
| | | } |
| | | |
| | | boolean check = policy.isAllowed(op, messages); |
| | | if (success) { |
| | | assertTrue(check); |
| | | } else { |
| | | assertFalse(check); |
| | | } |
| | | assertEquals(policy.isAllowed(op, messages), success); |
| | | } |
| | | } |
| | |
| | | import org.opends.server.admin.server.AdminTestCaseUtils; |
| | | import org.opends.server.admin.std.meta.CramMD5SASLMechanismHandlerCfgDefn; |
| | | import org.opends.server.admin.std.server.CramMD5SASLMechanismHandlerCfg; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | public void testLDAPBindSuccessWithDNAndLongPassword() |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | String password = |
| | | "reallyreallyreallyreallyreallyreallyreallyreallyreallylongpassword"; |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.net.Socket; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashSet; |
| | |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.forgerock.opendj.ldap.DereferenceAliasesPolicy; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.plugins.DelayPreOpPlugin; |
| | | import org.opends.server.protocols.ldap.AddRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.AddResponseProtocolOp; |
| | |
| | | import org.opends.server.protocols.ldap.ModifyResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.SearchRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.SearchResultDoneProtocolOp; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.RawAttribute; |
| | | import org.opends.server.types.RawModification; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | |
| | | // Add an entry to the server that we can delete. |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Create a new connection to the Directory Server and authenticate as |
| | | // the Directory Manager. |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | |
| | | // Add an entry to the server that we can rename. |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Create a new connection to the Directory Server and authenticate as |
| | | // the Directory Manager. |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | |
| | | import org.opends.server.admin.server.AdminTestCaseUtils; |
| | | import org.opends.server.admin.std.meta.DigestMD5SASLMechanismHandlerCfgDefn; |
| | | import org.opends.server.admin.std.server.DigestMD5SASLMechanismHandlerCfg; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | /** |
| | | * Tests the process of initializing the handler with invalid configurations. |
| | | * |
| | | * @param entry The configuration entry to use for the initialization. |
| | | * |
| | | * @param e The configuration entry to use for the initialization. |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test(dataProvider = "invalidConfigs", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | public void testSuccessfulBindReversiblePasswordWithRootDN() |
| | | throws Exception |
| | | { |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | Entry e = TestCaseUtils.addEntry( |
| | | "dn: cn=Second Root DN,cn=Root DNs,cn=config", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DereferenceAliasesPolicy; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.std.meta.VirtualAttributeCfgDefn; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | |
| | | |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", "dc=example,dc=com"); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | Entry e = TestCaseUtils.addEntry( |
| | | "dn: dc=example,dc=com", |
| | | "objectClass: top", |
| | | "objectClass: domain", |
| | | "dc: example"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = conn.processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | e = DirectoryServer.getEntry(e.getName()); |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(entryUUIDType)); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(entryUUIDType); |
| | |
| | | import org.opends.server.admin.std.meta.ExactMatchIdentityMapperCfgDefn; |
| | | import org.opends.server.admin.std.server.ExactMatchIdentityMapperCfg; |
| | | import org.opends.server.api.IdentityMapper; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: Test", |
| | | "cn: Test", |
| | | "userPassword: password"); |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Ensure that the identity mapper is able to establish the mapping |
| | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: Test", |
| | | "cn: Test", |
| | | "userPassword: password"); |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Ensure that the identity mapper is able to establish the mapping |
| | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: Test", |
| | | "cn: Test", |
| | | "userPassword: password"); |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Ensure that the identity mapper is able to establish the mapping |
| | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: Test", |
| | | "cn: Test", |
| | | "userPassword: password"); |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Ensure that the identity mapper is able to establish the mapping |
| | |
| | | |
| | | // Create two user entries and add them to the directory. |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: Test", |
| | | "cn: Test", |
| | | "userPassword: password"); |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test2,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: Test", |
| | | "cn: Test", |
| | | "userPassword: password"); |
| | | addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Ensure that the identity mapper is able to establish the mapping |
| | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=foo,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: Bar", |
| | | "cn: Bar", |
| | | "userPassword: password"); |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Ensure that the identity mapper is able to establish the mapping |
| | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=foo,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: Bar", |
| | | "cn: Bar", |
| | | "userPassword: password"); |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Ensure that the identity mapper is able to establish the mapping |
| | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=foo,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: Bar", |
| | | "cn: Bar", |
| | | "userPassword: password"); |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Ensure that the identity mapper is able to establish the mapping |
| | | // successfully. |
| | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: User", |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Verify that "test" works for the initial configuration but "test user" |
| | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: User", |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | // Verify that we can retrieve the user. |
| | |
| | | import org.opends.server.admin.server.AdminTestCaseUtils; |
| | | import org.opends.server.admin.std.meta.ExternalSASLMechanismHandlerCfgDefn; |
| | | import org.opends.server.admin.std.server.ExternalSASLMechanismHandlerCfg; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "givenName: Test", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | | String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "givenName: Test", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "givenName: Test", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config"; |
| | | String attrName = "ds-cfg-certificate-validation-policy"; |
| | |
| | | inputStream.close(); |
| | | byte[] certBytes = ks.getCertificate("client-cert").getEncoded(); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: User", |
| | | "userCertificate;binary:: " + Base64.encode(certBytes)); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | "axuJ8LFNbZtsp1ldW3i84+F5+SYT+xI67ZcoAtwx/VFVI9s5I/Gkmu9f9nxjPpK7" + |
| | | "1AIUXiE3Qcck"; |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: User", |
| | | "userCertificate;binary:: " + Certificate); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | inputStream.close(); |
| | | byte[] certBytes = ks.getCertificate("client-cert").getEncoded(); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userCertificate;binary:: " + Base64.encode(certBytes)); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String dnStr = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config"; |
| | | String attrName = "ds-cfg-certificate-validation-policy"; |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | |
| | | "axuJ8LFNbZtsp1ldW3i84+F5+SYT+xI67ZcoAtwx/VFVI9s5I/Gkmu9f9nxjPpK7" + |
| | | "1AIUXiE3Qcck"; |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userCertificate;binary:: " + Certificate); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String dnStr = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config"; |
| | | String attrName = "ds-cfg-certificate-validation-policy"; |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | Entry userEntry = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | Entry userEntry = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | Entry userEntry = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | Entry userEntry = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | Entry userEntry = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | Entry userEntry = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | Entry userEntry = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | Entry userEntry = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | Entry userEntry = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-allow-pre-encoded-passwords"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | /* Make sure preEncoded passwords are rejected */ |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-allow-pre-encoded-passwords"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | /* Make sure preEncoded passwords are rejected */ |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-allow-pre-encoded-passwords"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-allow-user-password-changes"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-allow-user-password-changes"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-password-change-requires-current-password"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-require-secure-authentication"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-require-secure-password-changes"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-require-secure-password-changes"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-min-password-age"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-min-password-age"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | Entry userEntry = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr1 = "ds-cfg-max-password-age"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | Entry userEntry = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr1 = "ds-cfg-max-password-age"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-password-generator"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-password-generator"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-password-validator"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "userPassword: password"); |
| | | |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=Default Password Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-password-validator"; |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | | "objectClass: organizationalPerson", |
| | | "objectClass: inetOrgPerson", |
| | | "uid: test.user", |
| | | "givenName: Test", |
| | | "sn: User", |
| | | "cn: Test User", |
| | | "userPassword: password", |
| | | "userPassword: password2"); |
| | | |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | AddOperation addOperation = conn.processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | | "objectClass: organizationalPerson", |
| | | "objectClass: inetOrgPerson", |
| | | "uid: test.user", |
| | | "givenName: Test", |
| | | "sn: User", |
| | | "cn: Test User", |
| | | "userPassword: password", |
| | | "userPassword: password2"); |
| | | |
| | | |
| | | String[] args = |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry userEntry = TestCaseUtils.makeEntry( |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | String dnStr = "cn=SHA1 AuthPassword Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-allow-multiple-password-values"; |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "true"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | String dnStr = "cn=SHA1 AuthPassword Policy,cn=Password Policies,cn=config"; |
| | | String attr = "ds-cfg-allow-multiple-password-values"; |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "true"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | AddOperation addOperation = conn.processAdd(userEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | | "--noPropertiesFile", |
| | |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.SASLMechanismHandler; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: " + password); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | ByteStringBuilder saslCredBytes = new ByteStringBuilder(); |
| | | saslCredBytes.append((byte)0); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: " + password); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | ByteStringBuilder saslCredBytes = new ByteStringBuilder(); |
| | | saslCredBytes.append((byte)0); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: " + password); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | ByteStringBuilder saslCredBytes = new ByteStringBuilder(); |
| | | saslCredBytes.append("u:test.user"); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | Entry e = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: " + password); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | ByteStringBuilder saslCredBytes = new ByteStringBuilder(); |
| | | saslCredBytes.append((byte)0); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | Entry e = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: " + password); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | ByteStringBuilder saslCredBytes = new ByteStringBuilder(); |
| | | saslCredBytes.append("dn:"); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection anonymousConn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | BindOperation bindOperation = |
| | |
| | | |
| | | import java.io.File; |
| | | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.tools.LDAPSearch; |
| | | import org.opends.server.types.Entry; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "givenName: Test", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | | String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "givenName: Test", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.controls.ProxiedAuthV2Control; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.ExtendedOperation; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp; |
| | |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | Entry e = TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOp = getRootConnection().processAdd(e); |
| | | assertEquals(addOp.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(new AuthenticationInfo(e, false)); |
| | | ExtendedOperation extOp = |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOp = getRootConnection().processAdd(e); |
| | | assertEquals(addOp.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader reader = new LDAPReader(s); |
| | |
| | | import java.util.UUID; |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.server.AdminTestCaseUtils; |
| | | import org.opends.server.admin.std.meta.EntryUUIDPluginCfgDefn; |
| | | import org.opends.server.admin.std.server.EntryUUIDPluginCfg; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.DN; |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | Entry e = TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | e = DirectoryConfig.getEntry(e.getName()); |
| | | assertNotNull(e); |
| | | assertNotNull(e.getAttribute("entryuuid")); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | Entry e = TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test", |
| | | "entryUUID: " + UUID.randomUUID()); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | e = DirectoryConfig.getEntry(e.getName()); |
| | | assertNotNull(e); |
| | | assertNotNull(e.getAttribute("entryuuid")); |
| | | } |
| | | } |
| | |
| | | import org.opends.server.admin.std.meta.LastModPluginCfgDefn; |
| | | import org.opends.server.admin.std.server.LastModPluginCfg; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | Entry e = TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | e = DirectoryConfig.getEntry(e.getName()); |
| | | assertNotNull(e); |
| | | assertNotNull(e.getAttribute("creatorsname")); |
| | | assertNotNull(e.getAttribute("createtimestamp")); |
| | | } |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | Entry e = TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ModifyDNOperation modifyDNOperation = |
| | | getRootConnection().processModifyDN(e.getName(), RDN.decode("cn=test2"), false); |
| | | assertEquals(modifyDNOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | import org.opends.server.types.RDN; |
| | | import org.testng.annotations.*; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * Unit test to test Referential Integrity plugin. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | public class ReferentialIntegrityPluginTestCase extends PluginTestCase { |
| | | |
| | | //Config DNs and attributes. |
| | |
| | | builder.add(valString); |
| | | } |
| | | mods.add(new Modification(ModificationType.ADD, builder.toAttribute())); |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | return conn.processModify(dn, mods); |
| | | return getRootConnection().processModify(dn, mods); |
| | | } |
| | | |
| | | /** |
| | |
| | | builder.add(valString); |
| | | } |
| | | mods.add(new Modification(ModificationType.REPLACE, builder.toAttribute())); |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | return conn.processModify(dn, mods); |
| | | return getRootConnection().processModify(dn, mods); |
| | | } |
| | | |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.empty(attrType))); |
| | | } |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | conn.processModify(dn, mods); |
| | | getRootConnection().processModify(dn, mods); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | private void deleteEntries(String... dns) throws Exception{ |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalClientConnection conn = getRootConnection(); |
| | | for(String dn : dns) { |
| | | DeleteOperation op=conn.processDelete(DN.valueOf(dn)); |
| | | assertEquals(op.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | |
| | | private void deleteSubtree(String... dns) throws Exception |
| | | { |
| | | InternalClientConnection conn = InternalClientConnection |
| | | .getRootConnection(); |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | SubtreeDeleteControl control = new SubtreeDeleteControl(true); |
| | | List<Control> controls = new ArrayList<Control>(1); |
| | |
| | | throws Exception { |
| | | AttributeType type= getAttrType(attr); |
| | | String filterStr="(" + attr + "=*)"; |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalClientConnection conn = getRootConnection(); |
| | | InternalSearchOperation operation = conn.processSearch(DN.valueOf(entryDN), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferenceAliasesPolicy.NEVER, 0, 0, false, |
| | |
| | | * |
| | | */ |
| | | private void addEntries(String... dns) throws Exception { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | for(String dn : dns) { |
| | | Entry e=makeEntry(dn); |
| | | AddOperation op=conn.processAdd(e); |
| | | assertEquals(op.getResultCode(), ResultCode.SUCCESS); |
| | | addEntry(dn); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return The created entry. |
| | | * @throws Exception If the entry can't be created. |
| | | */ |
| | | private Entry makeEntry(String dn) throws Exception { |
| | | return TestCaseUtils.makeEntry( |
| | | private Entry addEntry(String dn) throws Exception { |
| | | return TestCaseUtils.addEntry( |
| | | "dn: " + dn, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | */ |
| | | private void |
| | | doModDN(String dn, String rdn, String newSuperior) throws Exception { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalClientConnection conn = getRootConnection(); |
| | | ModifyDNOperation modDNop; |
| | | if(newSuperior != null) |
| | | modDNop = conn.processModifyDN(DN.valueOf(dn), RDN.decode(rdn), true, |
| | |
| | | "manager:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | Entry entry = null; |
| | | AddOperation addOperation = null; |
| | | addEntry("uid=manager,ou=people,ou=dept,o=test"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | entry = makeEntry("uid=manager,ou=people,ou=dept,o=test"); |
| | | |
| | | addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | entry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=employee,ou=people,ou=dept,dc=example,dc=com", |
| | | "objectclass: top", |
| | | "objectclass: person", |
| | |
| | | "sn: employee", |
| | | "givenname: employee", |
| | | "manager: uid=manager,ou=people,ou=dept,o=test"); |
| | | |
| | | addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | /** |
| | |
| | | "manager:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | Entry entry = null; |
| | | AddOperation addOperation = null; |
| | | addEntry("uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | entry = makeEntry("uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | entry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=employee,ou=people,ou=dept,dc=example,dc=com", |
| | | "objectclass: top", |
| | | "objectclass: person", |
| | |
| | | "sn: employee", |
| | | "givenname: employee", |
| | | "manager: uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | /** |
| | |
| | | "manager:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | Entry entry = null; |
| | | AddOperation addOperation = null; |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | entry = TestCaseUtils.makeEntry( |
| | | Entry entry = TestCaseUtils.makeEntry( |
| | | "dn: uid=employee,ou=people,ou=dept,dc=example,dc=com", |
| | | "objectclass: top", |
| | | "objectclass: person", |
| | |
| | | "givenname: employee", |
| | | "manager: uid=bad,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | addOperation = conn.processAdd(entry); |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | |
| | | "manager:(objectclass=gropuOfNames)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | Entry entry = null; |
| | | AddOperation addOperation = null; |
| | | addEntry("uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | entry = makeEntry("uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | entry = TestCaseUtils.makeEntry( |
| | | Entry entry = TestCaseUtils.makeEntry( |
| | | "dn: uid=employee,ou=people,ou=dept,dc=example,dc=com", |
| | | "objectclass: top", |
| | | "objectclass: person", |
| | |
| | | "givenname: employee", |
| | | "manager: uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | addOperation = conn.processAdd(entry); |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | |
| | | "manager:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | Entry entry = null; |
| | | AddOperation addOperation = null; |
| | | addEntry("uid=manager,ou=people,ou=dept,o=test"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | entry = makeEntry("uid=manager,ou=people,ou=dept,o=test"); |
| | | |
| | | addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | entry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=employee,ou=people,ou=dept,dc=example,dc=com", |
| | | "objectclass: top", |
| | | "objectclass: person", |
| | |
| | | "sn: employee", |
| | | "givenname: employee", |
| | | "manager: uid=manager,ou=people,ou=dept,o=test"); |
| | | |
| | | addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | | } |
| | | |
| | | /** |
| | |
| | | "member:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | Entry entry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=referent group,ou=groups,dc=example,dc=com", |
| | | "objectclass: top", |
| | | "objectclass: groupofnames", |
| | |
| | | "member: uid=user.4,ou=people,ou=dept,dc=example,dc=com", |
| | | "member: uid=user.5,ou=people,ou=dept,dc=example,dc=com" |
| | | ); |
| | | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | /** |
| | |
| | | "member:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | Entry entry = TestCaseUtils.makeEntry( |
| | | "dn: cn=referent group,ou=groups,dc=example,dc=com", |
| | | "objectclass: top", |
| | |
| | | "member: uid=user.5,ou=people,ou=dept,dc=example,dc=com" |
| | | ); |
| | | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | |
| | | "member:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | Entry entry = TestCaseUtils.makeEntry( |
| | | "dn: cn=referent group,ou=groups,dc=example,dc=com", |
| | | "objectclass: top", |
| | |
| | | "member: uid=user.5,ou=people,ou=dept,dc=example,dc=com" |
| | | ); |
| | | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | |
| | | "member:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | Entry entry = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=referent group,ou=groups,dc=example,dc=com", |
| | | "objectclass: top", |
| | | "objectclass: groupofnames", |
| | |
| | | "member: uid=user.4,ou=people,ou=dept,dc=example,dc=com", |
| | | "member: uid=user.5,ou=people,ou=dept,dc=example,dc=com" |
| | | ); |
| | | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | | } |
| | | |
| | | /** |
| | |
| | | "manager:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | Entry entry = makeEntry("uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | addEntry("uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(user1), |
| | | "manager", "uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | |
| | | "manager:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | Entry entry = makeEntry("uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | addEntry("uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(user1), |
| | | "manager", "uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | |
| | | "manager:(objectclass=posixAccount)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | Entry entry = makeEntry("uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | addEntry("uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(user1), |
| | | "manager", "uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | |
| | | "manager:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | Entry entry = makeEntry("uid=manager,ou=people,ou=dept,o=test"); |
| | | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | addEntry("uid=manager,ou=people,ou=dept,o=test"); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(user1), |
| | | "manager", "uid=manager,ou=people,ou=dept,o=test"); |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.types.*; |
| | | import org.testng.annotations.*; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.empty(attrType))); |
| | | } |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | conn.processModify(dn, mods); |
| | | getRootConnection().processModify(dn, mods); |
| | | } |
| | | |
| | | |
| | |
| | | builder.add(valString); |
| | | } |
| | | mods.add(new Modification(ModificationType.REPLACE, builder.toAttribute())); |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | conn.processModify(dn, mods); |
| | | getRootConnection().processModify(dn, mods); |
| | | } |
| | | |
| | | |
| | |
| | | * @throws Exception If an error occurs. |
| | | */ |
| | | private void addEntry(Entry e, ResultCode rc) throws Exception { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = conn.processAdd(e); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), rc); |
| | | } |
| | | |
| | |
| | | * @param dn The DN of the entry to modify. |
| | | * @param rc The expected return code. |
| | | */ |
| | | private void |
| | | doMods(LinkedList<Modification> mods, DN dn, ResultCode rc ) { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(dn, mods); |
| | | private void doMods(LinkedList<Modification> mods, DN dn, ResultCode rc) { |
| | | ModifyOperation modifyOperation = getRootConnection().processModify(dn, mods); |
| | | assertEquals(modifyOperation.getResultCode(), rc); |
| | | } |
| | | |
| | |
| | | * @param newSuperior New superior to move to. |
| | | * @param rc Expected return code from operation. |
| | | */ |
| | | private void |
| | | doModDN(DN dn, RDN rdn, boolean delOld, DN newSuperior, ResultCode rc) { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyDNOperation modifyDNOperation = |
| | | conn.processModifyDN(dn, rdn, delOld, newSuperior); |
| | | private void doModDN(DN dn, RDN rdn, boolean delOld, DN newSuperior, ResultCode rc) { |
| | | ModifyDNOperation modifyDNOperation = getRootConnection().processModifyDN(dn, rdn, delOld, newSuperior); |
| | | assertEquals(modifyDNOperation.getResultCode(), rc); |
| | | } |
| | | } |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | CompareOperation compareOperation = |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | CompareOperation compareOperation = |
| | | conn.processCompare(DN.valueOf("cn=test,o=test"), |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | DeleteOperation deleteOperation = |
| | | getRootConnection().processDelete(ByteString.valueOf("cn=test,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | getRootConnection().processDelete(DN.valueOf("cn=test,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | values.add(ByteString.valueOf("This is a test")); |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("description", "This is a test"))); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | ModifyDNOperation modifyDNOperation = |
| | | conn.processModifyDN(ByteString.valueOf("cn=test,o=test"), |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | ModifyDNOperation modifyDNOperation = |
| | | conn.processModifyDN(ByteString.valueOf("cn=test,o=test"), |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | ModifyDNOperation modifyDNOperation = |
| | | conn.processModifyDN(DN.valueOf("cn=test,o=test"), |
| | | RDN.decode("cn=test2"), true); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | ModifyDNOperation modifyDNOperation = |
| | | conn.processModifyDN(DN.valueOf("cn=test,o=test"), |
| | | RDN.decode("cn=test2"), true, |
| | |
| | | */ |
| | | protected void task(String task) throws Exception |
| | | { |
| | | Entry taskEntry = TestCaseUtils.makeEntry(task); |
| | | |
| | | // Add the task. |
| | | AddOperation addOperation = connection.processAdd(taskEntry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS, |
| | | "Add of the task definition was not successful"); |
| | | Entry taskEntry = TestCaseUtils.addEntry(task); |
| | | |
| | | // Wait until the task completes. |
| | | SearchFilter filter = SearchFilter.createFilterFromString("(objectclass=*)"); |
| | |
| | | baseDN = DN.valueOf("ou=People," + TEST_ROOT_DN_STRING); |
| | | |
| | | // Create necessary backend top level entry |
| | | String topEntry = "dn: " + baseDN + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: organizationalUnit\n" |
| | | + "entryUUID: 11111111-1111-1111-1111-111111111111\n"; |
| | | addEntry(TestCaseUtils.entryFromLdifString(topEntry)); |
| | | TestCaseUtils.addEntry( |
| | | "dn: " + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: organizationalUnit", |
| | | "entryUUID: 11111111-1111-1111-1111-111111111111"); |
| | | |
| | | baseUUID = getEntryUUID(baseDN); |
| | | |
| | |
| | | |
| | | private void testSetUp(String tc) throws Exception |
| | | { |
| | | personEntry = TestCaseUtils.entryFromLdifString("dn: uid=user.1." + tc + "," + baseDN + "\n" |
| | | + "objectClass: top\n" + "objectClass: person\n" |
| | | + "objectClass: organizationalPerson\n" |
| | | + "objectClass: inetOrgPerson\n" + "uid: user.1\n" |
| | | + "homePhone: 951-245-7634\n" |
| | | + "description: This is the description for Aaccf Amar.\n" + "st: NC\n" |
| | | + "mobile: 027-085-0537\n" |
| | | + "postalAddress: Aaccf Amar$17984 Thirteenth Street" |
| | | + "$Rockford, NC 85762\n" + "mail: user.1@example.com\n" |
| | | + "cn: Aaccf Amar\n" + "l: Rockford\n" + "pager: 508-763-4246\n" |
| | | + "street: 17984 Thirteenth Street\n" |
| | | + "telephoneNumber: 216-564-6748\n" + "employeeNumber: 1\n" |
| | | + "sn: Amar\n" + "givenName: Aaccf\n" + "postalCode: 85762\n" |
| | | + "userPassword: password\n" + "initials: AA\n"); |
| | | personEntry = TestCaseUtils.makeEntry( |
| | | "dn: uid=user.1." + tc + "," + baseDN + "", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | | "objectClass: organizationalPerson", |
| | | "objectClass: inetOrgPerson", |
| | | "uid: user.1", |
| | | "homePhone: 951-245-7634", |
| | | "description: This is the description for Aaccf Amar.", |
| | | "st: NC", |
| | | "mobile: 027-085-0537", |
| | | "postalAddress: Aaccf Amar$17984 Thirteenth Street $Rockford, NC 85762", |
| | | "mail: user.1@example.com", |
| | | "cn: Aaccf Amar", |
| | | "l: Rockford", |
| | | "pager: 508-763-4246", |
| | | "street: 17984 Thirteenth Street", |
| | | "telephoneNumber: 216-564-6748", |
| | | "employeeNumber: 1", |
| | | "sn: Amar", |
| | | "givenName: Aaccf", |
| | | "postalCode: 85762", |
| | | "userPassword: password", |
| | | "initials: AA"); |
| | | |
| | | /* |
| | | * The 2 entries defined in the following code are used for the naming |
| | |
| | | user1entryUUID = "33333333-3333-3333-3333-333333333333"; |
| | | user1entrysecondUUID = "22222222-2222-2222-2222-222222222222"; |
| | | user1dn = DN.valueOf("uid=user1" + tc + "," + baseDN); |
| | | personWithUUIDEntry = TestCaseUtils.entryFromLdifString("dn: "+ user1dn + "\n" |
| | | + "objectClass: top\n" + "objectClass: person\n" |
| | | + "objectClass: organizationalPerson\n" |
| | | + "objectClass: inetOrgPerson\n" + "uid: user.1\n" |
| | | + "homePhone: 951-245-7634\n" |
| | | + "description: This is the description for Aaccf Amar.\n" + "st: NC\n" |
| | | + "mobile: 027-085-0537\n" |
| | | + "postalAddress: Aaccf Amar$17984 Thirteenth Street" |
| | | + "$Rockford, NC 85762\n" + "mail: user.1@example.com\n" |
| | | + "cn: Aaccf Amar\n" + "l: Rockford\n" + "pager: 508-763-4246\n" |
| | | + "street: 17984 Thirteenth Street\n" |
| | | + "telephoneNumber: 216-564-6748\n" + "employeeNumber: 1\n" |
| | | + "sn: Amar\n" + "givenName: Aaccf\n" + "postalCode: 85762\n" |
| | | + "userPassword: password\n" + "initials: AA\n" |
| | | + "entryUUID: " + user1entryUUID + "\n"); |
| | | personWithUUIDEntry = TestCaseUtils.makeEntry( |
| | | "dn: "+ user1dn + "", |
| | | "objectClass: top", "objectClass: person", |
| | | "objectClass: organizationalPerson", |
| | | "objectClass: inetOrgPerson", "uid: user.1", |
| | | "homePhone: 951-245-7634", |
| | | "description: This is the description for Aaccf Amar.", "st: NC", |
| | | "mobile: 027-085-0537", |
| | | "postalAddress: Aaccf Amar$17984 Thirteenth Street $Rockford, NC 85762", "mail: user.1@example.com", |
| | | "cn: Aaccf Amar", "l: Rockford", "pager: 508-763-4246", |
| | | "street: 17984 Thirteenth Street", |
| | | "telephoneNumber: 216-564-6748", "employeeNumber: 1", |
| | | "sn: Amar", "givenName: Aaccf", "postalCode: 85762", |
| | | "userPassword: password", "initials: AA", |
| | | "entryUUID: " + user1entryUUID + "\n"); |
| | | |
| | | personWithSecondUniqueID = TestCaseUtils.entryFromLdifString("dn: "+ user1dn + "\n" |
| | | + "objectClass: top\n" + "objectClass: person\n" |
| | | + "objectClass: organizationalPerson\n" |
| | | + "objectClass: inetOrgPerson\n" + "uid: user.1\n" |
| | | + "homePhone: 951-245-7634\n" |
| | | + "description: This is the description for Aaccf Amar.\n" + "st: NC\n" |
| | | + "mobile: 027-085-0537\n" |
| | | + "postalAddress: Aaccf Amar$17984 Thirteenth Street" |
| | | + "$Rockford, NC 85762\n" + "mail: user.1@example.com\n" |
| | | + "cn: Aaccf Amar\n" + "l: Rockford\n" + "pager: 508-763-4246\n" |
| | | + "street: 17984 Thirteenth Street\n" |
| | | + "telephoneNumber: 216-564-6748\n" + "employeeNumber: 1\n" |
| | | + "sn: Amar\n" + "givenName: Aaccf\n" + "postalCode: 85762\n" |
| | | + "userPassword: password\n" + "initials: AA\n" |
| | | + "entryUUID: "+ user1entrysecondUUID + "\n"); |
| | | personWithSecondUniqueID = TestCaseUtils.makeEntry( |
| | | "dn: "+ user1dn, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | | "objectClass: organizationalPerson", |
| | | "objectClass: inetOrgPerson", |
| | | "uid: user.1", |
| | | "homePhone: 951-245-7634", |
| | | "description: This is the description for Aaccf Amar.", |
| | | "st: NC", |
| | | "mobile: 027-085-0537", |
| | | "postalAddress: Aaccf Amar$17984 Thirteenth Street $Rockford, NC 85762", |
| | | "mail: user.1@example.com", |
| | | "cn: Aaccf Amar", |
| | | "l: Rockford", |
| | | "pager: 508-763-4246", |
| | | "street: 17984 Thirteenth Street", |
| | | "telephoneNumber: 216-564-6748", |
| | | "employeeNumber: 1", |
| | | "sn: Amar", |
| | | "givenName: Aaccf", |
| | | "postalCode: 85762", |
| | | "userPassword: password", |
| | | "initials: AA", |
| | | "entryUUID: "+ user1entrysecondUUID); |
| | | |
| | | user3UUID = "44444444-4444-4444-4444-444444444444"; |
| | | user3dn = DN.valueOf("uid=user3" + tc + "," + baseDN); |
| | | user3Entry = TestCaseUtils.entryFromLdifString("dn: "+ user3dn + "\n" |
| | | + "objectClass: top\n" + "objectClass: person\n" |
| | | + "objectClass: organizationalPerson\n" |
| | | + "objectClass: inetOrgPerson\n" + "uid: user.1\n" |
| | | + "homePhone: 951-245-7634\n" |
| | | + "description: This is the description for Aaccf Amar.\n" + "st: NC\n" |
| | | + "mobile: 027-085-0537\n" |
| | | + "postalAddress: Aaccf Amar$17984 Thirteenth Street" |
| | | + "$Rockford, NC 85762\n" + "mail: user.3@example.com\n" |
| | | + "cn: Aaccf Amar\n" + "l: Rockford\n" + "pager: 508-763-4246\n" |
| | | + "street: 17984 Thirteenth Street\n" |
| | | + "telephoneNumber: 216-564-6748\n" + "employeeNumber: 1\n" |
| | | + "sn: Amar\n" + "givenName: Aaccf\n" + "postalCode: 85762\n" |
| | | + "userPassword: password\n" + "initials: AA\n" |
| | | + "entryUUID: " + user3UUID + "\n"); |
| | | user3Entry = TestCaseUtils.makeEntry("dn: "+ user3dn, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | | "objectClass: organizationalPerson", |
| | | "objectClass: inetOrgPerson", |
| | | "uid: user.1", |
| | | "homePhone: 951-245-7634", |
| | | "description: This is the description for Aaccf Amar.", |
| | | "st: NC", |
| | | "mobile: 027-085-0537", |
| | | "postalAddress: Aaccf Amar$17984 Thirteenth Street $Rockford, NC 85762", |
| | | "mail: user.3@example.com", |
| | | "cn: Aaccf Amar", |
| | | "l: Rockford", |
| | | "pager: 508-763-4246", |
| | | "street: 17984 Thirteenth Street", |
| | | "telephoneNumber: 216-564-6748", |
| | | "employeeNumber: 1", |
| | | "sn: Amar", |
| | | "givenName: Aaccf", |
| | | "postalCode: 85762", |
| | | "userPassword: password", |
| | | "initials: AA", |
| | | "entryUUID: " + user3UUID); |
| | | |
| | | domain1dn = DN.valueOf("dc=domain1," + baseDN); |
| | | domain2dn = DN.valueOf("dc=domain2,dc=domain1," + baseDN); |
| | | domain3dn = DN.valueOf("dc=domain3,dc=domain1," + baseDN); |
| | | domain1 = TestCaseUtils.entryFromLdifString( |
| | | "dn:" + domain1dn + "\n" |
| | | + "objectClass:domain\n" |
| | | + "dc:domain1"); |
| | | domain2 = TestCaseUtils.entryFromLdifString( |
| | | "dn:" + domain2dn + "\n" |
| | | + "objectClass:domain\n" |
| | | + "dc:domain2"); |
| | | domain3 = TestCaseUtils.entryFromLdifString( |
| | | "dn:" + domain3dn + "\n" |
| | | + "objectClass:domain\n" |
| | | + "dc:domain3"); |
| | | domain1 = TestCaseUtils.makeEntry( |
| | | "dn:" + domain1dn, |
| | | "objectClass:domain", |
| | | "dc:domain1"); |
| | | domain2 = TestCaseUtils.makeEntry( |
| | | "dn:" + domain2dn, |
| | | "objectClass:domain", |
| | | "dc:domain2"); |
| | | domain3 = TestCaseUtils.makeEntry( |
| | | "dn:" + domain3dn, |
| | | "objectClass:domain", |
| | | "dc:domain3"); |
| | | } |
| | | |
| | | /** |
| | |
| | | DN baseDN2 = DN.valueOf("ou=baseDn2," + baseDN); |
| | | |
| | | // - create parent entry 1 with baseDn1 |
| | | connection.processAdd(TestCaseUtils.entryFromLdifString( |
| | | "dn: " + baseDN1 + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: organizationalUnit\n" |
| | | + "entryUUID: 55555555-5555-5555-5555-555555555555\n")); |
| | | connection.processAdd(TestCaseUtils.makeEntry( |
| | | "dn: " + baseDN1, |
| | | "objectClass: top", |
| | | "objectClass: organizationalUnit", |
| | | "entryUUID: 55555555-5555-5555-5555-555555555555")); |
| | | assertNotNull(getEntry(baseDN1, 10000, true), |
| | | "Entry not added: " + baseDN1); |
| | | |
| | |
| | | "Entry not moved from " + baseDN1 + " to " + baseDN2); |
| | | |
| | | // - add new parent entry 2 with baseDn1 |
| | | connection.processAdd(TestCaseUtils.entryFromLdifString( |
| | | "dn: " + baseDN1 + "\n" |
| | | + "objectClass: top\n" |
| | | + "objectClass: organizationalUnit\n" |
| | | + "entryUUID: 66666666-6666-6666-6666-666666666666\n")); |
| | | connection.processAdd(TestCaseUtils.makeEntry( |
| | | "dn: " + baseDN1, |
| | | "objectClass: top", |
| | | "objectClass: organizationalUnit", |
| | | "entryUUID: 66666666-6666-6666-6666-666666666666")); |
| | | |
| | | // - publish msg |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | |
| | | CSNGenerator gen = new CSNGenerator(serverId, 0); |
| | | |
| | | // Create a test entry. |
| | | Entry tmp = TestCaseUtils.entryFromLdifString( |
| | | "dn: uid=user.2," + baseDN + "\n" |
| | | + "objectClass: top\n" + "objectClass: person\n" |
| | | + "objectClass: organizationalPerson\n" |
| | | + "objectClass: inetOrgPerson\n" + "uid: user.2\n" |
| | | + "homePhone: 951-245-7634\n" |
| | | + "description: This is the description for Aaccf Amar.\n" |
| | | + "st: NC\n" |
| | | + "mobile: 027-085-0537\n" |
| | | + "postalAddress: Aaccf Amar$17984 Thirteenth Street" |
| | | + "$Rockford, NC 85762\n" + "mail: user.1@example.com\n" |
| | | + "cn: Aaccf Amar\n" + "l: Rockford\n" + "pager: 508-763-4246\n" |
| | | + "street: 17984 Thirteenth Street\n" |
| | | + "telephoneNumber: 216-564-6748\n" + "employeeNumber: 1\n" |
| | | + "sn: Amar\n" + "givenName: Aaccf\n" + "postalCode: 85762\n" |
| | | + "userPassword: password\n" + "initials: AA\n"); |
| | | AddOperation addOp = connection.processAdd(tmp); |
| | | assertEquals(addOp.getResultCode(), ResultCode.SUCCESS); |
| | | Entry tmp = TestCaseUtils.addEntry( |
| | | "dn: uid=user.2," + baseDN, |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | | "objectClass: organizationalPerson", |
| | | "objectClass: inetOrgPerson", |
| | | "uid: user.2", |
| | | "homePhone: 951-245-7634", |
| | | "description: This is the description for Aaccf Amar.", |
| | | "st: NC", |
| | | "mobile: 027-085-0537", |
| | | "postalAddress: Aaccf Amar$17984 Thirteenth Street $Rockford, NC 85762", |
| | | "mail: user.1@example.com", |
| | | "cn: Aaccf Amar", |
| | | "l: Rockford", |
| | | "pager: 508-763-4246", |
| | | "street: 17984 Thirteenth Street", |
| | | "telephoneNumber: 216-564-6748", |
| | | "employeeNumber: 1", |
| | | "sn: Amar", |
| | | "givenName: Aaccf", |
| | | "postalCode: 85762", |
| | | "userPassword: password", |
| | | "initials: AA"); |
| | | |
| | | long initialCount = getMonitorAttrValue(baseDN, "replayed-updates"); |
| | | |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.SASLMechanismHandler; |
| | | import org.opends.server.controls.PasswordPolicyRequestControl; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.extensions.AnonymousSASLMechanismHandler; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | |
| | | import com.forgerock.opendj.cli.ClientException; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | SASLMechanismHandler<?> cramMD5Handler = |
| | | DirectoryServer.getSASLMechanismHandler("CRAM-MD5"); |
| | | DirectoryServer.deregisterSASLMechanismHandler("CRAM-MD5"); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | SASLMechanismHandler<?> digestMD5Handler = |
| | | DirectoryServer.getSASLMechanismHandler("DIGEST-MD5"); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: User", |
| | | "cn: Test User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | SASLMechanismHandler<?> externalHandler = |
| | | DirectoryServer.getSASLMechanismHandler("EXTERNAL"); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: User", |
| | | "cn: Test User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: User", |
| | | "cn: Test User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | SASLMechanismHandler<?> externalHandler = |
| | | DirectoryServer.getSASLMechanismHandler("EXTERNAL"); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: User", |
| | | "cn: Test User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | SASLMechanismHandler<?> plainHandler = |
| | | DirectoryServer.getSASLMechanismHandler("PLAIN"); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "sn: User", |
| | | "cn: Test User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | LDAPReader r = new LDAPReader(s); |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.util.Base64; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.testng.annotations.AfterClass; |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.ldap.LDAPResultCode.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * A set of test cases for the LDAPCompare tool. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | public class LDAPCompareTestCase |
| | | extends ToolsTestCase |
| | | { |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | import java.io.FileWriter; |
| | | import java.util.ArrayList; |
| | | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.types.Entry; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String path = TestCaseUtils.createTempFile( |
| | | "o=test", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "cn: Test User", |
| | | "userPassword: password"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | | |
| | | |
| | | import java.io.File; |
| | | import java.io.FileWriter; |
| | | import java.util.ArrayList; |
| | | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.types.Entry; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the LDAPModify tool. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | public class LDAPModifyTestCase |
| | | extends ToolsTestCase |
| | | { |
| | | // The path to a file containing an invalid bind password. |
| | | /** The path to a file containing an invalid bind password. */ |
| | | private String invalidPasswordFile; |
| | | |
| | | // The path to a file containing a valid bind password. |
| | | /** The path to a file containing a valid bind password. */ |
| | | private String validPasswordFile; |
| | | |
| | | // The path to a file containing a simple, valid modification. |
| | | /** The path to a file containing a simple, valid modification. */ |
| | | private String modifyFilePath; |
| | | |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-privilege-name: bypass-acl", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=People,o=test", |
| | | "objectClass: top", |
| | | "objectClass: organizationalUnit", |
| | | "ou: People"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String path = TestCaseUtils.createTempFile( |
| | | "dn: ou=People,o=test", |
| | | "changetype: moddn", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=People,o=test", |
| | | "objectClass: top", |
| | | "objectClass: organizationalUnit", |
| | | "ou: People"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String path = TestCaseUtils.createTempFile( |
| | | "dn: ou=People,o=test", |
| | | "changetype: moddn", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=People,o=test", |
| | | "objectClass: top", |
| | | "objectClass: organizationalUnit", |
| | | "ou: People"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String path = TestCaseUtils.createTempFile("dn: ou=People,o=test", |
| | | "changetype: moddn", |
| | | "newRDN: ou=Users", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=People,o=test", |
| | | "objectClass: top", |
| | | "objectClass: organizationalUnit", |
| | | "ou: People"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String path = TestCaseUtils.createTempFile("dn: ou=People,o=test", |
| | | "changetype: moddn", |
| | | "newRDN: ou=Users", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: ou=People,o=test", |
| | | "objectClass: top", |
| | | "objectClass: organizationalUnit", |
| | | "ou: People"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String path = TestCaseUtils.createTempFile("dn: ou=People,o=test", |
| | | "changetype: moddn", |
| | | "newRDN: ou=Users", |
| | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Entry; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * A set of test cases for the LDAPSearch tool. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | public class LDAPSearchTestCase |
| | | extends ToolsTestCase |
| | | { |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "givenName: Test", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "givenName: Test", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "givenName: Test", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: cn=Test User,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "givenName: Test", |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String keyStorePath = DirectoryServer.getInstanceRoot() + File.separator + |
| | | "config" + File.separator + "client.keystore"; |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | TestCaseUtils.addEntry( |
| | | "dn: uid=test.user,o=test", |
| | | "objectClass: top", |
| | | "objectClass: person", |
| | |
| | | "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," + |
| | | "cn=Password Policies,cn=config"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | TestCaseUtils.addEntry("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: ldapSubEntry", |
| | | "cn: test"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | |
| | | import java.io.File; |
| | | import java.io.FileWriter; |
| | | import java.net.Socket; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.UUID; |
| | | import java.util.concurrent.CopyOnWriteArraySet; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | import org.opends.server.backends.task.TaskState; |
| | | import org.opends.server.controls.ProxiedAuthV1Control; |
| | | import org.opends.server.controls.ProxiedAuthV2Control; |
| | | import org.opends.server.core.*; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.AddOperationBasis; |
| | | import org.opends.server.core.CompareOperation; |
| | | import org.opends.server.core.CompareOperationBasis; |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.DeleteOperationBasis; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyDNOperationBasis; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | | import org.opends.server.core.SchemaConfigManager; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | | import org.opends.server.protocols.ldap.BindResponseProtocolOp; |
| | | import org.opends.server.protocols.ldap.LDAPMessage; |
| | | import org.opends.server.tools.*; |
| | | import org.opends.server.tools.LDAPModify; |
| | | import org.opends.server.tools.LDAPPasswordModify; |
| | | import org.opends.server.tools.LDAPReader; |
| | | import org.opends.server.tools.LDAPSearch; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | |
| | | private void assertPrivilege(ResultCode actual, boolean hasPrivilege) |
| | | { |
| | | if (hasPrivilege) |
| | | { |
| | | assertEquals(actual, ResultCode.SUCCESS); |
| | | } |
| | | else |
| | | { |
| | | assertEquals(actual, ResultCode.INSUFFICIENT_ACCESS_RIGHTS); |
| | | } |
| | | assertEquals(actual, hasPrivilege ? SUCCESS : INSUFFICIENT_ACCESS_RIGHTS); |
| | | } |
| | | |
| | | private void assertProxyPrivilege(ResultCode actual, boolean hasProxyPrivilege) |
| | | { |
| | | if (hasProxyPrivilege) |
| | | { |
| | | assertEquals(actual, ResultCode.SUCCESS); |
| | | } |
| | | else |
| | | { |
| | | assertEquals(actual, ResultCode.AUTHORIZATION_DENIED); |
| | | } |
| | | assertEquals(actual, hasProxyPrivilege ? SUCCESS : AUTHORIZATION_DENIED); |
| | | } |
| | | |
| | | /** |
| | |
| | | ByteString.valueOf("config")); |
| | | if (hasPrivilege) |
| | | { |
| | | assertEquals(compareOperation.getResultCode(), ResultCode.COMPARE_TRUE); |
| | | assertEquals(compareOperation.getResultCode(), COMPARE_TRUE); |
| | | } |
| | | else |
| | | { |
| | | assertEquals(compareOperation.getResultCode(), |
| | | ResultCode.INSUFFICIENT_ACCESS_RIGHTS); |
| | | assertEquals(compareOperation.getResultCode(), INSUFFICIENT_ACCESS_RIGHTS); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | // We don't support modify DN operations in the server configuration, but |
| | | // at least we need to make sure we're getting past the privilege check. |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.UNWILLING_TO_PERFORM); |
| | | assertEquals(modifyDNOperation.getResultCode(), UNWILLING_TO_PERFORM); |
| | | } |
| | | else |
| | | { |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.INSUFFICIENT_ACCESS_RIGHTS); |
| | | assertEquals(modifyDNOperation.getResultCode(), INSUFFICIENT_ACCESS_RIGHTS); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | writer.close(); |
| | | |
| | | Entry taskEntry = TestCaseUtils.makeEntry( |
| | | assertPrivilege(conn, hasPrivilege, |
| | | "dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks", |
| | | "objectClass: top", |
| | | "objectClass: ds-task", |
| | | "objectClass: ds-task-add-schema-file", |
| | | "ds-task-class-name: org.opends.server.tasks.AddSchemaFileTask", |
| | | "ds-task-schema-file-name: 05-" + identifier + ".ldif"); |
| | | } |
| | | |
| | | private void assertPrivilege(InternalClientConnection conn, boolean hasPrivilege, String... lines) throws Exception |
| | | { |
| | | Entry taskEntry = TestCaseUtils.makeEntry(lines); |
| | | |
| | | AddOperation addOperation = conn.processAdd(taskEntry); |
| | | assertPrivilege(addOperation.getResultCode(), hasPrivilege); |
| | |
| | | assertEquals(conn.hasPrivilege(Privilege.BACKEND_BACKUP, null), |
| | | hasPrivilege); |
| | | |
| | | Entry taskEntry = TestCaseUtils.makeEntry( |
| | | assertPrivilege(conn, hasPrivilege, |
| | | "dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks", |
| | | "objectclass: top", |
| | | "objectclass: ds-task", |
| | |
| | | "ds-task-class-name: org.opends.server.tasks.BackupTask", |
| | | "ds-backup-directory-path: bak", |
| | | "ds-task-backup-all: TRUE"); |
| | | |
| | | AddOperation addOperation = conn.processAdd(taskEntry); |
| | | assertPrivilege(addOperation.getResultCode(), hasPrivilege); |
| | | |
| | | if (hasPrivilege) |
| | | { |
| | | Task task = getCompletedTask(taskEntry.getName()); |
| | | assertNotNull(task); |
| | | assertTrue(TaskState.isSuccessful(task.getTaskState())); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | assertEquals(conn.hasPrivilege(Privilege.BACKEND_RESTORE, null), |
| | | hasPrivilege); |
| | | |
| | | Entry taskEntry = TestCaseUtils.makeEntry( |
| | | assertPrivilege(conn, hasPrivilege, |
| | | "dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks", |
| | | "objectclass: top", |
| | | "objectclass: ds-task", |
| | | "objectclass: ds-task-restore", |
| | | "ds-task-class-name: org.opends.server.tasks.RestoreTask", |
| | | "ds-backup-directory-path: bak" + File.separator + "userRoot"); |
| | | |
| | | AddOperation addOperation = conn.processAdd(taskEntry); |
| | | assertPrivilege(addOperation.getResultCode(), hasPrivilege); |
| | | |
| | | if (hasPrivilege) |
| | | { |
| | | Task task = getCompletedTask(taskEntry.getName()); |
| | | assertNotNull(task); |
| | | assertTrue(TaskState.isSuccessful(task.getTaskState())); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | String tempFilePath = tempFile.getAbsolutePath(); |
| | | tempFile.delete(); |
| | | |
| | | Entry taskEntry = TestCaseUtils.makeEntry( |
| | | try |
| | | { |
| | | assertPrivilege(conn, hasPrivilege, |
| | | "dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks", |
| | | "objectclass: top", |
| | | "objectclass: ds-task", |
| | |
| | | "ds-task-class-name: org.opends.server.tasks.ExportTask", |
| | | "ds-task-export-backend-id: userRoot", |
| | | "ds-task-export-ldif-file: " + tempFilePath); |
| | | |
| | | AddOperation addOperation = conn.processAdd(taskEntry); |
| | | assertPrivilege(addOperation.getResultCode(), hasPrivilege); |
| | | |
| | | if (hasPrivilege) |
| | | } |
| | | finally |
| | | { |
| | | Task task = getCompletedTask(taskEntry.getName()); |
| | | assertNotNull(task); |
| | | assertTrue(TaskState.isSuccessful(task.getTaskState())); |
| | | |
| | | tempFile.delete(); |
| | | } |
| | | } |
| | |
| | | "objectClass: domain", |
| | | "dc: example"); |
| | | |
| | | Entry taskEntry = TestCaseUtils.makeEntry( |
| | | assertPrivilege(conn, hasPrivilege, |
| | | "dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks", |
| | | "objectclass: top", |
| | | "objectclass: ds-task", |
| | |
| | | "ds-task-class-name: org.opends.server.tasks.ImportTask", |
| | | "ds-task-import-backend-id: userRoot", |
| | | "ds-task-import-ldif-file: " + path); |
| | | |
| | | AddOperation addOperation = conn.processAdd(taskEntry); |
| | | assertPrivilege(addOperation.getResultCode(), hasPrivilege); |
| | | |
| | | if (hasPrivilege) |
| | | { |
| | | Task task = getCompletedTask(taskEntry.getName()); |
| | | assertNotNull(task); |
| | | assertTrue(TaskState.isSuccessful(task.getTaskState())); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | assertEquals(conn.hasPrivilege(Privilege.LDIF_IMPORT, null), hasPrivilege); |
| | | |
| | | Entry taskEntry = TestCaseUtils.makeEntry( |
| | | assertPrivilege(conn, hasPrivilege, |
| | | "dn: ds-task-id=" + UUID.randomUUID() + ",cn=Scheduled Tasks,cn=Tasks", |
| | | "objectclass: top", |
| | | "objectclass: ds-task", |
| | |
| | | "ds-task-class-name: org.opends.server.tasks.RebuildTask", |
| | | "ds-task-rebuild-base-dn: dc=example,dc=com", |
| | | "ds-task-rebuild-index: cn"); |
| | | |
| | | AddOperation addOperation = conn.processAdd(taskEntry); |
| | | assertPrivilege(addOperation.getResultCode(), hasPrivilege); |
| | | |
| | | if (hasPrivilege) |
| | | { |
| | | Task task = getCompletedTask(taskEntry.getName()); |
| | | assertNotNull(task); |
| | | assertTrue(TaskState.isSuccessful(task.getTaskState())); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | DirectoryServer.getAttributeType("cn", true), |
| | | ByteString.valueOf("PWReset Target")); |
| | | compareOperation.run(); |
| | | |
| | | if (hasProxyPrivilege) |
| | | { |
| | | assertEquals(compareOperation.getResultCode(), COMPARE_TRUE); |
| | |
| | | DirectoryServer.getAttributeType("cn", true), |
| | | ByteString.valueOf("PWReset Target")); |
| | | compareOperation.run(); |
| | | |
| | | if (hasProxyPrivilege) |
| | | { |
| | | assertEquals(compareOperation.getResultCode(), COMPARE_TRUE); |