Search in sources :

Example 11 with TestRepository

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

the class CSharpAnalyzerFactoryTest method setUpClass.

@BeforeAll
public static void setUpClass() throws Exception {
    ctags = new Ctags();
    repository = new TestRepository();
    repository.create(CSharpAnalyzerFactoryTest.class.getClassLoader().getResource("sources"));
    CSharpAnalyzerFactory analFact = new CSharpAnalyzerFactory();
    analyzer = analFact.getAnalyzer();
    RuntimeEnvironment env = RuntimeEnvironment.getInstance();
    if (env.validateUniversalCtags()) {
        analyzer.setCtags(new Ctags());
    }
}
Also used : TestRepository(org.opengrok.indexer.util.TestRepository) RuntimeEnvironment(org.opengrok.indexer.configuration.RuntimeEnvironment) Ctags(org.opengrok.indexer.analysis.Ctags) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 12 with TestRepository

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

the class CtagsTest method setUpClass.

@BeforeAll
public static void setUpClass() throws Exception {
    ctags = new Ctags();
    repository = new TestRepository();
    repository.create(CtagsTest.class.getClassLoader().getResource("sources"));
    /*
         * This setting is only needed for bug19195 but it does not seem
         * that it is possible to specify it just for single test case.
         * The config file contains assembly specific settings so it should
         * not be harmful to other test cases.
         */
    String extraOptionsFile = repository.getSourceRoot() + "/bug19195/ctags.config";
    ctags.setCTagsExtraOptionsFile(extraOptionsFile);
}
Also used : TestRepository(org.opengrok.indexer.util.TestRepository) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 13 with TestRepository

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

the class JarAnalyzerTest method setUpClass.

@BeforeAll
public static void setUpClass() throws Exception {
    env = RuntimeEnvironment.getInstance();
    originalProjectsEnabled = env.isProjectsEnabled();
    env.setProjectsEnabled(false);
    repository = new TestRepository();
    repository.createEmpty();
    repository.addAdhocFile(TESTPLUGINS_JAR, AuthorizationFrameworkReloadTest.class.getResourceAsStream("/authorization/plugins/" + TESTPLUGINS_JAR), null);
    env.setSourceRoot(repository.getSourceRoot());
    env.setDataRoot(repository.getDataRoot());
    RepositoryFactory.initializeIgnoredNames(env);
    env.setHistoryEnabled(false);
    IndexChangedListener progress = new DefaultIndexChangedListener();
    Indexer.getInstance().prepareIndexer(env, true, true, false, null, null);
    env.setDefaultProjectsFromNames(new TreeSet<>(Collections.singletonList("/c")));
    Indexer.getInstance().doIndexerExecution(true, null, progress);
    configFile = File.createTempFile("configuration", ".xml");
    env.writeConfiguration(configFile);
    env.readConfiguration(new File(configFile.getAbsolutePath()));
}
Also used : TestRepository(org.opengrok.indexer.util.TestRepository) IndexChangedListener(org.opengrok.indexer.index.IndexChangedListener) DefaultIndexChangedListener(org.opengrok.indexer.index.DefaultIndexChangedListener) DefaultIndexChangedListener(org.opengrok.indexer.index.DefaultIndexChangedListener) AuthorizationFrameworkReloadTest(org.opengrok.indexer.authorization.AuthorizationFrameworkReloadTest) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 14 with TestRepository

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

the class PascalAnalyzerFactoryTest method setUpClass.

@BeforeAll
public static void setUpClass() throws Exception {
    ctags = new Ctags();
    repository = new TestRepository();
    repository.create(PascalAnalyzerFactoryTest.class.getClassLoader().getResource("sources"));
    PascalAnalyzerFactory analyzerFactory = new PascalAnalyzerFactory();
    analyzer = analyzerFactory.getAnalyzer();
    RuntimeEnvironment env = RuntimeEnvironment.getInstance();
    if (env.validateUniversalCtags()) {
        analyzer.setCtags(new Ctags());
    }
}
Also used : TestRepository(org.opengrok.indexer.util.TestRepository) RuntimeEnvironment(org.opengrok.indexer.configuration.RuntimeEnvironment) Ctags(org.opengrok.indexer.analysis.Ctags) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 15 with TestRepository

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

the class DiffTest method setUp.

@BeforeAll
static void setUp() throws Exception {
    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) BeforeAll(org.junit.jupiter.api.BeforeAll)

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