Exemple #1
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);
  }
 /**
  * Create a new PollSerializer. The parameter pollDir is optional. If it is specified, it must be
  * a poll serialization directory that already exists. If it is null, a new poll serialization
  * directory will be created.
  *
  * @param dir Optionally, a pre-existing serialization directory to use.
  * @throws PollSerializerException
  */
 public V3Serializer(LockssDaemon daemon, File dir) throws PollSerializerException {
   if (dir == null) {
     throw new NullPointerException("Poll serialization directory must not " + "be null");
   }
   this.daemon = daemon;
   this.pollDir = dir;
   if (!pollDir.exists()) {
     throw new IllegalArgumentException(
         "Poll directories passed as " + "arguments must already exist");
   }
 }
 /** Clean up all resources used by this poll. Removes the poll directory. */
 public void closePoll() {
   if (pollDir != null && pollDir.isDirectory() && !FileUtil.delTree(pollDir))
     log.warning("Unable to delete poll state directory: " + pollDir);
 }