Move SQL files to resources from java (#1879)

This is similar to where we store the SQL files for beam pipelines, and
frankly makes more sense. Also streamlined the use of the API to read
SQL files from a jar.
This commit is contained in:
Lai Jiang 2022-12-12 16:32:27 -05:00 committed by GitHub
parent 0b8e7d1120
commit 1242e3d50c
19 changed files with 8 additions and 24 deletions

View file

@ -20,7 +20,6 @@ import static google.registry.tools.GenerateSqlErDiagramCommand.FLYWAY_FILE_ELEM
import static google.registry.tools.GenerateSqlErDiagramCommand.getLastFlywayFileName;
import com.google.common.base.Joiner;
import com.google.common.io.Resources;
import google.registry.util.ResourceUtils;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
@ -61,16 +60,14 @@ class GenerateSqlErDiagramCommandTest extends CommandTestCase<GenerateSqlErDiagr
void validateErDiagramIsUpToDate() {
String goldenFullDiagram =
ResourceUtils.readResourceUtf8(
Resources.getResource(
Paths.get(GOLDEN_DIAGRAM_FOLDER).resolve("full_er_diagram.html").toString()));
Paths.get(GOLDEN_DIAGRAM_FOLDER).resolve("full_er_diagram.html").toString());
assertWithMessage(UPDATE_INSTRUCTIONS)
.that(Jsoup.parse(goldenFullDiagram).getElementById(FLYWAY_FILE_ELEMENT_ID).text())
.isEqualTo(getLastFlywayFileName());
String briefFullDiagram =
ResourceUtils.readResourceUtf8(
Resources.getResource(
Paths.get(GOLDEN_DIAGRAM_FOLDER).resolve("brief_er_diagram.html").toString()));
Paths.get(GOLDEN_DIAGRAM_FOLDER).resolve("brief_er_diagram.html").toString());
assertWithMessage(UPDATE_INSTRUCTIONS)
.that(Jsoup.parse(briefFullDiagram).getElementById(FLYWAY_FILE_ELEMENT_ID).text())
.isEqualTo(getLastFlywayFileName());