{
LdapConfigurationManager ldapConfigManager = this.lookup(LdapConfigurationManager.class);
String id = "testUpdateServer";
CLdapServerConfiguration serverConfig = new CLdapServerConfiguration();
serverConfig.setId(id);
serverConfig.setName(id + "-name");
serverConfig.setConnectionInfo(this.buildConnectionInfo());
serverConfig.setUserAndGroupConfig(this.buildUserAndGroupAuthConfiguration());
// add the server
ldapConfigManager.addLdapServerConfiguration(serverConfig);
// NOT the same instance!
serverConfig = new CLdapServerConfiguration();
serverConfig.setId(id);
serverConfig.setName(id + "-name");
serverConfig.setConnectionInfo(this.buildConnectionInfo());
serverConfig.setUserAndGroupConfig(this.buildUserAndGroupAuthConfiguration());
serverConfig.setName(id + "newName");
serverConfig.getConnectionInfo().setBackupMirrorHost("newbackupMirrorHost");
serverConfig.getUserAndGroupConfig().setUserBaseDn("newuserBaseDn");
// save the updated one
ldapConfigManager.updateLdapServerConfiguration(serverConfig);
// get the config
CLdapServerConfiguration result = ldapConfigManager.getLdapServerConfiguration(id);
// manual check a couple things
Assert.assertEquals(id + "newName", result.getName());
Assert.assertEquals("newbackupMirrorHost", result.getConnectionInfo().getBackupMirrorHost());
Assert.assertEquals("newuserBaseDn", result.getUserAndGroupConfig().getUserBaseDn());
// compare the results
this.compareConfiguration(serverConfig, result);
// make sure there is only the one item