/** * Assemble a valid url String from all registered urls to add as * <code>PROVIDER_URL</code> to the environment. * * @param ldapUrls all individual url Strings. * @return the full url String */ public String assembleProviderUrlString(String[] ldapUrls) { StringBuilder providerUrlBuffer = new StringBuilder(DEFAULT_BUFFER_SIZE); for (String ldapUrl : ldapUrls) { providerUrlBuffer.append(ldapUrl); if (!base.isEmpty()) { if (!ldapUrl.endsWith("/")) { providerUrlBuffer.append("/"); } } providerUrlBuffer.append(formatForUrl(base)); providerUrlBuffer.append(' '); } return providerUrlBuffer.toString().trim(); }
/** * Assemble a valid url String from all registered urls to add as * <code>PROVIDER_URL</code> to the environment. * * @param ldapUrls all individual url Strings. * @return the full url String */ public String assembleProviderUrlString(String[] ldapUrls) { StringBuilder providerUrlBuffer = new StringBuilder(DEFAULT_BUFFER_SIZE); for (String ldapUrl : ldapUrls) { providerUrlBuffer.append(ldapUrl); if (!base.isEmpty()) { if (!ldapUrl.endsWith("/")) { providerUrlBuffer.append("/"); } } providerUrlBuffer.append(formatForUrl(base)); providerUrlBuffer.append(' '); } return providerUrlBuffer.toString().trim(); }
/** * Assemble a valid url String from all registered urls to add as * <code>PROVIDER_URL</code> to the environment. * * @param ldapUrls all individual url Strings. * @return the full url String */ public String assembleProviderUrlString(String[] ldapUrls) { StringBuilder providerUrlBuffer = new StringBuilder(DEFAULT_BUFFER_SIZE); for (String ldapUrl : ldapUrls) { providerUrlBuffer.append(ldapUrl); if (!base.isEmpty()) { if (!ldapUrl.endsWith("/")) { providerUrlBuffer.append("/"); } } providerUrlBuffer.append(formatForUrl(base)); providerUrlBuffer.append(' '); } return providerUrlBuffer.toString().trim(); }
/** * Assemble a valid url String from all registered urls to add as * <code>PROVIDER_URL</code> to the environment. * * @param ldapUrls all individual url Strings. * @return the full url String */ public String assembleProviderUrlString(String[] ldapUrls) { StringBuilder providerUrlBuffer = new StringBuilder(DEFAULT_BUFFER_SIZE); for (String ldapUrl : ldapUrls) { providerUrlBuffer.append(ldapUrl); if (!base.isEmpty()) { if (!ldapUrl.endsWith("/")) { providerUrlBuffer.append("/"); } } providerUrlBuffer.append(formatForUrl(base)); providerUrlBuffer.append(' '); } return providerUrlBuffer.toString().trim(); }
@Test public void testFormatForUrlNormalWithQuestionMark() throws InvalidNameException { LdapName ldapName = new LdapName("dc=261consulting?, dc=com"); String result = AbstractContextSource.formatForUrl(ldapName); assertThat(result).isEqualTo("dc=261consulting%3F,dc=com"); }
@Test public void testFormatForUrlNormal() throws InvalidNameException { LdapName ldapName = new LdapName("dc=261consulting, dc=com"); String result = AbstractContextSource.formatForUrl(ldapName); assertThat(result).isEqualTo("dc=261consulting,dc=com"); }
@Test public void testFormatForUrlEmpty() throws InvalidNameException { LdapName ldapName = new LdapName(""); String result = AbstractContextSource.formatForUrl(ldapName); assertThat(result).isEqualTo(""); } }
@Test public void testFormatForUrlWithSpace() throws InvalidNameException { LdapName ldapName = new LdapName("ou=some department, dc=261consulting, dc=com"); String result = AbstractContextSource.formatForUrl(ldapName); assertThat(result).isEqualTo("ou=some%20department,dc=261consulting,dc=com"); }