private static DescriptionRepositoryData readDataFromFile(final String fileName) throws IOException { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), ENCODING)); final ConcurrentMap<String, String> descriptionMap = new ConcurrentHashMap<String, String>(); while (true) { final String currentLine = reader.readLine(); if (currentLine == null) { break; } final String[] parts = DescriptionRepository.splitLine(currentLine); if (parts == null) { continue; } final String key = parts[0]; final String description = parts[1]; descriptionMap.put(key, description); } return new DescriptionRepositoryData(descriptionMap); } finally { if (reader != null) { reader.close(); } } }
private static DescriptionRepository prepareDescriptionRepository(final AnalysisController analysisController) { final ConcurrentMap<String, String> descriptions = new ConcurrentHashMap<String, String>(); descriptions.put(EXPECTED_ALLOCATION_COMPONENT_NAME_1, DESCRIPTION_1); descriptions.put(EXPECTED_ALLOCATION_COMPONENT_NAME_2, DESCRIPTION_2); final DescriptionRepositoryData repositoryData = new DescriptionRepositoryData(descriptions); return new DescriptionRepository(new Configuration(), repositoryData, analysisController); }