@Test public void shouldDumpBySqlString() throws SQLException, IOException, InterruptedException { try { schemaDumper.dump(SQL_FOR_TEST); assertTrue(true); } catch (CommunicationsException e) { assumeTrue("MySQL maybe not launched", false); } catch (Exception e) { assertTrue(false); } }
@Test public void shouldInstantiateByLocalMySqlConnectionInfo() throws SQLException, IOException, InterruptedException { SchemaDumper schemaDumper = new SchemaDumper(MySqlConnectionInfo.builder().build()); try { schemaDumper.dump(SQL_FOR_TEST); assertTrue(true); } catch (CommunicationsException e) { assumeTrue("MySQL maybe not launched", false); } catch (Exception e) { assertTrue(false); } }
@Test public void shouldInstantiateByMysqldumpPath() throws SQLException, IOException, InterruptedException { SchemaDumper schemaDumper = new SchemaDumper("mysqldump"); try { schemaDumper.dump(SQL_FOR_TEST); assertTrue(true); } catch (CommunicationsException e) { assumeTrue("MySQL maybe not launched", false); } catch (Exception e) { assertTrue(false); } }
@Test public void shouldDumpBySqlFileWithSpecifiedCharset() throws IOException, SQLException, InterruptedException { File sqlFile = File.createTempFile("tempsql", ".sql"); try (BufferedWriter bufferedWriter = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(sqlFile), Charset.forName("EUC-JP")))) { bufferedWriter.write(SQL_FOR_TEST); } try { schemaDumper.dump(sqlFile, Charset.forName("EUC-JP")); assertTrue(true); } catch (CommunicationsException e) { assumeTrue("MySQL maybe not launched", false); } catch (Exception e) { assertTrue(false); } finally { sqlFile.delete(); } }