Search in sources :

Example 6 with TestRepository

use of org.opensolaris.opengrok.util.TestRepository in project OpenGrok by OpenGrok.

the class IndexerRepoTest method setUp.

@Before
public void setUp() throws IOException {
    repository = new TestRepository();
    // For these tests we need Mercurial repository with renamed files.
    repository.create(HistoryGuru.class.getResourceAsStream("repositories.zip"));
}
Also used : TestRepository(org.opensolaris.opengrok.util.TestRepository) HistoryGuru(org.opensolaris.opengrok.history.HistoryGuru) Before(org.junit.Before)

Example 7 with TestRepository

use of org.opensolaris.opengrok.util.TestRepository in project OpenGrok by OpenGrok.

the class HistoryContextTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    repositories = new TestRepository();
    repositories.create(HistoryContextTest.class.getResourceAsStream("/org/opensolaris/opengrok/history/repositories.zip"));
    HistoryGuru.getInstance().addRepositories(repositories.getSourceRoot());
}
Also used : TestRepository(org.opensolaris.opengrok.util.TestRepository) BeforeClass(org.junit.BeforeClass)

Example 8 with TestRepository

use of org.opensolaris.opengrok.util.TestRepository in project OpenGrok by OpenGrok.

the class PageConfigTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    repository = new TestRepository();
    repository.create(HistoryGuru.class.getResourceAsStream("repositories.zip"));
    HistoryGuru.getInstance().addRepositories(repository.getSourceRoot());
}
Also used : TestRepository(org.opensolaris.opengrok.util.TestRepository) HistoryGuru(org.opensolaris.opengrok.history.HistoryGuru) BeforeClass(org.junit.BeforeClass)

Example 9 with TestRepository

use of org.opensolaris.opengrok.util.TestRepository in project OpenGrok by OpenGrok.

the class SearchEngineTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    repository = new TestRepository();
    repository.create(HistoryGuru.class.getResourceAsStream("repositories.zip"));
    RuntimeEnvironment env = RuntimeEnvironment.getInstance();
    env.setCtags(System.getProperty("org.opensolaris.opengrok.analysis.Ctags", "ctags"));
    env.setSourceRoot(repository.getSourceRoot());
    env.setDataRoot(repository.getDataRoot());
    if (env.validateExuberantCtags()) {
        env.setSourceRoot(repository.getSourceRoot());
        env.setDataRoot(repository.getDataRoot());
        env.setVerbose(false);
        Indexer.getInstance().prepareIndexer(env, true, true, "/c", null, false, false, false, null, null, new ArrayList<>(), false);
        Indexer.getInstance().doIndexerExecution(true, 1, null, null);
    } else {
        System.out.println("Skipping test. Could not find a ctags I could use in path.");
        skip = true;
    }
    configFile = File.createTempFile("configuration", ".xml");
    env.writeConfiguration(configFile);
    RuntimeEnvironment.getInstance().readConfiguration(new File(configFile.getAbsolutePath()));
}
Also used : TestRepository(org.opensolaris.opengrok.util.TestRepository) RuntimeEnvironment(org.opensolaris.opengrok.configuration.RuntimeEnvironment) HistoryGuru(org.opensolaris.opengrok.history.HistoryGuru) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 10 with TestRepository

use of org.opensolaris.opengrok.util.TestRepository in project OpenGrok by OpenGrok.

the class SearchTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    repository = new TestRepository();
    repository.create(IndexerTest.class.getResourceAsStream("source.zip"));
    RuntimeEnvironment env = RuntimeEnvironment.getInstance();
    env.setCtags(System.getProperty("org.opensolaris.opengrok.analysis.Ctags", "ctags"));
    env.setSourceRoot(repository.getSourceRoot());
    env.setDataRoot(repository.getDataRoot());
    if (env.validateExuberantCtags()) {
        env.setSourceRoot(repository.getSourceRoot());
        env.setDataRoot(repository.getDataRoot());
        env.setVerbose(false);
        Indexer.getInstance().prepareIndexer(env, true, true, "/c", null, false, false, false, null, null, new ArrayList<>(), false);
        Indexer.getInstance().doIndexerExecution(true, 1, null, null);
    } else {
        System.out.println("Skipping test. Could not find a ctags I could use in path.");
        skip = true;
    }
    configFile = File.createTempFile("configuration", ".xml");
    env.writeConfiguration(configFile);
    RuntimeEnvironment.getInstance().readConfiguration(new File(configFile.getAbsolutePath()));
    PrintStream stream = new PrintStream(new ByteArrayOutputStream());
    System.setErr(stream);
}
Also used : PrintStream(java.io.PrintStream) TestRepository(org.opensolaris.opengrok.util.TestRepository) RuntimeEnvironment(org.opensolaris.opengrok.configuration.RuntimeEnvironment) IndexerTest(org.opensolaris.opengrok.index.IndexerTest) ByteArrayOutputStream(java.io.ByteArrayOutputStream) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Aggregations

TestRepository (org.opensolaris.opengrok.util.TestRepository)22 BeforeClass (org.junit.BeforeClass)17 Ctags (org.opensolaris.opengrok.analysis.Ctags)6 File (java.io.File)4 Before (org.junit.Before)4 RuntimeEnvironment (org.opensolaris.opengrok.configuration.RuntimeEnvironment)3 HistoryGuru (org.opensolaris.opengrok.history.HistoryGuru)3 IndexerTest (org.opensolaris.opengrok.index.IndexerTest)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 CharArrayWriter (java.io.CharArrayWriter)1 PrintStream (java.io.PrintStream)1 ArrayList (java.util.ArrayList)1 CAnalyzerFactoryTest (org.opensolaris.opengrok.analysis.c.CAnalyzerFactoryTest)1