Search in sources :

Example 1 with BdbServerCache

use of org.archive.modules.net.BdbServerCache in project heritrix3 by internetarchive.

the class CrawlControllerTest method makeTempCrawlController.

// TODO TESTME
public static CrawlController makeTempCrawlController() throws Exception {
    String tmpPath = System.getProperty(TEST_TMP_SYSTEM_PROPERTY_NAME);
    if (tmpPath == null) {
        tmpPath = DEFAULT_TEST_TMP_DIR;
    }
    File tmp = new File(tmpPath);
    FileUtils.ensureWriteableDirectory(tmp);
    FileWriter fileWriter = null;
    try {
        fileWriter = new FileWriter(new File(tmp, "seeds.txt"));
        fileWriter.write("http://www.pandemoniummovie.com");
        fileWriter.close();
    } finally {
        ArchiveUtils.closeQuietly(fileWriter);
    }
    File state = new File(tmp, "state");
    FileUtils.ensureWriteableDirectory(state);
    File checkpoints = new File(tmp, "checkpoints");
    FileUtils.ensureWriteableDirectory(checkpoints);
    BdbModule bdb = new BdbModule();
    bdb.setDir(new ConfigPath("test", state.getAbsolutePath()));
    // def.set(bdb, BdbModule.DIR, state.getAbsolutePath());
    bdb.start();
    CrawlController controller = new CrawlController();
    controller.setServerCache(new BdbServerCache());
    controller.start();
    return controller;
}
Also used : BdbModule(org.archive.bdb.BdbModule) BdbServerCache(org.archive.modules.net.BdbServerCache) FileWriter(java.io.FileWriter) ConfigPath(org.archive.spring.ConfigPath) File(java.io.File)

Aggregations

File (java.io.File)1 FileWriter (java.io.FileWriter)1 BdbModule (org.archive.bdb.BdbModule)1 BdbServerCache (org.archive.modules.net.BdbServerCache)1 ConfigPath (org.archive.spring.ConfigPath)1