@Test public void gitlabToProject() { Project project = controller.gitlabToProject(gitlabProject); assertNotNull("Project shouldn't be null", project); assertEquals("Project name", "gitadmin / testing-benchmark", project.getName()); }
@Override public Project gitlabToProject(GitlabProject project) { GitlabBranch b; try { b = api.getBranch(project, project.getDefaultBranch()); } catch (Exception e) { return null; } Model systemModel = null; try { byte[] systemCfgBytes = api.getRawFileContent(project, b.getCommit().getId(), SYSTEM_CONFIG_FILENAME); systemModel = getCheckedModel(systemCfgBytes, "system", project.getWebUrl()); } catch (Exception e) { LOGGER.debug("system.ttl configuration file NOT FOUND in {}", project.getWebUrl()); } Model benchmarkModel = null; try { byte[] benchmarkCfgBytes = api.getRawFileContent(project, b.getCommit().getId(), BENCHMARK_CONFIG_FILENAME); benchmarkModel = getCheckedModel(benchmarkCfgBytes, "benchmark", project.getWebUrl()); } catch (Exception e) { LOGGER.debug("benchmark.ttl configuration file NOT FOUND in {}", project.getWebUrl()); } if ((benchmarkModel != null) || (systemModel != null)) { String user = null; GitlabUser owner = project.getOwner(); if (owner != null) { user = owner.getEmail(); } else { String warning = "The project " + project.getNameWithNamespace() + " has no owner."; handleErrorMsg(warning, null, false); } Project p = new Project(benchmarkModel, systemModel, user, project.getNameWithNamespace(), project.getCreatedAt(), project.getVisibility() == GITLAB_VISIBILITY_PRIVATE); return p; } else { return null; } }
GitlabControllerImpl implements GitlabController { @Override public Project gitlabToProject(GitlabProject project) { GitlabBranch b; try { b = api.getBranch(project, project.getDefaultBranch()); } catch (Exception e) { return null; } Model systemModel = null; try { byte[] systemCfgBytes = api.getRawFileContent(project, b.getCommit().getId(), SYSTEM_CONFIG_FILENAME); systemModel = getCheckedModel(systemCfgBytes, "system", project.getWebUrl()); } catch (Exception e) { LOGGER.debug("system.ttl configuration file NOT FOUND in {}", project.getWebUrl()); } Model benchmarkModel = null; try { byte[] benchmarkCfgBytes = api.getRawFileContent(project, b.getCommit().getId(), BENCHMARK_CONFIG_FILENAME); benchmarkModel = getCheckedModel(benchmarkCfgBytes, "benchmark", project.getWebUrl()); } catch (Exception e) { LOGGER.debug("benchmark.ttl configuration file NOT FOUND in {}", project.getWebUrl()); } if ((benchmarkModel != null) || (systemModel != null)) { String user = null; GitlabUser owner = project.getOwner(); if (owner != null) { user = owner.getEmail(); } else { String warning = "The project " + project.getNameWithNamespace() + " has no owner."; handleErrorMsg(warning, null, false); } Project p = new Project(benchmarkModel, systemModel, user, project.getNameWithNamespace(), project.getCreatedAt(), project.getVisibility() == GITLAB_VISIBILITY_PRIVATE); return p; } else { return null; } } }
GitlabControllerImpl implements GitlabController { @Override public Project gitlabToProject(GitlabProject project) { GitlabBranch b; try { b = api.getBranch(project, project.getDefaultBranch()); } catch (Exception e) { return null; } Model systemModel = null; try { byte[] systemCfgBytes = api.getRawFileContent(project, b.getCommit().getId(), SYSTEM_CONFIG_FILENAME); systemModel = getCheckedModel(systemCfgBytes, "system", project.getWebUrl()); } catch (Exception e) { LOGGER.debug("system.ttl configuration file NOT FOUND in {}", project.getWebUrl()); } Model benchmarkModel = null; try { byte[] benchmarkCfgBytes = api.getRawFileContent(project, b.getCommit().getId(), BENCHMARK_CONFIG_FILENAME); benchmarkModel = getCheckedModel(benchmarkCfgBytes, "benchmark", project.getWebUrl()); } catch (Exception e) { LOGGER.debug("benchmark.ttl configuration file NOT FOUND in {}", project.getWebUrl()); } if ((benchmarkModel != null) || (systemModel != null)) { String user = null; GitlabUser owner = project.getOwner(); if (owner != null) { user = owner.getEmail(); } else { String warning = "The project " + project.getNameWithNamespace() + " has no owner."; handleErrorMsg(warning, null, false); } Project p = new Project(benchmarkModel, systemModel, user, project.getNameWithNamespace(), project.getCreatedAt(), project.getVisibility() == GITLAB_VISIBILITY_PRIVATE); return p; } else { return null; } } GitlabControllerImpl();  GitlabControllerImpl(boolean startFetchingProjects, boolean useCache);  GitlabControllerImpl(String token, boolean startFetchingProjects, boolean useCache); }
GitlabControllerImpl implements GitlabController { @Override public Project gitlabToProject(GitlabProject project) { GitlabBranch b; try { b = api.getBranch(project, project.getDefaultBranch()); } catch (Exception e) { return null; } Model systemModel = null; try { byte[] systemCfgBytes = api.getRawFileContent(project, b.getCommit().getId(), SYSTEM_CONFIG_FILENAME); systemModel = getCheckedModel(systemCfgBytes, "system", project.getWebUrl()); } catch (Exception e) { LOGGER.debug("system.ttl configuration file NOT FOUND in {}", project.getWebUrl()); } Model benchmarkModel = null; try { byte[] benchmarkCfgBytes = api.getRawFileContent(project, b.getCommit().getId(), BENCHMARK_CONFIG_FILENAME); benchmarkModel = getCheckedModel(benchmarkCfgBytes, "benchmark", project.getWebUrl()); } catch (Exception e) { LOGGER.debug("benchmark.ttl configuration file NOT FOUND in {}", project.getWebUrl()); } if ((benchmarkModel != null) || (systemModel != null)) { String user = null; GitlabUser owner = project.getOwner(); if (owner != null) { user = owner.getEmail(); } else { String warning = "The project " + project.getNameWithNamespace() + " has no owner."; handleErrorMsg(warning, null, false); } Project p = new Project(benchmarkModel, systemModel, user, project.getNameWithNamespace(), project.getCreatedAt(), project.getVisibility() == GITLAB_VISIBILITY_PRIVATE); return p; } else { return null; } } 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 { @Override public Project gitlabToProject(GitlabProject project) { GitlabBranch b; try { b = api.getBranch(project, project.getDefaultBranch()); } catch (Exception e) { return null; } Model systemModel = null; try { byte[] systemCfgBytes = api.getRawFileContent(project, b.getCommit().getId(), SYSTEM_CONFIG_FILENAME); systemModel = getCheckedModel(systemCfgBytes, "system", project.getWebUrl()); } catch (Exception e) { LOGGER.debug("system.ttl configuration file NOT FOUND in {}", project.getWebUrl()); } Model benchmarkModel = null; try { byte[] benchmarkCfgBytes = api.getRawFileContent(project, b.getCommit().getId(), BENCHMARK_CONFIG_FILENAME); benchmarkModel = getCheckedModel(benchmarkCfgBytes, "benchmark", project.getWebUrl()); } catch (Exception e) { LOGGER.debug("benchmark.ttl configuration file NOT FOUND in {}", project.getWebUrl()); } if ((benchmarkModel != null) || (systemModel != null)) { String user = null; GitlabUser owner = project.getOwner(); if (owner != null) { user = owner.getEmail(); } else { String warning = "The project " + project.getNameWithNamespace() + " has no owner."; handleErrorMsg(warning, null, false); } Project p = new Project(benchmarkModel, systemModel, user, project.getNameWithNamespace(), project.getCreatedAt(), project.getVisibility() == GITLAB_VISIBILITY_PRIVATE); return p; } else { return null; } } 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; }