use of org.opengrok.indexer.util.TestRepository in project OpenGrok by OpenGrok.
the class IndexCheckTest method setUp.
@BeforeEach
public void setUp() throws IOException, URISyntaxException {
repository = new TestRepository();
repository.create(IndexerTest.class.getResource("/repositories"));
oldIndexDataDir = null;
configuration = new Configuration();
configuration.setDataRoot(env.getDataRootPath());
configuration.setSourceRoot(env.getSourceRootPath());
}
use of org.opengrok.indexer.util.TestRepository in project OpenGrok by OpenGrok.
the class SearchAndContextFormatterTest method setUpClass.
@BeforeAll
public static void setUpClass() throws Exception {
repository = new TestRepository();
repository.create(HistoryGuru.class.getResource("/repositories"));
env = RuntimeEnvironment.getInstance();
env.setCtags(System.getProperty("org.opengrok.indexer.analysis.Ctags", "ctags"));
env.setSourceRoot(repository.getSourceRoot());
env.setDataRoot(repository.getDataRoot());
RepositoryFactory.initializeIgnoredNames(env);
env.setSourceRoot(repository.getSourceRoot());
env.setDataRoot(repository.getDataRoot());
env.setHistoryEnabled(false);
Indexer.getInstance().prepareIndexer(env, true, true, false, null, null);
env.setDefaultProjectsFromNames(new TreeSet<>(Collections.singletonList("/c")));
Indexer.getInstance().doIndexerExecution(true, null, null);
configFile = File.createTempFile("configuration", ".xml");
env.writeConfiguration(configFile);
RuntimeEnvironment.getInstance().readConfiguration(new File(configFile.getAbsolutePath()));
}
use of org.opengrok.indexer.util.TestRepository in project OpenGrok by OpenGrok.
the class SearchAndContextFormatterTest2 method setUpClass.
@BeforeAll
public static void setUpClass() throws Exception {
env = RuntimeEnvironment.getInstance();
originalProjectsEnabled = env.isProjectsEnabled();
env.setProjectsEnabled(true);
File sourceRoot = createTemporaryDirectory("srcroot");
assertTrue(sourceRoot.isDirectory(), "sourceRoot.isDirectory()");
File dataroot = createTemporaryDirectory("dataroot");
assertTrue(dataroot.isDirectory(), "dataroot.isDirectory()");
repository1 = new TestRepository();
repository1.create(HistoryGuru.class.getResource("/repositories"));
repository2 = new TestRepository();
repository2.create(HistoryGuru.class.getResource("/repositories"));
// Create symlink #1 underneath source root.
final String SYMLINK1 = "symlink1";
File symlink1 = new File(sourceRoot.getCanonicalFile(), SYMLINK1);
Files.createSymbolicLink(Paths.get(symlink1.getPath()), Paths.get(repository1.getSourceRoot()));
assertTrue(symlink1.exists(), "symlink1.exists()");
// Create symlink #2 underneath source root.
final String SYMLINK2 = "symlink2";
File symlink2 = new File(sourceRoot.getCanonicalFile(), SYMLINK2);
Files.createSymbolicLink(Paths.get(symlink2.getPath()), Paths.get(repository2.getSourceRoot()));
assertTrue(symlink2.exists(), "symlink2.exists()");
Set<String> allowedSymlinks = new HashSet<>();
allowedSymlinks.add(symlink1.getAbsolutePath());
allowedSymlinks.add(symlink2.getAbsolutePath());
env.setAllowedSymlinks(allowedSymlinks);
env.setCtags(System.getProperty("org.opengrok.indexer.analysis.Ctags", "ctags"));
env.setSourceRoot(sourceRoot.getPath());
env.setDataRoot(dataroot.getPath());
RepositoryFactory.initializeIgnoredNames(env);
env.setHistoryEnabled(false);
Indexer.getInstance().prepareIndexer(env, true, true, false, null, null);
env.setDefaultProjectsFromNames(new TreeSet<>(Collections.singletonList("/c")));
Project proj1 = env.getProjects().get(SYMLINK1);
assertNotNull(proj1, "symlink1 project");
proj1.setTabSize(TABSIZE);
Indexer.getInstance().doIndexerExecution(true, null, null);
configFile = File.createTempFile("configuration", ".xml");
env.writeConfiguration(configFile);
RuntimeEnvironment.getInstance().readConfiguration(new File(configFile.getAbsolutePath()));
}
use of org.opengrok.indexer.util.TestRepository in project OpenGrok by OpenGrok.
the class IndexDatabaseTest method setUpClass.
@BeforeAll
public static void setUpClass() throws Exception {
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
repository = new TestRepository();
repository.create(HistoryGuru.class.getResource("/repositories"));
env.setSourceRoot(repository.getSourceRoot());
env.setDataRoot(repository.getDataRoot());
env.setHistoryEnabled(true);
env.setProjectsEnabled(true);
RepositoryFactory.initializeIgnoredNames(env);
// Note that all tests in this class share the index created below.
// Ergo, if they need to modify it, this has to be done in such a way
// so that it does not affect other tests, no matter in which order
// the tests are run.
Indexer indexer = Indexer.getInstance();
indexer.prepareIndexer(env, true, true, false, null, null);
env.setDefaultProjectsFromNames(new TreeSet<>(Arrays.asList("/c")));
indexer.doIndexerExecution(true, null, null);
}
use of org.opengrok.indexer.util.TestRepository in project OpenGrok by OpenGrok.
the class CAnalyzerFactoryTest method setUpClass.
@BeforeAll
public static void setUpClass() throws Exception {
ctags = new Ctags();
repository = new TestRepository();
repository.create(CAnalyzerFactoryTest.class.getClassLoader().getResource("sources"));
CAnalyzerFactory analFact = new CAnalyzerFactory();
analyzer = analFact.getAnalyzer();
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
if (env.validateUniversalCtags()) {
analyzer.setCtags(new Ctags());
}
}
Aggregations