use of org.opengrok.indexer.configuration.Project in project OpenGrok by OpenGrok.
the class ProjectHelperTestBase method setUp.
@BeforeEach
public void setUp() {
assertEquals(4, env.getGroups().size(), "Should contain 4 groups");
assertEquals(40, env.getProjects().size(), "Should contain 40 project");
assertEquals(20, env.getRepositories().size(), "Should contain 20 repositories");
assertNotNull(env.getProjectRepositoriesMap(), "Repository map should not be null");
assertEquals(20, env.getProjectRepositoriesMap().size(), "Repository map should contain 20 project");
env.setAuthorizationFramework(new AuthorizationFramework());
env.getAuthorizationFramework().reload();
IAuthorizationPlugin plugin = new TestPlugin() {
@Override
public boolean isAllowed(HttpServletRequest request, Project project) {
return project.getName().startsWith("allowed");
}
@Override
public boolean isAllowed(HttpServletRequest request, Group group) {
return group.getName().startsWith("allowed");
}
};
invokeAddPlugin(plugin);
cfg = PageConfig.get(getRequest());
helper = cfg.getProjectHelper();
}
use of org.opengrok.indexer.configuration.Project in project OpenGrok by OpenGrok.
the class ProjectHelperTestBase method createRepository.
protected static Project createRepository(int index, int number, int cnt, boolean grouped, boolean allowed, List<RepositoryInfo> rps, Map<String, Project> prjs, Map<Project, List<RepositoryInfo>> map) {
Project p = createProject(index, number, grouped, allowed, true, rps, prjs, map);
for (int i = 0; i < cnt; i++) {
RepositoryInfo info = new RepoRepository();
info.setParent(p.getName() + "_" + i);
info.setDirectoryNameRelative(p.getPath());
rps.add(info);
List<RepositoryInfo> infos = map.get(p);
if (infos == null) {
infos = new ArrayList<>();
}
infos.add(info);
map.put(p, infos);
}
return p;
}
use of org.opengrok.indexer.configuration.Project in project OpenGrok by OpenGrok.
the class PageConfigRequestedProjectsTest method setUp.
@BeforeEach
public void setUp() {
oldProjects = env.getProjects();
oldGroups = env.getGroups();
oldPluginStack = env.getPluginStack();
Set<Group> groups = new TreeSet<>();
Map<String, Project> projects = new TreeMap<>();
for (int i = 0; i < 10; i++) {
Project project = new Project();
project.setName("project-" + i);
project.setPath("/project-" + i);
project.setIndexed(true);
projects.put("project-" + i, project);
}
Group group;
group = new Group();
group.setName("group-1-2-3");
group.setPattern("project-(1|2|3)");
groups.add(group);
group = new Group();
group.setName("group-7-8-9");
group.setPattern("project-(7|8|9)");
groups.add(group);
env.setGroups(groups);
env.setProjects(projects);
env.setProjectsEnabled(true);
env.setPluginStack(null);
env.applyConfig(false, CommandTimeoutType.INDEXER);
}
Aggregations