@Test public void when_query_is_not_empty_and_other_required_properties_are_set_then_query_client_is_created(){ setSystemProperty(LdapClientProvider.LDAP_QUERY, "(|(cn=${login})(&(email=${login})(objectClass=inetOrgPerson))(emailAlias=${login}))"); setSystemProperty(LdapClientProvider.LDAP_QUERY_DN, "ou=users, dc=example, dc=com"); setSystemProperty(LdapClientProvider.LDAP_ADMIN_DN, "cn=admin"); OneTimePadRegistry registry = new OneTimePadRegistry("NOT_EXISTING_FILE_ONLY_FOR_TESTS"); registry.encryptAndStorePassword("password".toCharArray()); provider = new LdapClientProvider(registry); assertThat(provider.getClient()).isNotNull().isInstanceOf(QueryLdapClient.class); }
public LdapClient getClient(){ if(ldapClient == null){ throw new IllegalStateException("LDAP is not properly configured. Maybe you forgot to put LDAP properties inside cloudstore.properties?"); } return ldapClient; }
LdapClientProvider { public LdapClient getClient(){ if(ldapClient == null){ throw new IllegalStateException("LDAP is not properly configured. Maybe you forgot to put LDAP properties inside cloudstore.properties?"); } return ldapClient; } }
LdapClientProvider { public LdapClient getClient(){ if(ldapClient == null){ throw new IllegalStateException("LDAP is not properly configured. Maybe you forgot to put LDAP properties inside cloudstore.properties?"); } return ldapClient; } protected  LdapClientProvider(); protected  LdapClientProvider(OneTimePadRegistry adminPasswordRegistry); }
LdapClientProvider { public LdapClient getClient(){ if(ldapClient == null){ throw new IllegalStateException("LDAP is not properly configured. Maybe you forgot to put LDAP properties inside cloudstore.properties?"); } return ldapClient; } protected  LdapClientProvider(); protected  LdapClientProvider(OneTimePadRegistry adminPasswordRegistry); LdapClient getClient(); static LdapClientProvider getInstance(); }
LdapClientProvider { public LdapClient getClient(){ if(ldapClient == null){ throw new IllegalStateException("LDAP is not properly configured. Maybe you forgot to put LDAP properties inside cloudstore.properties?"); } return ldapClient; } protected  LdapClientProvider(); protected  LdapClientProvider(OneTimePadRegistry adminPasswordRegistry); LdapClient getClient(); static LdapClientProvider getInstance(); static final String LDAP_TEMPLATE_PATTERN; static final String LDAP_URL; static final String LDAP_QUERY; static final String LDAP_ADMIN_DN; static final String LDAP_QUERY_DN; }