Search in sources :

Example 1 with TestRepository

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

the class CVSRepositoryTest method setUpTestRepository.

/**
 * Set up a test repository. Should be called by the tests that need it. The
 * test repository will be destroyed automatically when the test finishes.
 */
private void setUpTestRepository() throws IOException, URISyntaxException {
    repository = new TestRepository();
    repository.create(getClass().getResource("/repositories"));
    // Checkout cvsrepo anew in order to get the CVS/Root files point to
    // the temporary directory rather than the OpenGrok workspace directory
    // it was created from. This is necessary since 'cvs update' changes
    // the CVS parent directory after branch has been created.
    File root = new File(repository.getSourceRoot(), "cvs_test");
    File cvsrepodir = new File(root, "cvsrepo");
    IOUtils.removeRecursive(cvsrepodir.toPath());
    File cvsroot = new File(root, "cvsroot");
    runCvsCommand(root, "-d", cvsroot.getAbsolutePath(), "checkout", "cvsrepo");
}
Also used : TestRepository(org.opengrok.indexer.util.TestRepository) File(java.io.File)

Example 2 with TestRepository

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

the class ProjectsControllerTest 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);
    env.setHandleHistoryOfRenamedFiles(true);
    RepositoryFactory.initializeIgnoredNames(env);
}
Also used : TestRepository(org.opengrok.indexer.util.TestRepository) HistoryGuru(org.opengrok.indexer.history.HistoryGuru) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with TestRepository

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

the class SearchControllerTest 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(SearchControllerTest.class.getClassLoader().getResource("sources"));
    env.setHistoryEnabled(false);
    env.setProjectsEnabled(true);
    env.setDefaultProjectsFromNames(Collections.singleton("__all__"));
    env.getSuggesterConfig().setRebuildCronConfig(null);
}
Also used : TestRepository(org.opengrok.indexer.util.TestRepository) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 4 with TestRepository

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

the class IndexerTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    repository = new TestRepository();
    repository.create(IndexerTest.class.getClassLoader().getResource("sources"));
}
Also used : TestRepository(org.opengrok.indexer.util.TestRepository) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with TestRepository

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

the class IndexerRepoTest 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