public void validateResourceResponse( LdapUserAndGroupConfigurationDTO expected, LdapUserAndGroupConfigurationDTO actual) throws Exception { // this object has an equals method, but it makes for not so easy debuging, so call it after // each field compare to make // sure we didn't forget anything Assert.assertEquals(actual.getGroupBaseDn(), expected.getGroupBaseDn()); Assert.assertEquals(actual.getGroupIdAttribute(), expected.getGroupIdAttribute()); Assert.assertEquals(actual.getGroupMemberAttribute(), expected.getGroupMemberAttribute()); Assert.assertEquals(actual.getGroupMemberFormat(), expected.getGroupMemberFormat()); Assert.assertEquals(actual.getGroupObjectClass(), expected.getGroupObjectClass()); Assert.assertEquals(actual.getUserBaseDn(), expected.getUserBaseDn()); Assert.assertEquals(actual.getUserIdAttribute(), expected.getUserIdAttribute()); Assert.assertEquals(actual.getUserObjectClass(), expected.getUserObjectClass()); Assert.assertEquals(actual.getUserPasswordAttribute(), expected.getUserPasswordAttribute()); Assert.assertEquals(actual.getUserRealNameAttribute(), expected.getUserRealNameAttribute()); Assert.assertEquals(actual.getEmailAddressAttribute(), expected.getEmailAddressAttribute()); Assert.assertEquals(actual.isLdapGroupsAsRoles(), expected.isLdapGroupsAsRoles()); Assert.assertEquals(actual.getUserMemberOfAttribute(), expected.getUserMemberOfAttribute()); Assert.assertEquals(actual.isGroupSubtree(), expected.isGroupSubtree()); Assert.assertEquals(actual.isUserSubtree(), expected.isUserSubtree()); Assert.assertEquals(actual, expected); // also validate the file config this.validateLdapConfig(expected); }
@SuppressWarnings("unchecked") public void validateLdapConfig(LdapUserAndGroupConfigurationDTO connInfo) throws Exception { CUserAndGroupAuthConfiguration fileConfig = LdapConfigurationUtil.getConfiguration().getUserAndGroupConfig(); Assert.assertEquals(fileConfig.getGroupBaseDn(), connInfo.getGroupBaseDn()); Assert.assertEquals(fileConfig.getGroupIdAttribute(), connInfo.getGroupIdAttribute()); Assert.assertEquals(fileConfig.getGroupMemberAttribute(), connInfo.getGroupMemberAttribute()); Assert.assertEquals(fileConfig.getGroupMemberFormat(), connInfo.getGroupMemberFormat()); Assert.assertEquals(fileConfig.getGroupObjectClass(), connInfo.getGroupObjectClass()); Assert.assertEquals(fileConfig.getUserBaseDn(), connInfo.getUserBaseDn()); Assert.assertEquals(fileConfig.getUserIdAttribute(), connInfo.getUserIdAttribute()); Assert.assertEquals(fileConfig.getUserObjectClass(), connInfo.getUserObjectClass()); Assert.assertEquals(fileConfig.getUserPasswordAttribute(), connInfo.getUserPasswordAttribute()); Assert.assertEquals(fileConfig.getUserRealNameAttribute(), connInfo.getUserRealNameAttribute()); Assert.assertEquals(fileConfig.getEmailAddressAttribute(), connInfo.getEmailAddressAttribute()); Assert.assertEquals(fileConfig.isLdapGroupsAsRoles(), connInfo.isLdapGroupsAsRoles()); Assert.assertEquals(fileConfig.getUserMemberOfAttribute(), connInfo.getUserMemberOfAttribute()); Assert.assertEquals(fileConfig.isGroupSubtree(), connInfo.isGroupSubtree()); Assert.assertEquals(fileConfig.isUserSubtree(), connInfo.isUserSubtree()); }