diff --git a/docs/src/main/java/org/springframework/cloud/internal/ConfigurationPropertiesAggregator.java b/docs/src/main/java/org/springframework/cloud/internal/ConfigurationPropertiesAggregator.java index 8a2ff145..d51db77b 100644 --- a/docs/src/main/java/org/springframework/cloud/internal/ConfigurationPropertiesAggregator.java +++ b/docs/src/main/java/org/springframework/cloud/internal/ConfigurationPropertiesAggregator.java @@ -34,21 +34,23 @@ List mergedConfigurationProperties(Path unpackedDocs) { try { return Files.walk(unpackedDocs).filter(path -> path.endsWith("_configprops.adoc")).flatMap(path -> { try { - return Files.readAllLines(path).stream() - .filter(s -> !StringUtils.isEmpty(s) && !wordsToIgnore.contains(s)).map(s -> { - // |foo|bar|baz -> foo|bar|baz -> split -> - // foo,bar,baz - String[] strings = s.substring(1).split("\\|"); - if (strings.length == 3) { - return new ConfigurationProperty(strings[0].trim(), - strings[1].trim().replace("`", ""), strings[2].trim()); - } - else if (strings.length == 2) { - return new ConfigurationProperty(strings[0].trim(), - strings[1].trim().replace("`", ""), ""); - } - return new ConfigurationProperty(strings[0].trim(), "", ""); - }); + return Files.readAllLines(path) + .stream() + .filter(s -> !StringUtils.isEmpty(s) && !wordsToIgnore.contains(s)) + .map(s -> { + // |foo|bar|baz -> foo|bar|baz -> split -> + // foo,bar,baz + String[] strings = s.substring(1).split("\\|"); + if (strings.length == 3) { + return new ConfigurationProperty(strings[0].trim(), strings[1].trim().replace("`", ""), + strings[2].trim()); + } + else if (strings.length == 2) { + return new ConfigurationProperty(strings[0].trim(), strings[1].trim().replace("`", ""), + ""); + } + return new ConfigurationProperty(strings[0].trim(), "", ""); + }); } catch (IOException e) { throw new IllegalStateException(e); diff --git a/docs/src/main/java/org/springframework/cloud/internal/GenerateReleaseTrainDocs.java b/docs/src/main/java/org/springframework/cloud/internal/GenerateReleaseTrainDocs.java index bfb7d470..612f2b31 100644 --- a/docs/src/main/java/org/springframework/cloud/internal/GenerateReleaseTrainDocs.java +++ b/docs/src/main/java/org/springframework/cloud/internal/GenerateReleaseTrainDocs.java @@ -48,9 +48,11 @@ void generate(File bomPath, File starterParentPath, File generatedTrainDocs) { List mavenPropertiesToDocsProjects(File file) { Model model = PomReader.readPom(file); Properties properties = model.getProperties(); - return properties.entrySet().stream().filter(e -> e.getKey().toString().endsWith(".version")) - .map(e -> new Project(e.getKey().toString().replace(".version", ""), e.getValue().toString())) - .collect(Collectors.toCollection(LinkedList::new)); + return properties.entrySet() + .stream() + .filter(e -> e.getKey().toString().endsWith(".version")) + .map(e -> new Project(e.getKey().toString().replace(".version", ""), e.getValue().toString())) + .collect(Collectors.toCollection(LinkedList::new)); } Project springBootVersion(File file) { diff --git a/docs/src/main/java/org/springframework/cloud/internal/TemplateGenerator.java b/docs/src/main/java/org/springframework/cloud/internal/TemplateGenerator.java index 05135684..27f3668d 100644 --- a/docs/src/main/java/org/springframework/cloud/internal/TemplateGenerator.java +++ b/docs/src/main/java/org/springframework/cloud/internal/TemplateGenerator.java @@ -55,8 +55,12 @@ File generate(List projects) { Template template = template(templateFile.getName().replace(".hbs", "")); Map map = new HashMap<>(); map.put("projects", projects); - map.put("springBootVersion", projects.stream().filter(project -> project.name.equals("spring-boot")) - .findFirst().orElse(new Project("spring-boot", "")).getVersion()); + map.put("springBootVersion", + projects.stream() + .filter(project -> project.name.equals("spring-boot")) + .findFirst() + .orElse(new Project("spring-boot", "")) + .getVersion()); map.put("springCloudProjects", templateProjects); String applied = template.apply(map); Files.write(outputFile.toPath(), applied.getBytes()); diff --git a/docs/src/test/java/org/springframework/cloud/internal/GenerateReleaseTrainDocsTests.java b/docs/src/test/java/org/springframework/cloud/internal/GenerateReleaseTrainDocsTests.java index 555e5d03..ce230ee7 100644 --- a/docs/src/test/java/org/springframework/cloud/internal/GenerateReleaseTrainDocsTests.java +++ b/docs/src/test/java/org/springframework/cloud/internal/GenerateReleaseTrainDocsTests.java @@ -34,12 +34,13 @@ void should_return_a_list_of_docs_modules_to_download() throws URISyntaxExceptio List projects = new GenerateReleaseTrainDocs().mavenPropertiesToDocsProjects(testPom); - BDDAssertions.then(projects).extracting("name").containsOnly("spring-cloud-foo-bus", "spring-cloud-foo-build", - "spring-cloud-foo-commons", "spring-cloud-foo-circuitbreaker", "spring-cloud-foo-config", - "spring-cloud-foo-consul", "spring-cloud-foo-contract", "spring-cloud-foo-function", - "spring-cloud-foo-gateway", "spring-cloud-foo-kubernetes", "spring-cloud-foo-netflix", - "spring-cloud-foo-openfeign", "spring-cloud-foo-task", "spring-cloud-foo-vault", - "spring-cloud-foo-zookeeper"); + BDDAssertions.then(projects) + .extracting("name") + .containsOnly("spring-cloud-foo-bus", "spring-cloud-foo-build", "spring-cloud-foo-commons", + "spring-cloud-foo-circuitbreaker", "spring-cloud-foo-config", "spring-cloud-foo-consul", + "spring-cloud-foo-contract", "spring-cloud-foo-function", "spring-cloud-foo-gateway", + "spring-cloud-foo-kubernetes", "spring-cloud-foo-netflix", "spring-cloud-foo-openfeign", + "spring-cloud-foo-task", "spring-cloud-foo-vault", "spring-cloud-foo-zookeeper"); BDDAssertions.then(projects).contains(new Project("spring-cloud-foo-bus", "2.2.3.RELEASE")); }