@Before @BeforeEach public final void openTestConnections() { if(!suppressDb){ loadConfiguration("/database.properties"); List<ConnectionSpecWrapper> connectionWrappers = getTestConnectionWrappers(); if (connectionWrappers.isEmpty()) { LOGGER.warn("no DB connections are configured, none opened"); return; } for (ConnectionSpecWrapper connectionWrapper : connectionWrappers) { DB db = new DB(connectionWrapper.getDbName()); db.open(connectionWrapper.getConnectionSpec()); if (rollback()){ db.openTransaction(); } } } }
public static void openTestConnections(){ List<ConnectionSpecWrapper> connectionWrappers = getTestConnectionWrappers(); if(connectionWrappers.isEmpty()){ LOGGER.warn("no DB connections are configured, none opened"); return; } for (ConnectionSpecWrapper connectionWrapper : connectionWrappers) { DB db = new DB(connectionWrapper.getDbName()); db.open(connectionWrapper.getConnectionSpec()); if (Configuration.rollback()) db.openTransaction(); } }
@Before public final void openTestConnections() { if(!suppressDb){ loadConfiguration("/database.properties"); List<ConnectionSpecWrapper> connectionWrappers = getTestConnectionWrappers(); if (connectionWrappers.isEmpty()) { LOGGER.warn("no DB connections are configured, none opened"); return; } for (ConnectionSpecWrapper connectionWrapper : connectionWrappers) { DB db = new DB(connectionWrapper.getDbName()); db.open(connectionWrapper.getConnectionSpec()); if (rollback()){ db.openTransaction(); } } } }
@Override public void before() { if(Configuration.isTesting()) return; List<ConnectionSpecWrapper> connectionWrappers = getConnectionWrappers(); if (connectionWrappers.isEmpty()) { throw new InitException("There are no connection specs in '" + Configuration.getEnv() + "' environment"); } for (ConnectionSpecWrapper connectionWrapper : connectionWrappers) { DB db = new DB(connectionWrapper.getDbName()); db.open(connectionWrapper.getConnectionSpec()); if(manageTransaction){ db.openTransaction(); } } }