Package org.archive.spring

Examples of org.archive.spring.ConfigPath


            public String format(java.util.logging.LogRecord record) {
                return ArchiveUtils.getLog17Date(record.getMillis()) + " " + record.getMessage() + '\n';
            }
        };

        ConfigPath logPath = new ConfigPath(logName + ".log", logName + ".log");
        logPath.setBase(getPath());
        try {
            setupLogFile(logger, logPath.getFile().getAbsolutePath(), f, true);
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
       
        return logger;
View Full Code Here


       
        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());
View Full Code Here

        File tmp = TmpDirTestCase.tmpDir();
        tmp = new File(tmp, "ARCWriterProcessTest");
        FileUtils.ensureWriteableDirectory(tmp);
       
        ARCWriterProcessor result = new ARCWriterProcessor();
        result.setDirectory(new ConfigPath("test",tmp.getAbsolutePath()));
        result.setServerCache(new DefaultServerCache());
        CrawlMetadata metadata = new CrawlMetadata();
        metadata.afterPropertiesSet();
        result.setMetadataProvider(metadata);
        result.start();
View Full Code Here

        File tmp = TmpDirTestCase.tmpDir();
        tmp = new File(tmp, name);
        FileUtils.ensureWriteableDirectory(tmp);

        WARCWriterProcessor result = new WARCWriterProcessor();
        result.setDirectory(new ConfigPath("test",tmp.getAbsolutePath()));
        result.setServerCache(new DefaultServerCache());
        CrawlMetadata metadata = new CrawlMetadata();
        metadata.afterPropertiesSet();
        result.setMetadataProvider(metadata);
        return result;
View Full Code Here

        return historyStore;
    }

    protected BdbModule bdb() throws IOException {
        if (bdb == null) {
            ConfigPath basePath = new ConfigPath("testBase",getTmpDir().getAbsolutePath());
            ConfigPath bdbDir = new ConfigPath("bdb","bdb");
            bdbDir.setBase(basePath);
            FileUtils.deleteDirectory(bdbDir.getFile());

            bdb = new BdbModule();
            bdb.setDir(bdbDir);
            bdb.start();
            logger.info("created " + bdb);
View Full Code Here

        protected File tmpdir = Files.createTempDir();

        protected BdbModule bdb() throws IOException {
            if (bdb == null) {
                ConfigPath basePath = new ConfigPath("testBase",
                        tmpdir.getAbsolutePath());
                ConfigPath bdbDir = new ConfigPath("bdb", "bdb");
                bdbDir.setBase(basePath);
                FileUtils.deleteDirectory(bdbDir.getFile());

                bdb = new BdbModule();
                bdb.setDir(bdbDir);
                bdb.start();
            }
View Full Code Here

        }

        protected AbstractCookieStore bdbCookieStore() throws IOException {
            if (bdbCookieStore == null) {
                bdbCookieStore = new BdbCookieStore();
                ConfigPath basePath = new ConfigPath("testBase",
                        tmpdir.getAbsolutePath());
                ConfigFile cookiesSaveFile = new ConfigFile("cookiesSaveFile", "cookies.txt");
                cookiesSaveFile.setBase(basePath);
                bdbCookieStore.setCookiesSaveFile(cookiesSaveFile);
                bdbCookieStore.setBdbModule(bdb());
View Full Code Here

*/
public class BdbModuleTest extends TmpDirTestCase {

    @SuppressWarnings("unchecked")
    public void testDoCheckpoint() throws Exception {
        ConfigPath basePath = new ConfigPath("testBase",getTmpDir().getAbsolutePath());
        ConfigPath bdbDir = new ConfigPath("bdb","bdb");
        bdbDir.setBase(basePath);
        FileUtils.deleteDirectory(bdbDir.getFile());

        BdbModule bdb = new BdbModule();
        bdb.setDir(bdbDir);
        bdb.start();

        // avoid data from prior runs being mistaken for current run
        int randomFactor = RandomUtils.nextInt();
       
        ObjectIdentityBdbManualCache<IdentityCacheableWrapper> testData =
            bdb.getOIBCCache("testData", false,IdentityCacheableWrapper.class);
        for (int i1 = 0; i1 < 1000; i1++) {
            String key = String.valueOf(i1);
            final String value = String.valueOf(randomFactor*i1);
            String cached = (String)testData.getOrUse(
                    key,
                    new Supplier<IdentityCacheableWrapper>(
                            new IdentityCacheableWrapper(key, value))).get();
            assertSame("unexpected prior entry",value,cached)
        }
       
        Checkpoint checkpointInProgress = new Checkpoint();
        ConfigPath checkpointsPath = new ConfigPath("checkpoints","checkpoints");
        checkpointsPath.setBase(basePath);
        checkpointInProgress.generateFrom(checkpointsPath,998);

        bdb.doCheckpoint(checkpointInProgress);
        String firstCheckpointName = checkpointInProgress.getName();
       
        for (int i2 = 1000; i2 < 2000; i2++) {
            String key = String.valueOf(i2);
            final String value = String.valueOf(randomFactor*i2);
            String cached = (String)testData.getOrUse(
                    key,
                    new Supplier<IdentityCacheableWrapper>(
                            new IdentityCacheableWrapper(key, value))).get();
            assertSame("unexpected prior entry",value,cached)
        }

        checkpointInProgress = new Checkpoint();
        checkpointInProgress.generateFrom(checkpointsPath,999);

        bdb.doCheckpoint(checkpointInProgress);
       
        bdb.stop();
        bdb.destroy();
       
        BdbModule bdb2 = new BdbModule();
        bdb2.setDir(bdbDir);
       
        Checkpoint recoveryCheckpoint = new Checkpoint();
        ConfigPath recoverPath = new ConfigPath("recover",firstCheckpointName);
        recoverPath.setBase(basePath);
        recoveryCheckpoint.setCheckpointDir(recoverPath);
        recoveryCheckpoint.afterPropertiesSet();
       
        bdb2.setRecoveryCheckpoint(recoveryCheckpoint);
       
View Full Code Here

    protected BdbCookieStore bdbCookieStore;
    protected BasicCookieStore basicCookieStore;

    protected BdbModule bdb() throws IOException {
        if (bdb == null) {
            ConfigPath basePath = new ConfigPath("testBase",
                    getTmpDir().getAbsolutePath());
            ConfigPath bdbDir = new ConfigPath("bdb", "bdb");
            bdbDir.setBase(basePath);
            FileUtils.deleteDirectory(bdbDir.getFile());

            bdb = new BdbModule();
            bdb.setDir(bdbDir);
            bdb.start();
            logger.info("created " + bdb);
View Full Code Here

    }

    protected AbstractCookieStore bdbCookieStore() throws IOException {
        if (bdbCookieStore == null) {
            bdbCookieStore = new BdbCookieStore();
            ConfigPath basePath = new ConfigPath("testBase",
                    getTmpDir().getAbsolutePath());
            ConfigFile cookiesSaveFile = new ConfigFile("cookiesSaveFile", "cookies.txt");
            cookiesSaveFile.setBase(basePath);
            bdbCookieStore.setCookiesSaveFile(cookiesSaveFile);
            bdbCookieStore.setBdbModule(bdb());
View Full Code Here

TOP

Related Classes of org.archive.spring.ConfigPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.