AutoRefactor'ed TestNG asserts
| | |
| | | |
| | | @Test(enabled = false) |
| | | public void testGetDatabasePaths() throws IOException { |
| | | assertTrue(!config.getDatabasePaths().isEmpty()); |
| | | assertFalse(config.getDatabasePaths().isEmpty()); |
| | | } |
| | | |
| | | @Test(enabled = false) |
| | | public void testLoad() { |
| | | //TODO: need way to verify reload |
| | | } |
| | | |
| | | } |
| | |
| | | try { |
| | | if (target.exists()) { |
| | | target.delete(); |
| | | assertTrue(!target.exists()); |
| | | assertFalse(target.exists()); |
| | | } |
| | | fileManager.rename(src, target); |
| | | assertTrue(!src.exists()); |
| | | assertFalse(src.exists()); |
| | | assertTrue(target.exists()); |
| | | } finally { |
| | | src.delete(); |
| | |
| | | File target = File.createTempFile("target", null); |
| | | try { |
| | | StaticUtils.renameFile(src, target); |
| | | assertTrue(!src.exists()); |
| | | assertFalse(src.exists()); |
| | | assertTrue(target.exists()); |
| | | } finally { |
| | | src.delete(); |
| | |
| | | IntegerPropertyDefinition.Builder builder = createTestBuilder(); |
| | | builder.setLowerLimit(1); |
| | | IntegerPropertyDefinition spd = buildTestDefinition(builder); |
| | | assertTrue(spd.getLowerLimit() == 1); |
| | | assertEquals(spd.getLowerLimit(), 1); |
| | | } |
| | | |
| | | /** |
| | |
| | | IntegerPropertyDefinition.Builder builder = createTestBuilder(); |
| | | builder.setLowerLimit(limit); |
| | | IntegerPropertyDefinition spd = buildTestDefinition(builder); |
| | | assertTrue(spd.getLowerLimit() == expectedValue); |
| | | assertEquals(spd.getLowerLimit(), expectedValue); |
| | | } |
| | | |
| | | /** |
| | |
| | | IntegerPropertyDefinition.Builder builder = createTestBuilder(); |
| | | builder.setLowerLimit(1); |
| | | IntegerPropertyDefinition spd = buildTestDefinition(builder); |
| | | assertTrue(spd.getLowerLimit() == 1); |
| | | assertEquals(spd.getLowerLimit(), 1); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param expectedValue to compare |
| | | */ |
| | | @Test(dataProvider = "limitData") |
| | | public void testUpperLimit2(int limit, int expectedValue) { |
| | | public void testUpperLimit2(int limit, Integer expectedValue) { |
| | | IntegerPropertyDefinition.Builder builder = createTestBuilder(); |
| | | builder.setUpperLimit(limit); |
| | | IntegerPropertyDefinition spd = buildTestDefinition(builder); |
| | | assertTrue(spd.getUpperLimit().equals(expectedValue)); |
| | | assertEquals(spd.getUpperLimit(), expectedValue); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | PatternDN patternDN = PatternDN.decode(pattern); |
| | | boolean match = patternDN.matchesDN(DN.valueOf(entryDN)); |
| | | assertTrue(!match, pattern + " should not have matched " + entryDN); |
| | | assertFalse(match, pattern + " should not have matched " + entryDN); |
| | | } |
| | | |
| | | |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | |
| | | new LDAPAttribute("ou", byteStrings("People"))); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd("invalid", attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | new LDAPAttribute("o", byteStrings("test"))); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd("o=test", attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | new LDAPAttribute("o", byteStrings("undefined"))); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd("o=undefined", attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | new LDAPAttribute("ou", byteStrings("People"))); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd("ou=People,o=undefined", attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests an internal add operation that fails because its parent doesn't |
| | | * exist. |
| | | * Tests an internal add operation that fails because its parent does not exist. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | |
| | | new LDAPAttribute("ou", byteStrings("People"))); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd("ou=People,o=missing,o=test", attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | new LDAPAttribute("ou", byteStrings("People"))); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(ByteString.valueOf("ou=People,o=test"), attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | AddOperation addOperation = |
| | | getRootConnection().processAdd(ByteString.empty(), attrs); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | /** |
| | |
| | | "objectClass: organizationalUnit"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | DirectoryServer.setAddMissingRDNAttributes(true); |
| | | } |
| | |
| | | "ou: People"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | "ou: People"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | "ou: People"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | "sn: User"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | "userPassword: password"); // Missing cn |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | "userPassword: password"); // Missing cn |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | "dc: Not allowed by inetOrgPerson"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | userAttrs.put(attrType, newArrayList(Attributes.empty(attrType))); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | DirectoryServer.setWritabilityMode(WritabilityMode.DISABLED); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | DirectoryServer.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | |
| | | b.setWritabilityMode(WritabilityMode.DISABLED); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | b.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | |
| | | "ou: People"); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | assertEquals(changeListener.getAddCount(), 0); |
| | | }finally { |
| | |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.testng.Assert.*; |
| | |
| | | Entry backendEntry = createBackendEntry(backendID, false, baseDN); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(backendEntry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | Entry backendEntry = createBackendEntry(backendID, false, baseDN); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(backendEntry); |
| | | assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | DirectoryServer.getBackendWithBaseDN(childBaseDN)); |
| | | assertNotNull(childBackend.getParentBackend()); |
| | | assertEquals(parentBackend, childBackend.getParentBackend()); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 1); |
| | | assertEquals(parentBackend.getSubordinateBackends().length, 1); |
| | | assertFalse(childBackend.entryExists(childBaseDN)); |
| | | assertFalse(DirectoryServer.isNamingContext(childBaseDN)); |
| | | |
| | |
| | | |
| | | |
| | | |
| | | // Make sure that we can't remove the parent backend with the child still |
| | | // in place. |
| | | // Make sure that we can't remove the parent backend with the child still in place. |
| | | DeleteOperation deleteOperation = conn.processDelete(parentBackendEntry.getName()); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(DirectoryServer.getBackend(parentBackendID)); |
| | | |
| | | // Delete the child and then delete the parent. |
| | | deleteOperation = conn.processDelete(childBackendEntry.getName()); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNull(DirectoryServer.getBackend(childBackendID)); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 0); |
| | | assertEquals(parentBackend.getSubordinateBackends().length, 0); |
| | | |
| | | deleteOperation = conn.processDelete(parentBackendEntry.getName()); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | DirectoryServer.getBackendWithBaseDN(parentBaseDN)); |
| | | assertNotNull(childBackend.getParentBackend()); |
| | | assertEquals(parentBackend, childBackend.getParentBackend()); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 1); |
| | | assertEquals(parentBackend.getSubordinateBackends().length, 1); |
| | | |
| | | createEntry(parentBaseDN, parentBackend); |
| | | assertTrue(DirectoryServer.isNamingContext(parentBaseDN)); |
| | |
| | | DeleteOperation deleteOperation = getRootConnection().processDelete(childBackendEntry.getName()); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNull(DirectoryServer.getBackend(childBackendID)); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 0); |
| | | assertEquals(parentBackend.getSubordinateBackends().length, 0); |
| | | |
| | | deleteOperation = getRootConnection().processDelete(parentBackendEntry.getName()); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | assertEquals(backend, DirectoryServer.getBackendWithBaseDN(baseDN)); |
| | | assertFalse(backend.entryExists(baseDN)); |
| | | assertNull(backend.getParentBackend()); |
| | | assertTrue(backend.getSubordinateBackends().length == 0); |
| | | assertEquals(backend.getSubordinateBackends().length, 0); |
| | | assertFalse(backend.entryExists(baseDN)); |
| | | assertTrue(DirectoryServer.isNamingContext(baseDN)); |
| | | } |
| | |
| | | DirectoryServer.getBackendWithBaseDN(grandchildBaseDN)); |
| | | assertNotNull(grandchildBackend.getParentBackend()); |
| | | assertEquals(grandchildBackend.getParentBackend(), parentBackend); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 1); |
| | | assertEquals(parentBackend.getSubordinateBackends().length, 1); |
| | | assertFalse(grandchildBackend.entryExists(grandchildBaseDN)); |
| | | |
| | | // Verify that we can't create the grandchild base entry because its parent |
| | |
| | | conn.processDelete(grandchildBackendEntry.getName()); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNull(DirectoryServer.getBackend(grandchildBackendID)); |
| | | assertTrue(childBackend.getSubordinateBackends().length == 0); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 1); |
| | | assertEquals(childBackend.getSubordinateBackends().length, 0); |
| | | assertEquals(parentBackend.getSubordinateBackends().length, 1); |
| | | |
| | | deleteOperation = conn.processDelete(childBackendEntry.getName()); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNull(DirectoryServer.getBackend(childBackendID)); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 0); |
| | | assertEquals(parentBackend.getSubordinateBackends().length, 0); |
| | | |
| | | deleteOperation = conn.processDelete(parentBackendEntry.getName()); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | assertEquals(childBackend, DirectoryServer.getBackendWithBaseDN(childBaseDN)); |
| | | assertNotNull(childBackend.getParentBackend()); |
| | | assertEquals(parentBackend, childBackend.getParentBackend()); |
| | | assertTrue(parentBackend.getSubordinateBackends().length == 1); |
| | | assertEquals(parentBackend.getSubordinateBackends().length, 1); |
| | | assertFalse(childBackend.entryExists(childBaseDN)); |
| | | assertTrue(childBackend.getSubordinateBackends().length == 1); |
| | | assertEquals(childBackend.getSubordinateBackends().length, 1); |
| | | assertEquals(childBackend.getSubordinateBackends()[0], grandchildBackend); |
| | | assertEquals(grandchildBackend.getParentBackend(), childBackend); |
| | | } |
| | |
| | | import org.testng.annotations.AfterMethod; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.testng.Assert.*; |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("ou=People,o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | @SuppressWarnings("unchecked") |
| | | List<LocalBackendDeleteOperation> localOps = |
| | | (List<LocalBackendDeleteOperation>) deleteOperation.getAttachment(Operation.LOCALBACKENDOPERATIONS); |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("malformed"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=does not exist"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | DeleteOperation deleteOperation = processDelete("o=does not exist"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("cn=entry,o=does not exist"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | DeleteOperation deleteOperation = processDelete("cn=entry,o=does not exist"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("cn=entry,o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | DeleteOperation deleteOperation = processDelete("cn=entry,o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | "cn: test"); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | "cn: test"); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | DirectoryServer.setWritabilityMode(WritabilityMode.DISABLED); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | DirectoryServer.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | |
| | | backend.setWritabilityMode(WritabilityMode.DISABLED); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | backend.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | |
| | | assertEquals(changeListener.getAddCount(), 0); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("cn=nonexistent,o=test"); |
| | | assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | assertEquals(changeListener.getDeleteCount(), 0); |
| | | } |
| | |
| | | SearchScope.WHOLE_SUBTREE, filter); |
| | | assertTrue(memberList.hasMoreMembers()); |
| | | DN memberDN = memberList.nextMemberDN(); |
| | | assertTrue(memberDN.equals(user1DN)); |
| | | assertEquals(memberDN, user1DN); |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | | filter = SearchFilter.createFilterFromString("(uid=user.3)"); |
| | |
| | | SearchScope.WHOLE_SUBTREE, filter); |
| | | assertTrue(memberList.hasMoreMembers()); |
| | | DN memberDN = memberList.nextMemberDN(); |
| | | assertTrue(memberDN.equals(user1DN)); |
| | | assertEquals(memberDN, user1DN); |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | | filter = SearchFilter.createFilterFromString("(uid=user.3)"); |
| | |
| | | SearchScope.WHOLE_SUBTREE, filter); |
| | | assertTrue(memberList.hasMoreMembers()); |
| | | DN memberDN = memberList.nextMemberDN(); |
| | | assertTrue(memberDN.equals(user1DN)); |
| | | assertEquals(memberDN, user1DN); |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | | filter = SearchFilter.createFilterFromString("(uid=user.3)"); |
| | |
| | | { |
| | | LDAPAttribute attr = newLDAPAttribute("description", "foo"); |
| | | ModifyOperation modifyOperation = processModify("invaliddn", replace(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | { |
| | | LDAPAttribute attr = newLDAPAttribute("description", "foo"); |
| | | ModifyOperation modifyOperation = processModify("o=nonexistent", replace(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | { |
| | | LDAPAttribute attr = newLDAPAttribute("description", "foo"); |
| | | ModifyOperation modifyOperation = processModify("cn=test,ou=nosuchparent," + baseDN, replace(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | { |
| | | LDAPAttribute attr = newLDAPAttribute("description", "foo"); |
| | | ModifyOperation modifyOperation = processModify("cn=nosuchentry," + baseDN, replace(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | ModifyOperation modifyOperation = processModify(baseDN); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("displayName", "foo"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, add(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("ds-pwp-account-disabled", "false"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, add(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("displayName", "foo", "bar"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, replace(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("ds-pwp-account-disabled", "true", "false"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, replace(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("givenName", "Test"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, add(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("description", "Foo", "Foo"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, replace(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("manager", "invaliddn"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, replace(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("manager", "invaliddn"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, add(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("uid", "foo"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, replace(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = new LDAPAttribute("uid"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, delete(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("uid", "test.user"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, delete(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("givenName", "Foo"); |
| | | ModifyOperation modifyOperation = processModify("givenName=Test,sn=User," + baseDN, replace(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = new LDAPAttribute("givenName"); |
| | | ModifyOperation modifyOperation = processModify("givenName=Test,sn=User," + baseDN, delete(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = new LDAPAttribute("sn"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, delete(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("sn", "User"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, delete(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = new LDAPAttribute("displayName"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, delete(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("displayName", "Foo"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, delete(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = new LDAPAttribute("objectClass"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, delete(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = new LDAPAttribute("objectClass"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, replace(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("objectClass", "organizationalUnit"); |
| | | ModifyOperation modifyOperation = processModify("ou=People," + baseDN, delete(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("objectClass", "organization"); |
| | | ModifyOperation modifyOperation = processModify("ou=People," + baseDN, add(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("displayName", "1"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, increment(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("description", "notnumeric"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, increment(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = new LDAPAttribute("roomNumber"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, increment(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("roomNumber", "1", "2"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, increment(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("employeeNumber", "1"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, increment(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("objectClass", "inetOrgPerson"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, add(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests that an attempt to remove an objectclass that doesn't exist will |
| | | * fail. |
| | | * Tests that an attempt to remove an objectclass that does not exist will fail. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("objectClass", "organizationalUnit"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, delete(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("objectClass", "extensibleObject"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, add(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | |
| | | DirectoryServer.setWritabilityMode(WritabilityMode.ENABLED); |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("objectClass", "extensibleObject"); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, add(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | |
| | | b.setWritabilityMode(WritabilityMode.ENABLED); |
| | |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("dc", "foo"); |
| | | ModifyOperation modifyOperation = processModify(baseDN, replace(attr)); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveFailedOperationElements(modifyOperation); |
| | | |
| | | assertEquals(changeListener.getModifyCount(), 0); |
| | |
| | | new LDAPControl(ServerConstants.OID_PERMISSIVE_MODIFY_CONTROL, false)); |
| | | |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, |
| | | mods, |
| | | requestControls); |
| | | assertTrue(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | mods, requestControls); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | new LDAPControl(ServerConstants.OID_PERMISSIVE_MODIFY_CONTROL, false)); |
| | | |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, |
| | | mods, |
| | | requestControls); |
| | | assertTrue(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | mods, requestControls); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | new LDAPControl(ServerConstants.OID_PERMISSIVE_MODIFY_CONTROL, false)); |
| | | |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, |
| | | mods, |
| | | requestControls); |
| | | assertTrue(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | mods, requestControls); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | } |
| | | |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | AddOperation addOperation = getRootConnection().processAdd(e); |
| | | assertTrue(addOperation.getResultCode() != ResultCode.SUCCESS); |
| | | assertNotEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNull(DirectoryServer.getEntry(e.getName())); |
| | | } |
| | | |
| | |
| | | // Compare the MD5 hash of the LDAP attribute with the one |
| | | // retrieved from the CryptoManager. |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | assertTrue(StaticUtils.bytesToHexNoSpace( |
| | | md.digest(ldapCert)).equals(cm.getInstanceKeyID())); |
| | | String actual = StaticUtils.bytesToHexNoSpace(md.digest(ldapCert)); |
| | | assertEquals(actual, cm.getInstanceKeyID()); |
| | | |
| | | // Call twice to ensure idempotent. |
| | | CryptoManagerImpl.publishInstanceKeyEntryInADS(); |
| | |
| | | assertTrue(Arrays.equals(keyID, keyID2)); |
| | | |
| | | // test for distinct ciphertext |
| | | assertTrue(! Arrays.equals(cipherText, cipherText2)); |
| | | assertFalse(Arrays.equals(cipherText, cipherText2)); |
| | | } |
| | | |
| | | |
| | |
| | | final byte[] keyID2 = new byte[16]; |
| | | System.arraycopy(cipherText, 1, keyID, 0, 16); |
| | | System.arraycopy(cipherText2, 1, keyID2, 0, 16); |
| | | assertTrue(! Arrays.equals(keyID, keyID2)); |
| | | assertFalse(Arrays.equals(keyID, keyID2)); |
| | | |
| | | // 2. Confirm ciphertext produced using the compromised key can still be |
| | | // decrypted. |
| | | // 2. Confirm ciphertext produced using the compromised key can still be decrypted. |
| | | final byte[] plainText = cm.decrypt(cipherText); |
| | | assertEquals(new String(plainText), secretMessage); |
| | | |
| | |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.testng.Assert.*; |
| | |
| | | internalConnection.processExtendedOperation( |
| | | ServerConstants.OID_GET_SYMMETRIC_KEY_EXTENDED_OP, requestValue); |
| | | |
| | | assertFalse(extendedOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(extendedOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_CRAM_MD5, |
| | | ByteString.valueOf("invalid")); |
| | | assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | bindOperation = |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_CRAM_MD5, |
| | | ByteString.valueOf("malformed")); |
| | | assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | ByteString.valueOf("dn:cn=Directory Manager malformeddigest"); |
| | | bindOperation = |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_CRAM_MD5, creds); |
| | | assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | "malformedcredswiththerightlength"); |
| | | bindOperation = |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_CRAM_MD5, creds); |
| | | assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_DIGEST_MD5, |
| | | ByteString.valueOf("invalid")); |
| | | assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_DIGEST_MD5, null); |
| | | assertEquals(bindOperation.getResultCode(), |
| | | ResultCode.SASL_BIND_IN_PROGRESS); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SASL_BIND_IN_PROGRESS); |
| | | |
| | | bindOperation = |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_DIGEST_MD5, |
| | | ByteString.valueOf("malformed")); |
| | | assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | | |
| | |
| | | assertFalse(attrList.isEmpty()); |
| | | for (Attribute a : attrList) |
| | | { |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertEquals(a.size(), 1); |
| | | assertTrue(a.contains(ByteString.valueOf(entryDN.toString()))); |
| | | } |
| | |
| | | assertFalse(attrList.isEmpty()); |
| | | for (Attribute a : attrList) |
| | | { |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertEquals(a.size(), 1); |
| | | assertTrue(a.contains(ByteString.valueOf(uuidString))); |
| | | } |
| | |
| | | assertFalse(attrList.isEmpty()); |
| | | for (Attribute a : attrList) |
| | | { |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertEquals(a.size(), 1); |
| | | assertFalse(a.contains(ByteString.valueOf(uuidString))); |
| | | } |
| | |
| | | String mapperDNString = "cn=Exact Match,cn=Identity Mappers,cn=config"; |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(ByteString.valueOf(mapperDNString), mods); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotSame(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | String mapperDNString = "cn=Exact Match,cn=Identity Mappers,cn=config"; |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(ByteString.valueOf(mapperDNString), mods); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotSame(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | String mapperDNString = "cn=Exact Match,cn=Identity Mappers,cn=config"; |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(ByteString.valueOf(mapperDNString), mods); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotSame(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | | |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotSame(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests to ensure that an attmept to remove the fingerprint algorithm will |
| | | * fail. |
| | | * Tests to ensure that an attempt to remove the fingerprint algorithm will fail. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotSame(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | "dITStructureRules: ( 21 NAME 'domainStructureRule' FORM domainNameForm )", |
| | | "dITStructureRules: ( 22 NAME 'organizationalStructureRule' FORM organizationalNameForm SUP 21 )" |
| | | ); |
| | | assertTrue(resultCode == 0); |
| | | assertEquals(resultCode, 0); |
| | | } |
| | | |
| | | |
| | |
| | | "nameForms: ( domainNameForm-oid NAME 'domainNameForm' OC domain MUST ( dc ) )", |
| | | "nameForms: ( organizationalNameForm-oid NAME 'organizationalNameForm' OC organization MUST ( o ) )" |
| | | ); |
| | | assertTrue(resultCode == 0); |
| | | assertEquals(resultCode, 0); |
| | | } |
| | | |
| | | |
| | |
| | | assertFalse(attrList.isEmpty()); |
| | | for (Attribute a : attrList) |
| | | { |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertEquals(a.size(), 1); |
| | | assertTrue(a.contains(ByteString.valueOf(ruleId))); |
| | | } |
| | |
| | | assertFalse(attrList.isEmpty()); |
| | | for (Attribute a : attrList) |
| | | { |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertEquals(a.size(), 1); |
| | | assertTrue(a.contains(ByteString.valueOf(toUpperCase(String.valueOf(hasSubs))))); |
| | | } |
| | |
| | | { |
| | | assertEquals(a.size(), 1); |
| | | |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertTrue(a.contains(ByteString.valueOf("cn=test static group,ou=groups,o=test"))); |
| | | assertFalse(a.contains(ByteString.valueOf("cn=not a group,ou=groups,o=test"))); |
| | | assertFalse(a.contains(ByteString.valueOf("invalid"))); |
| | |
| | | { |
| | | assertEquals(a.size(), 1); |
| | | |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertTrue(a.contains(ByteString.valueOf("cn=test static group,ou=groups,o=test"))); |
| | | assertFalse(a.contains(ByteString.valueOf("cn=not a group,ou=groups,o=test"))); |
| | | assertFalse(a.contains(ByteString.valueOf("invalid"))); |
| | |
| | | { |
| | | assertEquals(a.size(), 1); |
| | | |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertTrue(a.contains(ByteString.valueOf("cn=test dynamic group,ou=groups,o=test"))); |
| | | assertFalse(a.contains(ByteString.valueOf("cn=not a group,ou=groups,o=test"))); |
| | | assertFalse(a.contains(ByteString.valueOf("invalid"))); |
| | |
| | | { |
| | | assertEquals(a.size(), 2); |
| | | |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertTrue(a.contains(ByteString.valueOf("cn=test group 1,ou=groups,o=test"))); |
| | | assertFalse(a.contains(ByteString.valueOf("cn=test group 2,ou=groups,o=test"))); |
| | | assertTrue(a.contains(ByteString.valueOf("cn=test group 3,ou=groups,o=test"))); |
| | |
| | | { |
| | | assertEquals(a.size(), 4); |
| | | |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertTrue(a.contains(ByteString.valueOf("cn=test group 1,ou=groups,o=test"))); |
| | | assertFalse(a.contains(ByteString.valueOf("cn=test group 2,ou=groups,o=test"))); |
| | | assertTrue(a.contains(ByteString.valueOf("cn=test group 3,ou=groups,o=test"))); |
| | |
| | | assertFalse(attrList.isEmpty()); |
| | | for (Attribute a : attrList) |
| | | { |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertEquals(a.size(), 1); |
| | | assertTrue(a.contains(ByteString.valueOf(String.valueOf(count)))); |
| | | } |
| | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | ExtendedOperation extOp = conn.processExtendedOperation(OID_PASSWORD_MODIFY_REQUEST, requestValue); |
| | | assertFalse(extOp.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotSame(extOp.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | ExtendedOperation extOp = conn.processExtendedOperation(OID_PASSWORD_MODIFY_REQUEST, requestValue); |
| | | assertFalse(extOp.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotSame(extOp.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(new AuthenticationInfo()); |
| | | ExtendedOperation extOp = conn.processExtendedOperation(OID_PASSWORD_MODIFY_REQUEST, requestValue); |
| | | assertFalse(extOp.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotSame(extOp.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | assertFalse(attrList.isEmpty()); |
| | | for (Attribute a : attrList) |
| | | { |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertEquals(a.size(), 1); |
| | | assertTrue(a.contains(ByteString.valueOf(e.getStructuralObjectClass().getNameOrOID()))); |
| | | } |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotSame(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotSame(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | |
| | |
| | | assertFalse(attrList.isEmpty()); |
| | | for (Attribute a : attrList) |
| | | { |
| | | assertTrue(!a.isEmpty()); |
| | | assertFalse(a.isEmpty()); |
| | | assertEquals(a.size(), 1); |
| | | assertTrue(a.contains(ByteString.valueOf("cn=schema"))); |
| | | } |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.addEntries(LDIF_LINES); |
| | | |
| | | VirtualAttributeRule rule = null; |
| | | for (VirtualAttributeRule r : DirectoryServer.getVirtualAttributes()) |
| | | { |
| | | if (r.getAttributeType().equals(memberType)) |
| | | { |
| | | rule = r; |
| | | break; |
| | | } |
| | | } |
| | | VirtualAttributeRule rule = getRule(); |
| | | assertNotNull(rule); |
| | | |
| | | MemberVirtualAttributeProvider provider = |
| | |
| | | assertFalse(provider.isSearchable(rule, searchOperation, true)); |
| | | |
| | | provider.processSearch(rule, searchOperation); |
| | | assertFalse(searchOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotSame(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | cleanUp(); |
| | | } |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.addEntries(LDIF_LINES); |
| | | |
| | | VirtualAttributeRule rule = null; |
| | | for (VirtualAttributeRule r : DirectoryServer.getVirtualAttributes()) |
| | | { |
| | | if (r.getAttributeType().equals(memberType)) |
| | | { |
| | | rule = r; |
| | | break; |
| | | } |
| | | } |
| | | VirtualAttributeRule rule = getRule(); |
| | | assertNotNull(rule); |
| | | |
| | | MemberVirtualAttributeProvider provider = |
| | |
| | | assertFalse(provider.isSearchable(rule, searchOperation, false)); |
| | | |
| | | provider.processSearch(rule, searchOperation); |
| | | assertFalse(searchOperation.getResultCode() == ResultCode.SUCCESS); |
| | | assertNotSame(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | cleanUp(); |
| | | } |
| | | |
| | | |
| | | private VirtualAttributeRule getRule() |
| | | { |
| | | for (VirtualAttributeRule r : DirectoryServer.getVirtualAttributes()) |
| | | { |
| | | if (r.getAttributeType().equals(memberType)) |
| | | { |
| | | return r; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * Tests the behavior of the member virtual attribute with a dynamic group. |
| | |
| | | throws Exception |
| | | { |
| | | Set<PluginType> pluginTypes = getPluginTypes(e); |
| | | assertTrue(!pluginTypes.isEmpty()); |
| | | assertFalse(pluginTypes.isEmpty()); |
| | | |
| | | AttributeCleanupPluginCfg config = |
| | | AdminTestCaseUtils.getConfiguration( |
| | |
| | | throws ConfigException, InitializationException |
| | | { |
| | | Set<PluginType> pluginTypes = getPluginTypes(e); |
| | | assertTrue(!pluginTypes.isEmpty()); |
| | | assertFalse(pluginTypes.isEmpty()); |
| | | |
| | | AttributeCleanupPluginCfg config = |
| | | AdminTestCaseUtils.getConfiguration( |
| | |
| | | */ |
| | | PluginResult.PreParse res = plugin.doPreParse(modifyOperation); |
| | | assertFalse(res.continueProcessing()); |
| | | assertTrue(res.getResultCode() == ResultCode.SUCCESS); |
| | | assertSame(res.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | plugin.finalizePlugin(); |
| | | |
| | |
| | | */ |
| | | plugin.doPreParse(modifyOperation); |
| | | |
| | | assertTrue(modifyOperation.getRawModifications().size() == 2); |
| | | assertEquals(modifyOperation.getRawModifications().size(), 2); |
| | | |
| | | rawMods = modifyOperation.getRawModifications(); |
| | | assertNotNull(rawMods); |
| | |
| | | ExtendedOperation extOp = conn.processExtendedOperation( |
| | | ServerConstants.OID_PASSWORD_MODIFY_REQUEST, bsBuilder.toByteString()); |
| | | |
| | | assertTrue(extOp.getResultCode() == ResultCode.SUCCESS); |
| | | assertSame(extOp.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | // Verification of the result |
| | | assertThatPasswordsAreEqualTo(testEntry, |
| | |
| | | ExtendedOperation extOp = conn.processExtendedOperation( |
| | | ServerConstants.OID_PASSWORD_MODIFY_REQUEST, bsBuilder.toByteString()); |
| | | |
| | | assertTrue(extOp.getResultCode() == ResultCode.SUCCESS); |
| | | assertSame(extOp.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | // Verification of the result |
| | | |
| | |
| | | ExtendedOperation extOp = conn.processExtendedOperation( |
| | | ServerConstants.OID_PASSWORD_MODIFY_REQUEST, bsBuilder.toByteString()); |
| | | |
| | | assertTrue(extOp.getResultCode() == ResultCode.SUCCESS); |
| | | assertSame(extOp.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | // Verification of the result |
| | | assertThatPasswordsAreEqualTo(testEntry, |
| | |
| | | ExtendedOperation extOp = conn.processExtendedOperation( |
| | | ServerConstants.OID_PASSWORD_MODIFY_REQUEST, bsBuilder.toByteString()); |
| | | |
| | | assertTrue(extOp.getResultCode() == ResultCode.SUCCESS); |
| | | assertSame(extOp.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | // Verification of the result |
| | | |
| | |
| | | if (value != null) { |
| | | assertEquals(val, value); |
| | | } else { |
| | | assertTrue(val == null); |
| | | assertNull(val); |
| | | } |
| | | connector.close(); |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.protocols.jmx; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | |
| | | OpendsJmxConnector opendsConnector = new OpendsJmxConnector("localhost", |
| | | TestCaseUtils.getServerJmxPort(), env); |
| | | assertNotNull(opendsConnector); |
| | | try |
| | | { |
| | | opendsConnector.connect(); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | assertTrue(false, "JMX connection error: " + e.getMessage()); |
| | | } |
| | | |
| | | // Check that number of postconnect has been incremented. |
| | | // Don't wait more than 5 seconds |
| | |
| | | |
| | | ASN1Reader reader = ASN1.getReader(builder.toByteString()); |
| | | ProtocolOp reqOp= LDAPReader.readProtocolOp(reader); |
| | | assertTrue(reqOp.getProtocolOpName() == req.getProtocolOpName()); |
| | | assertTrue(reqOp.getType() == req.getType()); |
| | | assertSame(reqOp.getProtocolOpName(), req.getProtocolOpName()); |
| | | assertEquals(reqOp.getType(), req.getType()); |
| | | } |
| | | |
| | | @Test (expectedExceptions = LDAPException.class) |
| | |
| | | addEncoded.write(writer); |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | addDecoded = (AddResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | assertEquals(addDecoded.getMatchedDN(), null); |
| | | assertNull(addDecoded.getMatchedDN()); |
| | | |
| | | //Test case for a full empty referral url param. |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<>(); |
| | |
| | | addEncoded.write(writer); |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | addDecoded = (AddResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | assertTrue(addDecoded.getReferralURLs() == null); |
| | | assertNull(addDecoded.getReferralURLs()); |
| | | |
| | | //Test case for a full encode decode operation with resultCode param only. |
| | | addEncoded = new AddResponseProtocolOp(resultCode); |
| | |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | addDecoded = (AddResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | |
| | | assertEquals(addDecoded.getMatchedDN(), null); |
| | | assertEquals(addDecoded.getErrorMessage(), null); |
| | | assertNull(addDecoded.getMatchedDN()); |
| | | assertNull(addDecoded.getErrorMessage()); |
| | | assertEquals(addEncoded.getResultCode(), addDecoded.getResultCode()); |
| | | assertTrue(addDecoded.getReferralURLs() == null); |
| | | assertNull(addDecoded.getReferralURLs()); |
| | | } |
| | | |
| | | /** |
| | |
| | | (BindRequestProtocolOp)simpleDecodedOp; |
| | | BindRequestProtocolOp saslOp = |
| | | (BindRequestProtocolOp)saslDecodedOp; |
| | | assertTrue(saslOp.getDN().equals(sasl.getDN())); |
| | | assertTrue(simpleOp.getDN().equals(simple.getDN())); |
| | | assertEquals(saslOp.getDN(), sasl.getDN()); |
| | | assertEquals(simpleOp.getDN(), simple.getDN()); |
| | | |
| | | String simpleOpPwd=simpleOp.getSimplePassword().toString(); |
| | | String simplePwd=simple.getSimplePassword().toString(); |
| | | assertTrue(simpleOpPwd.equals(simplePwd)); |
| | | assertEquals(simpleOpPwd, simplePwd); |
| | | |
| | | assertTrue(saslOp.getProtocolOpName() == sasl.getProtocolOpName()); |
| | | assertTrue(simpleOp.getProtocolOpName() == simple.getProtocolOpName()); |
| | | assertSame(saslOp.getProtocolOpName(), sasl.getProtocolOpName()); |
| | | assertSame(simpleOp.getProtocolOpName(), simple.getProtocolOpName()); |
| | | |
| | | assertTrue(simpleOp.getProtocolVersion() == simple.getProtocolVersion()); |
| | | assertTrue(saslOp.getProtocolVersion() == sasl.getProtocolVersion()); |
| | | assertEquals(simpleOp.getProtocolVersion(), simple.getProtocolVersion()); |
| | | assertEquals(saslOp.getProtocolVersion(), sasl.getProtocolVersion()); |
| | | |
| | | assertTrue(simpleOp.getType() == simple.getType()); |
| | | assertTrue(saslOp.getType() == sasl.getType()); |
| | | assertEquals(simpleOp.getType(), simple.getType()); |
| | | assertEquals(saslOp.getType(), sasl.getType()); |
| | | |
| | | assertTrue(saslOp.getAuthenticationType().getBERType() == |
| | | sasl.getAuthenticationType().getBERType()); |
| | | assertTrue(simpleOp.getAuthenticationType().getBERType() == |
| | | simple.getAuthenticationType().getBERType()); |
| | | assertEquals(saslOp.getAuthenticationType().getBERType(), sasl.getAuthenticationType().getBERType()); |
| | | assertEquals(simpleOp.getAuthenticationType().getBERType(), simple.getAuthenticationType().getBERType()); |
| | | |
| | | assertTrue(saslOp.getSASLMechanism().equals(sasl.getSASLMechanism())); |
| | | assertEquals(saslOp.getSASLMechanism(), sasl.getSASLMechanism()); |
| | | String saslOpCreds=saslOp.getSASLCredentials().toString(); |
| | | String saslCreds=sasl.getSASLCredentials().toString(); |
| | | assertTrue(saslOpCreds.equals(saslCreds)); |
| | | assertEquals(saslOpCreds, saslCreds); |
| | | } |
| | | |
| | | @Test |
| | |
| | | |
| | | assertTrue(protocolOp instanceof BindResponseProtocolOp); |
| | | BindResponseProtocolOp bindResponse = (BindResponseProtocolOp)protocolOp; |
| | | assertTrue(bindResponse.getResultCode() == okCode.intValue()); |
| | | assertTrue(bindResponse.getMatchedDN().equals(responseDn)); |
| | | assertTrue(bindResponse.getErrorMessage().toString().equals(message.toString())); |
| | | assertEquals(bindResponse.getResultCode(), okCode.intValue()); |
| | | assertEquals(bindResponse.getMatchedDN(), responseDn); |
| | | assertEquals(bindResponse.getErrorMessage().toString(), message.toString()); |
| | | assertNull(bindResponse.getReferralURLs()); |
| | | assertNull(bindResponse.getServerSASLCredentials()); |
| | | } |
| | |
| | | |
| | | assertTrue(protocolOp instanceof BindResponseProtocolOp); |
| | | BindResponseProtocolOp bindResponse = (BindResponseProtocolOp)protocolOp; |
| | | assertTrue(bindResponse.getResultCode() == okCode.intValue()); |
| | | assertTrue(bindResponse.getMatchedDN().equals(responseDn)); |
| | | assertTrue(bindResponse.getErrorMessage().toString().equals(message.toString())); |
| | | assertEquals(bindResponse.getResultCode(), okCode.intValue()); |
| | | assertEquals(bindResponse.getMatchedDN(), responseDn); |
| | | assertEquals(bindResponse.getErrorMessage().toString(), message.toString()); |
| | | assertNull(bindResponse.getReferralURLs()); |
| | | assertNull(bindResponse.getServerSASLCredentials()); |
| | | } |
| | |
| | | BindResponseProtocolOp invalidSyntaxOp = |
| | | (BindResponseProtocolOp)invalidSyntaxDec; |
| | | |
| | | assertTrue(saslOkOp.getProtocolOpName() == saslOkResp.getProtocolOpName()); |
| | | assertTrue(busyOp.getProtocolOpName() == busyResp.getProtocolOpName()); |
| | | assertTrue(invalidSyntaxOp.getProtocolOpName() == invalidSyntaxResp.getProtocolOpName()); |
| | | assertSame(saslOkOp.getProtocolOpName(), saslOkResp.getProtocolOpName()); |
| | | assertSame(busyOp.getProtocolOpName(), busyResp.getProtocolOpName()); |
| | | assertSame(invalidSyntaxOp.getProtocolOpName(), invalidSyntaxResp.getProtocolOpName()); |
| | | |
| | | assertTrue(saslOkOp.getType() == saslOkResp.getType()); |
| | | assertTrue(busyOp.getType() == busyResp.getType()); |
| | | assertTrue(invalidSyntaxOp.getType() == invalidSyntaxResp.getType()); |
| | | assertEquals(saslOkOp.getType(), saslOkResp.getType()); |
| | | assertEquals(busyOp.getType(), busyResp.getType()); |
| | | assertEquals(invalidSyntaxOp.getType(), invalidSyntaxResp.getType()); |
| | | |
| | | assertTrue(saslOkOp.getResultCode() == saslOkResp.getResultCode()); |
| | | assertTrue(busyOp.getResultCode() == busyResp.getResultCode()); |
| | | assertTrue(invalidSyntaxOp.getResultCode() == invalidSyntaxResp.getResultCode()); |
| | | assertEquals(saslOkOp.getResultCode(), saslOkResp.getResultCode()); |
| | | assertEquals(busyOp.getResultCode(), busyResp.getResultCode()); |
| | | assertEquals(invalidSyntaxOp.getResultCode(), invalidSyntaxResp.getResultCode()); |
| | | |
| | | assertTrue(saslOkOp.getErrorMessage().equals(saslOkResp.getErrorMessage())); |
| | | assertTrue(invalidSyntaxOp.getErrorMessage().equals(invalidSyntaxResp.getErrorMessage())); |
| | | assertEquals(saslOkOp.getErrorMessage(), saslOkResp.getErrorMessage()); |
| | | assertEquals(invalidSyntaxOp.getErrorMessage(), invalidSyntaxResp.getErrorMessage()); |
| | | |
| | | String str1=saslOkOp.getServerSASLCredentials().toString(); |
| | | String str2=saslOkResp.getServerSASLCredentials().toString(); |
| | | assertTrue(str1.equals(str2)); |
| | | assertEquals(str1, str2); |
| | | List<String> list1 = saslOkOp.getReferralURLs(); |
| | | List<String> list2 = saslOkResp.getReferralURLs(); |
| | | assertTrue(list1.equals(list2)); |
| | | DN dn1=saslOkOp.getMatchedDN(); |
| | | DN dn2=saslOkResp.getMatchedDN(); |
| | | assertTrue(dn1.equals(dn2)); |
| | | assertEquals(dn1, dn2); |
| | | } |
| | | } |
| | |
| | | deleteEncoded.write(writer); |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | deleteDecoded = (CompareResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | assertEquals(deleteDecoded.getMatchedDN(), null); |
| | | assertNull(deleteDecoded.getMatchedDN()); |
| | | |
| | | //Test case for a full empty referral url param. |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<>(); |
| | |
| | | deleteEncoded.write(writer); |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | deleteDecoded = (CompareResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | assertTrue(deleteDecoded.getReferralURLs() == null); |
| | | assertNull(deleteDecoded.getReferralURLs()); |
| | | |
| | | //Test case for a full encode decode operation with resultCode param only. |
| | | deleteEncoded = new CompareResponseProtocolOp(resultCode); |
| | |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | deleteDecoded = (CompareResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | |
| | | assertEquals(deleteDecoded.getMatchedDN(), null); |
| | | assertEquals(deleteDecoded.getErrorMessage(), null); |
| | | assertNull(deleteDecoded.getMatchedDN()); |
| | | assertNull(deleteDecoded.getErrorMessage()); |
| | | assertEquals(deleteEncoded.getResultCode(), deleteDecoded.getResultCode()); |
| | | assertTrue(deleteDecoded.getReferralURLs() == null); |
| | | assertNull(deleteDecoded.getReferralURLs()); |
| | | } |
| | | |
| | | /** |
| | |
| | | deleteEncoded.write(writer); |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | deleteDecoded = (DeleteResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | assertEquals(deleteDecoded.getMatchedDN(), null); |
| | | assertNull(deleteDecoded.getMatchedDN()); |
| | | |
| | | //Test case for a full empty referral url param. |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<>(); |
| | |
| | | deleteEncoded.write(writer); |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | deleteDecoded = (DeleteResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | assertTrue(deleteDecoded.getReferralURLs() == null); |
| | | assertNull(deleteDecoded.getReferralURLs()); |
| | | |
| | | //Test case for a full encode decode operation with resultCode param only. |
| | | deleteEncoded = new DeleteResponseProtocolOp(resultCode); |
| | |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | deleteDecoded = (DeleteResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | |
| | | assertEquals(deleteDecoded.getMatchedDN(), null); |
| | | assertEquals(deleteDecoded.getErrorMessage(), null); |
| | | assertNull(deleteDecoded.getMatchedDN()); |
| | | assertNull(deleteDecoded.getErrorMessage()); |
| | | assertEquals(deleteEncoded.getResultCode(), deleteDecoded.getResultCode()); |
| | | assertTrue(deleteDecoded.getReferralURLs() == null); |
| | | assertNull(deleteDecoded.getReferralURLs()); |
| | | } |
| | | |
| | | /** |
| | |
| | | LocalizableMessageDescriptor.Arg1 msgDesc = ERR_ECN_INVALID_ELEMENT_TYPE; |
| | | LDAPException ex = |
| | | new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgDesc.get("")); |
| | | assertTrue(ex.getResultCode() == LDAPResultCode.PROTOCOL_ERROR); |
| | | assertEquals(ex.getResultCode(), LDAPResultCode.PROTOCOL_ERROR); |
| | | assertTrue(StaticUtils.hasDescriptor(ex.getMessageObject(), msgDesc)); |
| | | } |
| | | |
| | |
| | | LocalizableMessageDescriptor.Arg1<Object> msgID1 = |
| | | ERR_ECN_CANNOT_DECODE_VALUE; |
| | | new LDAPException(LDAPResultCode.PROTOCOL_ERROR, msgID1.get(""), ex); |
| | | assertTrue(ex.getResultCode() == LDAPResultCode.OTHER); |
| | | assertEquals(ex.getResultCode(), LDAPResultCode.OTHER); |
| | | assertTrue(StaticUtils.hasDescriptor(ex.getMessageObject(), msgID)); |
| | | } |
| | | } |
| | |
| | | deleteEncoded.write(writer); |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | deleteDecoded = (ModifyDNResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | assertEquals(deleteDecoded.getMatchedDN(), null); |
| | | assertNull(deleteDecoded.getMatchedDN()); |
| | | |
| | | //Test case for a full empty referral url param. |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<>(); |
| | |
| | | deleteEncoded.write(writer); |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | deleteDecoded = (ModifyDNResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | assertTrue(deleteDecoded.getReferralURLs() == null); |
| | | assertNull(deleteDecoded.getReferralURLs()); |
| | | |
| | | //Test case for a full encode decode operation with resultCode param only. |
| | | deleteEncoded = new ModifyDNResponseProtocolOp(resultCode); |
| | |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | deleteDecoded = (ModifyDNResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | |
| | | assertEquals(deleteDecoded.getMatchedDN(), null); |
| | | assertEquals(deleteDecoded.getErrorMessage(), null); |
| | | assertNull(deleteDecoded.getMatchedDN()); |
| | | assertNull(deleteDecoded.getErrorMessage()); |
| | | assertEquals(deleteEncoded.getResultCode(), deleteDecoded.getResultCode()); |
| | | assertTrue(deleteDecoded.getReferralURLs() == null); |
| | | assertNull(deleteDecoded.getReferralURLs()); |
| | | } |
| | | |
| | | /** |
| | |
| | | modifyEncoded.write(writer); |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | modifyDecoded = (ModifyResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | assertEquals(modifyDecoded.getMatchedDN(), null); |
| | | assertNull(modifyDecoded.getMatchedDN()); |
| | | |
| | | //Test case for a full empty referral url param. |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<>(); |
| | |
| | | modifyEncoded.write(writer); |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | modifyDecoded = (ModifyResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | assertTrue(modifyDecoded.getReferralURLs() == null); |
| | | assertNull(modifyDecoded.getReferralURLs()); |
| | | |
| | | //Test case for a full encode decode operation with resultCode param only. |
| | | modifyEncoded = new ModifyResponseProtocolOp(resultCode); |
| | |
| | | reader = ASN1.getReader(builder.toByteString()); |
| | | modifyDecoded = (ModifyResponseProtocolOp)LDAPReader.readProtocolOp(reader); |
| | | |
| | | assertEquals(modifyDecoded.getMatchedDN(), null); |
| | | assertEquals(modifyDecoded.getErrorMessage(), null); |
| | | assertNull(modifyDecoded.getMatchedDN()); |
| | | assertNull(modifyDecoded.getErrorMessage()); |
| | | assertEquals(modifyEncoded.getResultCode(), modifyDecoded.getResultCode()); |
| | | assertTrue(modifyDecoded.getReferralURLs() == null); |
| | | assertNull(modifyDecoded.getReferralURLs()); |
| | | } |
| | | |
| | | /** |
| | |
| | | (SearchRequestProtocolOp)decodedProtocolOp; |
| | | |
| | | // Check that the fields have not been changed during encode and decode. |
| | | assertTrue(protocolOp.getBaseDN().equals(searchOp.getBaseDN())); |
| | | assertTrue(protocolOp.getScope().equals(searchOp.getScope())); |
| | | assertTrue(protocolOp.getDereferencePolicy(). |
| | | equals(searchOp.getDereferencePolicy())); |
| | | assertTrue(protocolOp.getSizeLimit() == searchOp.getSizeLimit()); |
| | | assertTrue(protocolOp.getTimeLimit() == searchOp.getTimeLimit()); |
| | | assertTrue(protocolOp.getFilter().toString().equals( |
| | | searchOp.getFilter().toString())); |
| | | assertEquals(protocolOp.getBaseDN(), searchOp.getBaseDN()); |
| | | assertEquals(protocolOp.getScope(), searchOp.getScope()); |
| | | assertEquals(protocolOp.getDereferencePolicy(), searchOp.getDereferencePolicy()); |
| | | assertEquals(protocolOp.getSizeLimit(), searchOp.getSizeLimit()); |
| | | assertEquals(protocolOp.getTimeLimit(), searchOp.getTimeLimit()); |
| | | assertEquals(protocolOp.getFilter().toString(), searchOp.getFilter().toString()); |
| | | // Check that the attributes are in the correct order (comparing the sets |
| | | // directly does not guarantee this). |
| | | assertTrue(Arrays.equals(protocolOp.getAttributes().toArray(), |
| | |
| | | (SearchRequestProtocolOp)decodedProtocolOp; |
| | | |
| | | // Check that the fields have not been changed during encode and decode. |
| | | assertTrue(baseDN.equals(searchOp.getBaseDN())); |
| | | assertTrue(scope.equals(searchOp.getScope())); |
| | | assertTrue(dereferencePolicy. |
| | | equals(searchOp.getDereferencePolicy())); |
| | | assertTrue(sizeLimit == searchOp.getSizeLimit()); |
| | | assertTrue(timeLimit == searchOp.getTimeLimit()); |
| | | assertTrue(filter.toString().equals( |
| | | searchOp.getFilter().toString())); |
| | | assertEquals(baseDN, searchOp.getBaseDN()); |
| | | assertEquals(scope, searchOp.getScope()); |
| | | assertEquals(dereferencePolicy, searchOp.getDereferencePolicy()); |
| | | assertEquals(sizeLimit, searchOp.getSizeLimit()); |
| | | assertEquals(timeLimit, searchOp.getTimeLimit()); |
| | | assertEquals(filter.toString(), searchOp.getFilter().toString()); |
| | | // Check that the attributes are in the correct order (comparing the sets |
| | | // directly does not guarantee this). |
| | | assertTrue(Arrays.equals(attributes.toArray(), |
| | |
| | | req.write(writer); |
| | | ASN1Reader reader = ASN1.getReader(builder.toByteString()); |
| | | ProtocolOp reqOp = LDAPReader.readProtocolOp(reader); |
| | | assertTrue(reqOp.getProtocolOpName() == req.getProtocolOpName()); |
| | | assertTrue(reqOp.getType() == req.getType()); |
| | | assertSame(reqOp.getProtocolOpName(), req.getProtocolOpName()); |
| | | assertEquals(reqOp.getType(), req.getType()); |
| | | } |
| | | |
| | | @Test |
| | | public void testUnbindRequestToString() throws Exception |
| | | { |
| | | UnbindRequestProtocolOp r = |
| | | new UnbindRequestProtocolOp(); |
| | | toString(r); |
| | | toString(new UnbindRequestProtocolOp()); |
| | | } |
| | | } |
| | |
| | | addSynchroServerEntry(synchroServerLdif); |
| | | |
| | | replDomain = LDAPReplicationDomain.retrievesReplicationDomain(baseDN); |
| | | assertTrue(!replDomain.ieRunning(), |
| | | "ReplicationDomain: Import/Export is not expected to be running"); |
| | | assertFalse(replDomain.ieRunning(), "ReplicationDomain: Import/Export is not expected to be running"); |
| | | } |
| | | |
| | | private int getReplServerPort(int replServerId) throws Exception |
| | |
| | | |
| | | if (replDomain != null) |
| | | { |
| | | assertTrue(!replDomain.ieRunning(), |
| | | "ReplicationDomain: Import/Export is not expected to be running"); |
| | | assertFalse(replDomain.ieRunning(), "ReplicationDomain: Import/Export is not expected to be running"); |
| | | } |
| | | |
| | | log("Successfully ending " + testCase); |
| | |
| | | |
| | | if (replDomain != null) |
| | | { |
| | | assertTrue(!replDomain.ieRunning(), |
| | | "ReplicationDomain: Import/Export is not expected to be running"); |
| | | assertFalse(replDomain.ieRunning(), "ReplicationDomain: Import/Export is not expected to be running"); |
| | | } |
| | | |
| | | log("Successfully ending " + testCase); |
| | |
| | | } |
| | | sleep(500); |
| | | } |
| | | assertTrue(!replDomain.ieRunning(), |
| | | "ReplicationDomain: Import/Export is not expected to be running"); |
| | | assertFalse(replDomain.ieRunning(), "ReplicationDomain: Import/Export is not expected to be running"); |
| | | } |
| | | // Remove domain config |
| | | super.cleanConfigEntries(); |
| | |
| | | AddMsg addMsg = (AddMsg) msg; |
| | | |
| | | Operation receivedOp = addMsg.createOperation(connection); |
| | | assertTrue(OperationType.ADD.compareTo(receivedOp.getOperationType()) == 0, |
| | | "The received Replication message is not an ADD msg"); |
| | | assertEquals(OperationType.ADD.compareTo(receivedOp.getOperationType()), 0, "The received Replication message is not an ADD msg"); |
| | | |
| | | assertEquals(addMsg.getDN(), personEntry.getName(), |
| | | "The received ADD Replication message is not for the excepted DN"); |
| | |
| | | public void csnEquals(CSN csn1, CSN csn2, CSN csn3, CSN csn4, CSN csn5) throws Exception |
| | | { |
| | | assertFalse(csn1.equals(new Object())); |
| | | assertTrue(csn1.equals(csn1)); |
| | | assertTrue(csn1.equals(csn2)); |
| | | assertEquals(csn1, csn1); |
| | | assertEquals(csn1, csn2); |
| | | assertFalse(csn1.equals(csn3)); |
| | | assertFalse(csn1.equals(csn4)); |
| | | assertFalse(csn1.equals(csn5)); |
| | |
| | | boolean result = rd1.buildAndPublishMissingChanges(csn, session); |
| | | assertTrue(result, "buildAndPublishMissingChanges has failed"); |
| | | assertEquals(opList.size(), 3, "buildAndPublishMissingChanges should return 3 operations"); |
| | | assertTrue(opList.getFirst().getClass().equals(AddMsg.class)); |
| | | assertEquals(opList.getFirst().getClass(), AddMsg.class); |
| | | |
| | | |
| | | // Build a CSN from the first modification |
| | |
| | | result = rd1.buildAndPublishMissingChanges(fromCSN, session); |
| | | assertTrue(result, "buildAndPublishMissingChanges has failed"); |
| | | assertEquals(opList.size(), 1, "buildAndPublishMissingChanges should return 1 operation"); |
| | | assertTrue(opList.getFirst().getClass().equals(ModifyMsg.class)); |
| | | assertEquals(opList.getFirst().getClass(), ModifyMsg.class); |
| | | } |
| | | finally |
| | | { |
| | |
| | | assertTrue(result, "buildAndPublishMissingChanges has failed"); |
| | | assertEquals(opList.size(), 5, "buildAndPublishMissingChanges should return 5 operations"); |
| | | ReplicationMsg msg = opList.removeFirst(); |
| | | assertTrue(msg.getClass().equals(AddMsg.class)); |
| | | assertEquals(msg.getClass(), AddMsg.class); |
| | | assertEquals(((LDAPUpdateMsg) msg).getDN(), dnTest1); |
| | | msg = opList.removeFirst(); |
| | | assertTrue(msg.getClass().equals(DeleteMsg.class)); |
| | | assertEquals(msg.getClass(), DeleteMsg.class); |
| | | assertEquals(((LDAPUpdateMsg) msg).getDN(), dnTest3); |
| | | msg = opList.removeFirst(); |
| | | assertTrue(msg.getClass().equals(AddMsg.class)); |
| | | assertEquals(msg.getClass(), AddMsg.class); |
| | | assertEquals(((LDAPUpdateMsg) msg).getDN(), dnTest2); |
| | | msg = opList.removeFirst(); |
| | | assertTrue(msg.getClass().equals(ModifyMsg.class)); |
| | | assertEquals(msg.getClass(), ModifyMsg.class); |
| | | assertEquals(((LDAPUpdateMsg) msg).getDN(), dnTest2); |
| | | msg = opList.removeFirst(); |
| | | assertTrue(msg.getClass().equals(ModifyMsg.class)); |
| | | assertEquals(msg.getClass(), ModifyMsg.class); |
| | | assertEquals(((LDAPUpdateMsg) msg).getDN(), dnTest1); |
| | | } |
| | | finally |
| | |
| | | { |
| | | assertEquals(size, mods.size()); |
| | | Modification newMod = mods.get(0); |
| | | assertTrue(newMod.getModificationType().equals(modType)); |
| | | assertEquals(newMod.getModificationType(), modType); |
| | | ByteString val = newMod.getAttribute().iterator().next(); |
| | | assertEquals(val.toString(), value); |
| | | } |
| | |
| | | // Get the Entry uuid in String format |
| | | List<Attribute> uuidAttrs = entry.getOperationalAttribute(entryuuidAttrType); |
| | | String retrievedUuid = uuidAttrs.get(0).iterator().next().toString(); |
| | | assertTrue(retrievedUuid.equals(uuid)); |
| | | assertEquals(retrievedUuid, uuid); |
| | | |
| | | |
| | | // Test FakeOperation |
| | |
| | | if (fks.iterator().hasNext()) |
| | | { |
| | | FakeOperation fk = fks.iterator().next(); |
| | | assertTrue(new FakeOperationComparator().compare(fk, fk) == 0); |
| | | assertEquals(new FakeOperationComparator().compare(fk, fk), 0); |
| | | assertTrue(new FakeOperationComparator().compare(null, fk) < 0); |
| | | ReplicationMsg generatedMsg = fk.generateMessage(); |
| | | if (generatedMsg instanceof LDAPUpdateMsg) |
| | |
| | | // Get the op uuid in String format |
| | | List<Attribute> uuidAttrs = addOp.getOperationalAttributes().get(entryuuidAttrType); |
| | | String retrievedUuid = uuidAttrs.get(0).iterator().next().toString(); |
| | | assertTrue(retrievedUuid.equals(uuid)); |
| | | assertEquals(retrievedUuid, uuid); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | domain.replay(queue.take().getUpdateMessage(), SHUTDOWN); |
| | | |
| | | // Expect the parent entry to be deleted |
| | | assertTrue(!DirectoryServer.entryExists(parentEntry.getName()), |
| | | "Parent entry expected to be deleted : " + parentEntry.getName()); |
| | | assertFalse(DirectoryServer.entryExists(parentEntry.getName()), "Parent entry expected to be deleted : " + parentEntry.getName()); |
| | | |
| | | // Expect the child entry to be moved as conflict entry under the root |
| | | // entry of the suffix |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | state.clear(); |
| | | stateSaved = new PersistentServerState(baseDn, 1, new ServerState()); |
| | | csn1Saved = stateSaved.getMaxCSN(1); |
| | | assertEquals(csn1Saved, null, |
| | | "csn1 has not been saved after clear for " + dn); |
| | | assertNull(csn1Saved, "csn1 has not been saved after clear for " + dn); |
| | | } |
| | | } |
| | |
| | | Thread.sleep(1000); // Be sure status analyzer has time to test |
| | | ReplicationMsg msg = br3.getLastMsg(); |
| | | debugInfo(testCase + " Step 1: last message from writer: " + msg); |
| | | assertTrue(msg == null, (msg != null) ? msg.toString() : "null" ); |
| | | assertNull(msg, (msg != null) ? msg.toString() : "null"); |
| | | } |
| | | |
| | | /** |
| | |
| | | ReplicationMsg lastMsg = br3.getLastMsg(); |
| | | ReplicationMsg msg = br3.getLastMsg(); |
| | | debugInfo(testCase + " Step 3: last message from writer: " + msg); |
| | | assertTrue(lastMsg == null); |
| | | assertNull(lastMsg); |
| | | |
| | | /** |
| | | * DS2 replays every changes and should go back to normal status |
| | |
| | | assertEquals(newMsg.getAssuredMode(), AssuredMode.SAFE_DATA_MODE); |
| | | assertEquals(newMsg.getSafeDataLevel(), (byte)1); |
| | | assertEquals(modDnOpBasis.getModifications(), mods); |
| | | assertTrue(genModDnOpBasis.getModifications() == null); |
| | | assertNull(genModDnOpBasis.getModifications()); |
| | | |
| | | // Set again only VLAST fields |
| | | newMsg.setAssuredMode(assuredMode); |
| | |
| | | String synchroServerStringDN = "cn=" + testName + ", cn=domains," + |
| | | SYNCHRO_PLUGIN_DN; |
| | | // Must have called connectServer1ToChangelog previously |
| | | assertTrue(synchroServerEntry != null); |
| | | assertNotNull(synchroServerEntry); |
| | | DN synchroServerDN = DN.valueOf(synchroServerStringDN); |
| | | deleteEntry(synchroServerDN); |
| | | synchroServerEntry = null; |
| | |
| | | String entries = oStream.toString(); |
| | | debugInfo("Entries:" + entries); |
| | | assertEquals(retVal, 0, "Returned error: " + eStream); |
| | | assertTrue(!entries.equalsIgnoreCase(""), "Returned entries: " + entries); |
| | | assertFalse(entries.equalsIgnoreCase(""), "Returned entries: " + entries); |
| | | } |
| | | } |
| | |
| | | replicaDB.clear(); |
| | | |
| | | // Check the db is cleared. |
| | | assertEquals(null, replicaDB.getOldestCSN()); |
| | | assertEquals(null, replicaDB.getNewestCSN()); |
| | | assertNull(replicaDB.getOldestCSN()); |
| | | assertNull(replicaDB.getNewestCSN()); |
| | | debugInfo(tn,"Success"); |
| | | } |
| | | finally |
| | |
| | | // Clear DB and check it is cleared. |
| | | replicaDB.clear(); |
| | | |
| | | assertEquals(null, replicaDB.getOldestCSN()); |
| | | assertEquals(null, replicaDB.getNewestCSN()); |
| | | assertNull(replicaDB.getOldestCSN()); |
| | | assertNull(replicaDB.getNewestCSN()); |
| | | } |
| | | finally |
| | | { |
| | |
| | | replicaDB.clear(); |
| | | |
| | | // Check the db is cleared. |
| | | assertEquals(null, replicaDB.getOldestCSN()); |
| | | assertEquals(null, replicaDB.getNewestCSN()); |
| | | assertNull(replicaDB.getOldestCSN()); |
| | | assertNull(replicaDB.getNewestCSN()); |
| | | debugInfo(tn,"Success"); |
| | | } |
| | | finally |
| | |
| | | Boolean liveResult = |
| | | syntax.valueIsAcceptable(ByteString.valueOf(value), reason); |
| | | |
| | | if (liveResult != result) |
| | | { |
| | | fail(syntax + ".valueIsAcceptable gave bad result for " + value + " reason : " + reason); |
| | | } |
| | | assertSame(liveResult, result, syntax + ".valueIsAcceptable gave bad result for " + value + " reason : " + reason); |
| | | } |
| | | } |
| | |
| | | Boolean liveResult = |
| | | syntax.valueIsAcceptable(byteStringValue, reason); |
| | | |
| | | if (liveResult != result) |
| | | { |
| | | fail(syntax + ".valueIsAcceptable gave bad result for " + value + " reason : " + reason); |
| | | } |
| | | assertSame(liveResult, result, syntax + ".valueIsAcceptable gave bad result for " + value + " reason : " + reason); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | | List<SearchResultEntry> entries = searchOperation.getSearchEntries(); |
| | | assertTrue(entries.size()==1); |
| | | assertEquals(entries.size(), 1); |
| | | } |
| | | finally |
| | | { |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import java.net.Socket; |
| | | import java.net.UnknownHostException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | |
| | | String[] supportedMechanisms = |
| | | LDAPAuthenticationHandler.getSupportedSASLMechanisms(); |
| | | assertNotNull(supportedMechanisms); |
| | | assertTrue(supportedMechanisms.length == 6); |
| | | |
| | | boolean found = false; |
| | | for (String name : supportedMechanisms) |
| | | { |
| | | found = name.equals(saslMechanismName); |
| | | if (found) |
| | | { |
| | | break; |
| | | assertEquals(supportedMechanisms.length, 6); |
| | | assertTrue(Arrays.asList(supportedMechanisms).contains(saslMechanismName)); |
| | | } |
| | | } |
| | | |
| | | assertTrue(found); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the <CODE>getSASLProperties</CODE> method. |
| | | * |
| | | * @param saslMechanismName The name for which to retrieve the applicable |
| | | * properties. |
| | | * @param saslMechanismName The name for which to retrieve the applicable properties. |
| | | */ |
| | | @Test(dataProvider = "saslMechanisms") |
| | | public void testGetSASLProperties(String saslMechanismName) |
| | |
| | | "-X" |
| | | }; |
| | | |
| | | assertTrue(DSConfig.main(args, System.out, System.err) == CONFLICTING_ARGS.get()); |
| | | assertEquals(DSConfig.main(args, System.out, System.err), CONFLICTING_ARGS.get()); |
| | | } |
| | | |
| | | /** |
| | | * Quiet mode and verbose arguments can not be provided |
| | | * together. |
| | | */ |
| | | /** Quiet mode and verbose arguments can not be provided together. */ |
| | | @Test |
| | | public void testConflictualArgumentsQuietAndVerbose() |
| | | { |
| | |
| | | "-X" |
| | | }; |
| | | |
| | | assertTrue(DSConfig.main(args, System.out, System.err) == CONFLICTING_ARGS.get()); |
| | | assertEquals(DSConfig.main(args, System.out, System.err), CONFLICTING_ARGS.get()); |
| | | } |
| | | |
| | | /** |
| | |
| | | "-X" |
| | | }; |
| | | |
| | | assertTrue(DSConfig.main(args, System.out, System.err) == SUCCESS.get()); |
| | | assertEquals(DSConfig.main(args, System.out, System.err), SUCCESS.get()); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | String msg = e.getMessage(); |
| | | LocalizableMessage msg_locale = ERR_MAKELDIF_TAG_UNDEFINED_ATTRIBUTE.get("missingVar",1); |
| | | assertTrue (msg.equals(msg_locale.toString()), msg); |
| | | assertEquals(msg, msg_locale.toString(), msg); |
| | | } |
| | | } |
| | | |
| | |
| | | assertEquals(virtualAttribute.size(), 1); |
| | | assertTrue(virtualAttribute.contains(ByteString.valueOf("o=test"))); |
| | | |
| | | assertTrue(!virtualAttribute.isEmpty()); |
| | | assertFalse(virtualAttribute.isEmpty()); |
| | | |
| | | assertTrue(virtualAttribute.contains(ByteString.valueOf("o=test"))); |
| | | assertFalse(virtualAttribute.contains(ByteString.valueOf("o=not test"))); |
| | |
| | | try { |
| | | if (target.exists()) { |
| | | target.delete(); |
| | | assertTrue(!target.exists()); |
| | | assertFalse(target.exists()); |
| | | } |
| | | StaticUtils.renameFile(src, target); |
| | | assertTrue(!src.exists()); |
| | | assertFalse(src.exists()); |
| | | assertTrue(target.exists()); |
| | | } finally { |
| | | src.delete(); |
| | |
| | | File target = File.createTempFile("target", null); |
| | | try { |
| | | StaticUtils.renameFile(src, target); |
| | | assertTrue(!src.exists()); |
| | | assertFalse(src.exists()); |
| | | assertTrue(target.exists()); |
| | | } finally { |
| | | src.delete(); |