@Test public void testAsRepositoryResponses() { List<RepositoryInfo> repos = Lists.newArrayList(repoInfo("HDP", "HDP-2.3", "redhat6"), repoInfo("HDP-UTILS", "HDP-UTILS-1.1.0.20", "redhat6"), repoInfo("HDP", "HDP-2.3", "redhat5"), repoInfo("HDP-UTILS", "HDP-UTILS-1.1.0.20", "redhat5")); List<RepositoryResponse> responses = RepoUtil.asResponses(repos, "HDP-2.3", "HDP", "2.3"); Assert.assertEquals("Wrong number of responses", repos.size(), responses.size()); for (RepositoryResponse response: responses) { Assert.assertEquals("Unexpected version definition id", "HDP-2.3", response.getVersionDefinitionId()); Assert.assertEquals("Unexpected stack name", "HDP", response.getStackName()); Assert.assertEquals("Unexpected stack version", "2.3", response.getStackVersion()); } }
public static List<RepositoryResponse> asResponses(List<RepositoryInfo> repositoryInfos, @Nullable String versionDefinitionId, @Nullable String stackName, @Nullable String stackVersion) { List<RepositoryResponse> responses = new ArrayList<>(repositoryInfos.size()); for (RepositoryInfo repoInfo: repositoryInfos) { RepositoryResponse response = repoInfo.convertToResponse(); response.setVersionDefinitionId(versionDefinitionId); response.setStackName(stackName); response.setStackVersion(stackVersion); responses.add(response); } return responses; }
RepoUtil { public static List<RepositoryResponse> asResponses(List<RepositoryInfo> repositoryInfos, @Nullable String versionDefinitionId, @Nullable String stackName, @Nullable String stackVersion) { List<RepositoryResponse> responses = new ArrayList<>(repositoryInfos.size()); for (RepositoryInfo repoInfo: repositoryInfos) { RepositoryResponse response = repoInfo.convertToResponse(); response.setVersionDefinitionId(versionDefinitionId); response.setStackName(stackName); response.setStackVersion(stackVersion); responses.add(response); } return responses; } }
RepoUtil { public static List<RepositoryResponse> asResponses(List<RepositoryInfo> repositoryInfos, @Nullable String versionDefinitionId, @Nullable String stackName, @Nullable String stackVersion) { List<RepositoryResponse> responses = new ArrayList<>(repositoryInfos.size()); for (RepositoryInfo repoInfo: repositoryInfos) { RepositoryResponse response = repoInfo.convertToResponse(); response.setVersionDefinitionId(versionDefinitionId); response.setStackName(stackName); response.setStackVersion(stackVersion); responses.add(response); } return responses; }  }
RepoUtil { public static List<RepositoryResponse> asResponses(List<RepositoryInfo> repositoryInfos, @Nullable String versionDefinitionId, @Nullable String stackName, @Nullable String stackVersion) { List<RepositoryResponse> responses = new ArrayList<>(repositoryInfos.size()); for (RepositoryInfo repoInfo: repositoryInfos) { RepositoryResponse response = repoInfo.convertToResponse(); response.setVersionDefinitionId(versionDefinitionId); response.setStackName(stackName); response.setStackVersion(stackVersion); responses.add(response); } return responses; }  static RepositoryFolderAndXml parseRepoFile(File directory,
                                                 Collection<String> subDirs,
                                                 ModuleFileUnmarshaller unmarshaller); static void addServiceReposToOperatingSystemEntities(List<OperatingSystemEntity> operatingSystems,
      ListMultimap<String, RepositoryInfo> stackReposByOs); static List<RepositoryInfo> getServiceRepos(List<RepositoryInfo> vdfRepos,
                                                   ListMultimap<String, RepositoryInfo> stackReposByOs); static List<RepositoryResponse> asResponses(List<RepositoryInfo> repositoryInfos,
                                                     @Nullable String versionDefinitionId,
                                                     @Nullable String stackName,
                                                     @Nullable String stackVersion); }
RepoUtil { public static List<RepositoryResponse> asResponses(List<RepositoryInfo> repositoryInfos, @Nullable String versionDefinitionId, @Nullable String stackName, @Nullable String stackVersion) { List<RepositoryResponse> responses = new ArrayList<>(repositoryInfos.size()); for (RepositoryInfo repoInfo: repositoryInfos) { RepositoryResponse response = repoInfo.convertToResponse(); response.setVersionDefinitionId(versionDefinitionId); response.setStackName(stackName); response.setStackVersion(stackVersion); responses.add(response); } return responses; }  static RepositoryFolderAndXml parseRepoFile(File directory,
                                                 Collection<String> subDirs,
                                                 ModuleFileUnmarshaller unmarshaller); static void addServiceReposToOperatingSystemEntities(List<OperatingSystemEntity> operatingSystems,
      ListMultimap<String, RepositoryInfo> stackReposByOs); static List<RepositoryInfo> getServiceRepos(List<RepositoryInfo> vdfRepos,
                                                   ListMultimap<String, RepositoryInfo> stackReposByOs); static List<RepositoryResponse> asResponses(List<RepositoryInfo> repositoryInfos,
                                                     @Nullable String versionDefinitionId,
                                                     @Nullable String stackName,
                                                     @Nullable String stackVersion);  }