private static ProjectRepositories processStream(InputStream is) throws IOException { WsProjectResponse response = WsProjectResponse.parseFrom(is); if (response.getFileDataByModuleAndPathCount() == 0) { return new SingleProjectRepository(constructFileDataMap(response.getFileDataByPathMap()), new Date(response.getLastAnalysisDate())); } else { final Map<String, SingleProjectRepository> repositoriesPerModule = new HashMap<>(); response.getFileDataByModuleAndPathMap().keySet().forEach(moduleKey -> { WsProjectResponse.FileDataByPath filePaths = response.getFileDataByModuleAndPathMap().get(moduleKey); repositoriesPerModule.put(moduleKey, new SingleProjectRepository( constructFileDataMap(filePaths.getFileDataByPathMap()), new Date(response.getLastAnalysisDate()))); }); return new MultiModuleProjectRepository(repositoriesPerModule, new Date(response.getLastAnalysisDate())); } }
@Before public void setUp() { Date lastAnalysisDate = new Date(); SingleProjectRepository repository1 = new SingleProjectRepository(Maps.newHashMap("/Abc.java", new FileData("123", "456")), lastAnalysisDate); SingleProjectRepository repository2 = new SingleProjectRepository(Maps.newHashMap("/Def.java", new FileData("567", "321")), lastAnalysisDate); Map<String, SingleProjectRepository> moduleRepositories = Maps.newHashMap("module1", repository1); moduleRepositories.put("module2", repository2); repository = new MultiModuleProjectRepository(moduleRepositories, lastAnalysisDate); }
private static ProjectRepositories processStream(InputStream is) throws IOException { WsProjectResponse response = WsProjectResponse.parseFrom(is); if (response.getFileDataByModuleAndPathCount() == 0) { return new SingleProjectRepository(constructFileDataMap(response.getFileDataByPathMap()), new Date(response.getLastAnalysisDate())); } else { final Map<String, SingleProjectRepository> repositoriesPerModule = new HashMap<>(); response.getFileDataByModuleAndPathMap().keySet().forEach(moduleKey -> { WsProjectResponse.FileDataByPath filePaths = response.getFileDataByModuleAndPathMap().get(moduleKey); repositoriesPerModule.put(moduleKey, new SingleProjectRepository( constructFileDataMap(filePaths.getFileDataByPathMap()), new Date(response.getLastAnalysisDate()))); }); return new MultiModuleProjectRepository(repositoriesPerModule, new Date(response.getLastAnalysisDate())); } }