Search in sources :

Example 16 with TestRepository

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

the class FileControllerTest method setUp.

@BeforeEach
@Override
public void setUp() throws Exception {
    super.setUp();
    repository = new TestRepository();
    repository.create(HistoryGuru.class.getResource("/repositories"));
    env.setSourceRoot(repository.getSourceRoot());
    env.setDataRoot(repository.getDataRoot());
    env.setProjectsEnabled(true);
    env.setHistoryEnabled(true);
    RepositoryFactory.initializeIgnoredNames(env);
    Indexer.getInstance().prepareIndexer(env, // search for repositories
    true, // scan and add projects
    true, // don't create dictionary
    false, // subFiles - needed when refreshing history partially
    null, // repositories - needed when refreshing history partially
    null);
    Indexer.getInstance().doIndexerExecution(true, Collections.singletonList("/git"), null);
}
Also used : TestRepository(org.opengrok.indexer.util.TestRepository) HistoryGuru(org.opengrok.indexer.history.HistoryGuru) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 17 with TestRepository

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

the class HistoryControllerTest method setUp.

@BeforeEach
@Override
public void setUp() throws Exception {
    super.setUp();
    repository = new TestRepository();
    repository.create(HistoryGuru.class.getResource("/repositories"));
    env.setSourceRoot(repository.getSourceRoot());
    env.setDataRoot(repository.getDataRoot());
    env.setProjectsEnabled(true);
    env.setHistoryEnabled(true);
    RepositoryFactory.initializeIgnoredNames(env);
    Indexer.getInstance().prepareIndexer(env, // search for repositories
    true, // scan and add projects
    true, // don't create dictionary
    false, // subFiles - needed when refreshing history partially
    null, // repositories - needed when refreshing history partially
    null);
}
Also used : TestRepository(org.opengrok.indexer.util.TestRepository) HistoryGuru(org.opengrok.indexer.history.HistoryGuru) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 18 with TestRepository

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

the class SuggesterControllerTest method setUpClass.

@BeforeAll
public static void setUpClass() throws Exception {
    // necessary to test CORS from controllers
    System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
    repository = new TestRepository();
    repository.create(SuggesterControllerTest.class.getClassLoader().getResource("sources"));
    env.setHistoryEnabled(false);
    env.setProjectsEnabled(true);
    Indexer.getInstance().prepareIndexer(env, true, true, false, null, null);
    env.setDefaultProjectsFromNames(Collections.singleton("__all__"));
    Indexer.getInstance().doIndexerExecution(true, null, null);
    env.getSuggesterConfig().setRebuildCronConfig(null);
}
Also used : TestRepository(org.opengrok.indexer.util.TestRepository) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 19 with TestRepository

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

the class IndexDatabaseSymlinksTest method setUpClass.

@BeforeAll
public static void setUpClass() throws Exception {
    env = RuntimeEnvironment.getInstance();
    repository = new TestRepository();
    repository.createExternal(IndexDatabaseSymlinksTest.class.getResourceAsStream("/index/links_tests.zip"));
    // Create and verify symlink from source/ to external/links_tests/links
    Path symlink = Paths.get(repository.getSourceRoot(), "links");
    Path target = Paths.get(repository.getExternalRoot(), "links_tests", "links");
    assertTrue(target.toFile().exists(), target + "should exist");
    Files.createSymbolicLink(symlink, target);
    assertTrue(symlink.toFile().exists(), symlink + " should exist");
    env.setSourceRoot(repository.getSourceRoot());
    env.setDataRoot(repository.getDataRoot());
    env.setHistoryEnabled(true);
    env.setProjectsEnabled(true);
    RepositoryFactory.initializeIgnoredNames(env);
}
Also used : Path(java.nio.file.Path) TestRepository(org.opengrok.indexer.util.TestRepository) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 20 with TestRepository

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

the class IndexerMainTest method setUp.

@BeforeEach
public void setUp() throws IOException, URISyntaxException {
    repository = new TestRepository();
    // For these tests we need Mercurial repository with renamed files.
    repository.create(HistoryGuru.class.getResource("/repositories"));
}
Also used : TestRepository(org.opengrok.indexer.util.TestRepository) HistoryGuru(org.opengrok.indexer.history.HistoryGuru) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

TestRepository (org.opengrok.indexer.util.TestRepository)45 BeforeAll (org.junit.jupiter.api.BeforeAll)26 BeforeEach (org.junit.jupiter.api.BeforeEach)16 HistoryGuru (org.opengrok.indexer.history.HistoryGuru)15 File (java.io.File)14 RuntimeEnvironment (org.opengrok.indexer.configuration.RuntimeEnvironment)10 Ctags (org.opengrok.indexer.analysis.Ctags)6 EnabledForRepository (org.opengrok.indexer.condition.EnabledForRepository)3 Project (org.opengrok.indexer.configuration.Project)3 BufferedWriter (java.io.BufferedWriter)2 FileWriter (java.io.FileWriter)2 IOException (java.io.IOException)2 Path (java.nio.file.Path)2 Test (org.junit.jupiter.api.Test)2 CharArrayWriter (java.io.CharArrayWriter)1 FileReader (java.io.FileReader)1 StringWriter (java.io.StringWriter)1 URL (java.net.URL)1 Files (java.nio.file.Files)1 Paths (java.nio.file.Paths)1