src/test/java/org/embulk/output/mysql/MySQLTests.java in embulk-output-mysql-0.8.2 vs src/test/java/org/embulk/output/mysql/MySQLTests.java in embulk-output-mysql-0.8.3

- old
+ new

@@ -4,10 +4,13 @@ import static org.embulk.test.EmbulkTests.readSortedFile; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; import org.embulk.config.ConfigSource; import org.embulk.test.EmbulkTests; import org.embulk.test.TestingEmbulk; @@ -18,9 +21,20 @@ public class MySQLTests { public static ConfigSource baseConfig() { return EmbulkTests.config("EMBULK_OUTPUT_MYSQL_TEST_CONFIG"); + } + + public static Connection connect() throws SQLException + { + ConfigSource config = baseConfig(); + + String url = String.format("jdbc:mysql://%s:%s/%s", + config.get(String.class, "host"), + config.get(String.class, "port", "3306"), + config.get(String.class, "database")); + return DriverManager.getConnection(url, config.get(String.class, "user"), config.get(String.class, "password")); } public static void execute(String sql) { ConfigSource config = baseConfig();