Search in sources :

Example 6 with DynamicProperties

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"));
}
Also used : DynamicProperties(org.codelibs.core.misc.DynamicProperties) File(java.io.File)

Aggregations

DynamicProperties (org.codelibs.core.misc.DynamicProperties)6 File (java.io.File)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 SimpleDateFormat (java.text.SimpleDateFormat)1 LocalDateTime (java.time.LocalDateTime)1 Date (java.util.Date)1 ContainerNotAvailableException (org.codelibs.fess.exception.ContainerNotAvailableException)1 CrawlingInfoHelper (org.codelibs.fess.helper.CrawlingInfoHelper)1 CmdLineException (org.kohsuke.args4j.CmdLineException)1