use of org.codelibs.core.misc.DynamicProperties in project fess by codelibs.
the class FessPropTest method test_maxUsernameLength10.
public void test_maxUsernameLength10() throws IOException {
FessProp.propMap.clear();
FessConfig fessConfig = new FessConfig.SimpleImpl() {
@Override
public Integer getLdapMaxUsernameLengthAsInteger() {
return Integer.valueOf(10);
}
};
File file = File.createTempFile("test", ".properties");
file.deleteOnExit();
FileUtil.writeBytes(file.getAbsolutePath(), "ldap.security.principal=%s@fess.codelibs.local".getBytes("UTF-8"));
DynamicProperties systemProps = new DynamicProperties(file);
SingletonLaContainerFactory.getContainer().register(systemProps, "systemProperties");
assertEquals("@fess.codelibs.local", fessConfig.getLdapSecurityPrincipal(null));
assertEquals("@fess.codelibs.local", fessConfig.getLdapSecurityPrincipal(""));
assertEquals("123456789@fess.codelibs.local", fessConfig.getLdapSecurityPrincipal("123456789"));
assertEquals("1234567890@fess.codelibs.local", fessConfig.getLdapSecurityPrincipal("1234567890"));
assertEquals("1234567890@fess.codelibs.local", fessConfig.getLdapSecurityPrincipal("12345678901"));
}
Aggregations