Skip to content

Commit 6c68931

Browse files
committed
patio resource path
1 parent 2b24f09 commit 6c68931

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

jdk_11_gradle/em/embedded/graphql/patio-api/src/main/java/em/embedded/patio/EmbeddedEvoMasterController.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public static void main(String[] args){
4848

4949
private final String INIT_DB_SCRIPT_PATH = "/initDB.sql";
5050

51-
private String initSQLScript;
5251

5352
private final int portApp = 8080; //Hardcoded. will need fixing
5453
// TODO maybe report at https://github.com/micronaut-projects/micronaut-core/issues
@@ -70,11 +69,6 @@ public EmbeddedEvoMasterController() {
7069
public EmbeddedEvoMasterController(int port) {
7170
setControllerPort(port);
7271

73-
try (InputStream in = getClass().getResourceAsStream(INIT_DB_SCRIPT_PATH)) {
74-
initSQLScript = (new SqlScriptRunner()).readSQLCommandsAsString(new InputStreamReader(in));
75-
} catch (Exception e) {
76-
throw new RuntimeException(e);
77-
}
7872
}
7973

8074

@@ -113,7 +107,7 @@ public String startSut() {
113107
DbCleaner.clearDatabase_Postgres(sqlConnection, "public", List.of("flyway_schema_history"));
114108

115109
dbSpecification = Arrays.asList(new DbSpecification(DatabaseType.POSTGRES,sqlConnection)
116-
.withSchemas("public").withInitSqlScript(initSQLScript));
110+
.withSchemas("public").withInitSqlOnResourcePath(INIT_DB_SCRIPT_PATH));
117111

118112
return "http://localhost:" + getSutPort();
119113
}

jdk_11_gradle/em/external/graphql/patio-api/src/main/java/em/external/patio/ExternalEvoMasterController.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ public static void main(String[] args) {
7070

7171
private final String INIT_DB_SCRIPT_PATH = "/initDB.sql";
7272

73-
private String initSQLScript;
74-
7573
private static final GenericContainer postgres = new GenericContainer("postgres:9")
7674
.withEnv("POSTGRES_HOST_AUTH_METHOD","trust")
7775
.withEnv("POSTGRES_DB", "patio")
@@ -103,11 +101,6 @@ public ExternalEvoMasterController(
103101
setControllerPort(controllerPort);
104102
setJavaCommand(command);
105103

106-
try (InputStream in = getClass().getResourceAsStream(INIT_DB_SCRIPT_PATH)) {
107-
initSQLScript = (new SqlScriptRunner()).readSQLCommandsAsString(new InputStreamReader(in));
108-
} catch (Exception e) {
109-
throw new RuntimeException(e);
110-
}
111104
}
112105

113106

@@ -172,7 +165,7 @@ public void postStart() {
172165
DbCleaner.clearDatabase_Postgres(sqlConnection, "public", List.of("flyway_schema_history"));
173166

174167
dbSpecification = Arrays.asList(new DbSpecification(DatabaseType.POSTGRES,sqlConnection)
175-
.withSchemas("public").withInitSqlScript(initSQLScript));
168+
.withSchemas("public").withInitSqlOnResourcePath(INIT_DB_SCRIPT_PATH));
176169

177170
} catch (Exception e) {
178171
throw new RuntimeException(e);

0 commit comments

Comments
 (0)