Skip to content

Commit 87698cf

Browse files
authored
Rework report generation (#482)
- closes #489 - closes #483
1 parent b40f6d7 commit 87698cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3836
-52
lines changed

applications/spring-shell/src/test/java/org/springframework/sbm/BootUpgrade_27_30_MultiModule_IntegrationTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ private void verifyPropertyConfigurationUpdate() {
153153
"spring.datasource.driverClassName=org.h2.Driver\n" +
154154
"spring.datasource.username=sa\n" +
155155
"spring.datasource.password=password\n" +
156-
"spring.jpa.database-platform=org.hibernate.dialect.H2Dialect\n");
156+
"spring.jpa.database-platform=org.hibernate.dialect.H2Dialect\n" +
157+
"logging.pattern.dateformat=yyyy-MM-dd HH:mm:ss.SSS\n");
157158
}
158159

159160
private void verifyEhCacheVersionIsUpgraded() {

ci/images/ci-image/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ENV JAVA_HOME /opt/openjdk
1515
ENV PATH $PATH:$JAVA_HOME/bin
1616
ENV MAVEN_HOME /usr/share/maven
1717
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
18+
ENV JAVA_TOOL_OPTIONS "-Dfile.encoding=\"UTF-8\""
1819

1920
ADD docker-lib.sh /docker-lib.sh
2021

components/sbm-core/src/main/java/org/springframework/sbm/engine/git/GitSupport.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ public static Optional<Repository> findRepository(File repo) {
5959
Optional<Repository> repository = Optional.empty();
6060
try {
6161
repository = Optional.of(new FileRepositoryBuilder().findGitDir(repo).setMustExist(true).build());
62-
6362
} catch (IllegalArgumentException | IOException e) {
64-
log.error("Could not find .git in the given directory '{}' or any of it's parents", repo, e);
63+
log.debug("Could not find .git in the given directory '{}' or any of it's parents", repo, e);
6564
}
6665
return repository;
6766
}

components/sbm-core/src/main/java/org/springframework/sbm/properties/api/PropertiesSource.java

+15
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@
2828
import org.openrewrite.properties.tree.Properties.Entry;
2929
import org.openrewrite.properties.tree.Properties.File;
3030

31+
import java.io.ByteArrayInputStream;
32+
import java.io.IOException;
33+
import java.nio.charset.StandardCharsets;
3134
import java.nio.file.Path;
3235
import java.util.List;
3336
import java.util.Optional;
3437
import java.util.Set;
38+
import java.util.stream.Collectors;
3539

3640
// TODO: fcoi RewriteSourceFileHolder as member ?!
3741
@Slf4j
@@ -79,6 +83,17 @@ public Optional<String> getProperty(String key) {
7983

8084
}
8185

86+
public java.util.Properties getProperties() {
87+
String collect = getSourceFile().printAll();
88+
try {
89+
java.util.Properties properties = new java.util.Properties(collect.length());
90+
properties.load(new ByteArrayInputStream(collect.getBytes(StandardCharsets.UTF_8)));
91+
return properties;
92+
} catch (IOException e) {
93+
throw new RuntimeException(e);
94+
}
95+
}
96+
8297
private void apply(Recipe r) {
8398
File rewriteResource = getSourceFile();
8499
List<Result> results = r.run(List.of(rewriteResource), executionContext).getResults();

components/sbm-core/src/test/java/org/springframework/sbm/engine/git/GitSupportTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void findRepository_withoutGit_shouldLogErrorAndReturnEmpty(@TempDir Path tmpDir
5353

5454
Optional<Repository> repository = GitSupport.findRepository(tmpDir.toFile());
5555
assertThat(repository).isEmpty();
56-
assertThat(sysOutBuffer.toString()).matches("[\\d\\: \\. ]*\\[main\\] ERROR o\\.s\\.sbm\\.engine\\.git\\.GitSupport - Could not find \\.git in the given directory '"+tmpDir.toString().replace("/", "\\/")+"' or any of it's parents(?s).*");
56+
assertThat(sysOutBuffer.toString()).matches("[\\d\\: \\. ]*\\[main\\] DEBUG o\\.s\\.sbm\\.engine\\.git\\.GitSupport - Could not find \\.git in the given directory '"+tmpDir.toString().replace("/", "\\/")+"' or any of it's parents(?s).*");
5757
System.setOut(realSysOut);
5858
}
5959

0 commit comments

Comments
 (0)