@BeforeMethod(groups = {"slow", "mysql"}) public void beforeMethod() throws Exception { try { DBTestingHelper.get().cleanupAllTables(); } catch (Exception ignored) { } }
@Override protected void configure() { super.configure(); final EmbeddedDB instance = DBTestingHelper.get(); bind(EmbeddedDB.class).toInstance(instance); try { bind(DataSource.class).toInstance(DBTestingHelper.get().getDataSource()); bind(IDBI.class).toInstance(DBTestingHelper.getDBI()); } catch (IOException e) { Assert.fail(e.toString()); } } }
@BeforeMethod(groups = {"slow", "mysql"}) public void cleanupTablesBetweenMethods() { try { DBTestingHelper.get().cleanupAllTables(); } catch (Exception ignored) { } }
@AfterSuite(groups = {"slow", "mysql"}) public void shutdownMysqlAfterTestSuite() throws IOException, ClassNotFoundException, SQLException, URISyntaxException { if (hasFailed()) { log.error("**********************************************************************************************"); log.error("*** TESTS HAVE FAILED - LEAVING DB RUNNING FOR DEBUGGING - MAKE SURE TO KILL IT ONCE DONE ****"); log.error(DBTestingHelper.get().getCmdLineConnectionString()); log.error("**********************************************************************************************"); return; } try { DBTestingHelper.get().stop(); } catch (Exception ignored) { } } }
@AfterSuite(groups = {"slow", "mysql"}) public void afterSuite() throws Exception { if (hasFailed()) { log.error("**********************************************************************************************"); log.error("*** TESTS HAVE FAILED - LEAVING DB RUNNING FOR DEBUGGING - MAKE SURE TO KILL IT ONCE DONE ****"); log.error(DBTestingHelper.get().getCmdLineConnectionString()); log.error("**********************************************************************************************"); return; } try { DBTestingHelper.get().stop(); } catch (Exception ignored) { } } }
public static synchronized IDBI getDBI() throws IOException { return new DBIProvider(get().getDataSource()).get(); }
public static synchronized void start() throws IOException { final EmbeddedDB instance = get(); instance.initialize(); instance.start();