| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions copyright 2013 Manuel Gaupp |
| | | */ |
| | | package org.opends.server.core; |
| | |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | |
| | | ModifyDNOperationBasis modifyDNOperation = |
| | | new ModifyDNOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | noControls, |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=USER.0"), true, |
| | | null); |
| | | |
| | | |
| | | modifyDNOperation.run(); |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | |
| | | Entry newEntry = DirectoryServer.getEntry(DN.decode( |
| | | "uid=user.0,ou=People,dc=example,dc=com")); |
| | | assertNotNull(newEntry); |
| | | |
| | | |
| | | assertTrue(newEntry.getDN().toString().equals("uid=USER.0,ou=People,dc=example,dc=com")); |
| | | |
| | | |
| | | AttributeType at = DirectoryServer.getAttributeType("uid"); |
| | | List<Attribute> attrList = newEntry.getAttribute(at); |
| | | |
| | |
| | | assertNotNull(newEntry); |
| | | |
| | | examineCompletedOperation(modifyDNOperation); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Add another attribute to the RDN and change case of the existing value |
| | | */ |
| | |
| | | "givenName: Babs", |
| | | "sn: Jensen", |
| | | "cn: Babs Jensen"); |
| | | |
| | | |
| | | ArrayList<Control> noControls = new ArrayList<Control>(0); |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | |
| | | ModifyDNOperationBasis modifyDNOperation = |
| | | new ModifyDNOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | noControls, |
| | | DN.decode("uid=userid.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=UserID.0+cn=Test"), false, |
| | | null); |
| | | |
| | | |
| | | modifyDNOperation.run(); |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | |
| | | Entry newEntry = DirectoryServer.getEntry(DN.decode( |
| | | "uid=userid.0+cn=test,ou=People,dc=example,dc=com")); |
| | | assertNotNull(newEntry); |
| | | |
| | | |
| | | assertTrue(newEntry.getDN().toString().equals("uid=UserID.0+cn=Test,ou=People,dc=example,dc=com")); |
| | | |
| | | |
| | | AttributeType at = DirectoryServer.getAttributeType("uid"); |
| | | List<Attribute> attrList = newEntry.getAttribute(at); |
| | | |
| | |
| | | examineCompletedOperation(modifyDNOperation); |
| | | TestCaseUtils.deleteEntry(DN.decode("uid=UserID.0+cn=Test,ou=People,dc=example,dc=com")); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Add a value to the RDN which is already part of the entry, but with another string representation |
| | | */ |
| | |
| | | "givenName: Babs", |
| | | "sn: Jensen", |
| | | "cn: Babs Jensen"); |
| | | |
| | | |
| | | ArrayList<Control> noControls = new ArrayList<Control>(0); |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | |
| | | ModifyDNOperationBasis modifyDNOperation = |
| | | new ModifyDNOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | noControls, |
| | | DN.decode("uid=userid.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=userid.0+sn=JENSEN"), false, |
| | | null); |
| | | |
| | | |
| | | modifyDNOperation.run(); |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | |
| | | Entry newEntry = DirectoryServer.getEntry(DN.decode( |
| | | "uid=userid.0+sn=jensen,ou=People,dc=example,dc=com")); |
| | | assertNotNull(newEntry); |
| | | |
| | | |
| | | assertTrue(newEntry.getDN().toString().equals("uid=userid.0+sn=JENSEN,ou=People,dc=example,dc=com")); |
| | | |
| | | |
| | | AttributeType at = DirectoryServer.getAttributeType("sn"); |
| | | List<Attribute> attrList = newEntry.getAttribute(at); |
| | | |
| | |
| | | examineCompletedOperation(modifyDNOperation); |
| | | TestCaseUtils.deleteEntry(DN.decode("uid=userid.0+sn=Jensen,ou=People,dc=example,dc=com")); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void testRawDeleteOldRDNModify() throws Exception |
| | | { |
| | |
| | | ModifyDNResponseProtocolOp modifyResponse = |
| | | message.getModifyDNResponseProtocolOp(); |
| | | |
| | | assertEquals(modifyResponse.getResultCode(), |
| | | DirectoryServer.getServerErrorResultCode().getIntValue()); |
| | | assertEquals(modifyResponse.getResultCode(), ResultCode.BUSY); |
| | | |
| | | // assertEquals(InvocationCounterPlugin.getPreParseCount(), 1); |
| | | // assertEquals(InvocationCounterPlugin.getPreOperationCount(), 0); |