| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(deleteOperation); |
| | | List<LocalBackendDeleteOperation> localOps = |
| | |
| | | } |
| | | } |
| | | |
| | | private DeleteOperation processDeleteRaw(String entryDN) |
| | | { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | return conn.processDelete(ByteString.valueOf(entryDN)); |
| | | } |
| | | |
| | | private DeleteOperation processDelete(String entryDN) throws DirectoryException |
| | | { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | return conn.processDelete(DN.decode(entryDN)); |
| | | } |
| | | |
| | | private void processAdd(String... entryLines) throws Exception |
| | | { |
| | | Entry e = TestCaseUtils.makeEntry(entryLines); |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = |
| | | conn.processAdd(e.getDN(), e.getObjectClasses(), e.getUserAttributes(), |
| | | e.getOperationalAttributes()); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>getEntryToDelete</CODE> method for a delete operation that |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("ou=People,o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("ou=People,o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | List<LocalBackendDeleteOperation> localOps = |
| | | (List) (deleteOperation.getAttachment(Operation.LOCALBACKENDOPERATIONS)); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | String[] args = |
| | | { |
| | | "-h", "127.0.0.1", |
| | | "-p", String.valueOf(TestCaseUtils.getServerLdapPort()), |
| | | "-D", "cn=Directory Manager", |
| | | "-w", "password", |
| | | "o=test" |
| | | }; |
| | | String[] args = getArgs("o=test"); |
| | | assertEquals(LDAPDelete.mainDelete(args, false, null, null), 0); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(deleteOperation); |
| | | } |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("o=test")); |
| | | DeleteOperation deleteOperation = processDelete("o=test"); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(deleteOperation); |
| | | } |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | processAdd("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = |
| | | conn.processAdd(e.getDN(), e.getObjectClasses(), |
| | | e.getUserAttributes(), e.getOperationalAttributes()); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("cn=test,o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("cn=test,o=test"); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(deleteOperation); |
| | | } |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | processAdd("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = |
| | | conn.processAdd(e.getDN(), e.getObjectClasses(), |
| | | e.getUserAttributes(), e.getOperationalAttributes()); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test,o=test")); |
| | | DeleteOperation deleteOperation = processDelete("cn=test,o=test"); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(deleteOperation); |
| | | } |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("malformed")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("malformed"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("o=does not exist")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=does not exist"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("o=does not exist")); |
| | | DeleteOperation deleteOperation = processDelete("o=does not exist"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("cn=entry,o=does not exist")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("cn=entry,o=does not exist"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=entry,o=does not exist")); |
| | | DeleteOperation deleteOperation = processDelete("cn=entry,o=does not exist"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("cn=entry,o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("cn=entry,o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=entry,o=test")); |
| | | DeleteOperation deleteOperation = processDelete("cn=entry,o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | processAdd("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = |
| | | conn.processAdd(e.getDN(), e.getObjectClasses(), |
| | | e.getUserAttributes(), e.getOperationalAttributes()); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry("dn: cn=test,o=test", |
| | | processAdd("dn: cn=test,o=test", |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = |
| | | conn.processAdd(e.getDN(), e.getObjectClasses(), |
| | | e.getUserAttributes(), e.getOperationalAttributes()); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DirectoryServer.setWritabilityMode(WritabilityMode.DISABLED); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | |
| | | DirectoryServer.setWritabilityMode(WritabilityMode.ENABLED); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DirectoryServer.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | DirectoryServer.setWritabilityMode(WritabilityMode.ENABLED); |
| | |
| | | |
| | | DirectoryServer.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | String[] args = |
| | | { |
| | | "-h", "127.0.0.1", |
| | | "-p", String.valueOf(TestCaseUtils.getServerLdapPort()), |
| | | "-D", "cn=Directory Manager", |
| | | "-w", "password", |
| | | "o=test" |
| | | }; |
| | | String[] args = getArgs("o=test"); |
| | | assertFalse(LDAPDelete.mainDelete(args, false, null, null) == 0); |
| | | |
| | | DirectoryServer.setWritabilityMode(WritabilityMode.ENABLED); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | Backend backend = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | backend.setWritabilityMode(WritabilityMode.DISABLED); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | |
| | | backend.setWritabilityMode(WritabilityMode.ENABLED); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | Backend backend = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | backend.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | backend.setWritabilityMode(WritabilityMode.ENABLED); |
| | |
| | | Backend backend = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | backend.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | String[] args = |
| | | String[] args = getArgs("o=test"); |
| | | assertFalse(LDAPDelete.mainDelete(args, false, null, null) == 0); |
| | | |
| | | backend.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | | |
| | | private String[] getArgs(String entryDn) |
| | | { |
| | | return new String[] { |
| | | "-h", "127.0.0.1", |
| | | "-p", String.valueOf(TestCaseUtils.getServerLdapPort()), |
| | | "-D", "cn=Directory Manager", |
| | | "-w", "password", |
| | | "o=test" |
| | | entryDn |
| | | }; |
| | | assertFalse(LDAPDelete.mainDelete(args, false, null, null) == 0); |
| | | |
| | | backend.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | try |
| | | { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.BUSY); |
| | | } |
| | | finally |
| | |
| | | DirectoryServer.registerChangeNotificationListener(changeListener); |
| | | assertEquals(changeListener.getAddCount(), 0); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(deleteOperation); |
| | | |
| | |
| | | DirectoryServer.registerChangeNotificationListener(changeListener); |
| | | assertEquals(changeListener.getAddCount(), 0); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(ByteString.valueOf("cn=nonexistent,o=test")); |
| | | DeleteOperation deleteOperation = processDeleteRaw("cn=nonexistent,o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | |
| | | assertEquals(changeListener.getDeleteCount(), 0); |