diff --git a/test-native-image/src/main/java/org/example/Main.java b/test-native-image/src/main/java/org/example/Main.java index 7c3a3bd..dd18899 100644 --- a/test-native-image/src/main/java/org/example/Main.java +++ b/test-native-image/src/main/java/org/example/Main.java @@ -1,30 +1,29 @@ package org.example; -import io.ebean.migration.*; +import io.ebean.migration.MigrationConfig; +import io.ebean.migration.MigrationRunner; -import java.io.InputStream; -import java.util.List; -import java.util.Properties; +import java.net.URL; public class Main { - public static void main(String[] args) { - // InputStream is = Main.class.getResourceAsStream("/dbmigration/postgres/idx_postgres.migrations"); - // System.out.println("GOT is: " + is); + public static void main(String[] args) { + URL url = Main.class.getResource("/dbmigration/postgres/idx_postgres.migrations"); + System.out.println("Found idx_postgres.migrations: " + url); - MigrationConfig config = new MigrationConfig(); - config.setDbUsername("mig"); - config.setDbPassword("test"); - config.setDbUrl("jdbc:postgresql://localhost:6432/mig"); - config.setBasePlatform("postgres"); - config.setPlatform("postgres"); - config.setMigrationPath("dbmigration"); + MigrationConfig config = new MigrationConfig(); + config.setDbUsername("mig"); + config.setDbPassword("test"); + config.setDbUrl("jdbc:postgresql://localhost:6432/mig"); + config.setBasePlatform("postgres"); + config.setPlatform("postgres"); + config.setMigrationPath("dbmigration"); - MigrationRunner runner = new MigrationRunner(config); - runner.run(); + MigrationRunner runner = new MigrationRunner(config); + runner.run(); - //System.out.println("state: " + runner.checkState()); - System.out.println("DONE"); - } + //System.out.println("state: " + runner.checkState()); + System.out.println("DONE"); + } } diff --git a/test-native-image/src/test/java/org/example/StartPostgresContainerTest.java b/test-native-image/src/test/java/org/example/StartPostgresContainerTest.java index 631f0ae..ba571d4 100644 --- a/test-native-image/src/test/java/org/example/StartPostgresContainerTest.java +++ b/test-native-image/src/test/java/org/example/StartPostgresContainerTest.java @@ -12,17 +12,16 @@ class StartPostgresContainerTest { @Test - void test() { - PostgresContainer.builder("15") + void test() throws Exception { + PostgresContainer container = PostgresContainer.builder("15") .port(6432) .dbName("mig") .build() .start(); - } - @Test - void run() throws Exception { - File out = new File("out"); + System.out.println("Postgres container running " + container.isRunning()); + + var out = new File("out"); Process process = new ProcessBuilder() .command("./target/test-native-image") @@ -31,7 +30,7 @@ void run() throws Exception { .start(); int code = process.waitFor(); - System.out.println("exit " + code); + System.out.println("exit code: " + code); Files.lines(out.toPath()).forEach(System.out::println); }