src/test/java/org/embulk/output/AbstractJdbcOutputPluginTest.java in embulk-output-jdbc-0.6.4 vs src/test/java/org/embulk/output/AbstractJdbcOutputPluginTest.java in embulk-output-jdbc-0.6.5

- old
+ new

@@ -12,14 +12,19 @@ import java.util.Comparator; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.embulk.output.tester.EmbulkPluginTester; + import com.google.common.io.Files; public abstract class AbstractJdbcOutputPluginTest { + protected static boolean enabled; + protected static EmbulkPluginTester tester = new EmbulkPluginTester(); + protected void dropTable(String table) throws SQLException { String sql = String.format("DROP TABLE %s", table); executeSQL(sql, true); } @@ -63,10 +68,14 @@ executeSQL(sql, false); } protected void executeSQL(String sql, boolean ignoreError) throws SQLException { + if (!enabled) { + return; + } + try (Connection connection = connect()) { try { connection.setAutoCommit(true); try (Statement statement = connection.createStatement()) { @@ -78,9 +87,18 @@ if (!ignoreError) { throw e; } } } + } + + protected void test(String ymlPath) throws Exception + { + if (!enabled) { + return; + } + + tester.run(convertYml(ymlPath)); } protected String convertYml(String ymlName) throws Exception { StringBuilder builder = new StringBuilder();