throws Exception
{
PlexusResource pr = this.lookup(PlexusResource.class, "LdapServerListPlexusResource");
LdapServerRequest ldapServerRequest = new LdapServerRequest();
LdapServerConfigurationDTO dto = new LdapServerConfigurationDTO();
LdapConnectionInfoDTO connectionDto = new LdapConnectionInfoDTO();
LdapUserAndGroupAuthConfigurationDTO userGroupDto = new LdapUserAndGroupAuthConfigurationDTO();
ldapServerRequest.setData(dto);
dto.setConnectionInfo(connectionDto);
dto.setUserAndGroupConfig(userGroupDto);
dto.setName("test");
connectionDto.setHost("test");
connectionDto.setPort(389);
connectionDto.setSearchBase("test");
connectionDto.setAuthScheme("none");
connectionDto.setProtocol("ldap");
connectionDto.setBackupMirrorProtocol("ldap");
connectionDto.setBackupMirrorHost("asdf");
connectionDto.setBackupMirrorPort(389);
connectionDto.setConnectionTimeout(33);
connectionDto.setConnectionRetryDelay(44);
connectionDto.setCacheTimeout(55);
userGroupDto.setEmailAddressAttribute("qasdf");
userGroupDto.setLdapGroupsAsRoles(true);
userGroupDto.setUserPasswordAttribute("asdf");
userGroupDto.setUserIdAttribute("asdf");
userGroupDto.setUserObjectClass("asdf");
userGroupDto.setUserRealNameAttribute("asdf");
userGroupDto.setUserSubtree(false);
userGroupDto.setGroupSubtree(false);
userGroupDto.setUserMemberOfAttribute("asdf");
Request request = this.buildRequest();
LdapServerRequest postResult = (LdapServerRequest) pr.post(null, request, null, ldapServerRequest);
// we need to update the ID in the original, because it was set on the server
Assert.assertNotNull(postResult.getData().getId());
dto.setId(postResult.getData().getId());
// update the request with the expected URL, so we can compare
dto.setUrl(request.getResourceRef().toString() + "/" + dto.getId());
this.compare(dto, postResult.getData());
}