use of org.qi4j.library.sql.common.SQLConfiguration in project qi4j-sdk by Qi4j.
the class PostgreSQLEntityStorePerformanceTest method cleanUp.
@Override
protected void cleanUp() throws Exception {
try {
super.cleanUp();
} finally {
Energy4Java qi4j = new Energy4Java();
Assembler[][][] assemblers = new Assembler[][][] { { { createAssembler() } } };
Application application = qi4j.newApplication(new ApplicationAssemblerAdapter(assemblers) {
});
application.activate();
Module moduleInstance = application.findModule("Layer 1", "config");
UnitOfWorkFactory uowf = moduleInstance;
UnitOfWork uow = uowf.newUnitOfWork();
try {
SQLConfiguration config = uow.get(SQLConfiguration.class, PostgreSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY);
// TODO fix AbstractEntityStorePerformanceTest to extend from AbstractQi4jTest
// SQLUtil.getConnection( this.serviceLocator );
Connection connection = null;
String schemaName = config.schemaName().get();
if (schemaName == null) {
schemaName = SQLs.DEFAULT_SCHEMA_NAME;
}
Statement stmt = null;
try {
stmt = connection.createStatement();
stmt.execute(String.format("DELETE FROM %s." + SQLs.TABLE_NAME, schemaName));
connection.commit();
} finally {
SQLUtil.closeQuietly(stmt);
}
} finally {
uow.discard();
}
}
}
Aggregations