use of org.opensolaris.opengrok.configuration.Project in project OpenGrok by OpenGrok.
the class IndexerTest method testRescanProjects.
/**
* Test that rescanning for projects does not erase customization of
* existing projects. Bug #16006.
* @throws java.lang.Exception*/
@Test
public void testRescanProjects() throws Exception {
// Generate one project that will be found in source.zip, and set
// some properties that we can verify after the rescan.
Project p1 = new Project();
p1.setPath("/java");
p1.setName("Project 1");
p1.setTabSize(3);
// Generate one project that will not be found in source.zip, and that
// should not be in the list of projects after the rescan.
Project p2 = new Project();
p2.setPath("/this_path_does_not_exist");
p2.setName("Project 2");
// Make the runtime environment aware of these two projects.
List<Project> projects = new ArrayList<>();
projects.add(p1);
projects.add(p2);
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
env.setProjects(projects);
// Do a rescan of the projects, and only that (we don't care about
// the other aspects of indexing in this test case).
Indexer.getInstance().prepareIndexer(env, // don't search for repositories
false, // scan and add projects
true, // no default project
null, // don't write config file
null, // don't refresh history
false, // don't list files
false, // don't create dictionary
false, // subFiles - not needed since we don't list files
null, // repositories - not needed when not refreshing history
null, // don't zap cache
new ArrayList<>(), // don't list repos
false);
List<Project> newProjects = env.getProjects();
// p2 should not be in the project list anymore
for (Project p : newProjects) {
assertFalse("p2 not removed", p.getPath().equals(p2.getPath()));
}
// p1 should be there
Project newP1 = null;
for (Project p : newProjects) {
if (p.getPath().equals(p1.getPath())) {
newP1 = p;
break;
}
}
assertNotNull("p1 not in list", newP1);
// The properties of p1 should be preserved
assertEquals("project path", p1.getPath(), newP1.getPath());
assertEquals("project description", p1.getName(), newP1.getName());
assertEquals("project tabsize", p1.getTabSize(), newP1.getTabSize());
}
use of org.opensolaris.opengrok.configuration.Project in project OpenGrok by OpenGrok.
the class ProjectHelperTest method testGetUngroupedRepositories.
/**
* Test of getUngroupedRepositories method, of class ProjectHelper.
*/
@Test
public void testGetUngroupedRepositories() {
Set<Project> result = helper.getUngroupedRepositories();
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 testAllowedGetRepositoryInfo.
/**
* Test of getRepositoryInfo method, of class ProjectHelper.
*/
@Test
public void testAllowedGetRepositoryInfo() {
Project p = new Project();
p.setName("allowed_grouped_repository_0_1");
List<RepositoryInfo> result = helper.getRepositoryInfo(p);
Assert.assertEquals(1, result.size());
Assert.assertEquals("allowed_grouped_repository_0_1_" + 0, result.get(0).getParent());
}
use of org.opensolaris.opengrok.configuration.Project in project OpenGrok by OpenGrok.
the class ProjectHelperTest method testGetGroupedRepositories.
/**
* Test of getGroupedRepositories method, of class ProjectHelper.
*/
@Test
public void testGetGroupedRepositories() {
Set<Project> result = helper.getGroupedRepositories();
Assert.assertEquals(4, 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 testGetAllUngrouped.
/**
* Test of getAllUngrouped method, of class ProjectHelper.
*/
@Test
public void testGetAllUngrouped() {
Set<Project> result = helper.getAllUngrouped();
Assert.assertEquals(4, result.size());
for (Project p : result) {
Assert.assertTrue(p.getName().startsWith("allowed_"));
}
}
Aggregations