public void testGetRepositoryList() throws Exception { assertEmpty(mgr.getRepositoryList()); String tempDirPath = setUpDiskSpace(); assertEquals(ListUtil.list("local:" + tempDirPath), mgr.getRepositoryList()); String tempdir2 = getTempDir().getAbsolutePath() + File.separator; ConfigurationUtil.setFromArgs( "org.lockss.platform.diskSpacePaths", tempdir2 + ";" + tempDirPath); assertEquals( ListUtil.list("local:" + tempdir2, "local:" + tempDirPath), mgr.getRepositoryList()); }
public void testConfig() throws Exception { MyMockLockssRepositoryImpl repo1 = makeRepo("foo"); assertEquals(RepositoryManager.DEFAULT_MAX_PER_AU_CACHE_SIZE, repo1.nodeCacheSize); ConfigurationUtil.setFromArgs(RepositoryManager.PARAM_MAX_PER_AU_CACHE_SIZE, "4"); MyMockLockssRepositoryImpl repo2 = makeRepo("bar"); assertEquals(4, repo1.nodeCacheSize); assertEquals(4, repo2.nodeCacheSize); repo1.cnt = 0; ConfigurationUtil.setFromArgs(RepositoryManager.PARAM_MAX_PER_AU_CACHE_SIZE, "37"); assertEquals(37, repo1.nodeCacheSize); assertEquals(37, repo2.nodeCacheSize); assertEquals(1, repo1.cnt); // ensure setNodeCacheSize doesn't get called if param doesn't change ConfigurationUtil.setFromArgs( RepositoryManager.PARAM_MAX_PER_AU_CACHE_SIZE, "37", "org.lockss.somethingElse", "bar"); assertEquals(1, repo1.cnt); PlatformUtil.DF warn = mgr.getDiskWarnThreshold(); PlatformUtil.DF full = mgr.getDiskFullThreshold(); assertEquals(5000 * 1024, warn.getAvail()); assertEquals(0.98, warn.getPercent(), .00001); assertEquals(100 * 1024, full.getAvail()); assertEquals(0.99, full.getPercent(), .00001); Properties p = new Properties(); p.put(RepositoryManager.PARAM_DISK_WARN_FRRE_MB, "17"); p.put(RepositoryManager.PARAM_DISK_WARN_FRRE_PERCENT, "20"); p.put(RepositoryManager.PARAM_DISK_FULL_FRRE_MB, "7"); p.put(RepositoryManager.PARAM_DISK_FULL_FRRE_PERCENT, "10"); ConfigurationUtil.setCurrentConfigFromProps(p); warn = mgr.getDiskWarnThreshold(); full = mgr.getDiskFullThreshold(); assertEquals(17 * 1024, warn.getAvail()); assertEquals(0.80, warn.getPercent(), .00001); assertEquals(7 * 1024, full.getAvail()); assertEquals(0.90, full.getPercent(), .00001); }
public void setUp() throws Exception { super.setUp(); String tempDirPath = getTempDir().getAbsolutePath() + File.separator; ConfigurationUtil.setFromArgs(LockssRepositoryImpl.PARAM_CACHE_LOCATION, tempDirPath); theDaemon = getMockLockssDaemon(); theDaemon.getAlertManager(); theDaemon.getPluginManager().setLoadablePluginsReady(true); theDaemon.setDaemonInited(true); theDaemon.getPluginManager().startService(); theDaemon.getCrawlManager(); sau = PluginTestUtil.createAndStartSimAu(simAuConfig(tempDirPath)); nau = PluginTestUtil.createAndStartAu(PLUGIN_NAME, natureAuConfig()); }