SOLR-10783: Fix constructor.

This commit is contained in:
Mark Miller 2017-09-07 14:46:51 -05:00
parent f828edf332
commit 9388208613
3 changed files with 24 additions and 0 deletions

View File

@ -44,6 +44,10 @@ public class EnvSSLCredentialProvider extends AbstractSSLCredentialProvider {
private Map<String, String> envVars;
public EnvSSLCredentialProvider() {
this.envVars = System.getenv();
}
protected EnumMap<CredentialType, String> getCredentialKeyMap() {
return Maps.newEnumMap(ImmutableMap.of(
SSL_KEY_STORE_PASSWORD, EnvVars.SOLR_SSL_KEY_STORE_PASSWORD,

View File

@ -49,4 +49,13 @@ public class EnvSSLCredentialProviderTest {
}
}
@Test
public void testGetCredentialsWithEnvVars() throws Exception {
EnvSSLCredentialProvider sut = new EnvSSLCredentialProvider();
// assuming not to fail
sut.getCredential(SSLCredentialProvider.CredentialType.SSL_KEY_STORE_PASSWORD);
sut.getCredential(SSLCredentialProvider.CredentialType.SSL_CLIENT_KEY_STORE_PASSWORD);
sut.getCredential(SSLCredentialProvider.CredentialType.SSL_TRUST_STORE_PASSWORD);
sut.getCredential(SSLCredentialProvider.CredentialType.SSL_CLIENT_TRUST_STORE_PASSWORD);
}
}

View File

@ -52,4 +52,15 @@ public class SysPropSSLCredentialProviderTest {
assertThat(sut.getCredential(set.getKey()), is(pw));
}
}
@Test
public void testGetCredentialsWithoutSetup() throws Exception {
SysPropSSLCredentialProvider sut = new SysPropSSLCredentialProvider();
// assuming not to fail
sut.getCredential(SSLCredentialProvider.CredentialType.SSL_KEY_STORE_PASSWORD);
sut.getCredential(SSLCredentialProvider.CredentialType.SSL_CLIENT_KEY_STORE_PASSWORD);
sut.getCredential(SSLCredentialProvider.CredentialType.SSL_TRUST_STORE_PASSWORD);
sut.getCredential(SSLCredentialProvider.CredentialType.SSL_CLIENT_TRUST_STORE_PASSWORD);
}
}