public void setUp() throws Exception {
    super.setUp();
    tempDirPath = getTempDir().getAbsolutePath() + File.separator;

    theDaemon = getMockLockssDaemon();
    theDaemon.getAlertManager();
    theDaemon.getPluginManager().setLoadablePluginsReady(true);
    theDaemon.getHashService();
    MockSystemMetrics metrics = new MyMockSystemMetrics();
    metrics.initService(theDaemon);
    theDaemon.setSystemMetrics(metrics);

    theDaemon.setDaemonInited(true);

    Properties props = new Properties();
    props.setProperty(SystemMetrics.PARAM_HASH_TEST_DURATION, "1000");
    props.setProperty(SystemMetrics.PARAM_HASH_TEST_BYTE_STEP, "1024");
    props.setProperty(ConfigManager.PARAM_PLATFORM_DISK_SPACE_LIST, tempDirPath);
    ConfigurationUtil.setCurrentConfigFromProps(props);

    pluginMgr = theDaemon.getPluginManager();
    pluginMgr.startService();
    theDaemon.getHashService().startService();
    metrics.startService();
    metrics.setHashSpeed(100);

    simPlugin = PluginTestUtil.findPlugin(SimulatedPlugin.class);
  }
Esempio n. 2
0
  public void setUp() throws Exception {
    super.setUp();
    theDaemon = getMockLockssDaemon();
    tempDir = getTempDir();
    String tempDirPath = tempDir.getAbsolutePath();
    System.setProperty("java.io.tmpdir", tempDirPath);

    Properties p = new Properties();
    p.setProperty(IdentityManager.PARAM_IDDB_DIR, tempDirPath + "iddb");
    p.setProperty(ConfigManager.PARAM_PLATFORM_DISK_SPACE_LIST, tempDirPath);
    p.setProperty(IdentityManager.PARAM_LOCAL_IP, "127.0.0.1");
    p.setProperty(V3LcapMessage.PARAM_REPAIR_DATA_THRESHOLD, "4096");
    ConfigurationUtil.setCurrentConfigFromProps(p);
    IdentityManager idmgr = theDaemon.getIdentityManager();
    idmgr.startService();
    mPollMgr = new MockPollManager();
    theDaemon.setPollManager(mPollMgr);
    try {
      m_testID = idmgr.stringToPeerIdentity("127.0.0.1");
    } catch (IOException ex) {
      fail("can't open test host 127.0.0.1: " + ex);
    }
    m_repairProps = new CIProperties();
    m_repairProps.setProperty("key1", "val1");
    m_repairProps.setProperty("key2", "val2");
    m_repairProps.setProperty("key3", "val3");

    m_testVoteBlocks = V3TestUtils.makeVoteBlockList(10);
    m_testMsg = this.makeTestVoteMessage(m_testVoteBlocks);
  }
Esempio n. 3
0
 private void setEnabled(boolean enabled, int port) {
   ConfigurationUtil.addFromArgs(
       IcpManager.PARAM_ICP_ENABLED,
       Boolean.toString(enabled),
       IcpManager.PARAM_ICP_PORT,
       Integer.toString(enabled ? port : BAD_PORT));
 }
 protected ArchivalUnit createAu() throws ArchivalUnit.ConfigurationException {
   return PluginTestUtil.createAndStartAu(
       PLUGIN_NAME,
       ConfigurationUtil.fromArgs(
           "base_url",
           "http://pediatrics.aappublications.org/",
           "volume_name",
           "52",
           "journal_issn",
           "1098-4275"));
 }
 protected ArchivalUnit createTarAu() throws ArchivalUnit.ConfigurationException {
   // in this directory this is file "test_elsevierdtd5.tdb" but it becomes xml
   try {
     ConfigurationUtil.addFromUrl(getResource("test_elsevierdtd5.xml"));
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   Tdb tdb = ConfigManager.getCurrentConfig().getTdb();
   TdbAu tdbau1 = tdb.getTdbAusLikeName("Elsevier Source Content 2014").get(0);
   assertNotNull("Didn't find named TdbAu", tdbau1);
   return PluginTestUtil.createAndStartAu(tdbau1);
 }
  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());
  }
Esempio n. 7
0
 /* Inherit documentation */
 public void setUp() throws Exception {
   super.setUp();
   ConfigurationUtil.addFromArgs(
       "org.lockss.log.IcpManager.level",
       "debug3",
       "org.lockss.log.IcpSocketImpl.level",
       "debug3");
   setEnabled(false, BAD_PORT);
   setConfigCalled = false;
   mockLockssDaemon = getMockLockssDaemon();
   testableIcpManager = new TestableIcpManager();
   mockLockssDaemon.setIcpManager(testableIcpManager);
   testableIcpManager.initService(mockLockssDaemon);
   mockLockssDaemon.setDaemonInited(true);
   testableIcpManager.startService();
 }
  public void setUp() throws Exception {
    super.setUp();
    setUpDiskSpace(); // you need this to have startService work properly...

    theDaemon = getMockLockssDaemon();
    theDaemon.getAlertManager();
    theDaemon.getPluginManager().setLoadablePluginsReady(true);
    theDaemon.setDaemonInited(true);
    theDaemon.getPluginManager().startService();
    theDaemon.getCrawlManager();

    // in this directory this is file "test_baseatypon.tdb" but it becomes xml
    ConfigurationUtil.addFromUrl(getResource("test_baseatypon.xml"));
    Tdb tdb = ConfigManager.getCurrentConfig().getTdb();

    TdbAu tdbau1 = tdb.getTdbAusLikeName(goodJournal + " Volume " + goodVolume).get(0);
    assertNotNull("Didn't find named TdbAu", tdbau1);
    bau1 = PluginTestUtil.createAndStartAu(tdbau1);
    assertNotNull(bau1);
    TypedEntryMap auConfig = bau1.getProperties();
    assertEquals(BASE_URL, auConfig.getString(BASE_URL_KEY));
  }