use of org.opensolaris.opengrok.configuration.Project in project OpenGrok by OpenGrok.
the class ProjectHelperExtendedTest method createProject.
protected static Project createProject(String name) {
Project p = new Project();
p.setName(name);
return p;
}
use of org.opensolaris.opengrok.configuration.Project in project OpenGrok by OpenGrok.
the class ProjectHelperTest method testGetRepositories.
/**
* Test of getRepositories method, of class ProjectHelper.
*/
@Test
public void testGetRepositories() {
Set<Project> result = helper.getRepositories();
Assert.assertEquals(2, result.size());
for (Project p : result) {
Assert.assertTrue(p.getName().startsWith("allowed_"));
}
}
use of org.opensolaris.opengrok.configuration.Project in project OpenGrok by OpenGrok.
the class ProjectHelperTest method testGetRepositoriesAllowedGroup.
/**
* Test of getRepositories method, of class ProjectHelper.
*/
@Test
public void testGetRepositoriesAllowedGroup() {
for (Group g : RuntimeEnvironment.getInstance().getGroups()) {
if (g.getName().startsWith("allowed_group_0")) {
Set<Project> result = helper.getRepositories(g);
Assert.assertEquals(2, result.size());
for (Project p : result) {
Assert.assertTrue(p.getName().startsWith("allowed_"));
}
}
}
}
use of org.opensolaris.opengrok.configuration.Project in project OpenGrok by OpenGrok.
the class IndexerTest method testBug11896.
@Test
public void testBug11896() throws Exception {
boolean test = true;
if (FileUtilities.findProgInPath("mkfifo") == null) {
System.out.println("Error: mkfifo not found in PATH !\n");
test = false;
}
if (test) {
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
env.setSourceRoot(repository.getSourceRoot());
env.setDataRoot(repository.getDataRoot());
Executor executor;
executor = new Executor(new String[] { "mkdir", "-p", repository.getSourceRoot() + "/testBug11896" });
executor.exec(true);
executor = new Executor(new String[] { "mkfifo", repository.getSourceRoot() + "/testBug11896/FIFO" });
executor.exec(true);
if (env.validateExuberantCtags()) {
Project project = new Project();
project.setPath("/testBug11896");
IndexDatabase idb = new IndexDatabase(project);
assertNotNull(idb);
MyIndexChangeListener listener = new MyIndexChangeListener();
idb.addIndexChangedListener(listener);
System.out.println("Trying to index a special file - FIFO in this case.");
idb.update();
assertEquals(0, listener.files.size());
} else {
System.out.println("Skipping test. Could not find a ctags I could use in path.");
}
} else {
System.out.println("Skipping test for bug 11896. Could not find a mkfifo in path.");
}
}
use of org.opensolaris.opengrok.configuration.Project in project OpenGrok by OpenGrok.
the class IndexerTest method testRFE2575.
@Test
public void testRFE2575() throws Exception {
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
env.setCtags(System.getProperty(ctagsProperty, "ctags"));
env.setSourceRoot(repository.getSourceRoot());
env.setDataRoot(repository.getDataRoot());
HistoryGuru.getInstance().addRepositories(repository.getSourceRoot());
List<RepositoryInfo> repos = env.getRepositories();
Repository r = null;
for (RepositoryInfo ri : repos) {
if (ri.getDirectoryName().equals(repository.getSourceRoot() + "/rfe2575")) {
r = RepositoryFactory.getRepository(ri);
break;
}
}
if (r != null && r.isWorking() && env.validateExuberantCtags()) {
Project project = new Project();
project.setPath("/rfe2575");
IndexDatabase idb = new IndexDatabase(project);
assertNotNull(idb);
MyIndexChangeListener listener = new MyIndexChangeListener();
idb.addIndexChangedListener(listener);
idb.update();
assertEquals(2, listener.files.size());
repository.purgeData();
RuntimeEnvironment.getInstance().setIndexVersionedFilesOnly(true);
idb = new IndexDatabase(project);
listener = new MyIndexChangeListener();
idb.addIndexChangedListener(listener);
idb.update();
assertEquals(1, listener.files.size());
RuntimeEnvironment.getInstance().setIndexVersionedFilesOnly(false);
} else {
System.out.println("Skipping test. Repository for rfe2575 not found or could not find a ctags or an sccs I could use in path.");
}
}
Aggregations