@Test public void getProjectsOfUnknownUser() throws IOException { Set<String> projects = controller.getProjectsOfUser("nonexisting@example.com"); assertEquals("Empty project list for unknown user", 0, projects.size()); }
protected Set<String> getProjectsOfUser(String mail) throws IOException { if (isAdmin()) { GitlabUser user = getUserByMail(mail); if (user == null) { LOGGER.warn("Couldn't find user with mail \"{}\". returning empty list of projects.", mail); return new TreeSet<>(); } List<GitlabProject> gitProjects = getProjectsVisibleForUser(user); Set<String> projectNames = new HashSet<String>(); for (GitlabProject p : gitProjects) { projectNames.add(p.getNameWithNamespace()); } return projectNames; } else { return (projectUris != null) ? projectUris : new TreeSet<>(); } }
GitlabControllerImpl implements GitlabController { protected Set<String> getProjectsOfUser(String mail) throws IOException { if (isAdmin()) { GitlabUser user = getUserByMail(mail); if (user == null) { LOGGER.warn("Couldn't find user with mail \"{}\". returning empty list of projects.", mail); return new TreeSet<>(); } List<GitlabProject> gitProjects = getProjectsVisibleForUser(user); Set<String> projectNames = new HashSet<String>(); for (GitlabProject p : gitProjects) { projectNames.add(p.getNameWithNamespace()); } return projectNames; } else { return (projectUris != null) ? projectUris : new TreeSet<>(); } } }
GitlabControllerImpl implements GitlabController { protected Set<String> getProjectsOfUser(String mail) throws IOException { if (isAdmin()) { GitlabUser user = getUserByMail(mail); if (user == null) { LOGGER.warn("Couldn't find user with mail \"{}\". returning empty list of projects.", mail); return new TreeSet<>(); } List<GitlabProject> gitProjects = getProjectsVisibleForUser(user); Set<String> projectNames = new HashSet<String>(); for (GitlabProject p : gitProjects) { projectNames.add(p.getNameWithNamespace()); } return projectNames; } else { return (projectUris != null) ? projectUris : new TreeSet<>(); } } GitlabControllerImpl();  GitlabControllerImpl(boolean startFetchingProjects, boolean useCache);  GitlabControllerImpl(String token, boolean startFetchingProjects, boolean useCache); }
GitlabControllerImpl implements GitlabController { protected Set<String> getProjectsOfUser(String mail) throws IOException { if (isAdmin()) { GitlabUser user = getUserByMail(mail); if (user == null) { LOGGER.warn("Couldn't find user with mail \"{}\". returning empty list of projects.", mail); return new TreeSet<>(); } List<GitlabProject> gitProjects = getProjectsVisibleForUser(user); Set<String> projectNames = new HashSet<String>(); for (GitlabProject p : gitProjects) { projectNames.add(p.getNameWithNamespace()); } return projectNames; } else { return (projectUris != null) ? projectUris : new TreeSet<>(); } } GitlabControllerImpl();  GitlabControllerImpl(boolean startFetchingProjects, boolean useCache);  GitlabControllerImpl(String token, boolean startFetchingProjects, boolean useCache); void runAfterFirstFetch(Runnable r); void startFetchingProjects(); @Override void stopFetchingProjects(); @Override List<Project> getAllProjects(); @Override Project gitlabToProject(GitlabProject project); static void main(String[] args); @Override Model getCheckedModel(byte modelData[], String modelType, String projectName); List<Project> getProjectsVisibleForUser(String mail); }
GitlabControllerImpl implements GitlabController { protected Set<String> getProjectsOfUser(String mail) throws IOException { if (isAdmin()) { GitlabUser user = getUserByMail(mail); if (user == null) { LOGGER.warn("Couldn't find user with mail \"{}\". returning empty list of projects.", mail); return new TreeSet<>(); } List<GitlabProject> gitProjects = getProjectsVisibleForUser(user); Set<String> projectNames = new HashSet<String>(); for (GitlabProject p : gitProjects) { projectNames.add(p.getNameWithNamespace()); } return projectNames; } else { return (projectUris != null) ? projectUris : new TreeSet<>(); } } GitlabControllerImpl();  GitlabControllerImpl(boolean startFetchingProjects, boolean useCache);  GitlabControllerImpl(String token, boolean startFetchingProjects, boolean useCache); void runAfterFirstFetch(Runnable r); void startFetchingProjects(); @Override void stopFetchingProjects(); @Override List<Project> getAllProjects(); @Override Project gitlabToProject(GitlabProject project); static void main(String[] args); @Override Model getCheckedModel(byte modelData[], String modelType, String projectName); List<Project> getProjectsVisibleForUser(String mail); static final String GITLAB_URL_KEY; static final String GITLAB_TOKEN_KEY; }