[FIX] some open close corrections
This commit is contained in:
parent
1713e20252
commit
30ef425d75
@ -31,6 +31,7 @@ public class DbIoFactory {
|
|||||||
}
|
}
|
||||||
final DbIo dbIo = createInstance(config);
|
final DbIo dbIo = createInstance(config);
|
||||||
if (config.getKeepConnected()) {
|
if (config.getKeepConnected()) {
|
||||||
|
dbIo.open();
|
||||||
dbIoStored.add(dbIo);
|
dbIoStored.add(dbIo);
|
||||||
}
|
}
|
||||||
dbIo.open();
|
dbIo.open();
|
||||||
|
@ -26,10 +26,6 @@ public class DbIoMorphia extends DbIo implements Closeable {
|
|||||||
|
|
||||||
public DbIoMorphia(final DbConfig config) throws IOException {
|
public DbIoMorphia(final DbConfig config) throws IOException {
|
||||||
super(config);
|
super(config);
|
||||||
// If we want to stay connected, we instantiate a basic connection (only force close can remove it).
|
|
||||||
if (this.config.getKeepConnected()) {
|
|
||||||
open();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Datastore getDatastore() {
|
public Datastore getDatastore() {
|
||||||
|
@ -15,10 +15,6 @@ public class DbIoSql extends DbIo {
|
|||||||
|
|
||||||
public DbIoSql(final DbConfig config) throws IOException {
|
public DbIoSql(final DbConfig config) throws IOException {
|
||||||
super(config);
|
super(config);
|
||||||
// If we want to stay connected, we instantiate a basic connection (only force close can remove it).
|
|
||||||
if (this.config.getKeepConnected()) {
|
|
||||||
open();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Connection getConnection() {
|
public Connection getConnection() {
|
||||||
|
@ -122,14 +122,15 @@ public class ConfigureDb {
|
|||||||
da.deleteDB(ConfigBaseVariable.bdDatabase);
|
da.deleteDB(ConfigBaseVariable.bdDatabase);
|
||||||
} else if ("MONGO".equalsIgnoreCase(modeTest)) {
|
} else if ("MONGO".equalsIgnoreCase(modeTest)) {
|
||||||
da.deleteDB(ConfigBaseVariable.bdDatabase);
|
da.deleteDB(ConfigBaseVariable.bdDatabase);
|
||||||
} else {}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clear() throws IOException {
|
public static void clear() throws IOException {
|
||||||
LOGGER.info("Remove the test db");
|
LOGGER.info("Remove the test db");
|
||||||
removeDB();
|
removeDB();
|
||||||
|
// The connection is by default open ==> close it at the end of test:
|
||||||
|
da.close();
|
||||||
DbIoFactory.closeAllForceMode();
|
DbIoFactory.closeAllForceMode();
|
||||||
ConfigBaseVariable.clearAllValue();
|
ConfigBaseVariable.clearAllValue();
|
||||||
da.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user