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;
}
Aggregations