Search in sources :

Example 1 with LocalDBLoggerSettings

use of password.pwm.util.logging.LocalDBLoggerSettings in project pwm by pwm-project.

the class LocalDBLoggerTest method setUp.

@Override
protected void setUp() throws Exception {
    // To change body of overridden methods use File | Settings | File Templates.
    super.setUp();
    TestHelper.setupLogging();
    final File localDBPath = new File(TestHelper.getParameter("localDBPath"));
    final File configFile = new File(TestHelper.getParameter("configurationFile"));
    final ConfigurationReader reader = new ConfigurationReader(configFile);
    config = reader.getConfiguration();
    localDB = LocalDBFactory.getInstance(localDBPath, false, null, config);
    // localDB.truncate(LocalDB.DB.EVENTLOG_EVENTS);
    // System.out.println(localDB.size(LocalDB.DB.EVENTLOG_EVENTS));
    // new TimeDuration(1,TimeUnit.HOURS).pause();
    {
        // open localDBLogger based on configuration settings;
        final int maxEvents = (int) reader.getConfiguration().readSettingAsLong(PwmSetting.EVENTS_PWMDB_MAX_EVENTS);
        final long maxAgeMs = reader.getConfiguration().readSettingAsLong(PwmSetting.EVENTS_PWMDB_MAX_AGE) * (long) 1000;
        final LocalDBLoggerSettings settings = new LocalDBLoggerSettings.Builder().setMaxEvents(maxEvents).setMaxAge(new TimeDuration(maxAgeMs)).setFlags(Collections.<LocalDBLoggerSettings.Flag>emptySet()).createLocalDBLoggerSettings();
        localDBLogger = new LocalDBLogger(null, localDB, settings);
    }
    settings = new Settings();
    settings.threads = 10;
    settings.testDuration = new TimeDuration(3, TimeUnit.HOURS);
    settings.valueLength = 5000;
    settings.batchSize = 100;
}
Also used : LocalDBLogger(password.pwm.util.logging.LocalDBLogger) LocalDBLoggerSettings(password.pwm.util.logging.LocalDBLoggerSettings) TimeDuration(password.pwm.util.java.TimeDuration) File(java.io.File) ConfigurationReader(password.pwm.config.stored.ConfigurationReader) LocalDBLoggerSettings(password.pwm.util.logging.LocalDBLoggerSettings)

Aggregations

File (java.io.File)1 ConfigurationReader (password.pwm.config.stored.ConfigurationReader)1 TimeDuration (password.pwm.util.java.TimeDuration)1 LocalDBLogger (password.pwm.util.logging.LocalDBLogger)1 LocalDBLoggerSettings (password.pwm.util.logging.LocalDBLoggerSettings)1