Skip to content

Rework report generation #482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ private void verifyPropertyConfigurationUpdate() {
"spring.datasource.driverClassName=org.h2.Driver\n" +
"spring.datasource.username=sa\n" +
"spring.datasource.password=password\n" +
"spring.jpa.database-platform=org.hibernate.dialect.H2Dialect\n");
"spring.jpa.database-platform=org.hibernate.dialect.H2Dialect\n" +
"logging.pattern.dateformat=yyyy-MM-dd HH:mm:ss.SSS\n");
}

private void verifyEhCacheVersionIsUpgraded() {
Expand Down
1 change: 1 addition & 0 deletions ci/images/ci-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ENV JAVA_HOME /opt/openjdk
ENV PATH $PATH:$JAVA_HOME/bin
ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
ENV JAVA_TOOL_OPTIONS "-Dfile.encoding=\"UTF-8\""

ADD docker-lib.sh /docker-lib.sh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ public static Optional<Repository> findRepository(File repo) {
Optional<Repository> repository = Optional.empty();
try {
repository = Optional.of(new FileRepositoryBuilder().findGitDir(repo).setMustExist(true).build());

} catch (IllegalArgumentException | IOException e) {
log.error("Could not find .git in the given directory '{}' or any of it's parents", repo, e);
log.debug("Could not find .git in the given directory '{}' or any of it's parents", repo, e);
}
return repository;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@
import org.openrewrite.properties.tree.Properties.Entry;
import org.openrewrite.properties.tree.Properties.File;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

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

}

public java.util.Properties getProperties() {
String collect = getSourceFile().printAll();
try {
java.util.Properties properties = new java.util.Properties(collect.length());
properties.load(new ByteArrayInputStream(collect.getBytes(StandardCharsets.UTF_8)));
return properties;
} catch (IOException e) {
throw new RuntimeException(e);
}
}

private void apply(Recipe r) {
File rewriteResource = getSourceFile();
List<Result> results = r.run(List.of(rewriteResource), executionContext).getResults();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void findRepository_withoutGit_shouldLogErrorAndReturnEmpty(@TempDir Path tmpDir

Optional<Repository> repository = GitSupport.findRepository(tmpDir.toFile());
assertThat(repository).isEmpty();
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).*");
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).*");
System.setOut(realSysOut);
}

Expand Down
Loading