コード例 #1
0
ファイル: TestV3LcapMessage.java プロジェクト: ravn/lockss
  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);
  }
コード例 #2
0
 static void saveAuIdProperties(String location, Properties props) {
   // XXX these AU_ID_FILE entries need to be backed up elsewhere to avoid
   // single-point corruption
   File propDir = new File(location);
   if (!propDir.exists()) {
     logger.debug("Creating directory '" + propDir.getAbsolutePath() + "'");
     propDir.mkdirs();
   }
   File propFile = new File(propDir, AU_ID_FILE);
   try {
     logger.debug3("Saving au id properties at '" + location + "'.");
     OutputStream os = new BufferedOutputStream(new FileOutputStream(propFile));
     props.store(os, "ArchivalUnit id info");
     os.close();
     propFile.setReadOnly();
   } catch (IOException ioe) {
     logger.error("Couldn't write properties for " + propFile.getPath() + ".", ioe);
     throw new LockssRepository.RepositoryStateException("Couldn't write au id properties file.");
   }
 }