Skip to content

Commit

Permalink
HBX-2889: Write project path using Properties to fix functional tests…
Browse files Browse the repository at this point in the history
… on Windows
  • Loading branch information
Sineaggi committed Aug 5, 2024
1 parent 9687f50 commit cf6c588
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.util.Properties;

import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.GradleRunner;
Expand Down Expand Up @@ -37,7 +40,16 @@ protected File getHibernatePropertiesFile() {
}

protected String getHibernatePropertiesContents() {
return HIBERNATE_PROPERTIES_CONTENTS.replace("${projectDir}", projectDir.getAbsolutePath());
try {
Properties properties = new Properties();
properties.load(new StringReader(HIBERNATE_PROPERTIES_CONTENTS));
properties.setProperty("hibernate.connection.url", "jdbc:h2:" + new File(projectDir, DATABASE_PATH));
StringWriter writer = new StringWriter();
properties.store(writer, null);
return writer.toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
}

protected void copyDatabase() {
Expand Down

0 comments on commit cf6c588

Please sign in to comment.