class LdapConfigService extends AbstractArchivistService<LdapConfig> {

    public String testConnection(String environmentCrn, LdapConfig ldapConfig) {
        if (environmentCrn == null && ldapConfig == null) {
            throw new BadRequestException("Either an environment or an LDAP 'validationRequest' needs to be specified in the request. ");
        }
        try {
            if (environmentCrn != null) {
                ldapConfig = get(environmentCrn);
            }
            ldapConfigValidator.validateLdapConnection(ldapConfig);
            return "connected";
        } catch (BadRequestException e) {
            return e.getMessage();
        }
    }

}