String getProviderURL(LdapName baseDN) throws NamingException
    {
        StringBuffer ldapURL = new StringBuffer();

        try
        {
            for ( String host : hosts )
            {
                // Create a correctly-encoded ldap URL for the PROVIDER_URL
                final URI uri = new URI(sslEnabled ? "ldaps" : "ldap", null, host, port, "/" + baseDN.toString(), null, null);
                ldapURL.append(uri.toASCIIString());
                ldapURL.append(" ");
            }
            return ldapURL.toString().trim();
        }
        catch ( Exception e )
        {
            Log.error( "Unable to generate provider URL for baseDN: '{}'.", baseDN, e );
            throw new NamingException( "Unable to generate provider URL for baseDN: '"+baseDN+"': " + e.getMessage() );
        }
    }
@Test
    public void testGetProviderURL() throws Exception
    {
        // Setup fixture.
        final Map<String, String> properties = new HashMap<>();
        properties.put("ldap.host", "localhost");
        properties.put("ldap.port", "389");
        final LdapManager manager = new LdapManager( properties );
        final LdapName name = new LdapName("ou=people,dc=example,dc=org");

        // Execute system under test.
        final String result = manager.getProviderURL( name );

        // Verify result.
        assertEquals("ldaps://localhost:389/ou=people,dc=example,dc=org", result);
    }